summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-03-28 21:32:22 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2017-04-12 11:32:18 +0100
commit79d97bcf668172078c88cece3509ac7007e23248 (patch)
tree73f6f4569d0a38b1d75213e2ae8f346dbe9c63c0
parent5094311078e23a3a9f62b143f2451d3b91691134 (diff)
gbm/dri: Flush after unmap
Drivers may queue dma operations on the context at unmap time so we need to flush to make sure the data gets to the bo. Ideally the application would take care of this, but since there appears to be no exported gbm flush functionality we need to explicitly flush at unmap time. This fixes a problem where kmscube on vmwgfx in rgba textured mode would render using an uninitialized texture rather than the intended rgba pattern. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit ba8df2286a50117011925e915cd832b4a79f126e) Squashed with commit gbm/dri: Check dri extension version before flush after unmap The commit mentioned below required the __DRI2FlushExtension to have version 4 or above, for GBM functionality. That broke GBM with some classic dri drivers. Relax that requirement so that we only flush after unmap if we have version 4 or above. Drivers that require the flush for correct functionality should implement the desired version. Fixes: ba8df228 ("gbm/dri: Flush after unmap") Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Tested-by: Dylan Baker <dylan@pnwbakers.com> (cherry picked from commit 18e2aa063ca8e2aeb22a72253891e6f8f5d0d96b)
-rw-r--r--src/gbm/backends/dri/gbm_dri.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 45cb42a8625..decf2030c60 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -987,6 +987,14 @@ gbm_dri_bo_unmap(struct gbm_bo *_bo, void *map_data)
return;
dri->image->unmapImage(dri->context, bo->image, map_data);
+
+ /*
+ * Not all DRI drivers use direct maps. They may queue up DMA operations
+ * on the mapping context. Since there is no explicit gbm flush
+ * mechanism, we need to flush here.
+ */
+ if (dri->flush->base.version >= 4)
+ dri->flush->flush_with_flags(dri->context, NULL, __DRI2_FLUSH_CONTEXT, 0);
}