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.
*/
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;
}