aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-01 21:08:21 +0200
committerSimon Ser <contact@emersion.fr>2021-04-06 14:57:59 +0200
commit511e42be5e48b3a7eec082dc32c04863a370c4c7 (patch)
tree53d7c5d48ea6eca6d80ad0f3a0413e8be16255c7 /backend
parentb514d4afe253f9e69b29f7377870a6f6125574a2 (diff)
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.
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index a9c1b3c9..db9747b3 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -399,29 +399,11 @@ static bool test_buffer(struct wlr_drm_connector *conn,
return false;
}
- struct wlr_dmabuf_attributes attribs;
- if (!wlr_buffer_get_dmabuf(wlr_buffer, &attribs)) {
+ struct wlr_drm_fb *fb = NULL;
+ if (!drm_fb_import(&fb, drm, wlr_buffer, &crtc->primary->formats)) {
return false;
}
-
- 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;
- }
- }
+ drm_fb_clear(&fb);
return true;
}