Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
surface: accept commits with buffer size not divisible by scale
Browse files Browse the repository at this point in the history
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: swaywm/sway#6352
  • Loading branch information
emersion authored and bl4ckb0ne committed Jun 30, 2021
1 parent 1b4fb4b commit 1c4b5bc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions types/wlr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,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) {
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
if (state->buffer_resource != NULL) {
Expand All @@ -187,7 +187,6 @@ static bool surface_state_finalize(struct wlr_surface *surface,
wlr_log(WLR_DEBUG, "Client bug: submitted a buffer whose size (%dx%d) "
"is not divisible by scale (%d)", state->buffer_width,
state->buffer_height, state->scale);
return false;
}

if (state->viewport.has_dst) {
Expand All @@ -207,8 +206,6 @@ static bool surface_state_finalize(struct wlr_surface *surface,
pixman_region32_intersect_rect(&state->buffer_damage,
&state->buffer_damage, 0, 0, state->buffer_width,
state->buffer_height);

return true;
}

static void surface_update_damage(pixman_region32_t *buffer_damage,
Expand Down Expand Up @@ -470,9 +467,7 @@ static void surface_commit_state(struct wlr_surface *surface,
}

static void surface_commit_pending(struct wlr_surface *surface) {
if (!surface_state_finalize(surface, &surface->pending)) {
return;
}
surface_state_finalize(surface, &surface->pending);

if (surface->role && surface->role->precommit) {
surface->role->precommit(surface);
Expand Down

0 comments on commit 1c4b5bc

Please sign in to comment.