mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
backend/drm: try to import buffer when testing it
If the import to KMS succeeds, we have a better chance to be able to scan it out. Importing is also necessary for test-only commits, which we want to add in the future.
This commit is contained in:
parent
b514d4afe2
commit
511e42be5e
1 changed files with 3 additions and 21 deletions
|
@ -399,29 +399,11 @@ static bool test_buffer(struct wlr_drm_connector *conn,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_dmabuf_attributes attribs;
|
struct wlr_drm_fb *fb = NULL;
|
||||||
if (!wlr_buffer_get_dmabuf(wlr_buffer, &attribs)) {
|
if (!drm_fb_import(&fb, drm, wlr_buffer, &crtc->primary->formats)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
drm_fb_clear(&fb);
|
||||||
if (attribs.flags != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wlr_drm_format_set_has(&crtc->primary->formats,
|
|
||||||
attribs.format, attribs.modifier)) {
|
|
||||||
// The format isn't supported by the plane. Try stripping the alpha
|
|
||||||
// channel, if any.
|
|
||||||
const struct wlr_pixel_format_info *info =
|
|
||||||
drm_get_pixel_format_info(attribs.format);
|
|
||||||
if (info != NULL && info->opaque_substitute != DRM_FORMAT_INVALID &&
|
|
||||||
wlr_drm_format_set_has(&crtc->primary->formats,
|
|
||||||
info->opaque_substitute, attribs.modifier)) {
|
|
||||||
attribs.format = info->opaque_substitute;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue