diff options
author | Simon Ser <contact@emersion.fr> | 2020-04-10 14:54:33 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-04-10 15:52:20 +0200 |
commit | 50ade3671fb6776379b0923ca230e7105f25bbc2 (patch) | |
tree | 717790863165f4f8592ed1e2b7f8b82b0f3dead2 /backend | |
parent | 5f092c55d1fbd244ceb73adb710aa0ce185a03ee (diff) |
output: check for buffer size compatibility in common code
Instead of checking for buffer size compatibility in each backend,
centralize the check in wlr_output itself.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 3 | ||||
-rw-r--r-- | backend/wayland/output.c | 16 |
2 files changed, 5 insertions, 14 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 01da2d2c..9be67244 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -365,9 +365,6 @@ static bool test_buffer(struct wlr_drm_connector *conn, if (attribs.flags != 0) { return false; } - if (attribs.width != output->width || attribs.height != output->height) { - return false; - } if (!wlr_drm_format_set_has(&crtc->primary->formats, attribs.format, attribs.modifier)) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index a6ec7439..1f56eabe 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -128,17 +128,12 @@ static const struct wl_buffer_listener buffer_listener = { }; static bool test_buffer(struct wlr_wl_backend *wl, - struct wlr_buffer *wlr_buffer, - int required_width, int required_height) { + struct wlr_buffer *wlr_buffer) { struct wlr_dmabuf_attributes attribs; if (!wlr_buffer_get_dmabuf(wlr_buffer, &attribs)) { return false; } - if (attribs.width != required_width || attribs.height != required_height) { - return false; - } - if (!wlr_drm_format_set_has(&wl->linux_dmabuf_v1_formats, attribs.format, attribs.modifier)) { return false; @@ -148,9 +143,8 @@ static bool test_buffer(struct wlr_wl_backend *wl, } static struct wlr_wl_buffer *create_wl_buffer(struct wlr_wl_backend *wl, - struct wlr_buffer *wlr_buffer, - int required_width, int required_height) { - if (!test_buffer(wl, wlr_buffer, required_width, required_height)) { + struct wlr_buffer *wlr_buffer) { + if (!test_buffer(wl, wlr_buffer)) { return NULL; } @@ -253,8 +247,8 @@ static bool output_commit(struct wlr_output *wlr_output) { } break; case WLR_OUTPUT_STATE_BUFFER_SCANOUT:; - struct wlr_wl_buffer *buffer = create_wl_buffer(output->backend, - wlr_output->pending.buffer, wlr_output->width, wlr_output->height); + struct wlr_wl_buffer *buffer = + create_wl_buffer(output->backend, wlr_output->pending.buffer); if (buffer == NULL) { return false; } |