[Mesa-dev] [PATCH 1/4] winsys/radeon: remove parameter reloc from radeon_get_reloc

Marek Olšák maraeo at gmail.com
Wed Apr 16 06:30:50 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 12 +++++-------
 src/gallium/winsys/radeon/drm/radeon_drm_cs.h |  7 +++----
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 284a404..45920e8 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -199,8 +199,7 @@ static INLINE void update_reloc(struct drm_radeon_cs_reloc *reloc,
     reloc->flags = MAX2(reloc->flags, priority);
 }
 
-int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo,
-                     struct drm_radeon_cs_reloc **out_reloc)
+int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo)
 {
     struct drm_radeon_cs_reloc *reloc = NULL;
     unsigned hash = bo->handle & (sizeof(csc->is_handle_added)-1);
@@ -230,8 +229,6 @@ int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo,
             }
         }
     }
-    if (out_reloc)
-        *out_reloc = reloc;
     return i;
 }
 
@@ -252,9 +249,10 @@ static unsigned radeon_add_reloc(struct radeon_drm_cs *cs,
     priority = MIN2(priority, 15);
     *added_domains = 0;
 
-    i = radeon_get_reloc(csc, bo, &reloc);
+    i = radeon_get_reloc(csc, bo);
 
     if (i >= 0) {
+        reloc = &csc->relocs[i];
         update_reloc(reloc, rd, wd, priority, added_domains);
 
         /* For async DMA, every add_reloc call must add a buffer to the list
@@ -329,7 +327,7 @@ static int radeon_drm_cs_get_reloc(struct radeon_winsys_cs *rcs,
 {
     struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
 
-    return radeon_get_reloc(cs->csc, (struct radeon_bo*)buf, NULL);
+    return radeon_get_reloc(cs->csc, (struct radeon_bo*)buf);
 }
 
 static boolean radeon_drm_cs_validate(struct radeon_winsys_cs *rcs)
@@ -583,7 +581,7 @@ static boolean radeon_bo_is_referenced(struct radeon_winsys_cs *rcs,
     if (!bo->num_cs_references)
         return FALSE;
 
-    index = radeon_get_reloc(cs->csc, bo, NULL);
+    index = radeon_get_reloc(cs->csc, bo);
     if (index == -1)
         return FALSE;
 
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
index 59819a5..4dfc53e 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
@@ -80,8 +80,7 @@ struct radeon_drm_cs {
     struct radeon_bo                    *trace_buf;
 };
 
-int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo,
-                     struct drm_radeon_cs_reloc **out_reloc);
+int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo);
 
 static INLINE struct radeon_drm_cs *
 radeon_drm_cs(struct radeon_winsys_cs *base)
@@ -95,7 +94,7 @@ radeon_bo_is_referenced_by_cs(struct radeon_drm_cs *cs,
 {
     int num_refs = bo->num_cs_references;
     return num_refs == bo->rws->num_cs ||
-           (num_refs && radeon_get_reloc(cs->csc, bo, NULL) != -1);
+           (num_refs && radeon_get_reloc(cs->csc, bo) != -1);
 }
 
 static INLINE boolean
@@ -107,7 +106,7 @@ radeon_bo_is_referenced_by_cs_for_write(struct radeon_drm_cs *cs,
     if (!bo->num_cs_references)
         return FALSE;
 
-    index = radeon_get_reloc(cs->csc, bo, NULL);
+    index = radeon_get_reloc(cs->csc, bo);
     if (index == -1)
         return FALSE;
 
-- 
1.8.3.2



More information about the mesa-dev mailing list