From a04dc1a4517bbe359fb246a79cd38c99f250c826 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 12 Jul 2024 20:17:46 +0200 Subject: [PATCH] frontends/dri: add error logs to dri2_create_image_from_fd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These silent failures are hard to track otherwise. Reviewed-by: Marek Olšák Part-of: --- src/gallium/frontends/dri/dri2.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 15690e6e35f..924922eb419 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -39,6 +39,7 @@ #include "util/u_debug.h" #include "util/libsync.h" #include "util/os_file.h" +#include "util/log.h" #include "frontend/drm_driver.h" #include "state_tracker/st_format.h" #include "state_tracker/st_cb_texture.h" @@ -1193,13 +1194,22 @@ dri2_create_image_from_fd(__DRIscreen *_screen, int i; const int expected_num_fds = dri2_get_modifier_num_planes(_screen, modifier, fourcc); - if (!map || expected_num_fds == 0) { + if (!map) { err = __DRI_IMAGE_ERROR_BAD_MATCH; + mesa_loge("dri: cannot create image from fds (fourcc 0x%08x -> dri2 failed)\n", + fourcc); + goto exit; + } + if (expected_num_fds == 0) { + err = __DRI_IMAGE_ERROR_BAD_MATCH; + mesa_loge("dri: cannot create image from fds (unsupported modifier 0x%" PRIx64 ")\n", + modifier); goto exit; } - if (num_fds != expected_num_fds) { err = __DRI_IMAGE_ERROR_BAD_MATCH; + mesa_loge("dri: cannot create image from fds (expected %d fds but got %d)\n", + expected_num_fds, num_fds); goto exit; }