Mesa (master): vc4: Switch from errx() to fprintf() and abort().

Eric Anholt anholt at kemper.freedesktop.org
Thu Sep 25 23:48:55 UTC 2014


Module: Mesa
Branch: master
Commit: db11eb92cfb5a9e7bd1a65a6bd693eaf15e4269a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=db11eb92cfb5a9e7bd1a65a6bd693eaf15e4269a

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Sep 25 16:38:38 2014 -0700

vc4: Switch from errx() to fprintf() and abort().

These are pretty catastrophic, "should never happen" failure paths (though
4 tests in piglit hit them currently, due to a single bug).  An abort()
that you can gdb on easily is probably more useful than a clean exit,
particularly since a bug in piglit framework right now is causing early
exit(1)s to simply not be recorded in the results at all.

---

 src/gallium/drivers/vc4/vc4_bufmgr.c  |   17 +++++++++++------
 src/gallium/drivers/vc4/vc4_context.c |    6 ++++--
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
index 7664d86..33592e8 100644
--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
+++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
@@ -52,8 +52,10 @@ vc4_bo_alloc(struct vc4_screen *screen, uint32_t size, const char *name)
         create.height = (size + 127) / 128;
 
         int ret = drmIoctl(screen->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create);
-        if (ret != 0)
-                errx(1, "create ioctl");
+        if (ret != 0) {
+                fprintf(stderr, "create ioctl failure\n");
+                abort();
+        }
 
         bo->handle = create.handle;
         assert(create.size >= size);
@@ -162,14 +164,17 @@ vc4_bo_map(struct vc4_bo *bo)
         memset(&map, 0, sizeof(map));
         map.handle = bo->handle;
         ret = drmIoctl(bo->screen->fd, DRM_IOCTL_MODE_MAP_DUMB, &map);
-        if (ret != 0)
-                errx(1, "map ioctl");
+        if (ret != 0) {
+                fprintf(stderr, "map ioctl failure\n");
+                abort();
+        }
 
         bo->map = mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
                        bo->screen->fd, map.offset);
         if (bo->map == MAP_FAILED) {
-                errx(1, "mmap of bo %d (offset 0x%016llx, size %d) failed\n",
-                     bo->handle, (long long)map.offset, bo->size);
+                fprintf(stderr, "mmap of bo %d (offset 0x%016llx, size %d) failed\n",
+                        bo->handle, (long long)map.offset, bo->size);
+                abort();
         }
 
         return bo->map;
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 13f0ef0..5bb95fd 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -248,8 +248,10 @@ vc4_flush(struct pipe_context *pctx)
 #else
                 ret = vc4_simulator_flush(vc4, &submit);
 #endif
-                if (ret)
-                        errx(1, "VC4 submit failed\n");
+                if (ret) {
+                        fprintf(stderr, "VC4 submit failed\n");
+                        abort();
+                }
         }
 
         vc4_reset_cl(&vc4->bcl);




More information about the mesa-commit mailing list