Add a fence object class field for future use (For example VSYNC fence objects)
parent
7058d06317
commit
a6535c8db4
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -639,6 +639,7 @@ typedef struct drm_set_version {
|
|||
|
||||
typedef struct drm_fence_arg {
|
||||
unsigned handle;
|
||||
int class;
|
||||
unsigned type;
|
||||
unsigned flags;
|
||||
unsigned signaled;
|
||||
|
|
Loading…
Reference in New Issue