[Mesa-dev] [PATCH] winsys/radeon: use zero sized buffers for fences if the kernel supports it

Christian König deathsimple at vodafone.de
Thu Aug 7 07:31:08 PDT 2014


From: Christian König <christian.koenig at amd.com>

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/auxiliary/pipebuffer/pb_buffer.h  | 2 +-
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 2 +-
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 03bdce3..531f05e 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -196,7 +196,7 @@ pb_get_base_buffer( struct pb_buffer *buf,
    assert(buf->vtbl->get_base_buffer);
    buf->vtbl->get_base_buffer(buf, base_buf, offset);
    assert(*base_buf);
-   assert(*offset < (*base_buf)->size);
+   assert(*offset < (*base_buf)->size || !(*base_buf)->size);
 }
 
 
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 73f8d38..6361879 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -532,7 +532,7 @@ static struct pb_buffer *radeon_bomgr_create_bo(struct pb_manager *_mgr,
     bo->initial_domain = rdesc->initial_domains;
     pipe_mutex_init(bo->map_mutex);
 
-    if (mgr->va) {
+    if (mgr->va && size) {
         struct drm_radeon_gem_va va;
 
         bo->va = radeon_bomgr_find_va(mgr, size, desc->alignment);
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index a06ecb2..faf99e9 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -602,10 +602,11 @@ static struct pipe_fence_handle *
 radeon_cs_create_fence(struct radeon_winsys_cs *rcs)
 {
     struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    unsigned size = cs->ws->info.drm_minor >= 40 ? 0 : 1;
     struct pb_buffer *fence;
 
     /* Create a fence, which is a dummy BO. */
-    fence = cs->ws->base.buffer_create(&cs->ws->base, 1, 1, TRUE,
+    fence = cs->ws->base.buffer_create(&cs->ws->base, size, 0, TRUE,
                                        RADEON_DOMAIN_GTT, 0);
     /* Add the fence as a dummy relocation. */
     cs->ws->base.cs_add_reloc(rcs, cs->ws->base.buffer_get_cs_handle(fence),
-- 
1.9.1



More information about the mesa-dev mailing list