summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-08-07 15:26:30 -0700
committerKeith Packard <keithp@keithp.com>2008-08-07 15:26:30 -0700
commit5968e061db90451b19c3948bbd91c6d5ac9af941 (patch)
tree6f1af729ab2cc21a813fd8cef5cd70d00df1ded8 /libdrm
parentac20e14d2361160cf199dc31c3fe1ffbacdf5bb7 (diff)
Make flink save the kernel-assigned name and return it instead of creating another name
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;
}