[Mesa-dev] [PATCH 4/6] radeon_drm_bo: explicitly check return value of drmCommandWriteRead
Julien Isorce
julien.isorce at gmail.com
Thu Mar 16 14:25:26 UTC 2017
CID 1313492
Signed-off-by: Julien Isorce <jisorce at oblong.com>
---
src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index f4ed3ce..f6d5c8a 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -186,8 +186,13 @@ static enum radeon_bo_domain radeon_bo_get_initial_domain(
args.handle = bo->handle;
args.op = RADEON_GEM_OP_GET_INITIAL_DOMAIN;
- drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP,
- &args, sizeof(args));
+ if (drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP,
+ &args, sizeof(args))) {
+ fprintf(stderr, "radeon: failed to get initial domain: %p 0x%08X\n",
+ bo, bo->handle);
+ /* Default domain as returned by get_valid_domain. */
+ return RADEON_DOMAIN_VRAM_GTT;
+ }
/* GEM domains and winsys domains are defined the same. */
return get_valid_domain(args.value);
--
2.7.4
More information about the mesa-dev
mailing list