radeon/winsys: correct RADEON_GEM_WAIT_IDLE use
authorJonathan Gray <jsg@jsg.id.au>
Wed, 5 Jun 2013 05:00:33 +0000 (15:00 +1000)
committerMichel Dänzer <michel@daenzer.net>
Thu, 6 Jun 2013 09:01:18 +0000 (11:01 +0200)
RADEON_GEM_WAIT_IDLE is declared DRM_IOW but mesa
uses it with drmCommandWriteRead instead of drmCommandWrite
which leads to the ioctl being unmatched and returning an
error on at least OpenBSD.

Problem originally noticed in libdrm by Mark Kettenis.
Dave Airlie pointed out that mesa has the same issue.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/tools/radeon_ctx.h

index 6ec171328bbce9d0a682047b3f91afdc15c8398a..bcd4b27b05508f7d8c686911be33d9c2510076e4 100644 (file)
@@ -167,7 +167,7 @@ static void radeon_bo_wait(struct pb_buffer *_buf, enum radeon_bo_usage usage)
         struct drm_radeon_gem_wait_idle args;
         memset(&args, 0, sizeof(args));
         args.handle = bo->handle;
-        while (drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_WAIT_IDLE,
+        while (drmCommandWrite(bo->rws->fd, DRM_RADEON_GEM_WAIT_IDLE,
                                    &args, sizeof(args)) == -EBUSY);
     }
 }
index c2967ff0ff8491ebfffdd5bcaac917c0736ae820..1eecfd5b6ffec3fd69f2ef5c3b35c09cb6a9fefe 100644 (file)
@@ -98,7 +98,7 @@ static void bo_wait(struct ctx *ctx, struct bo *bo)
     memset(&args, 0, sizeof(args));
     args.handle = bo->handle;
     do {
-        r = drmCommandWriteRead(ctx->fd, DRM_RADEON_GEM_WAIT_IDLE, &args, sizeof(args));
+        r = drmCommandWrite(ctx->fd, DRM_RADEON_GEM_WAIT_IDLE, &args, sizeof(args));
     } while (r == -EBUSY);
 }