mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND 0/3] drm/verisilicon: misc fixes
@ 2026-10-30 13:32 Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 1/3] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN Icenowy Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Icenowy Zheng @ 2026-10-30 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, Dmitry Baryshkov, Joey Lu, Han Gao,
	dri-devel, linux-kernel, Icenowy Zheng, Icenowy Zheng

This patchset fixes several problems. Two of them are pointed out by
Sashiko, and the remaining one is found when running the driver on some
weird TH1520 firmware that does mode set but fixes to 800x600.

This patchset is re-sent because of forgetting to Cc the mailing list
previously.

Icenowy Zheng (2):
  drm/verisilicon: disable the output before enabling it
  drm/verisilicon: stop to reuse atomic_disable for invisible planes

Joey Lu (1):
  drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN

 drivers/gpu/drm/verisilicon/vs_bridge.c        |  8 ++++++++
 drivers/gpu/drm/verisilicon/vs_cursor_plane.c  | 17 +++++++++++------
 drivers/gpu/drm/verisilicon/vs_primary_plane.c | 15 ++++++++++-----
 3 files changed, 29 insertions(+), 11 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH RESEND 1/3] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN
  2026-10-30 13:32 [PATCH RESEND 0/3] drm/verisilicon: misc fixes Icenowy Zheng
@ 2026-10-30 13:32 ` Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 2/3] drm/verisilicon: disable the output before enabling it Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes Icenowy Zheng
  2 siblings, 0 replies; 5+ messages in thread
From: Icenowy Zheng @ 2026-10-30 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, Dmitry Baryshkov, Joey Lu, Han Gao,
	dri-devel, linux-kernel, Icenowy Zheng, Icenowy Zheng

From: Joey Lu <a0987203069@gmail.com>

vs_primary_plane_atomic_disable() calls regmap_set_bits() on
VSDC_FB_CONFIG_EX_FB_EN instead of regmap_clear_bits(), so disabling
the primary plane on DC8200-family hardware actually leaves the
framebuffer enable bit instead of clearing it.

Fixes: dbf21777caa8 ("drm: verisilicon: add a driver for Verisilicon display controllers")
Signed-off-by: Joey Lu <a0987203069@gmail.com>
[Icenowy: rebased on top of torvalds/master and reworked the commit
 message]
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
---
 drivers/gpu/drm/verisilicon/vs_primary_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
index 8e94491693019..d5563c3b825c3 100644
--- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
@@ -88,8 +88,8 @@ static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
 	unsigned int output = vcrtc->id;
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			  VSDC_FB_CONFIG_EX_FB_EN);
 
 	vs_primary_plane_commit(dc, output);
 }
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH RESEND 2/3] drm/verisilicon: disable the output before enabling it
  2026-10-30 13:32 [PATCH RESEND 0/3] drm/verisilicon: misc fixes Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 1/3] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN Icenowy Zheng
@ 2026-10-30 13:32 ` Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes Icenowy Zheng
  2 siblings, 0 replies; 5+ messages in thread
From: Icenowy Zheng @ 2026-10-30 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, Dmitry Baryshkov, Joey Lu, Han Gao,
	dri-devel, linux-kernel, Icenowy Zheng, Icenowy Zheng

When either of the RUNNING bits are set, change to some timing
parameters won't take effect.

This will lead to failure of the first modeset done by the kernel, if
the bootloader sets a different mode and keeps the display running
before it.

Flip these RUNNING bits off before setting it on to fix this problem.

Fixes: dbf21777caa8 ("drm: verisilicon: add a driver for Verisilicon display controllers")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
---
 drivers/gpu/drm/verisilicon/vs_bridge.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/verisilicon/vs_bridge.c b/drivers/gpu/drm/verisilicon/vs_bridge.c
index dc7c85b07fe32..a095b20e81c00 100644
--- a/drivers/gpu/drm/verisilicon/vs_bridge.c
+++ b/drivers/gpu/drm/verisilicon/vs_bridge.c
@@ -162,6 +162,14 @@ static void vs_bridge_enable_common(struct vs_crtc *crtc,
 			VSDC_DISP_PANEL_CONFIG_DE_EN |
 			VSDC_DISP_PANEL_CONFIG_DAT_EN |
 			VSDC_DISP_PANEL_CONFIG_CLK_EN);
+
+	/* Disable it first to prevent stale hardware state */
+	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
+			  VSDC_DISP_PANEL_START_RUNNING(output));
+	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
+			  VSDC_DISP_PANEL_CONFIG_RUNNING);
+
 	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
 			VSDC_DISP_PANEL_CONFIG_RUNNING);
 	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes
  2026-10-30 13:32 [PATCH RESEND 0/3] drm/verisilicon: misc fixes Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 1/3] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN Icenowy Zheng
  2026-10-30 13:32 ` [PATCH RESEND 2/3] drm/verisilicon: disable the output before enabling it Icenowy Zheng
@ 2026-10-30 13:32 ` Icenowy Zheng
  2026-10-31 13:04   ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Icenowy Zheng @ 2026-10-30 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, Dmitry Baryshkov, Joey Lu, Han Gao,
	dri-devel, linux-kernel, Icenowy Zheng, Icenowy Zheng

