[Mesa-dev] [PATCH 10/51] i965: Add a simple utility function to wrap drm_intel_bo_flink()
Chris Wilson
chris at chris-wilson.co.uk
Tue Jan 10 21:23:33 UTC 2017
Just to reduce some later churn, pull out the flink wrapper.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
src/mesa/drivers/dri/i965/brw_batch.h | 7 +++++++
src/mesa/drivers/dri/i965/brw_context.c | 11 +++++------
src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_batch.h b/src/mesa/drivers/dri/i965/brw_batch.h
index a3aa2cba89..d4898a592c 100644
--- a/src/mesa/drivers/dri/i965/brw_batch.h
+++ b/src/mesa/drivers/dri/i965/brw_batch.h
@@ -79,6 +79,13 @@ inline static void brw_bo_put(brw_bo *bo)
drm_intel_bo_unreference(bo);
}
+inline static uint32_t brw_bo_flink(brw_bo *bo)
+{
+ uint32_t name = 0;
+ drm_intel_bo_flink(bo, &name);
+ return name;
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 9edfc525a3..d09127a951 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1609,12 +1609,11 @@ intel_process_dri2_buffer(struct brw_context *brw,
uint32_t old_name = 0;
if (last_mt) {
- /* The bo already has a name because the miptree was created by a
- * previous call to intel_process_dri2_buffer(). If a bo already has a
- * name, then drm_intel_bo_flink() is a low-cost getter. It does not
- * create a new name.
- */
- drm_intel_bo_flink(last_mt->bo, &old_name);
+ /* The bo already has a name because the miptree was created by a
+ * previous call to intel_process_dri2_buffer(). If a bo already has a
+ * name, then flink is a low-cost getter. It does not create a new name.
+ */
+ old_name = brw_bo_flink(last_mt->bo);
}
if (old_name == buffer->name)
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index f63d51d159..b3f2787005 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -589,7 +589,7 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
*value = image->bo->handle;
return true;
case __DRI_IMAGE_ATTRIB_NAME:
- return !drm_intel_bo_flink(image->bo, (uint32_t *) value);
+ return drm_intel_bo_flink(image->bo, (uint32_t *) value) == 0;
case __DRI_IMAGE_ATTRIB_FORMAT:
*value = image->dri_format;
return true;
--
2.11.0
More information about the mesa-dev
mailing list