mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
Mediatek DRM Fixes - 20250718
1. Add wait_event_timeout when disabling plane 2. only announce AFBC if really supported 3. mtk_dpi: Reorder output formats on MT8195/88 -----BEGIN PGP SIGNATURE----- iQJMBAABCgA2FiEEACwLKSDmq+9RDv5P4cpzo8lZTiQFAmh5hc0YHGNodW5rdWFu Zy5odUBrZXJuZWwub3JnAAoJEOHKc6PJWU4k2ywP/RWEbDdxzM6zRZMSRJYcwqyy YFU9f0HgjahMdCF84BhffdmkxY/gbvx1t7I0OLbdKf3dPHZF3D61SOhs1Cy+RGPw 5IHzWzzBSjDM2jtCe+P7pM6M6fVzuxGnyf06apkGEFDLy5e4yJ2YWE3SHpWMQezy xjtjLakDd4/70WMszKqfsaF9RrhZCi0sPcbSMRH1vxsTSnZCH7dN6cn3LCnhgDc6 VejUd7yRnKrYFQPELXKL5WSqZsClPOCT4tqjpIiz3eSahvbAVrtuxAL1gM6lC8kC U5rHjq0p4b8eZnNkLRvurxpOn2ggoDh/Fn6iWblLWkTmfMTIU8KR1Xf/n3mNVvEU 6X/lzjqvp4s8l3n7fE1KtEFtVZlKXxuXeLLHYRPA+EwQ2cyxJjv0GInBE6YAcHSJ 8tzwirAN1C3i83U9y/JrgP2VgTPdE3uye5KizYjac1c1fObIAvVncKZ9lXggE+xP H+Vsi2cHqND8LqEmeC/qxPnRC5PPeeie3KMpj95XhT6fDbky0jO0qdLplrwlRHHN v6irQG4rsouCkWSqYmXpeWs0KmD6ZQELBGEWI50Q/WwcQLUkjQGDn8M2Ut2mZFyG O3V09gHU9Ym7eB/C/WkgHEwJuZK+h6JjMwPHMedlf0aGK5aW+mUoMZSEJm/91iKM hgbaI774q9D8f/+Xf7Pp =zlcI -----END PGP SIGNATURE----- Merge tag 'mediatek-drm-fixes-20250718' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes Mediatek DRM Fixes - 20250718 1. Add wait_event_timeout when disabling plane 2. only announce AFBC if really supported 3. mtk_dpi: Reorder output formats on MT8195/88 Signed-off-by: Dave Airlie <airlied@redhat.com> From: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://lore.kernel.org/r/20250717232916.12372-1-chunkuang.hu@kernel.org
This commit is contained in:
commit
4399e3d84d
|
|
@ -719,6 +719,39 @@ int mtk_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void mtk_crtc_plane_disable(struct drm_crtc *crtc, struct drm_plane *plane)
|
||||
{
|
||||
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
|
||||
struct mtk_crtc *mtk_crtc = to_mtk_crtc(crtc);
|
||||
struct mtk_plane_state *plane_state = to_mtk_plane_state(plane->state);
|
||||
int i;
|
||||
|
||||
/* no need to wait for disabling the plane by CPU */
|
||||
if (!mtk_crtc->cmdq_client.chan)
|
||||
return;
|
||||
|
||||
if (!mtk_crtc->enabled)
|
||||
return;
|
||||
|
||||
/* set pending plane state to disabled */
|
||||
for (i = 0; i < mtk_crtc->layer_nr; i++) {
|
||||
struct drm_plane *mtk_plane = &mtk_crtc->planes[i];
|
||||
struct mtk_plane_state *mtk_plane_state = to_mtk_plane_state(mtk_plane->state);
|
||||
|
||||
if (mtk_plane->index == plane->index) {
|
||||
memcpy(mtk_plane_state, plane_state, sizeof(*plane_state));
|
||||
break;
|
||||
}
|
||||
}
|
||||
mtk_crtc_update_config(mtk_crtc, false);
|
||||
|
||||
/* wait for planes to be disabled by CMDQ */
|
||||
wait_event_timeout(mtk_crtc->cb_blocking_queue,
|
||||
mtk_crtc->cmdq_vblank_cnt == 0,
|
||||
msecs_to_jiffies(500));
|
||||
#endif
|
||||
}
|
||||
|
||||
void mtk_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
|
|
@ -930,7 +963,8 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
|
|||
mtk_ddp_comp_supported_rotations(comp),
|
||||
mtk_ddp_comp_get_blend_modes(comp),
|
||||
mtk_ddp_comp_get_formats(comp),
|
||||
mtk_ddp_comp_get_num_formats(comp), i);
|
||||
mtk_ddp_comp_get_num_formats(comp),
|
||||
mtk_ddp_comp_is_afbc_supported(comp), i);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path,
|
|||
unsigned int num_conn_routes);
|
||||
int mtk_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane,
|
||||
struct mtk_plane_state *state);
|
||||
void mtk_crtc_plane_disable(struct drm_crtc *crtc, struct drm_plane *plane);
|
||||
void mtk_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane,
|
||||
struct drm_atomic_state *plane_state);
|
||||
struct device *mtk_crtc_dma_dev_get(struct drm_crtc *crtc);
|
||||
|
|
|
|||
|
|
@ -366,6 +366,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = {
|
|||
.get_blend_modes = mtk_ovl_get_blend_modes,
|
||||
.get_formats = mtk_ovl_get_formats,
|
||||
.get_num_formats = mtk_ovl_get_num_formats,
|
||||
.is_afbc_supported = mtk_ovl_is_afbc_supported,
|
||||
};
|
||||
|
||||
static const struct mtk_ddp_comp_funcs ddp_postmask = {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ struct mtk_ddp_comp_funcs {
|
|||
u32 (*get_blend_modes)(struct device *dev);
|
||||
const u32 *(*get_formats)(struct device *dev);
|
||||
size_t (*get_num_formats)(struct device *dev);
|
||||
bool (*is_afbc_supported)(struct device *dev);
|
||||
void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
|
||||
void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
|
||||
void (*add)(struct device *dev, struct mtk_mutex *mutex);
|
||||
|
|
@ -294,6 +295,14 @@ size_t mtk_ddp_comp_get_num_formats(struct mtk_ddp_comp *comp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline bool mtk_ddp_comp_is_afbc_supported(struct mtk_ddp_comp *comp)
|
||||
{
|
||||
if (comp->funcs && comp->funcs->is_afbc_supported)
|
||||
return comp->funcs->is_afbc_supported(comp->dev);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool mtk_ddp_comp_add(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex)
|
||||
{
|
||||
if (comp->funcs && comp->funcs->add) {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ void mtk_ovl_disable_vblank(struct device *dev);
|
|||
u32 mtk_ovl_get_blend_modes(struct device *dev);
|
||||
const u32 *mtk_ovl_get_formats(struct device *dev);
|
||||
size_t mtk_ovl_get_num_formats(struct device *dev);
|
||||
bool mtk_ovl_is_afbc_supported(struct device *dev);
|
||||
|
||||
void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex *mutex);
|
||||
void mtk_ovl_adaptor_remove_comp(struct device *dev, struct mtk_mutex *mutex);
|
||||
|
|
|
|||
|
|
@ -236,6 +236,13 @@ size_t mtk_ovl_get_num_formats(struct device *dev)
|
|||
return ovl->data->num_formats;
|
||||
}
|
||||
|
||||
bool mtk_ovl_is_afbc_supported(struct device *dev)
|
||||
{
|
||||
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
|
||||
|
||||
return ovl->data->supports_afbc;
|
||||
}
|
||||
|
||||
int mtk_ovl_clk_enable(struct device *dev)
|
||||
{
|
||||
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
|
||||
|
|
|
|||
|
|
@ -1095,7 +1095,6 @@ static const u32 mt8183_output_fmts[] = {
|
|||
};
|
||||
|
||||
static const u32 mt8195_dpi_output_fmts[] = {
|
||||
MEDIA_BUS_FMT_BGR888_1X24,
|
||||
MEDIA_BUS_FMT_RGB888_1X24,
|
||||
MEDIA_BUS_FMT_RGB888_2X12_LE,
|
||||
MEDIA_BUS_FMT_RGB888_2X12_BE,
|
||||
|
|
@ -1103,18 +1102,19 @@ static const u32 mt8195_dpi_output_fmts[] = {
|
|||
MEDIA_BUS_FMT_YUYV8_1X16,
|
||||
MEDIA_BUS_FMT_YUYV10_1X20,
|
||||
MEDIA_BUS_FMT_YUYV12_1X24,
|
||||
MEDIA_BUS_FMT_BGR888_1X24,
|
||||
MEDIA_BUS_FMT_YUV8_1X24,
|
||||
MEDIA_BUS_FMT_YUV10_1X30,
|
||||
};
|
||||
|
||||
static const u32 mt8195_dp_intf_output_fmts[] = {
|
||||
MEDIA_BUS_FMT_BGR888_1X24,
|
||||
MEDIA_BUS_FMT_RGB888_1X24,
|
||||
MEDIA_BUS_FMT_RGB888_2X12_LE,
|
||||
MEDIA_BUS_FMT_RGB888_2X12_BE,
|
||||
MEDIA_BUS_FMT_RGB101010_1X30,
|
||||
MEDIA_BUS_FMT_YUYV8_1X16,
|
||||
MEDIA_BUS_FMT_YUYV10_1X20,
|
||||
MEDIA_BUS_FMT_BGR888_1X24,
|
||||
MEDIA_BUS_FMT_YUV8_1X24,
|
||||
MEDIA_BUS_FMT_YUV10_1X30,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -285,9 +285,14 @@ static void mtk_plane_atomic_disable(struct drm_plane *plane,
|
|||
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
|
||||
plane);
|
||||
struct mtk_plane_state *mtk_plane_state = to_mtk_plane_state(new_state);
|
||||
struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
|
||||
plane);
|
||||
|
||||
mtk_plane_state->pending.enable = false;
|
||||
wmb(); /* Make sure the above parameter is set before update */
|
||||
mtk_plane_state->pending.dirty = true;
|
||||
|
||||
mtk_crtc_plane_disable(old_state->crtc, plane);
|
||||
}
|
||||
|
||||
static void mtk_plane_atomic_update(struct drm_plane *plane,
|
||||
|
|
@ -321,7 +326,8 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
|
|||
int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type,
|
||||
unsigned int supported_rotations, const u32 blend_modes,
|
||||
const u32 *formats, size_t num_formats, unsigned int plane_idx)
|
||||
const u32 *formats, size_t num_formats,
|
||||
bool supports_afbc, unsigned int plane_idx)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
|
@ -332,7 +338,9 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
|||
|
||||
err = drm_universal_plane_init(dev, plane, possible_crtcs,
|
||||
&mtk_plane_funcs, formats,
|
||||
num_formats, modifiers, type, NULL);
|
||||
num_formats,
|
||||
supports_afbc ? modifiers : NULL,
|
||||
type, NULL);
|
||||
if (err) {
|
||||
DRM_ERROR("failed to initialize plane\n");
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -49,5 +49,6 @@ to_mtk_plane_state(struct drm_plane_state *state)
|
|||
int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type,
|
||||
unsigned int supported_rotations, const u32 blend_modes,
|
||||
const u32 *formats, size_t num_formats, unsigned int plane_idx);
|
||||
const u32 *formats, size_t num_formats,
|
||||
bool supports_afbc, unsigned int plane_idx);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user