gl-renderer: apply output transform before readback in repaint

When reading back for the remote backends we need to convert the extents
of the damage (which is in global coordinates) to output coordinates
to read back the correct region.

We were doing this in a bespoke fashion by adding the output coordinates.
Instead, use weston_matrix_transform_rect() to transform the extents by
the output transform - which includes the scale factor.

This fixes output scale on RDP with the gl renderer.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2024-04-04 14:48:41 -05:00
parent 3179e0f0e0
commit 527bc8aeb3

View File

@ -2229,26 +2229,29 @@ gl_renderer_repaint_output(struct weston_output *output,
uint32_t *pixels = rb->pixels;
int width = go->fb_size.width;
int stride = width * (compositor->read_format->bpp >> 3);
pixman_box32_t *extents = &rb->base.damage.extents;
pixman_box32_t extents;
struct weston_geometry rect = {
.x = go->area.x,
.width = go->area.width,
};
extents = weston_matrix_transform_rect(&output->matrix,
rb->base.damage.extents);
if (gr->fan_debug) {
rect.y = go->fb_size.height - go->area.y - go->area.height;
rect.height = go->area.height;
} else {
rect.y = go->fb_size.height - go->area.y - extents->y2;
rect.height = extents->y2 - extents->y1;
pixels += rect.width * (extents->y1 - (int)output->pos.c.y);
rect.y = go->fb_size.height - go->area.y - extents.y2;
rect.height = extents.y2 - extents.y1;
pixels += rect.width * extents.y1;
}
if (gr->gl_version >= gr_gl_version(3, 0) && ! gr->fan_debug) {
glPixelStorei(GL_PACK_ROW_LENGTH, width);
rect.width = extents->x2 - extents->x1;
rect.x += extents->x1 - (int)output->pos.c.x;
pixels += extents->x1 - (int)output->pos.c.x;
rect.width = extents.x2 - extents.x1;
rect.x += extents.x1;
pixels += extents.x1;
}
gl_renderer_do_read_pixels(gr, compositor->read_format, pixels,