summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/intel/intel_bufmgr_gem.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index 22f8695d..f5732226 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -103,6 +103,11 @@ struct _dri_bo_gem {
const char *name;
/**
+ * Kenel-assigned global name for this object
+ */
+ unsigned int global_name;
+
+ /**
* Index of the buffer within the validation list while preparing a
* batchbuffer execution.
*/
@@ -833,13 +838,16 @@ dri_gem_flink(dri_bo *bo, uint32_t *name)
struct drm_gem_flink flink;
int ret;
- flink.handle = bo_gem->gem_handle;
-
- ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_FLINK, &flink);
- if (ret != 0)
- return -errno;
-
- *name = flink.name;
+ if (!bo_gem->global_name) {
+ flink.handle = bo_gem->gem_handle;
+
+ ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (ret != 0)
+ return -errno;
+ bo_gem->gem_handle = flink.name;
+ }
+
+ *name = bo_gem->gem_handle;
return 0;
}