Require the hardware lock for buffer creation

(since that implies a validate).
Fix drm_bo_wait_unfenced error messages and codes.
Fix some return codes from libdrm.
main
Thomas Hellstrom 2007-04-16 16:23:05 +02:00
parent 9b7211dd67
commit e6e4946c82
2 changed files with 19 additions and 23 deletions

View File

@ -2814,7 +2814,7 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
} while (ret != 0 && errno == EAGAIN);
if (ret)
return ret;
return -errno;
if (!arg.handled)
return -EFAULT;
if (rep->ret)
@ -2870,7 +2870,7 @@ int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
} while (ret && errno == EAGAIN);
if (ret)
return ret;
return -errno;
if (!arg.handled)
return -EFAULT;
if (rep->ret)
@ -2897,7 +2897,7 @@ int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle)
ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
if (ret)
return ret;
return -errno;
if (!arg.handled)
return -EFAULT;
if (rep->ret)
@ -2919,7 +2919,7 @@ int drmBOInfo(int fd, drmBO *buf)
ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
if (ret)
return ret;
return -errno;
if (!arg.handled)
return -EFAULT;
if (rep->ret)
@ -2947,7 +2947,7 @@ int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint)
} while (ret && errno == EAGAIN);
if (ret)
return ret;
return -errno;
if (!arg.handled)
return -EFAULT;
if (rep->ret)
@ -3199,7 +3199,7 @@ int drmMMLock(int fd, unsigned memType)
ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
} while (ret && errno == EAGAIN);
return ret;
return -errno;
}
int drmMMUnlock(int fd, unsigned memType)
@ -3215,7 +3215,7 @@ int drmMMUnlock(int fd, unsigned memType)
ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
} while (ret && errno == EAGAIN);
return ret;
return -errno;
}
#define DRM_MAX_FDS 16

View File

@ -1024,30 +1024,23 @@ static int drm_bo_wait_unfenced(drm_buffer_object_t * bo, int no_wait,
int eagain_if_wait)
{
int ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
unsigned long _end = jiffies + 3 * DRM_HZ;
if (ret && no_wait)
return -EBUSY;
else if (!ret)
return 0;
do {
mutex_unlock(&bo->mutex);
DRM_WAIT_ON(ret, bo->event_queue, 3 * DRM_HZ,
!drm_bo_check_unfenced(bo));
mutex_lock(&bo->mutex);
if (ret == -EINTR)
return -EAGAIN;
if (ret) {
DRM_ERROR
("Error waiting for buffer to become fenced\n");
return ret;
}
ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
} while (ret && !time_after_eq(jiffies, _end));
ret = 0;
mutex_unlock(&bo->mutex);
DRM_WAIT_ON(ret, bo->event_queue, 3 * DRM_HZ,
!drm_bo_check_unfenced(bo));
mutex_lock(&bo->mutex);
if (ret == -EINTR)
return -EAGAIN;
ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
if (ret) {
DRM_ERROR("Timeout waiting for buffer to become fenced\n");
return ret;
return -EBUSY;
}
if (eagain_if_wait)
return -EAGAIN;
@ -1669,6 +1662,9 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS)
rep.ret = 0;
switch (req->op) {
case drm_bo_create:
rep.ret = drm_bo_lock_test(dev, filp);
if (rep.ret)
break;
rep.ret =
drm_buffer_object_create(priv, req->size,
req->type,