Skip to contentSkip to conversation

Add a drm_crtc_helper_atomic_check() helper

PATCH Superseded Javier Martinez Canillas 2 participants 10 messages Oct 10, 2022 – Oct 11, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Javier Martinez Canillas

author maintainer
#0 lore raw

cover Add a drm_crtc_helper_atomic_check() helper

Add a helper function and make drivers that have the same logic in their struct drm_crtc_helper_funcs .atomic_check handler to use this instead.

Patch #1 and #2 are just cleanups for the simpledrm and ssd130x drivers respectively, so that these can be converted to use the helper added by patch #3. The changes are inspired by a patch from Thomas Zimmermann for the ast DRM driver:

https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/

Best regards,
Javier

Javier Martinez Canillas (3):
drm/simpledrm: Do not call drm_atomic_add_affected_planes() drm/ssd130x: Do not call drm_atomic_add_affected_planes() drm/crtc-helper: Add a drm_crtc_helper_atomic_check() helper

 drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/solomon/ssd130x.c | 20 ++------------------
 drivers/gpu/drm/tiny/simpledrm.c  | 20 ++------------------
 include/drm/drm_crtc_helper.h     |  2 ++
 4 files changed, 30 insertions(+), 36 deletions(-)
Signature · 1 line
2.37.3
author maintainer
#1 lore raw

PATCH 1/3 drm/simpledrm: Do not call drm_atomic_add_affected_planes()

There's no need to add planes to the atomic state. Remove the call to drm_atomic_add_affected_planes() from simpledrm.

On full modesets, the DRM helpers already add a CRTC's planes to the atomic state; see drm_atomic_helper_check_modeset(). There's no reason to call drm_atomic_add_affected_planes() unconditionally in the CRTC's atomic_check() in simpledrm. It's also too late, as the atomic_check() of the added planes will not be called before the commit.

---

 drivers/gpu/drm/tiny/simpledrm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/tiny/simpledrm.c +2 -8