When a plane is configured to be invisible, the atomic_update
implementation currently just calls the atomic_disable function.

However these two functions behave differently when disabling planes:
atomic_update disables the plane specified in the NEW state, but
atomic_disable disables the plane specified in the OLD state, so this
shortcut may lead to NULL dereference if the old state doesn't have a
CRTC bound.

Fixes: dbf21777caa8 ("drm: verisilicon: add a driver for Verisilicon display controllers")
Fixes: 8c4ae2189125 ("drm: verisilicon: add support for cursor planes")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
---
 drivers/gpu/drm/verisilicon/vs_cursor_plane.c  | 17 +++++++++++------
 drivers/gpu/drm/verisilicon/vs_primary_plane.c | 15 ++++++++++-----
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
index da456dced88aa..725921ac25d48 100644
--- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
@@ -98,6 +98,15 @@ static void vs_cursor_plane_commit(struct vs_dc *dc, unsigned int output)
 			VSDC_CURSOR_CONFIG_IMG_UPDATE);
 }
 
+static void vs_cursor_plane_disable(struct vs_dc *dc, unsigned int output)
+{
+	regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
+			   VSDC_CURSOR_CONFIG_FMT_MASK,
+			   VSDC_CURSOR_CONFIG_FMT_OFF);
+
+	vs_cursor_plane_commit(dc, output);
+}
+
 static void vs_cursor_plane_atomic_enable(struct drm_plane *plane,
 					   struct drm_atomic_commit *atomic_state)
 {
@@ -125,11 +134,7 @@ static void vs_cursor_plane_atomic_disable(struct drm_plane *plane,
 	unsigned int output = vcrtc->id;
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
-			   VSDC_CURSOR_CONFIG_FMT_MASK,
-			   VSDC_CURSOR_CONFIG_FMT_OFF);
-
-	vs_cursor_plane_commit(dc, output);
+	vs_cursor_plane_disable(dc, output);
 }
 
 static void vs_cursor_plane_atomic_update(struct drm_plane *plane,
@@ -145,7 +150,7 @@ static void vs_cursor_plane_atomic_update(struct drm_plane *plane,
 	dma_addr_t dma_addr;
 
 	if (!state->visible) {
-		vs_cursor_plane_atomic_disable(plane, atomic_state);
+		vs_cursor_plane_disable(dc, output);
 		return;
 	}
 
diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
index d5563c3b825c3..594d56bf32410 100644
--- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
@@ -59,6 +59,14 @@ static void vs_primary_plane_commit(struct vs_dc *dc, unsigned int output)
 			VSDC_FB_CONFIG_EX_COMMIT);
 }
 
