[Mesa-dev] [PATCH 5/5] panfrost: Print errors from kernel

Alyssa Rosenzweig alyssa at rosenzweig.io
Mon Aug 5 17:00:39 UTC 2019


I didn't know about %m, nifty.

I don't think this is portable, though... which might be a problem
if/when someone tries to port Android, etc.

On Mon, Aug 05, 2019 at 05:18:36PM +0200, Tomeu Vizoso wrote:
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_drm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
> index 122bc5f3db36..46cceb808919 100644
> --- a/src/gallium/drivers/panfrost/pan_drm.c
> +++ b/src/gallium/drivers/panfrost/pan_drm.c
> @@ -49,14 +49,14 @@ panfrost_drm_mmap_bo(struct panfrost_screen *screen, struct panfrost_bo *bo)
>  
>          ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, &mmap_bo);
>          if (ret) {
> -                fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %d\n", ret);
> +                fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %m\n");
>                  assert(0);
>          }
>  
>          bo->cpu = os_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
>                            screen->fd, mmap_bo.offset);
>          if (bo->cpu == MAP_FAILED) {
> -                fprintf(stderr, "mmap failed: %p\n", bo->cpu);
> +                fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
>                  assert(0);
>          }
>  
> @@ -121,7 +121,7 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size,
>  
>                  ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, &create_bo);
>                  if (ret) {
> -                        fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: %d\n", ret);
> +                        fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: %m\n");
>                          assert(0);
>                  }
>  
> @@ -175,7 +175,7 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo,
>  
>          ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
>          if (ret) {
> -                fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %d\n", ret);
> +                fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
>                  assert(0);
>          }
>  
> @@ -331,7 +331,7 @@ panfrost_fence_create(struct panfrost_context *ctx)
>           */
>          drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, &f->fd);
>          if (f->fd == -1) {
> -                fprintf(stderr, "export failed\n");
> +                fprintf(stderr, "export failed: %m\n");
>                  free(f);
>                  return NULL;
>          }
> -- 
> 2.20.1


More information about the mesa-dev mailing list