compositor-drm: Make drm_output_check_scanout_format() work for all formats
This used to work only for ARGB8888 and XRGB8888 buffers, but this lets us support pageflipping to any client buffer as long as it matches the framebuffer format.
This commit is contained in:
+11
-12
@@ -413,32 +413,31 @@ static uint32_t
|
|||||||
drm_output_check_scanout_format(struct drm_output *output,
|
drm_output_check_scanout_format(struct drm_output *output,
|
||||||
struct weston_surface *es, struct gbm_bo *bo)
|
struct weston_surface *es, struct gbm_bo *bo)
|
||||||
{
|
{
|
||||||
|
struct drm_compositor *c =
|
||||||
|
(struct drm_compositor *) output->base.compositor;
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
pixman_region32_t r;
|
pixman_region32_t r;
|
||||||
|
|
||||||
format = gbm_bo_get_format(bo);
|
format = gbm_bo_get_format(bo);
|
||||||
|
|
||||||
switch (format) {
|
if (format == GBM_FORMAT_ARGB8888) {
|
||||||
case GBM_FORMAT_XRGB8888:
|
/* We can scanout an ARGB buffer if the surface's
|
||||||
return format;
|
* opaque region covers the whole output, but we have
|
||||||
case GBM_FORMAT_ARGB8888:
|
* to use XRGB as the KMS format code. */
|
||||||
/* We can only scanout an ARGB buffer if the surface's
|
|
||||||
* opaque region covers the whole output */
|
|
||||||
pixman_region32_init(&r);
|
pixman_region32_init(&r);
|
||||||
pixman_region32_subtract(&r, &output->base.region,
|
pixman_region32_subtract(&r, &output->base.region,
|
||||||
&es->opaque);
|
&es->opaque);
|
||||||
|
|
||||||
if (!pixman_region32_not_empty(&r))
|
if (!pixman_region32_not_empty(&r))
|
||||||
format = GBM_FORMAT_XRGB8888;
|
format = GBM_FORMAT_XRGB8888;
|
||||||
else
|
|
||||||
format = 0;
|
|
||||||
|
|
||||||
pixman_region32_fini(&r);
|
pixman_region32_fini(&r);
|
||||||
|
|
||||||
return format;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c->format == format)
|
||||||
|
return format;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct weston_plane *
|
static struct weston_plane *
|
||||||
|
|||||||
Reference in New Issue
Block a user