Skip to content

Commit

Permalink
drm/verisilicon: add format_mod_supported to plane
Browse files Browse the repository at this point in the history
Otherwise IN_FORMATS blob is corrupted.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
  • Loading branch information
Icenowy authored and RevySR committed Sep 16, 2024
1 parent 90077b9 commit a142318
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/gpu/drm/verisilicon/vs_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,27 @@ static int vs_plane_atomic_get_property(struct drm_plane *plane,
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 = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
Expand All @@ -205,6 +226,7 @@ const struct drm_plane_funcs vs_plane_funcs = {
.atomic_destroy_state = vs_plane_atomic_destroy_state,
.atomic_set_property = vs_plane_atomic_set_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)
Expand Down Expand Up @@ -303,6 +325,8 @@ struct vs_plane *vs_plane_create(struct drm_device *drm_dev,
if (!plane)
return NULL;

plane->info = info;

ret = drm_universal_plane_init(drm_dev, &plane->base, possible_crtcs,
&vs_plane_funcs, info->formats,
info->num_formats, info->modifiers, info->type,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/verisilicon/vs_plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct vs_plane {
struct drm_plane base;
u8 id;
dma_addr_t dma_addr[MAX_NUM_PLANES];
struct vs_plane_info *info;

struct drm_property *degamma_mode;
struct drm_property *watermark_prop;
Expand Down

0 comments on commit a142318

Please sign in to comment.