diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2023-11-26 23:05:44 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2023-11-26 23:11:28 +0300 |
commit | 4102b722d9812dbdc6bc0a8cb816e429d4533424 (patch) | |
tree | 2bc7e0571504103191bf45a96943803e1866c834 /backend/x11 | |
parent | 4fbe648fafe687a061e246c2f16b971ecfaf89ec (diff) |
backend/x11: check buffer format in output_test()
Diffstat (limited to 'backend/x11')
-rw-r--r-- | backend/x11/output.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/x11/output.c b/backend/x11/output.c index 0940c9b7..585e037a 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -113,6 +113,9 @@ static void output_destroy(struct wlr_output *wlr_output) { static bool output_test(struct wlr_output *wlr_output, const struct wlr_output_state *state) { + struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); + struct wlr_x11_backend *x11 = output->x11; + uint32_t unsupported = state->committed & ~SUPPORTED_OUTPUT_STATE; if (unsupported != 0) { wlr_log(WLR_DEBUG, "Unsupported output state fields: 0x%"PRIx32, @@ -132,6 +135,22 @@ static bool output_test(struct wlr_output *wlr_output, } } + if (state->committed & WLR_OUTPUT_STATE_BUFFER) { + struct wlr_buffer *buffer = state->buffer; + struct wlr_dmabuf_attributes dmabuf_attrs; + struct wlr_shm_attributes shm_attrs; + uint32_t format = DRM_FORMAT_INVALID; + if (wlr_buffer_get_dmabuf(buffer, &dmabuf_attrs)) { + format = dmabuf_attrs.format; + } else if (wlr_buffer_get_shm(buffer, &shm_attrs)) { + format = shm_attrs.format; + } + if (format != x11->x11_format->drm) { + wlr_log(WLR_DEBUG, "Unsupported buffer format"); + return false; + } + } + if (state->committed & WLR_OUTPUT_STATE_MODE) { assert(state->mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM); |