index ecd49a8f3334..f03f17f62a56 100644
@@ -549,17 +549,11 @@ static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
 					      struct drm_atomic_state *new_state)
 {
 	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-	int ret;
 
 	if (!new_crtc_state->enable)
-		goto out;
-
-	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-	if (ret)
-		return ret;
+		return 0;
 
-out:
-	return drm_atomic_add_affected_planes(new_state, crtc);
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
 }
 
 /*
Signature · 1 line
2.37.3
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] drm/simpledrm: Do not call drm_atomic_add_affected_planes()

Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 11 lines

There's no need to add planes to the atomic state. Remove the call to drm_atomic_add_affected_planes() from simpledrm.

On full modesets, the DRM helpers already add a CRTC's planes to the atomic state; see drm_atomic_helper_check_modeset(). There's no reason to call drm_atomic_add_affected_planes() unconditionally in the CRTC's atomic_check() in simpledrm. It's also too late, as the atomic_check() of the added planes will not be called before the commit.

There's also drm_atomic_add_affected_planes() in mgag200. Since you're at it, I'd appreciate a patch.

Best regards
Thomas

Quoted 29 lines

---

  drivers/gpu/drm/tiny/simpledrm.c | 10 ++--------
  1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/tiny/simpledrm.c +2 -8
index ecd49a8f3334..f03f17f62a56 100644
@@ -549,17 +549,11 @@ static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
  					      struct drm_atomic_state *new_state)
  {
  	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-	int ret;
 
  	if (!new_crtc_state->enable)
-		goto out;
-
-	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-	if (ret)
-		return ret;
+		return 0;
 
-out:
-	return drm_atomic_add_affected_planes(new_state, crtc);
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
  }
 
  /*
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
author maintainer
#3 lore raw

Re: [PATCH 1/3] drm/simpledrm: Do not call drm_atomic_add_affected_planes()

Hello Thomas,

Quoted 12 lines · Thomas Zimmermann

Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 9 lines

There's no need to add planes to the atomic state. Remove the call to drm_atomic_add_affected_planes() from simpledrm.

On full modesets, the DRM helpers already add a CRTC's planes to the atomic state; see drm_atomic_helper_check_modeset(). There's no reason to call drm_atomic_add_affected_planes() unconditionally in the CRTC's atomic_check() in simpledrm. It's also too late, as the atomic_check() of the added planes will not be called before the commit.

Quoted 5 lines
Quoted 2 lines

Thanks.

Quoted 3 lines

There's also drm_atomic_add_affected_planes() in mgag200. Since you're at it, I'd appreciate a patch.

Sure, I'll include in v2. I noticed that but didn't feel like posting a patch because I'm not familiar with that device nor have HW to test.

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
author maintainer
#4 lore raw

PATCH 2/3 drm/ssd130x: Do not call drm_atomic_add_affected_planes()

In reply to Javier Martinez Canillas

There's no need to add planes to the atomic state. Remove the call to drm_atomic_add_affected_planes() from ssd130x.

On full modesets, the DRM helpers already add a CRTC's planes to the atomic state; see drm_atomic_helper_check_modeset(). There's no reason to call drm_atomic_add_affected_planes() unconditionally in the CRTC's atomic_check() in ssd130x. It's also too late, as the atomic_check() of the added planes will not be called before the commit.

---

 drivers/gpu/drm/solomon/ssd130x.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +2 -8
index 57e48355c008..0d4ab65233db 100644
@@ -649,17 +649,11 @@ static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
 					    struct drm_atomic_state *new_state)
 {
 	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-	int ret;
 
 	if (!new_crtc_state->enable)
-		goto out;
-
-	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-	if (ret)
-		return ret;
+		return 0;
 
-out:
-	return drm_atomic_add_affected_planes(new_state, crtc);
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
 }
 
 /*
Signature · 1 line
2.37.3
maintainer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] drm/ssd130x: Do not call drm_atomic_add_affected_planes()

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 11 lines

There's no need to add planes to the atomic state. Remove the call to drm_atomic_add_affected_planes() from ssd130x.

On full modesets, the DRM helpers already add a CRTC's planes to the atomic state; see drm_atomic_helper_check_modeset(). There's no reason to call drm_atomic_add_affected_planes() unconditionally in the CRTC's atomic_check() in ssd130x. It's also too late, as the atomic_check() of the added planes will not be called before the commit.

Quoted 29 lines

---

  drivers/gpu/drm/solomon/ssd130x.c | 10 ++--------
  1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +2 -8
index 57e48355c008..0d4ab65233db 100644
@@ -649,17 +649,11 @@ static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
  					    struct drm_atomic_state *new_state)
  {
  	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-	int ret;
 
  	if (!new_crtc_state->enable)
-		goto out;
-
-	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-	if (ret)
-		return ret;
+		return 0;
 
-out:
-	return drm_atomic_add_affected_planes(new_state, crtc);
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
  }
 
  /*
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
author maintainer
#6 lore raw

PATCH 3/3 drm/crtc-helper: Add a drm_crtc_helper_atomic_check() helper

In reply to Javier Martinez Canillas

Provides a default CRTC state check handler for CRTCs that only have one primary plane attached.

There are some drivers that duplicate this logic in their helpers, such as simpledrm and ssd130x. Factor out this common code into a CRTC helper and make drivers use it.

---

 drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/solomon/ssd130x.c | 14 ++------------
 drivers/gpu/drm/tiny/simpledrm.c  | 14 ++------------
 include/drm/drm_crtc_helper.h     |  2 ++
 4 files changed, 30 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +24 -0
index 457448cc60f7..4ad3abaa98f4 100644
@@ -421,6 +421,30 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_crtc_helper_set_mode);
 
+/**
+ * drm_crtc_helper_atomic_check() - Helper to check CRTC atomic-state
+ * @crtc: CRTC to check
+ * @state: atomic state object
+ *
+ * Provides a default CRTC-state check handler for CRTCs that only have
+ * one primary plane attached to it.
+ *
+ * This is often the case for the CRTC of simple framebuffers.
+ *
+ * RETURNS:
+ * Zero on success, or an errno code otherwise.
+ */
+int drm_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
+{
+	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
+
+	if (!new_crtc_state->enable)
+		return 0;
+
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
+}
+EXPORT_SYMBOL(drm_crtc_helper_atomic_check);
+
 static void
 drm_crtc_helper_disable(struct drm_crtc *crtc)
 {
drivers/gpu/drm/solomon/ssd130x.c +2 -12
index 0d4ab65233db..f2795f90ea69 100644
@@ -20,6 +20,7 @@
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fb_helper.h>
@@ -645,17 +646,6 @@ static enum drm_mode_status ssd130x_crtc_helper_mode_valid(struct drm_crtc *crtc
 	return MODE_OK;
 }
 
-static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
-					    struct drm_atomic_state *new_state)
-{
-	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-
-	if (!new_crtc_state->enable)
-		return 0;
-
-	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-}
-
 /*
  * The CRTC is always enabled. Screen updates are performed by
  * the primary plane's atomic_update function. Disabling clears
@@ -663,7 +653,7 @@ static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
  */
 static const struct drm_crtc_helper_funcs ssd130x_crtc_helper_funcs = {
 	.mode_valid = ssd130x_crtc_helper_mode_valid,
-	.atomic_check = ssd130x_crtc_helper_atomic_check,
+	.atomic_check = drm_crtc_helper_atomic_check,
 };
 
 static void ssd130x_crtc_reset(struct drm_crtc *crtc)
