backend-drm: Retrieve reason if dmabuf import failed
As we could have situations where dmabuf import failed when attempting to figure it the framebuffer is scanout-capable, make sure we also have a way to store that information. Otherwise, we could end up NULL-dereferencing, as we don't provide a valid storage for it. Further more, with this, we also print out the reason why it failed, to aid in further debugging. Observed on platforms where GBM_BO_HANDLE failed + in combination w/ direct-display proto extension. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
parent
8ebebb20ef
commit
7412a01437
@ -454,14 +454,15 @@ drm_can_scanout_dmabuf(struct weston_compositor *ec,
|
|||||||
struct drm_fb *fb;
|
struct drm_fb *fb;
|
||||||
struct drm_backend *b = to_drm_backend(ec);
|
struct drm_backend *b = to_drm_backend(ec);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
uint32_t try_reason = 0x0;
|
||||||
|
|
||||||
fb = drm_fb_get_from_dmabuf(dmabuf, b, true, NULL);
|
fb = drm_fb_get_from_dmabuf(dmabuf, b, true, &try_reason);
|
||||||
if (fb)
|
if (fb)
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
drm_fb_unref(fb);
|
drm_fb_unref(fb);
|
||||||
drm_debug(b, "[dmabuf] dmabuf %p, import test %s\n", dmabuf,
|
drm_debug(b, "[dmabuf] dmabuf %p, import test %s, with reason 0x%x\n", dmabuf,
|
||||||
ret ? "succeeded" : "failed");
|
ret ? "succeeded" : "failed", try_reason);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user