aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 10:44:09 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-08-22 10:44:09 +0200
commita6535c8db4614376ce8ecb7d889b92db066a96cc (patch)
tree90b4676d1e0b9316e0fe735d596f79b175200171
parent7058d06317e17253d874bf4df7b09d0d52a5fd74 (diff)
Add a fence object class field for future use (For example VSYNC fence objects)
-rw-r--r--libdrm/xf86drm.c10
-rw-r--r--libdrm/xf86drm.h4
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux-core/drm_fence.c2
-rw-r--r--shared-core/drm.h1
5 files changed, 16 insertions, 2 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 6302db3a..a2a2e28c 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2237,18 +2237,21 @@ int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data,
return 0;
}
-int drmFenceCreate(int fd, int shareable, unsigned type, int emit,
+int drmFenceCreate(int fd, int shareable, int class,unsigned type,
+ int emit,
drmFence *fence)
{
drm_fence_arg_t arg;
arg.type = type;
+ arg.class = class;
arg.flags = (shareable) ? DRM_FENCE_FLAG_SHAREABLE : 0;
arg.flags |= (emit) ? DRM_FENCE_FLAG_EMIT : 0;
arg.op = drm_fence_create;
if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
return -errno;
fence->handle = arg.handle;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = 0;
return 0;
@@ -2274,6 +2277,7 @@ int drmFenceReference(int fd, unsigned handle, drmFence *fence)
if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
return -errno;
fence->handle = arg.handle;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = arg.signaled;
return 0;
@@ -2299,6 +2303,7 @@ int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type)
arg.op = drm_fence_flush;
if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
return -errno;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = arg.signaled;
return 0;
@@ -2312,6 +2317,7 @@ int drmFenceSignaled(int fd, drmFence *fence)
arg.op = drm_fence_signaled;
if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
return -errno;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = arg.signaled;
return 0;
@@ -2326,6 +2332,7 @@ int drmFenceEmit(int fd, drmFence *fence, unsigned emit_type)
arg.op = drm_fence_emit;
if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
return -errno;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = arg.signaled;
return 0;
@@ -2349,6 +2356,7 @@ int drmFenceWait(int fd, drmFence *fence, unsigned flush_type,
if (ret)
return -errno;
+ fence->class = arg.class;
fence->type = arg.type;
fence->signaled = arg.signaled;
return 0;
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index 0e037daa..78730785 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -282,6 +282,7 @@ typedef struct _drmSetVersion {
typedef struct _drmFence{
unsigned handle;
+ int class;
unsigned type;
unsigned signaled;
} drmFence;
@@ -603,7 +604,8 @@ extern int drmWaitVBlank(int fd, drmVBlankPtr vbl);
/* Fencing */
-extern int drmFenceCreate(int fd, int shareable, unsigned type, int emit,
+extern int drmFenceCreate(int fd, int shareable, int class,
+ unsigned type, int emit,
drmFence *fence);
extern int drmFenceDestroy(int fd, const drmFence *fence);
extern int drmFenceReference(int fd, unsigned handle, drmFence *fence);
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 8f8f324e..5a4a37fc 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -963,6 +963,7 @@ typedef struct drm_fence_object{
*/
struct list_head ring;
+ int class;
volatile uint32_t type;
volatile uint32_t signaled;
uint32_t sequence;
diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c
index fc27c576..cfcda2b2 100644
--- a/linux-core/drm_fence.c
+++ b/linux-core/drm_fence.c
@@ -397,6 +397,7 @@ int drm_fence_object_init(drm_device_t * dev, uint32_t type, int emit,
write_lock_irqsave(&fm->lock, flags);
INIT_LIST_HEAD(&fence->ring);
+ fence->class = 0;
fence->type = type;
fence->flush_mask = 0;
fence->submitted_flush = 0;
@@ -577,6 +578,7 @@ int drm_fence_ioctl(DRM_IOCTL_ARGS)
return -EINVAL;
}
read_lock_irqsave(&fm->lock, flags);
+ arg.class = fence->class;
arg.type = fence->type;
arg.signaled = fence->signaled;
read_unlock_irqrestore(&fm->lock, flags);
diff --git a/shared-core/drm.h b/shared-core/drm.h
index b588b15c..cd2b1907 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -639,6 +639,7 @@ typedef struct drm_set_version {
typedef struct drm_fence_arg {
unsigned handle;
+ int class;
unsigned type;
unsigned flags;
unsigned signaled;