drivers/gpu/drm/tiny/simpledrm.c +2 -12
index f03f17f62a56..cbb100753154 100644
@@ -11,6 +11,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_connector.h>
+#include <drm/drm_crtc_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
@@ -545,17 +546,6 @@ static enum drm_mode_status simpledrm_crtc_helper_mode_valid(struct drm_crtc *cr
 	return drm_crtc_helper_mode_valid_fixed(crtc, mode, &sdev->mode);
 }
 
-static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
-					      struct drm_atomic_state *new_state)
-{
-	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-
-	if (!new_crtc_state->enable)
-		return 0;
-
-	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-}
-
 /*
  * The CRTC is always enabled. Screen updates are performed by
  * the primary plane's atomic_update function. Disabling clears
@@ -563,7 +553,7 @@ static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
  */
 static const struct drm_crtc_helper_funcs simpledrm_crtc_helper_funcs = {
 	.mode_valid = simpledrm_crtc_helper_mode_valid,
-	.atomic_check = simpledrm_crtc_helper_atomic_check,
+	.atomic_check = drm_crtc_helper_atomic_check,
 };
 
 static const struct drm_crtc_funcs simpledrm_crtc_funcs = {
include/drm/drm_crtc_helper.h +2 -0
index a6d520d5b6ca..1840db247f69 100644
@@ -50,6 +50,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 			      struct drm_display_mode *mode,
 			      int x, int y,
 			      struct drm_framebuffer *old_fb);
+int drm_crtc_helper_atomic_check(struct drm_crtc *crtc,
+				 struct drm_atomic_state *state);
 bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
 bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
 
Signature · 1 line
2.37.3
maintainer Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] drm/crtc-helper: Add a drm_crtc_helper_atomic_check() helper

Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 8 lines

Provides a default CRTC state check handler for CRTCs that only have one primary plane attached.

There are some drivers that duplicate this logic in their helpers, such as simpledrm and ssd130x. Factor out this common code into a CRTC helper and make drivers use it.

There really isn't much here for now. I suspect that there are more drivers that could use this helper. If you merge this before ofdrm, I'll rebase ofdrm on top.

Please also see my comment below.

Quoted 15 lines

---

  drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++++++++++++++
  drivers/gpu/drm/solomon/ssd130x.c | 14 ++------------
  drivers/gpu/drm/tiny/simpledrm.c  | 14 ++------------
  include/drm/drm_crtc_helper.h     |  2 ++
  4 files changed, 30 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +0 -0
