surface: accept commits with buffer size not divisible by scale

There are still many situations where the buffer scale is not
divisible by scale. The fix will require a tad more work, so
let's just log the client error for now and continue handling
the surface commit as usual.

Closes: https://github.com/swaywm/sway/issues/6352
(cherry picked from commit 1c4b5bcab3)
This commit is contained in:
Simon Ser 2021-06-30 09:48:31 +02:00
parent 8810e95082
commit 4b2ef3dff9
1 changed files with 2 additions and 7 deletions

View File

@ -169,7 +169,7 @@ static void surface_state_viewport_src_size(struct wlr_surface_state *state,
} }
} }
static bool surface_state_finalize(struct wlr_surface *surface, static void surface_state_finalize(struct wlr_surface *surface,
struct wlr_surface_state *state) { struct wlr_surface_state *state) {
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) { if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
if (state->buffer_resource != NULL) { if (state->buffer_resource != NULL) {
@ -189,7 +189,6 @@ static bool surface_state_finalize(struct wlr_surface *surface,
wlr_log(WLR_DEBUG, "Client bug: submitted a buffer whose size (%dx%d) " wlr_log(WLR_DEBUG, "Client bug: submitted a buffer whose size (%dx%d) "
"is not divisible by scale (%d)", state->buffer_width, "is not divisible by scale (%d)", state->buffer_width,
state->buffer_height, state->scale); state->buffer_height, state->scale);
return false;
} }
if (state->viewport.has_dst) { if (state->viewport.has_dst) {
@ -209,8 +208,6 @@ static bool surface_state_finalize(struct wlr_surface *surface,
pixman_region32_intersect_rect(&state->buffer_damage, pixman_region32_intersect_rect(&state->buffer_damage,
&state->buffer_damage, 0, 0, state->buffer_width, &state->buffer_damage, 0, 0, state->buffer_width,
state->buffer_height); state->buffer_height);
return true;
} }
static void surface_update_damage(pixman_region32_t *buffer_damage, static void surface_update_damage(pixman_region32_t *buffer_damage,
@ -472,9 +469,7 @@ static void surface_commit_state(struct wlr_surface *surface,
} }
static void surface_commit_pending(struct wlr_surface *surface) { static void surface_commit_pending(struct wlr_surface *surface) {
if (!surface_state_finalize(surface, &surface->pending)) { surface_state_finalize(surface, &surface->pending);
return;
}
if (surface->role && surface->role->precommit) { if (surface->role && surface->role->precommit) {
surface->role->precommit(surface); surface->role->precommit(surface);