compositor-drm: Make composite bypass work on secondary outputs
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 17 Jan 2014 22:22:41 +0000 (14:22 -0800)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 17 Jan 2014 22:22:41 +0000 (14:22 -0800)
The opaque region is in surface coordinates, which we compare to the
output region, which is in compositor coordinates.  For non-primary
outputs, that means that the output region is not located at 0,0 but
something like 1920,0 instead.  That means that the output region isn't
contained in the surface opaque region and then we decide we can't scan
out from it.

Instead, compare the surface opaque region to the output region
translated to 0,0.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=7348i5

src/compositor-drm.c

index 136d517..454c393 100644 (file)
@@ -431,9 +431,10 @@ drm_output_check_scanout_format(struct drm_output *output,
                /* We can scanout an ARGB buffer if the surface's
                 * opaque region covers the whole output, but we have
                 * to use XRGB as the KMS format code. */
-               pixman_region32_init(&r);
-               pixman_region32_subtract(&r, &output->base.region,
-                                        &es->opaque);
+               pixman_region32_init_rect(&r, 0, 0,
+                                         output->base.width,
+                                         output->base.height);
+               pixman_region32_subtract(&r, &r, &es->opaque);
 
                if (!pixman_region32_not_empty(&r))
                        format = GBM_FORMAT_XRGB8888;