index 457448cc60f7..4ad3abaa98f4 100644
@@ -421,6 +421,30 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
  }
  EXPORT_SYMBOL(drm_crtc_helper_set_mode);

drivers/gpu/drm/drm_crtc_helper.c bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, · line 432

Quoted 10 lines
drivers/gpu/drm/drm_crtc_helper.c +9 -0
 
+/**
+ * drm_crtc_helper_atomic_check() - Helper to check CRTC atomic-state
+ * @crtc: CRTC to check
+ * @state: atomic state object
+ *
+ * Provides a default CRTC-state check handler for CRTCs that only have
+ * one primary plane attached to it.
+ *
+ * This is often the case for the CRTC of simple framebuffers.

I'd add a reference to drm_plane_helper_atomic_check() to this paragraph. Like

See drm_plane_helper_atomic_check() for the respective plane helpers.

And also reference back from the plane-check helper to the CRTC-check helper.

Best regards
Thomas

Quoted 109 lines
drivers/gpu/drm/drm_crtc_helper.c +15 -0
+ *
+ * RETURNS:
+ * Zero on success, or an errno code otherwise.
+ */
+int drm_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
+{
+	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
+
+	if (!new_crtc_state->enable)
+		return 0;
+
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
+}
+EXPORT_SYMBOL(drm_crtc_helper_atomic_check);
+
  static void
  drm_crtc_helper_disable(struct drm_crtc *crtc)
  {
drivers/gpu/drm/solomon/ssd130x.c +2 -12
index 0d4ab65233db..f2795f90ea69 100644
@@ -20,6 +20,7 @@
 
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc_helper.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_edid.h>
  #include <drm/drm_fb_helper.h>
@@ -645,17 +646,6 @@ static enum drm_mode_status ssd130x_crtc_helper_mode_valid(struct drm_crtc *crtc
  	return MODE_OK;
  }
 
-static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
-					    struct drm_atomic_state *new_state)
-{
-	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-
-	if (!new_crtc_state->enable)
-		return 0;
-
-	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-}
-
  /*
   * The CRTC is always enabled. Screen updates are performed by
   * the primary plane's atomic_update function. Disabling clears
@@ -663,7 +653,7 @@ static int ssd130x_crtc_helper_atomic_check(struct drm_crtc *crtc,
   */
  static const struct drm_crtc_helper_funcs ssd130x_crtc_helper_funcs = {
  	.mode_valid = ssd130x_crtc_helper_mode_valid,
-	.atomic_check = ssd130x_crtc_helper_atomic_check,
+	.atomic_check = drm_crtc_helper_atomic_check,
  };
 
  static void ssd130x_crtc_reset(struct drm_crtc *crtc)
drivers/gpu/drm/tiny/simpledrm.c +2 -12
index f03f17f62a56..cbb100753154 100644
@@ -11,6 +11,7 @@
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_state_helper.h>
  #include <drm/drm_connector.h>
+#include <drm/drm_crtc_helper.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_device.h>
  #include <drm/drm_drv.h>
@@ -545,17 +546,6 @@ static enum drm_mode_status simpledrm_crtc_helper_mode_valid(struct drm_crtc *cr
  	return drm_crtc_helper_mode_valid_fixed(crtc, mode, &sdev->mode);
  }
 
-static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
-					      struct drm_atomic_state *new_state)
-{
-	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-
-	if (!new_crtc_state->enable)
-		return 0;
-
-	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-}
-
  /*
   * The CRTC is always enabled. Screen updates are performed by
   * the primary plane's atomic_update function. Disabling clears
@@ -563,7 +553,7 @@ static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
   */
  static const struct drm_crtc_helper_funcs simpledrm_crtc_helper_funcs = {
  	.mode_valid = simpledrm_crtc_helper_mode_valid,
-	.atomic_check = simpledrm_crtc_helper_atomic_check,
+	.atomic_check = drm_crtc_helper_atomic_check,
  };
 
  static const struct drm_crtc_funcs simpledrm_crtc_funcs = {
include/drm/drm_crtc_helper.h +2 -0
index a6d520d5b6ca..1840db247f69 100644
@@ -50,6 +50,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
  			      struct drm_display_mode *mode,
  			      int x, int y,
  			      struct drm_framebuffer *old_fb);
