aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-11-17 11:19:50 -0500
committerLucas Stach <l.stach@pengutronix.de>2018-01-02 11:21:37 -0500
commit4375ffffbf099f14815380a3d9e5784ffc55bf31 (patch)
tree2aae9fd53fcba2d81140c5c11edd585854a7da33
parentfa67ac84a33eeb5a3702970fe75083be79f460f9 (diff)
drm/etnaviv: remove switch_context member from etnaviv_gpu
There is no need to store this in the gpu struct. MMU flushes are triggered correctly in reaction to MMU maps and unmaps, independent of the current ctx. Any required pipe switches can be infered from the current and the desired GPU exec state. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_buffer.c10
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c8
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.h1
3 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
index 9e7098e3207f..6ad8972a59cc 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -294,6 +294,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
294 unsigned int waitlink_offset = buffer->user_size - 16; 294 unsigned int waitlink_offset = buffer->user_size - 16;
295 u32 return_target, return_dwords; 295 u32 return_target, return_dwords;
296 u32 link_target, link_dwords; 296 u32 link_target, link_dwords;
297 bool switch_context = gpu->exec_state != cmdbuf->exec_state;
297 298
298 if (drm_debug & DRM_UT_DRIVER) 299 if (drm_debug & DRM_UT_DRIVER)
299 etnaviv_buffer_dump(gpu, buffer, 0, 0x50); 300 etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
@@ -306,7 +307,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
306 * need to append a mmu flush load state, followed by a new 307 * need to append a mmu flush load state, followed by a new
307 * link to this buffer - a total of four additional words. 308 * link to this buffer - a total of four additional words.
308 */ 309 */
309 if (gpu->mmu->need_flush || gpu->switch_context) { 310 if (gpu->mmu->need_flush || switch_context) {
310 u32 target, extra_dwords; 311 u32 target, extra_dwords;
311 312
312 /* link command */ 313 /* link command */
@@ -321,7 +322,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
321 } 322 }
322 323
323 /* pipe switch commands */ 324 /* pipe switch commands */
324 if (gpu->switch_context) 325 if (switch_context)
325 extra_dwords += 4; 326 extra_dwords += 4;
326 327
327 target = etnaviv_buffer_reserve(gpu, buffer, extra_dwords); 328 target = etnaviv_buffer_reserve(gpu, buffer, extra_dwords);
@@ -349,10 +350,9 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
349 gpu->mmu->need_flush = false; 350 gpu->mmu->need_flush = false;
350 } 351 }
351 352
352 if (gpu->switch_context) { 353 if (switch_context) {
353 etnaviv_cmd_select_pipe(gpu, buffer, cmdbuf->exec_state); 354 etnaviv_cmd_select_pipe(gpu, buffer, cmdbuf->exec_state);
354 gpu->exec_state = cmdbuf->exec_state; 355 gpu->exec_state = cmdbuf->exec_state;
355 gpu->switch_context = false;
356 } 356 }
357 357
358 /* And the link to the submitted buffer */ 358 /* And the link to the submitted buffer */
@@ -421,4 +421,6 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
421 421
422 if (drm_debug & DRM_UT_DRIVER) 422 if (drm_debug & DRM_UT_DRIVER)
423 etnaviv_buffer_dump(gpu, buffer, 0, 0x50); 423 etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
424
425 gpu->lastctx = cmdbuf->ctx;
424} 426}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 3738383474fb..6ce4b9d236b4 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1416,12 +1416,6 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
1416 submit->fence = dma_fence_get(fence); 1416 submit->fence = dma_fence_get(fence);
1417 gpu->active_fence = submit->fence->seqno; 1417 gpu->active_fence = submit->fence->seqno;
1418 1418
1419 if (gpu->lastctx != cmdbuf->ctx) {
1420 gpu->mmu->need_flush = true;
1421 gpu->switch_context = true;
1422 gpu->lastctx = cmdbuf->ctx;
1423 }
1424
1425 if (cmdbuf->nr_pmrs) { 1419 if (cmdbuf->nr_pmrs) {
1426 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; 1420 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre;
1427 gpu->event[event[1]].cmdbuf = cmdbuf; 1421 gpu->event[event[1]].cmdbuf = cmdbuf;
@@ -1662,7 +1656,7 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
1662 etnaviv_gpu_update_clock(gpu); 1656 etnaviv_gpu_update_clock(gpu);
1663 etnaviv_gpu_hw_init(gpu); 1657 etnaviv_gpu_hw_init(gpu);
1664 1658
1665 gpu->switch_context = true; 1659 gpu->lastctx = NULL;
1666 gpu->exec_state = -1; 1660 gpu->exec_state = -1;
1667 1661
1668 mutex_unlock(&gpu->lock); 1662 mutex_unlock(&gpu->lock);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
index 4f10f147297a..15090bb68f5a 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
@@ -106,7 +106,6 @@ struct etnaviv_gpu {
106 struct mutex lock; 106 struct mutex lock;
107 struct etnaviv_chip_identity identity; 107 struct etnaviv_chip_identity identity;
108 struct etnaviv_file_private *lastctx; 108 struct etnaviv_file_private *lastctx;
109 bool switch_context;
110 109
111 /* 'ring'-buffer: */ 110 /* 'ring'-buffer: */
112 struct etnaviv_cmdbuf *buffer; 111 struct etnaviv_cmdbuf *buffer;