backend-drm: add DRM_FORMAT_MOD_INVALID to modifier sets when no modifiers are supported
From now on, when we can't know the modifiers supported for a certain format, we add DRM_FORMAT_MOD_INVALID to its modifier set. There is some parts where nothing is being added an others where DRM_FORMAT_MOD_LINEAR is being added, so fix them. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
f767302729
commit
567cc92797
@@ -195,8 +195,8 @@ create_gbm_surface(struct gbm_device *gbm, struct drm_output *output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GBM_MODIFIERS
|
#ifdef HAVE_GBM_MODIFIERS
|
||||||
modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers);
|
if (!weston_drm_format_has_modifier(fmt, DRM_FORMAT_MOD_INVALID)) {
|
||||||
if (num_modifiers > 0) {
|
modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers);
|
||||||
output->gbm_surface =
|
output->gbm_surface =
|
||||||
gbm_surface_create_with_modifiers(gbm,
|
gbm_surface_create_with_modifiers(gbm,
|
||||||
mode->width, mode->height,
|
mode->width, mode->height,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ drm_virtual_plane_create(struct drm_backend *b, struct drm_output *output)
|
|||||||
{
|
{
|
||||||
struct drm_plane *plane;
|
struct drm_plane *plane;
|
||||||
struct weston_drm_format *fmt;
|
struct weston_drm_format *fmt;
|
||||||
int ret;
|
uint64_t mod;
|
||||||
|
|
||||||
plane = zalloc(sizeof(*plane));
|
plane = zalloc(sizeof(*plane));
|
||||||
if (!plane) {
|
if (!plane) {
|
||||||
@@ -112,11 +112,16 @@ drm_virtual_plane_create(struct drm_backend *b, struct drm_output *output)
|
|||||||
if (!fmt)
|
if (!fmt)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if ((output->gbm_bo_flags & GBM_BO_USE_LINEAR) && b->fb_modifiers) {
|
/* If output supports linear modifier, we add it to the plane.
|
||||||
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR);
|
* Otherwise we add DRM_FORMAT_MOD_INVALID, as explicit modifiers
|
||||||
if (ret < 0)
|
* are not supported. */
|
||||||
goto err;
|
if ((output->gbm_bo_flags & GBM_BO_USE_LINEAR) && b->fb_modifiers)
|
||||||
}
|
mod = DRM_FORMAT_MOD_LINEAR;
|
||||||
|
else
|
||||||
|
mod = DRM_FORMAT_MOD_INVALID;
|
||||||
|
|
||||||
|
if (weston_drm_format_add_modifier(fmt, mod) < 0)
|
||||||
|
goto err;
|
||||||
|
|
||||||
weston_plane_init(&plane->base, b->compositor, 0, 0);
|
weston_plane_init(&plane->base, b->compositor, 0, 0);
|
||||||
wl_list_insert(&b->plane_list, &plane->link);
|
wl_list_insert(&b->plane_list, &plane->link);
|
||||||
|
|||||||
@@ -760,6 +760,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane,
|
|||||||
struct drm_plane *plane;
|
struct drm_plane *plane;
|
||||||
drmModeObjectProperties *props;
|
drmModeObjectProperties *props;
|
||||||
uint64_t *zpos_range_values;
|
uint64_t *zpos_range_values;
|
||||||
|
struct weston_drm_format *fmt;
|
||||||
|
|
||||||
plane = zalloc(sizeof(*plane));
|
plane = zalloc(sizeof(*plane));
|
||||||
if (!plane) {
|
if (!plane) {
|
||||||
@@ -816,7 +817,14 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane,
|
|||||||
plane->type = type;
|
plane->type = type;
|
||||||
plane->zpos_max = DRM_PLANE_ZPOS_INVALID_PLANE;
|
plane->zpos_max = DRM_PLANE_ZPOS_INVALID_PLANE;
|
||||||
plane->zpos_min = DRM_PLANE_ZPOS_INVALID_PLANE;
|
plane->zpos_min = DRM_PLANE_ZPOS_INVALID_PLANE;
|
||||||
if (!weston_drm_format_array_add_format(&plane->formats, format))
|
|
||||||
|
/* Without universal planes support we can't tell the formats
|
||||||
|
* and modifiers that the plane support, as we don't know
|
||||||
|
* anything about the planes. So modifiers are not supported. */
|
||||||
|
fmt = weston_drm_format_array_add_format(&plane->formats, format);
|
||||||
|
if (!fmt)
|
||||||
|
goto err;
|
||||||
|
if (!weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fmt->modifiers.size == 0) {
|
if (fmt->modifiers.size == 0) {
|
||||||
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR);
|
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ fallback:
|
|||||||
kplane->formats[i]);
|
kplane->formats[i]);
|
||||||
if (!fmt)
|
if (!fmt)
|
||||||
return -1;
|
return -1;
|
||||||
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR);
|
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user