drm: Get renderer buffer size from drm_fb
authorDaniel Stone <daniels@collabora.com>
Fri, 6 Mar 2020 11:07:15 +0000 (11:07 +0000)
committerPekka Paalanen <pq@iki.fi>
Fri, 20 Mar 2020 15:25:24 +0000 (15:25 +0000)
The renderer buffer size is usually the same size as the current mode,
so we were taking the dimensions from the currently-set mode. However,
using current_mode is quite confusing in places when it comes to scale,
and it also hampers our ability to do mode switches, as well as to
introduce a future option which will let the renderer use a smaller
buffer than the output and display scaled.

Simply take the dimensions of the renderer's output buffer from the
buffer itself.

Signed-off-by: Daniel Stone <daniels@collabora.com>
libweston/backend-drm/drm.c

index 94729d896e704ec9185bec9df327adc7b8986ec0..11936115ba5bdec3c0a8859111eee8e99f70ea36 100644 (file)
@@ -391,13 +391,13 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
 
        scanout_state->src_x = 0;
        scanout_state->src_y = 0;
-       scanout_state->src_w = output->base.current_mode->width << 16;
-       scanout_state->src_h = output->base.current_mode->height << 16;
+       scanout_state->src_w = fb->width << 16;
+       scanout_state->src_h = fb->height << 16;
 
        scanout_state->dest_x = 0;
        scanout_state->dest_y = 0;
-       scanout_state->dest_w = scanout_state->src_w >> 16;
-       scanout_state->dest_h = scanout_state->src_h >> 16;
+       scanout_state->dest_w = output->base.current_mode->width;
+       scanout_state->dest_h = output->base.current_mode->height;
 
        pixman_region32_copy(&scanout_state->damage, damage);
        if (output->base.zoom.active) {