summaryrefslogtreecommitdiff
path: root/src/armsoc_dumb.c
diff options
context:
space:
mode:
authorDavid Garbett <david.garbett@arm.com>2013-04-04 09:04:26 +0100
committerDavid Garbett <david.garbett@arm.com>2013-07-09 10:40:33 +0100
commit119001b1eff83fdb9232f96c031b9b0353eb5aa1 (patch)
tree7db055366f39b8fbc504820a7b7ee8596d2fe459 /src/armsoc_dumb.c
parentea65195a9f14ee8af412f7041ec858a2fadeebf6 (diff)
Cache GEM name in omap_bo
A name remains valid while a GEM object has a handle. As such we avoid the IOCTL if we already have the name for an omap_bo. This simplifies the n-buffering implementation in DRI2, as we do not also need to track the names of the additional buffers. Change-Id: Ifa204e9f72239ce2777f6b48d824a77e8879a514 Signed-off-by: David Garbett <David.Garbett@arm.com>
Diffstat (limited to 'src/armsoc_dumb.c')
-rw-r--r--src/armsoc_dumb.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/armsoc_dumb.c b/src/armsoc_dumb.c
index b067fcd..d395b89 100644
--- a/src/armsoc_dumb.c
+++ b/src/armsoc_dumb.c
@@ -59,6 +59,7 @@ struct armsoc_bo {
* check if the new size will fit
*/
uint32_t original_size;
+ uint32_t name;
};
/* device related functions:
@@ -165,6 +166,7 @@ struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev,
new_buf->bpp = create_dumb.bpp;
new_buf->refcnt = 1;
new_buf->dmabuf = -1;
+ new_buf->name = 0;
return new_buf;
}
@@ -177,6 +179,8 @@ static void armsoc_bo_del(struct armsoc_bo *bo)
if (!bo)
return;
+ /* NB: name doesn't need cleanup */
+
assert(bo->refcnt == 0);
assert(bo->dmabuf < 0);
@@ -218,17 +222,26 @@ void armsoc_bo_reference(struct armsoc_bo *bo)
int armsoc_bo_get_name(struct armsoc_bo *bo, uint32_t *name)
{
- int ret;
- struct drm_gem_flink flink;
-
- assert(bo->refcnt > 0);
- flink.handle = bo->handle;
+ if (bo->name == 0) {
+ int ret;
+ struct drm_gem_flink flink;
+
+ assert(bo->refcnt > 0);
+ flink.handle = bo->handle;
+
+ ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (ret) {
+ xf86DrvMsg(-1, X_ERROR,
+ "_GEM_FLINK(handle:0x%X)failed. errno:0x%X\n",
+ flink.handle, errno);
+ return ret;
+ }
+
+ bo->name = flink.name;
+ }
- ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_FLINK, &flink);
- if (ret)
- return ret;
+ *name = bo->name;
- *name = flink.name;
return 0;
}