From e3f54ecdd9d266607afd7d8b62960b2154b63e9d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 5 Sep 2006 19:36:45 +0200 Subject: Multithreaded application note. --- libdrm/xf86drm.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'libdrm/xf86drm.c') diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 6d087427..dd97e26e 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -2750,17 +2750,6 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint, drm_bo_arg_reply_t *rep = &arg.rep; int ret = 0; - /* - * At the moment, we don't allow recursive mapping of a buffer, since - * the first mapping may have to be unmapped before this one to succeed. - * This might result in a deadlock. We need a DRM mutex mechanism!! - */ - - if (buf->mapCount) { - drmMsg("Recursive mapping is currently not allowed.\n"); - return -EAGAIN; - } - /* * Make sure we have a virtual address of the buffer. */ @@ -2827,8 +2816,6 @@ int drmBOUnmap(int fd, drmBO *buf) if (rep->ret) return rep->ret; - --buf->mapCount; - return 0; } @@ -2840,11 +2827,6 @@ int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, drm_bo_arg_reply_t *rep = &arg.rep; int ret = 0; - if (buf->mapCount) { - drmMsg("Cannot validate while buffer is mapped.\n"); - return -EAGAIN; - } - arg.handled = 0; req->handle = buf->handle; req->mask = flags; @@ -2853,10 +2835,12 @@ int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, req->op = drm_bo_validate; req->next = 0; + do{ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg); } while (ret && errno == -EAGAIN); + if (ret) return ret; if (!arg.handled) @@ -3008,11 +2992,6 @@ int drmBOValidateList(int fd, drmBOList *list) if (prevNext) *prevNext = (unsigned long) arg; - if (node->buf->mapCount) { - drmMsg("Cannot validate while buffer is mapped.\n"); - return -EAGAIN; - } - req->next = 0; prevNext = &req->next; arg->handled = 0; @@ -3030,6 +3009,7 @@ int drmBOValidateList(int fd, drmBOList *list) ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg); } while (ret && errno == -EAGAIN); + if (ret) return -errno; -- cgit v1.2.3