+int drm_crtc_helper_atomic_check(struct drm_crtc *crtc,
+				 struct drm_atomic_state *state);
  bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
  bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
author maintainer
#8 lore raw

Re: [PATCH 3/3] drm/crtc-helper: Add a drm_crtc_helper_atomic_check() helper

Quoted 10 lines · Thomas Zimmermann

Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 7 lines

Provides a default CRTC state check handler for CRTCs that only have one primary plane attached.

There are some drivers that duplicate this logic in their helpers, such as simpledrm and ssd130x. Factor out this common code into a CRTC helper and make drivers use it.

Quoted 8 lines
Quoted 1 line

There really isn't much here for now. I suspect that there are more drivers that could use this helper. If you merge this before ofdrm, I'll rebase ofdrm on top.

Sure. I probably won't post a v2 until tomorrow and I believe ofdrm is ready to be merged, so I'll just rebase this series on top of that once just push it.

Quoted 3 lines

Please also see my comment below.

[...]

Quoted 10 lines
Quoted 9 lines

+/**
+ * drm_crtc_helper_atomic_check() - Helper to check CRTC atomic-state
+ * @crtc: CRTC to check
+ * @state: atomic state object
+ *
+ * Provides a default CRTC-state check handler for CRTCs that only have
+ * one primary plane attached to it.
+ *
+ * This is often the case for the CRTC of simple framebuffers.

Quoted 8 lines

I'd add a reference to drm_plane_helper_atomic_check() to this paragraph. Like

See drm_plane_helper_atomic_check() for the respective plane helpers.

And also reference back from the plane-check helper to the CRTC-check helper.

Good idea, I'll do that. Thanks for your review.

Quoted 3 lines

Best regards
Thomas

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
#9 lore raw

Re: [PATCH 3/3] drm/crtc-helper: Add a drm_crtc_helper_atomic_check() helper

Hi

Am 11.10.22 um 15:26 schrieb Javier Martinez Canillas:

Quoted 15 lines · Thomas Zimmermann
Quoted 14 lines

Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:

Quoted 8 lines

Provides a default CRTC state check handler for CRTCs that only have one primary plane attached.

There are some drivers that duplicate this logic in their helpers, such as simpledrm and ssd130x. Factor out this common code into a CRTC helper and make drivers use it.

Quoted 8 lines
Quoted 4 lines

There really isn't much here for now. I suspect that there are more drivers that could use this helper. If you merge this before ofdrm, I'll rebase ofdrm on top.

Sure. I probably won't post a v2 until tomorrow and I believe ofdrm is ready to be merged, so I'll just rebase this series on top of that once just push it.

I just realized that this function in ofdrm has additional code for color management. There won't be anything to convert.

Best regards
Thomas

Quoted 32 lines
Quoted 4 lines

Please also see my comment below.

[...]

Quoted 10 lines
Quoted 9 lines

+/**
+ * drm_crtc_helper_atomic_check() - Helper to check CRTC atomic-state
+ * @crtc: CRTC to check
+ * @state: atomic state object
+ *
+ * Provides a default CRTC-state check handler for CRTCs that only have
+ * one primary plane attached to it.
+ *
+ * This is often the case for the CRTC of simple framebuffers.

Quoted 8 lines

I'd add a reference to drm_plane_helper_atomic_check() to this paragraph. Like

See drm_plane_helper_atomic_check() for the respective plane helpers.

And also reference back from the plane-check helper to the CRTC-check helper.

Good idea, I'll do that. Thanks for your review.

Quoted 3 lines

Best regards
Thomas

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev