Skip to contentSkip to conversation

drm/msm/mdp5: Add pingpong entry to mdp5 config table

PATCH In review Hai Li 2 participants 7 messages Mar 5, 2015 – Mar 6, 2015

Subsystems (3)
lore
Share & tools
lore

Hai Li

author
#0 lore raw

PATCH 1/4 drm/msm/mdp5: Add pingpong entry to mdp5 config table

Pingpong register base addresses are different across platforms. This change adds this information to config table and initialize the values for 8x74 and 8084.

---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | 8 ++++++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h | 1 +
 2 files changed, 9 insertions(+)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +8 -0
index 8bee023..6c467fb 100644
@@ -58,6 +58,10 @@ const struct mdp5_cfg_hw msm8x74_config = {
 		.count = 2,
 		.base = { 0x13100, 0x13300 }, /* NOTE: no ad in v1.0 */
 	},
+	.pp = {
+		.count = 3,
+		.base = { 0x12d00, 0x12e00, 0x12f00 },
+	},
 	.intf = {
 		.count = 4,
 		.base = { 0x12500, 0x12700, 0x12900, 0x12b00 },
@@ -111,6 +115,10 @@ const struct mdp5_cfg_hw apq8084_config = {
 		.count = 3,
 		.base = { 0x13500, 0x13700, 0x13900 },
 	},
+	.pp = {
+		.count = 4,
+		.base = { 0x12f00, 0x13000, 0x13100, 0x13200 },
+	},
 	.intf = {
 		.count = 5,
 		.base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 },
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h +1 -0
index 4e91f14..c2d4498 100644
@@ -71,6 +71,7 @@ struct mdp5_cfg_hw {
 	struct mdp5_lm_block  lm;
 	struct mdp5_sub_block dspp;
 	struct mdp5_sub_block ad;
+	struct mdp5_sub_block pp;
 	struct mdp5_sub_block intf;
 
 	u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
author
#1 lore raw

PATCH 2/4 drm/msm/mdp5: Update generated mdp5 header file with DSI support

This change adds the registers in mdp5 ping pong blocks and split display control registers.

---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h | 105 ++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h +105 -0
index d8360a5..e86bcf0 100644
@@ -235,6 +235,9 @@ static inline uint32_t MDP5_DISP_INTF_SEL_INTF3(enum mdp5_intf_type val)
 
 #define REG_MDP5_HIST_INTR_CLEAR				0x00000124
 
+#define REG_MDP5_SPARE_0					0x00000128
+#define MDP5_SPARE_0_SPLIT_DPL_SINGLE_FLUSH_EN			0x00000001
+
 static inline uint32_t REG_MDP5_SMP_ALLOC_W(uint32_t i0) { return 0x00000180 + 0x4*i0; }
 
 static inline uint32_t REG_MDP5_SMP_ALLOC_W_REG(uint32_t i0) { return 0x00000180 + 0x4*i0; }
@@ -305,6 +308,20 @@ static inline uint32_t MDP5_IGC_LUT_REG_VAL(uint32_t val)
 #define MDP5_IGC_LUT_REG_DISABLE_PIPE_1				0x20000000
 #define MDP5_IGC_LUT_REG_DISABLE_PIPE_2				0x40000000
 
+#define REG_MDP5_SPLIT_DPL_EN					0x000003f4
+
+#define REG_MDP5_SPLIT_DPL_UPPER				0x000003f8
+#define MDP5_SPLIT_DPL_UPPER_SMART_PANEL			0x00000002
+#define MDP5_SPLIT_DPL_UPPER_SMART_PANEL_FREE_RUN		0x00000004
+#define MDP5_SPLIT_DPL_UPPER_INTF1_SW_TRG_MUX			0x00000010
+#define MDP5_SPLIT_DPL_UPPER_INTF2_SW_TRG_MUX			0x00000100
+
+#define REG_MDP5_SPLIT_DPL_LOWER				0x000004f0
+#define MDP5_SPLIT_DPL_LOWER_SMART_PANEL			0x00000002
+#define MDP5_SPLIT_DPL_LOWER_SMART_PANEL_FREE_RUN		0x00000004
+#define MDP5_SPLIT_DPL_LOWER_INTF1_TG_SYNC			0x00000010
+#define MDP5_SPLIT_DPL_LOWER_INTF2_TG_SYNC			0x00000100
+
 static inline uint32_t __offset_CTL(uint32_t idx)
 {
 	switch (idx) {
@@ -1114,6 +1131,94 @@ static inline uint32_t REG_MDP5_DSPP_GAMUT_BASE(uint32_t i0) { return 0x000002dc
 
 static inline uint32_t REG_MDP5_DSPP_GC_BASE(uint32_t i0) { return 0x000002b0 + __offset_DSPP(i0); }
 
+static inline uint32_t __offset_PP(uint32_t idx)
+{
+	switch (idx) {
+		case 0: return (mdp5_cfg->pp.base[0]);
+		case 1: return (mdp5_cfg->pp.base[1]);
+		case 2: return (mdp5_cfg->pp.base[2]);
+		case 3: return (mdp5_cfg->pp.base[3]);
+		default: return INVALID_IDX(idx);
+	}
+}
+static inline uint32_t REG_MDP5_PP(uint32_t i0) { return 0x00000000 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_TEAR_CHECK_EN(uint32_t i0) { return 0x00000000 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_SYNC_CONFIG_VSYNC(uint32_t i0) { return 0x00000004 + __offset_PP(i0); }
+#define MDP5_PP_SYNC_CONFIG_VSYNC_COUNT__MASK			0x0007ffff
+#define MDP5_PP_SYNC_CONFIG_VSYNC_COUNT__SHIFT			0
+static inline uint32_t MDP5_PP_SYNC_CONFIG_VSYNC_COUNT(uint32_t val)
+{
+	return ((val) << MDP5_PP_SYNC_CONFIG_VSYNC_COUNT__SHIFT) & MDP5_PP_SYNC_CONFIG_VSYNC_COUNT__MASK;
+}
+#define MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN			0x00080000
+#define MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN				0x00100000
+
+static inline uint32_t REG_MDP5_PP_SYNC_CONFIG_HEIGHT(uint32_t i0) { return 0x00000008 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_SYNC_WRCOUNT(uint32_t i0) { return 0x0000000c + __offset_PP(i0); }
+#define MDP5_PP_SYNC_WRCOUNT_LINE_COUNT__MASK			0x0000ffff
+#define MDP5_PP_SYNC_WRCOUNT_LINE_COUNT__SHIFT			0
+static inline uint32_t MDP5_PP_SYNC_WRCOUNT_LINE_COUNT(uint32_t val)
+{
+	return ((val) << MDP5_PP_SYNC_WRCOUNT_LINE_COUNT__SHIFT) & MDP5_PP_SYNC_WRCOUNT_LINE_COUNT__MASK;
+}
+#define MDP5_PP_SYNC_WRCOUNT_FRAME_COUNT__MASK			0xffff0000
+#define MDP5_PP_SYNC_WRCOUNT_FRAME_COUNT__SHIFT			16
+static inline uint32_t MDP5_PP_SYNC_WRCOUNT_FRAME_COUNT(uint32_t val)
+{
+	return ((val) << MDP5_PP_SYNC_WRCOUNT_FRAME_COUNT__SHIFT) & MDP5_PP_SYNC_WRCOUNT_FRAME_COUNT__MASK;
+}
+
+static inline uint32_t REG_MDP5_PP_VSYNC_INIT_VAL(uint32_t i0) { return 0x00000010 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_INT_COUNT_VAL(uint32_t i0) { return 0x00000014 + __offset_PP(i0); }
+#define MDP5_PP_INT_COUNT_VAL_LINE_COUNT__MASK			0x0000ffff
+#define MDP5_PP_INT_COUNT_VAL_LINE_COUNT__SHIFT			0
+static inline uint32_t MDP5_PP_INT_COUNT_VAL_LINE_COUNT(uint32_t val)
+{
+	return ((val) << MDP5_PP_INT_COUNT_VAL_LINE_COUNT__SHIFT) & MDP5_PP_INT_COUNT_VAL_LINE_COUNT__MASK;
+}
+#define MDP5_PP_INT_COUNT_VAL_FRAME_COUNT__MASK			0xffff0000
+#define MDP5_PP_INT_COUNT_VAL_FRAME_COUNT__SHIFT		16
+static inline uint32_t MDP5_PP_INT_COUNT_VAL_FRAME_COUNT(uint32_t val)
+{
+	return ((val) << MDP5_PP_INT_COUNT_VAL_FRAME_COUNT__SHIFT) & MDP5_PP_INT_COUNT_VAL_FRAME_COUNT__MASK;
+}
+
+static inline uint32_t REG_MDP5_PP_SYNC_THRESH(uint32_t i0) { return 0x00000018 + __offset_PP(i0); }
+#define MDP5_PP_SYNC_THRESH_START__MASK				0x0000ffff
+#define MDP5_PP_SYNC_THRESH_START__SHIFT			0
+static inline uint32_t MDP5_PP_SYNC_THRESH_START(uint32_t val)
+{
+	return ((val) << MDP5_PP_SYNC_THRESH_START__SHIFT) & MDP5_PP_SYNC_THRESH_START__MASK;
+}
+#define MDP5_PP_SYNC_THRESH_CONTINUE__MASK			0xffff0000
+#define MDP5_PP_SYNC_THRESH_CONTINUE__SHIFT			16
+static inline uint32_t MDP5_PP_SYNC_THRESH_CONTINUE(uint32_t val)
+{
+	return ((val) << MDP5_PP_SYNC_THRESH_CONTINUE__SHIFT) & MDP5_PP_SYNC_THRESH_CONTINUE__MASK;
+}
+
+static inline uint32_t REG_MDP5_PP_START_POS(uint32_t i0) { return 0x0000001c + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_RD_PTR_IRQ(uint32_t i0) { return 0x00000020 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_WR_PTR_IRQ(uint32_t i0) { return 0x00000024 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_OUT_LINE_COUNT(uint32_t i0) { return 0x00000028 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_PP_LINE_COUNT(uint32_t i0) { return 0x0000002c + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_AUTOREFRESH_CONFIG(uint32_t i0) { return 0x00000030 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_FBC_MODE(uint32_t i0) { return 0x00000034 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_FBC_BUDGET_CTL(uint32_t i0) { return 0x00000038 + __offset_PP(i0); }
+
+static inline uint32_t REG_MDP5_PP_FBC_LOSSY_MODE(uint32_t i0) { return 0x0000003c + __offset_PP(i0); }
+
 static inline uint32_t __offset_INTF(uint32_t idx)
 {
 	switch (idx) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
author
#2 lore raw

PATCH 3/4 drm/msm/mdp5: Fix PIPE source image size settings

In reply to Hai Li

The width and height in SSPP_SRC_IMG_SIZE register should be the size of the entire source framebuffer, not the fetch size.

---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
index 05cf9ab..37fef77 100644
@@ -505,8 +505,8 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
 	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
 	mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_IMG_SIZE(pipe),
-			MDP5_PIPE_SRC_IMG_SIZE_WIDTH(src_w) |
-			MDP5_PIPE_SRC_IMG_SIZE_HEIGHT(src_h));
+			MDP5_PIPE_SRC_IMG_SIZE_WIDTH(fb->width) |
+			MDP5_PIPE_SRC_IMG_SIZE_HEIGHT(fb->height));
 
 	mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_SIZE(pipe),
 			MDP5_PIPE_SRC_SIZE_WIDTH(src_w) |
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
author
#3 lore raw

PATCH 4/4 drm/msm: Fix default fb var width and height

In reply to Hai Li

The framebuffer var width and height should reflect the size of framebuffer memory allocated, which is the entire surface size.

In case of dual DSI connectors with TILE properties, this change makes the whole image show on the dual DSI panel, instead of duplicated images on both sides.

---
 drivers/gpu/drm/msm/msm_fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_fbdev.c +2 -1
index df60f65..d3e8b14 100644
@@ -169,7 +169,8 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 	}
 
 	drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
-	drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
+	drm_fb_helper_fill_var(fbi, helper,
+			sizes->surface_width, sizes->surface_height);
 
 	dev->mode_config.fb_base = paddr;
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#4 lore raw

Re: [PATCH 4/4] drm/msm: Fix default fb var width and height

Quoted 17 lines · Hai Li

The framebuffer var width and height should reflect the size of framebuffer memory allocated, which is the entire surface size.

In case of dual DSI connectors with TILE properties, this change makes the whole image show on the dual DSI panel, instead of duplicated images on both sides.

---
 drivers/gpu/drm/msm/msm_fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_fbdev.c +0 -0
index df60f65..d3e8b14 100644

drivers/gpu/drm/msm/msm_fbdev.c static int msm_fbdev_create(struct drm_fb_helper *helper, · line 174

Quoted 7 lines
drivers/gpu/drm/msm/msm_fbdev.c +2 -1
@@ -169,7 +169,8 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
        }
 
        drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
-       drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
+       drm_fb_helper_fill_var(fbi, helper,
+                       sizes->surface_width, sizes->surface_height);
 

so, I believe the intention for separation if surface_width/height and fb_width/height, it to allocate a buffer that is big enough (width and height) for all connected displays (so as to not leave some display scanning out too small of a buffer), but size the fbdev buffer small enough that text would be visible on all screens. Using surface_width/height here instead of fb_width/height would break that.

But I think I have a different idea.. we could implement fb helper func initial_config() to just call drm_pick_crtcs() (which we'd have to export), and then for each of the crtcs[n] connected to a connector with TILE property, populate the offsets[n].x/y. Or possibly we should just make drm_setup_crtcs() clever enough to do that automatically.. that would result in larger fb_size and the two crtc's scanning out their own parts of the buffer.

BR,
-R

Quoted 6 lines
drivers/gpu/drm/msm/msm_fbdev.c +0 -1
        dev->mode_config.fb_base = paddr;
 
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation

#5 lore raw

Re: [PATCH 4/4] drm/msm: Fix default fb var width and height

Quoted 33 lines · Rob Clark
Quoted 17 lines · Hai Li

The framebuffer var width and height should reflect the size of framebuffer memory allocated, which is the entire surface size.

In case of dual DSI connectors with TILE properties, this change makes the whole image show on the dual DSI panel, instead of duplicated images on both sides.

---
 drivers/gpu/drm/msm/msm_fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_fbdev.c +0 -0
index df60f65..d3e8b14 100644

drivers/gpu/drm/msm/msm_fbdev.c static int msm_fbdev_create(struct drm_fb_helper *helper, · line 174

Quoted 7 lines
drivers/gpu/drm/msm/msm_fbdev.c +2 -1
@@ -169,7 +169,8 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
        }
 
        drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
-       drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
+       drm_fb_helper_fill_var(fbi, helper,
+                       sizes->surface_width, sizes->surface_height);
 

so, I believe the intention for separation if surface_width/height and fb_width/height, it to allocate a buffer that is big enough (width and height) for all connected displays (so as to not leave some display scanning out too small of a buffer), but size the fbdev buffer small enough that text would be visible on all screens. Using surface_width/height here instead of fb_width/height would break that.

Quoted 7 lines

But I think I have a different idea.. we could implement fb helper func initial_config() to just call drm_pick_crtcs() (which we'd have to export), and then for each of the crtcs[n] connected to a connector with TILE property, populate the offsets[n].x/y. Or possibly we should just make drm_setup_crtcs() clever enough to do that automatically.. that would result in larger fb_size and the two crtc's scanning out their own parts of the buffer.

Oh, I spoke too soon.. looks like Dave already added it in drm_get_tile_offsets()..

BR,
-R
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH 4/4] drm/msm: Fix default fb var width and height

Hi Rob,

Quoted 45 lines · Rob Clark
Quoted 36 lines · Hai Li
Quoted 18 lines

The framebuffer var width and height should reflect the size of framebuffer memory allocated, which is the entire surface size.

In case of dual DSI connectors with TILE properties, this change makes the whole image show on the dual DSI panel, instead of duplicated images on both sides.

---
 drivers/gpu/drm/msm/msm_fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_fbdev.c +0 -0
index df60f65..d3e8b14 100644

drivers/gpu/drm/msm/msm_fbdev.c static int msm_fbdev_create(struct drm_fb_helper · line 176

Quoted 9 lines
drivers/gpu/drm/msm/msm_fbdev.c +2 -1
@@ -169,7 +169,8 @@ static int msm_fbdev_create(struct drm_fb_helper
 *helper,
        }
 
        drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
-       drm_fb_helper_fill_var(fbi, helper, sizes->fb_width,
 sizes->fb_height);
+       drm_fb_helper_fill_var(fbi, helper,
+                       sizes->surface_width, sizes->surface_height);
 

so, I believe the intention for separation if surface_width/height and fb_width/height, it to allocate a buffer that is big enough (width and height) for all connected displays (so as to not leave some display scanning out too small of a buffer), but size the fbdev buffer small enough that text would be visible on all screens. Using surface_width/height here instead of fb_width/height would break that.

Quoted 7 lines

But I think I have a different idea.. we could implement fb helper func initial_config() to just call drm_pick_crtcs() (which we'd have to export), and then for each of the crtcs[n] connected to a connector with TILE property, populate the offsets[n].x/y. Or possibly we should just make drm_setup_crtcs() clever enough to do that automatically.. that would result in larger fb_size and the two crtc's scanning out their own parts of the buffer.

Quoted 3 lines

Oh, I spoke too soon.. looks like Dave already added it in drm_get_tile_offsets()..

As discussed in IRC, the TILE information has been set and the framebuffer is allocated with the full size, not the half.

The problem is, we create the full size framebuffer but only tell the user (fbcon here, but may be real user space application who will use the default framebuffer.) the half resolution. I think this mismatch will cause trouble not only in the case of TILE connectors.

For our specific case of TILE connectors, since the right crtc offset.x has been set to the half width, while the framebuffer width set to plane is 0~half_width-1 (got from fb var info), the PIPE takes it wrong settings and will not fetch the image data from framebuffer.

Quoted 3 lines

BR,
-R

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel