Mediatek DRM Fixes for Linux 5.6

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJeYFZhAAoJEOHKc6PJWU4kYl4P/2PhnbbKZCblXy8Qi82wMH4h
 meoDy17nkmntaoc4TY8Z04QGSUPfaOPw3s8+oCVr7pvhBIxpMl/blDUs2co6Tg7A
 s53pPi+TbMuxSaU9DSMqhiTrBhRUvkqCTyWsrIy1V+hlFizUZ7sg5uwWQ0MgIFCi
 f7s6U5Ts3k1SBItdDhNHBBTxdFYRyp4O6AAAkHJUHXzvHRsSfdDyvfv/aSvyHb6f
 bcdPIHUZawAVaUtJzLwLrQe+vP4+fQjhx8UgYqFYVdD4Ro8KqEj1jpuJ1fqj169P
 bue8aaL7mny6VZBOP0Ec2M/yqjXataqFNbu9fWea23ljx5mKu1Tl01DNqOSkLn+d
 5hyEM+l08wqWgP/98jjciOM2SViZXscNjHdUHYxqscxL3H8k7a02H2dU+LnUdej3
 5xFmgUWs0BPw++2b1E8FP/gh8nY2kMQollPncKyFvmw0mWeS5ulcyhxfe1nm5dK9
 ye/NuuwWQvTXgpU+nkcIkiud9XsbClveKQ293AMhVWdrKOMOmG9KlwliQDvq9zXz
 JxpcU5n0Ov4rkuLkRikdg6BfAWRtrq6RQGYUbVtJ2YyflQ5BIj+4g5mRjm5y4fGb
 rCQSK6pctSDofNbBqfeYZ6oWVzIyOGtmVEr7caDDWSQ4km0H8qsVgAFoBxeiGn5X
 8BBNW1e81OOKA4uhtV0L
 =q4iP
 -----END PGP SIGNATURE-----

Merge tag 'mediatek-drm-fixes-5.6' of https://github.com/ckhu-mediatek/linux.git-tags into drm-fixes

Mediatek DRM Fixes for Linux 5.6

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1583373069.364.4.camel@mtksdaap41
This commit is contained in:
Dave Airlie 2020-03-05 12:59:39 +10:00
commit 70b8ea1ab1
3 changed files with 28 additions and 10 deletions

View File

@ -486,6 +486,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
}
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
if (mtk_crtc->cmdq_client) {
mbox_flush(mtk_crtc->cmdq_client->chan, 2000);
cmdq_handle = cmdq_pkt_create(mtk_crtc->cmdq_client, PAGE_SIZE);
cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event);
@ -636,10 +637,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
static int mtk_drm_crtc_init(struct drm_device *drm,
struct mtk_drm_crtc *mtk_crtc,
struct drm_plane *primary,
struct drm_plane *cursor, unsigned int pipe)
unsigned int pipe)
{
int ret;
struct drm_plane *primary = NULL;
struct drm_plane *cursor = NULL;
int i, ret;
for (i = 0; i < mtk_crtc->layer_nr; i++) {
if (mtk_crtc->planes[i].type == DRM_PLANE_TYPE_PRIMARY)
primary = &mtk_crtc->planes[i];
else if (mtk_crtc->planes[i].type == DRM_PLANE_TYPE_CURSOR)
cursor = &mtk_crtc->planes[i];
}
ret = drm_crtc_init_with_planes(drm, &mtk_crtc->base, primary, cursor,
&mtk_crtc_funcs, NULL);
@ -689,11 +698,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc,
}
static inline
enum drm_plane_type mtk_drm_crtc_plane_type(unsigned int plane_idx)
enum drm_plane_type mtk_drm_crtc_plane_type(unsigned int plane_idx,
unsigned int num_planes)
{
if (plane_idx == 0)
return DRM_PLANE_TYPE_PRIMARY;
else if (plane_idx == 1)
else if (plane_idx == (num_planes - 1))
return DRM_PLANE_TYPE_CURSOR;
else
return DRM_PLANE_TYPE_OVERLAY;
@ -712,7 +722,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev,
ret = mtk_plane_init(drm_dev,
&mtk_crtc->planes[mtk_crtc->layer_nr],
BIT(pipe),
mtk_drm_crtc_plane_type(mtk_crtc->layer_nr),
mtk_drm_crtc_plane_type(mtk_crtc->layer_nr,
num_planes),
mtk_ddp_comp_supported_rotations(comp));
if (ret)
return ret;
@ -807,9 +818,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
return ret;
}
ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0],
mtk_crtc->layer_nr > 1 ? &mtk_crtc->planes[1] :
NULL, pipe);
ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, pipe);
if (ret < 0)
return ret;
@ -828,7 +837,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
drm_crtc_index(&mtk_crtc->base));
mtk_crtc->cmdq_client = NULL;
}
ret = of_property_read_u32_index(dev->of_node, "mediatek,gce-events",
ret = of_property_read_u32_index(priv->mutex_node,
"mediatek,gce-events",
drm_crtc_index(&mtk_crtc->base),
&mtk_crtc->cmdq_event);
if (ret)

View File

@ -471,6 +471,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
/* Only DMA capable components need the LARB property */
comp->larb_dev = NULL;
if (type != MTK_DISP_OVL &&
type != MTK_DISP_OVL_2L &&
type != MTK_DISP_RDMA &&
type != MTK_DISP_WDMA)
return 0;

View File

@ -80,6 +80,7 @@ static int mtk_plane_atomic_async_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_crtc_state *crtc_state;
int ret;
if (plane != state->crtc->cursor)
return -EINVAL;
@ -90,6 +91,11 @@ static int mtk_plane_atomic_async_check(struct drm_plane *plane,
if (!plane->state->fb)
return -EINVAL;
ret = mtk_drm_crtc_plane_check(state->crtc, plane,
to_mtk_plane_state(state));
if (ret)
return ret;
if (state->state)
crtc_state = drm_atomic_get_existing_crtc_state(state->state,
state->crtc);
@ -115,6 +121,7 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane,
plane->state->src_y = new_state->src_y;
plane->state->src_h = new_state->src_h;
plane->state->src_w = new_state->src_w;
swap(plane->state->fb, new_state->fb);
state->pending.async_dirty = true;
mtk_drm_crtc_async_update(new_state->crtc, plane, new_state);