drm/verisilicon: add format_mod_supported to plane

Otherwise IN_FORMATS blob is corrupted.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
This commit is contained in:
Icenowy Zheng
2024-03-28 17:09:59 +08:00
committed by Han Gao/Revy/Rabenda
parent 833d4accd7
commit 90bcc90cb8
2 changed files with 25 additions and 0 deletions

View File

@@ -193,6 +193,27 @@ static int vs_plane_atomic_get_property(struct drm_plane *plane,
return 0; return 0;
} }
static bool vs_plane_format_mod_supported(struct drm_plane *plane,
uint32_t format,
uint64_t modifier)
{
struct vs_plane *vs_plane = to_vs_plane(plane);
int i;
for(i = 0; i < vs_plane->info->num_modifiers; i++) {
if (vs_plane->info->modifiers[i] == modifier)
break;
}
if (i && i == vs_plane->info->num_modifiers)
return false;
for(i = 0; i < vs_plane->info->num_formats; i++) {
if (vs_plane->info->formats[i] == format)
return true;
}
return false;
}
const struct drm_plane_funcs vs_plane_funcs = { const struct drm_plane_funcs vs_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane, .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane, .disable_plane = drm_atomic_helper_disable_plane,
@@ -202,6 +223,7 @@ const struct drm_plane_funcs vs_plane_funcs = {
.atomic_destroy_state = vs_plane_atomic_destroy_state, .atomic_destroy_state = vs_plane_atomic_destroy_state,
.atomic_set_property = vs_plane_atomic_set_property, .atomic_set_property = vs_plane_atomic_set_property,
.atomic_get_property = vs_plane_atomic_get_property, .atomic_get_property = vs_plane_atomic_get_property,
.format_mod_supported = vs_plane_format_mod_supported,
}; };
static unsigned char vs_get_plane_number(struct drm_framebuffer *fb) static unsigned char vs_get_plane_number(struct drm_framebuffer *fb)
@@ -300,6 +322,8 @@ struct vs_plane *vs_plane_create(struct drm_device *drm_dev,
if (!plane) if (!plane)
return NULL; return NULL;
plane->info = info;
ret = drm_universal_plane_init(drm_dev, &plane->base, possible_crtcs, ret = drm_universal_plane_init(drm_dev, &plane->base, possible_crtcs,
&vs_plane_funcs, info->formats, &vs_plane_funcs, info->formats,
info->num_formats, info->modifiers, info->type, info->num_formats, info->modifiers, info->type,

View File

@@ -47,6 +47,7 @@ struct vs_plane {
struct drm_plane base; struct drm_plane base;
u8 id; u8 id;
dma_addr_t dma_addr[MAX_NUM_PLANES]; dma_addr_t dma_addr[MAX_NUM_PLANES];
struct vs_plane_info *info;
struct drm_property *degamma_mode; struct drm_property *degamma_mode;
struct drm_property *watermark_prop; struct drm_property *watermark_prop;