From: Andy Yan <[email protected]>

In the upcoming VOP for rk3576, every VP has it's own LAYER_SEL
register, and the configuration value of each VP for the same
window maybe different, so extend the layer_sel_id to array,
let it can descption the layer select configuration value for
different VP.

Signed-off-by: Andy Yan <[email protected]>
---

(no changes since v1)

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c |  3 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  5 ++--
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 29 ++++++++++----------
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index cd861c022a66..467c3d66c735 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -35,7 +35,6 @@
 #include <uapi/linux/videodev2.h>
 #include <dt-bindings/soc/rockchip,vop2.h>
 
-#include "rockchip_drm_drv.h"
 #include "rockchip_drm_gem.h"
 #include "rockchip_drm_vop2.h"
 #include "rockchip_rgb.h"
@@ -2436,7 +2435,7 @@ static void vop2_setup_layer_mixer(struct vop2_video_port 
*vp)
                layer_sel &= 
~RK3568_OVL_LAYER_SEL__LAYER(plane->state->normalized_zpos + ofs,
                                                          0x7);
                layer_sel |= 
RK3568_OVL_LAYER_SEL__LAYER(plane->state->normalized_zpos + ofs,
-                                                        
win->data->layer_sel_id);
+                                                        
win->data->layer_sel_id[vp->id]);
                nlayer++;
        }
 
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
index 59cd6b933bfb..aa4318a91554 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
@@ -9,6 +9,7 @@
 
 #include <linux/regmap.h>
 #include <drm/drm_modes.h>
+#include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
 
 #define VOP2_VP_FEATURE_OUTPUT_10BIT        BIT(0)
@@ -144,9 +145,9 @@ struct vop2_win_data {
        const unsigned int supported_rotations;
 
        /**
-        * @layer_sel_id: defined by register OVERLAY_LAYER_SEL of VOP2
+        * @layer_sel_id: defined by register OVERLAY_LAYER_SEL or 
PORTn_LAYER_SEL
         */
-       unsigned int layer_sel_id;
+       unsigned int layer_sel_id[ROCKCHIP_MAX_CRTC];
        uint64_t feature;
 
        unsigned int max_upscale_factor;
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c 
b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
index 8ff0bd528d65..2978c5f9b93a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -180,7 +180,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .formats = formats_smart,
                .nformats = ARRAY_SIZE(formats_smart),
                .format_modifiers = format_modifiers,
-               .layer_sel_id = 3,
+               /* 0xf means this layer can't attached to this VP */
+               .layer_sel_id = { 3, 3, 3, 0xf },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
                .max_upscale_factor = 8,
@@ -193,7 +194,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_smart),
                .format_modifiers = format_modifiers,
                .base = 0x1e00,
-               .layer_sel_id = 7,
+               .layer_sel_id = { 7, 7, 7, 0xf },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
                .max_upscale_factor = 8,
@@ -206,7 +207,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_rk356x_esmart),
                .format_modifiers = format_modifiers,
                .base = 0x1a00,
-               .layer_sel_id = 6,
+               .layer_sel_id = { 6, 6, 6, 0xf },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
                .max_upscale_factor = 8,
@@ -219,7 +220,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_rk356x_esmart),
                .format_modifiers = format_modifiers,
                .base = 0x1800,
-               .layer_sel_id = 2,
+               .layer_sel_id = { 2, 2, 2, 0xf },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
                .max_upscale_factor = 8,
@@ -232,7 +233,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 0,
+               .layer_sel_id = { 0, 0, 0, 0xf },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                        DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .max_upscale_factor = 4,
@@ -247,7 +248,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 1,
+               .layer_sel_id = { 1, 1, 1, 0xf },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                        DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_OVERLAY,
@@ -412,7 +413,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 0,
+               .layer_sel_id = { 0, 0, 0, 0 },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                       DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .max_upscale_factor = 4,
@@ -427,7 +428,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 1,
+               .layer_sel_id = { 1, 1, 1, 1 },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                       DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
@@ -442,7 +443,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 4,
+               .layer_sel_id = { 4, 4, 4, 4 },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                       DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
@@ -457,7 +458,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .formats = formats_cluster,
                .nformats = ARRAY_SIZE(formats_cluster),
                .format_modifiers = format_modifiers_afbc,
-               .layer_sel_id = 5,
+               .layer_sel_id =  { 5, 5, 5, 5 },
                .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 
|
                                       DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_PRIMARY,
@@ -472,7 +473,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_esmart),
                .format_modifiers = format_modifiers,
                .base = 0x1800,
-               .layer_sel_id = 2,
+               .layer_sel_id = { 2, 2, 2, 2 },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_OVERLAY,
                .max_upscale_factor = 8,
@@ -485,7 +486,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_esmart),
                .format_modifiers = format_modifiers,
                .base = 0x1a00,
-               .layer_sel_id = 3,
+               .layer_sel_id = { 3, 3, 3, 3 },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_OVERLAY,
                .max_upscale_factor = 8,
@@ -498,7 +499,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .formats = formats_esmart,
                .nformats = ARRAY_SIZE(formats_esmart),
                .format_modifiers = format_modifiers,
-               .layer_sel_id = 6,
+               .layer_sel_id =  { 6, 6, 6, 6 },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_OVERLAY,
                .max_upscale_factor = 8,
@@ -511,7 +512,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
                .nformats = ARRAY_SIZE(formats_esmart),
                .format_modifiers = format_modifiers,
                .base = 0x1e00,
-               .layer_sel_id = 7,
+               .layer_sel_id =  { 7, 7, 7, 7 },
                .supported_rotations = DRM_MODE_REFLECT_Y,
                .type = DRM_PLANE_TYPE_OVERLAY,
                .max_upscale_factor = 8,
-- 
2.34.1

Reply via email to