[v2,5/5] panfrost: Print errors from kernel

Submitted by Tomeu Vizoso on Aug. 7, 2019, 8:36 a.m.

Details

Message ID 20190807083657.40757-5-tomeu.vizoso@collabora.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Tomeu Vizoso Aug. 7, 2019, 8:36 a.m.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
---
 src/gallium/drivers/panfrost/pan_drm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 71eda2d1e328..36a6b975680a 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);
         }
 
@@ -122,7 +122,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);
                 }
 
@@ -176,7 +176,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);
         }
 
@@ -332,7 +332,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;
         }

Comments

On Wed, Aug 7, 2019 at 2:37 AM Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@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 71eda2d1e328..36a6b975680a 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");

Is this going to work on Android and bionic? stderr goes to /dev/null
anyways on Android, so probably not a big deal.

Rob

On Thu, 8 Aug 2019 at 00:52, Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Aug 7, 2019 at 2:37 AM Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> >
> > Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> > Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@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 71eda2d1e328..36a6b975680a 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");
>
> Is this going to work on Android and bionic?

Yep: https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/vfprintf.cpp#455

Musl and uClibc also support it.

Cheers,

Tomeu

> stderr goes to /dev/null
> anyways on Android, so probably not a big deal.
>
> Rob
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev