Bugfixes.

main
Thomas Hellstrom 2006-08-27 22:01:33 +02:00
parent 928bdc6c1c
commit 886d3b3061
3 changed files with 29 additions and 36 deletions

View File

@ -2385,37 +2385,28 @@ static void split32(unsigned long val, unsigned *lo, unsigned *hi)
int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, unsigned flags)
{
drm_ttm_arg_t argTTM;
drm_bo_arg_t arg;
drm_ttm_arg_t arg;
arg.num_requests = 1;
arg.op = drm_op_ttm;
split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
argTTM.op = drm_ttm_create;
argTTM.flags = flags;
split32((unsigned long) &size, &argTTM.size_lo, &argTTM.size_hi);
arg.op = drm_ttm_create;
arg.flags = flags;
split32((unsigned long) size, &arg.size_lo, &arg.size_hi);
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
ttm->handle = argTTM.handle;
ttm->user_token = (drm_handle_t) argTTM.user_token;
ttm->flags = argTTM.flags;
ttm->size = combine64(argTTM.size_lo, argTTM.size_hi);
ttm->handle = arg.handle;
ttm->user_token = (drm_handle_t) arg.user_token;
ttm->flags = arg.flags;
ttm->size = combine64(arg.size_lo, arg.size_hi);
return 0;
}
int drmTTMDestroy(int fd, const drmTTM *ttm)
{
drm_ttm_arg_t argTTM;
drm_bo_arg_t arg;
drm_ttm_arg_t arg;
arg.num_requests = 1;
arg.op = drm_op_ttm;
split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
argTTM.op = drm_ttm_destroy;
argTTM.handle = ttm->handle;
arg.op = drm_ttm_destroy;
arg.handle = ttm->handle;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
return 0;
@ -2424,31 +2415,25 @@ int drmTTMDestroy(int fd, const drmTTM *ttm)
int drmTTMReference(int fd, unsigned handle, drmTTM *ttm)
{
drm_ttm_arg_t argTTM;
drm_bo_arg_t arg;
drm_ttm_arg_t arg;
arg.num_requests = 1;
arg.op = drm_op_ttm;
split32((unsigned long) &argTTM, &arg.data_lo, &arg.data_hi);
argTTM.handle = handle;
argTTM.op = drm_ttm_reference;
arg.handle = handle;
arg.op = drm_ttm_reference;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
ttm->handle = argTTM.handle;
ttm->user_token = (drm_handle_t) argTTM.user_token;
ttm->flags = argTTM.flags;
ttm->size = combine64(argTTM.size_lo, argTTM.size_hi);
ttm->handle = arg.handle;
ttm->user_token = (drm_handle_t) arg.user_token;
ttm->flags = arg.flags;
ttm->size = combine64(arg.size_lo, arg.size_hi);
return 0;
}
int drmTTMUnreference(int fd, const drmTTM *ttm)
{
drm_ttm_arg_t argTTM;
drm_bo_arg_t arg;
drm_ttm_arg_t arg;
argTTM.op = drm_ttm_destroy;
argTTM.handle = ttm->handle;
arg.op = drm_ttm_destroy;
arg.handle = ttm->handle;
if (ioctl(fd, DRM_IOCTL_TTM, &arg))
return -errno;
return 0;

View File

@ -623,6 +623,13 @@ extern int drmFenceWait(int fd, drmFence *fence, unsigned flush_type,
int lazy, int ignore_signals);
extern int drmFenceEmit(int fd, drmFence *fence, unsigned emit_type);
/* TTMS */
extern int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size,
unsigned flags);
extern int drmTTMDestroy(int fd, const drmTTM *ttm);
extern int drmTTMReference(int fd, unsigned handle, drmTTM *ttm);
extern int drmTTMUnreference(int fd, const drmTTM *ttm);
extern drm_handle_t drmTTMMapHandle(int fd, const drmTTM *ttm);
/* Support routines */

View File

@ -846,6 +846,7 @@ int drm_ttm_object_create(drm_device_t *dev, unsigned long size,
object->base.unref = NULL;
atomic_set(&object->usage, 1);
*ttm_object = object;
return 0;
}