+static void vs_primary_plane_disable(struct vs_dc *dc, unsigned int output)
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			  VSDC_FB_CONFIG_EX_FB_EN);
+
+	vs_primary_plane_commit(dc, output);
+}
+
 static void vs_primary_plane_atomic_enable(struct drm_plane *plane,
 					   struct drm_atomic_commit *atomic_state)
 {
@@ -88,10 +96,7 @@ static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
 	unsigned int output = vcrtc->id;
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			  VSDC_FB_CONFIG_EX_FB_EN);
-
-	vs_primary_plane_commit(dc, output);
+	vs_primary_plane_disable(dc, output);
 }
 
 static void vs_primary_plane_atomic_update(struct drm_plane *plane,
@@ -108,7 +113,7 @@ static void vs_primary_plane_atomic_update(struct drm_plane *plane,
 	dma_addr_t dma_addr;
 
 	if (!state->visible) {
-		vs_primary_plane_atomic_disable(plane, atomic_state);
+		vs_primary_plane_disable(dc, output);
 		return;
 	}
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes
  2026-10-30 13:32 ` [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes Icenowy Zheng
@ 2026-10-31 13:04   ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-10-31 13:04 UTC (permalink / raw)
  To: Icenowy Zheng, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: llvm, oe-kbuild-all, David Airlie, Simona Vetter,
	Dmitry Baryshkov, Joey Lu, Han Gao, dri-devel, linux-kernel,
	Icenowy Zheng

Hi Icenowy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v7.3 next-20261030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Icenowy-Zheng/drm-verisilicon-fix-DC8200-primary-plane-disable-clearing-FB_EN/20261030-213231
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20261030133233.197189-4-zhengxingda%40iscas.ac.cn
patch subject: [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes
config: arm64-randconfig-1001-20261031 (https://download.01.org/0day-ci/archive/20261031/202610312040.VpGybfak-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project c2ea4440d4b64c148de4fdfca1fc2c437a0701e4)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261031/202610312040.VpGybfak-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610312040.VpGybfak-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/verisilicon/vs_primary_plane.c:117:28: warning: variable 'dc' is uninitialized when used here [-Wuninitialized]
     117 |                 vs_primary_plane_disable(dc, output);
         |                                          ^~
   drivers/gpu/drm/verisilicon/vs_primary_plane.c:111:18: note: initialize the variable 'dc' to silence this warning
     111 |         struct vs_dc *dc;
         |                         ^
         |                          = NULL
>> drivers/gpu/drm/verisilicon/vs_primary_plane.c:117:32: warning: variable 'output' is uninitialized when used here [-Wuninitialized]
     117 |                 vs_primary_plane_disable(dc, output);
         |                                              ^~~~~~
   drivers/gpu/drm/verisilicon/vs_primary_plane.c:113:21: note: initialize the variable 'output' to silence this warning
     113 |         unsigned int output;
         |                            ^
         |                             = 0
   2 warnings generated.
--
>> drivers/gpu/drm/verisilicon/vs_cursor_plane.c:154:27: warning: variable 'dc' is uninitialized when used here [-Wuninitialized]
     154 |                 vs_cursor_plane_disable(dc, output);
         |                                         ^~
   drivers/gpu/drm/verisilicon/vs_cursor_plane.c:148:18: note: initialize the variable 'dc' to silence this warning
     148 |         struct vs_dc *dc;
         |                         ^
         |                          = NULL
>> drivers/gpu/drm/verisilicon/vs_cursor_plane.c:154:31: warning: variable 'output' is uninitialized when used here [-Wuninitialized]
     154 |                 vs_cursor_plane_disable(dc, output);
         |                                             ^~~~~~
   drivers/gpu/drm/verisilicon/vs_cursor_plane.c:150:21: note: initialize the variable 'output' to silence this warning
     150 |         unsigned int output;
         |                            ^
         |                             = 0
   2 warnings generated.


vim +/dc +117 drivers/gpu/drm/verisilicon/vs_primary_plane.c

   102	
   103	static void vs_primary_plane_atomic_update(struct drm_plane *plane,
   104						   struct drm_atomic_commit *atomic_state)
   105	{
   106		struct drm_plane_state *state = drm_atomic_get_new_plane_state(atomic_state,
   107									       plane);
   108		struct vs_plane_state *vs_state = to_vs_plane_state(state);
   109		struct drm_framebuffer *fb = state->fb;
   110		struct drm_crtc *crtc = state->crtc;
   111		struct vs_dc *dc;
   112		struct vs_crtc *vcrtc;
   113		unsigned int output;
   114		dma_addr_t dma_addr;
   115	
   116		if (!state->visible) {
 > 117			vs_primary_plane_disable(dc, output);
   118			return;
   119		}
   120	
   121		vcrtc = drm_crtc_to_vs_crtc(crtc);
   122		output = vcrtc->id;
   123		dc = vcrtc->dc;
   124	
   125		regmap_update_bits(dc->regs, VSDC_FB_CONFIG(output),
   126				   VSDC_FB_CONFIG_FMT_MASK,
   127				   VSDC_FB_CONFIG_FMT(vs_state->format.color));
   128		regmap_update_bits(dc->regs, VSDC_FB_CONFIG(output),
   129				   VSDC_FB_CONFIG_SWIZZLE_MASK,
   130				   VSDC_FB_CONFIG_SWIZZLE(vs_state->format.swizzle));
   131		regmap_assign_bits(dc->regs, VSDC_FB_CONFIG(output),
   132				   VSDC_FB_CONFIG_UV_SWIZZLE_EN,
   133				   vs_state->format.uv_swizzle);
   134	
   135		/*
   136		 * Primary plane cannot be moved, no clipping is involved,
   137		 * so the non-clipped framebuffer address can be used.
   138		 */
   139		dma_addr = drm_fb_dma_get_gem_addr(fb, state, 0);
   140	
   141		regmap_write(dc->regs, VSDC_FB_ADDRESS(output),
   142			     lower_32_bits(dma_addr));
   143		regmap_write(dc->regs, VSDC_FB_STRIDE(output),
   144			     fb->pitches[0]);
   145	
   146		regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
   147			     VSDC_MAKE_PLANE_POS(state->crtc_x, state->crtc_y));
   148		regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
   149			     VSDC_MAKE_PLANE_POS(state->crtc_x + state->crtc_w,
   150						 state->crtc_y + state->crtc_h));
   151		regmap_write(dc->regs, VSDC_FB_SIZE(output),
   152			     VSDC_MAKE_PLANE_SIZE(state->crtc_w, state->crtc_h));
   153	
   154		regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
   155			     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
   156	
   157		vs_primary_plane_commit(dc, output);
   158	}
   159	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-31 13:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 13:32 [PATCH RESEND 0/3] drm/verisilicon: misc fixes Icenowy Zheng
2026-10-30 13:32 ` [PATCH RESEND 1/3] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN Icenowy Zheng
2026-10-30 13:32 ` [PATCH RESEND 2/3] drm/verisilicon: disable the output before enabling it Icenowy Zheng
2026-10-30 13:32 ` [PATCH RESEND 3/3] drm/verisilicon: stop to reuse atomic_disable for invisible planes Icenowy Zheng
2026-10-31 13:04   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®