aboutsummaryrefslogtreecommitdiff
path: root/backend/x11/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/x11/output.c')
-rw-r--r--backend/x11/output.c19
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);