From 5968e061db90451b19c3948bbd91c6d5ac9af941 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 7 Aug 2008 15:26:30 -0700 Subject: Make flink save the kernel-assigned name and return it instead of creating another name --- libdrm/intel/intel_bufmgr_gem.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'libdrm') 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 @@ -102,6 +102,11 @@ struct _dri_bo_gem { uint32_t gem_handle; 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; } -- cgit v1.2.3