[Mesa-dev] [PATCH 03/13] i965: Refactor __gen_combine_address()

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 19 10:09:11 UTC 2017


Since brw_emit_reloc() now does the test for target==NULL itself, we can
remove the test from __gen_combine_address() and call brw_emit_reloc()
directly.
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 64bcc2fd0d..8540fad9ae 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -76,9 +76,12 @@ struct brw_address {
    uint32_t offset;
 };
 
+#define __gen_address_type struct brw_address
+#define __gen_user_data struct brw_context
+
 static uint64_t
-emit_reloc(struct brw_context *brw,
-           void *location, struct brw_address address, uint32_t delta)
+__gen_combine_address(struct brw_context *brw, void *location,
+                      struct brw_address address, uint32_t delta)
 {
    uint32_t offset = (char *) location - (char *) brw->batch.map;
 
@@ -88,20 +91,6 @@ emit_reloc(struct brw_context *brw,
                          address.write_domain);
 }
 
-#define __gen_address_type struct brw_address
-#define __gen_user_data struct brw_context
-
-static uint64_t
-__gen_combine_address(struct brw_context *brw, void *location,
-                      struct brw_address address, uint32_t delta)
-{
-   if (address.bo == NULL) {
-      return address.offset + delta;
-   } else {
-      return emit_reloc(brw, location, address, delta);
-   }
-}
-
 static inline struct brw_address
 render_bo(struct brw_bo *bo, uint32_t offset)
 {
-- 
2.13.3



More information about the mesa-dev mailing list