linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] drm: shmobile: Fixes and enhancements
@ 2023-03-31 14:48 Geert Uytterhoeven
  2023-03-31 14:48 ` [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes Geert Uytterhoeven
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

	Hi all,

Currently, there are two drivers for the LCD controller on Renesas
SuperH-based and ARM-based SH-Mobile and R-Mobile SoCs:
  1. sh_mobile_lcdcfb, using the fbdev framework,
  2. shmob_drm, using the DRM framework.
However, only the former driver can be used, as all platform support
integrates the former.  None of these drivers support DT-based systems.

This patch series is a first step to enable the SH-Mobile DRM driver for
Renesas ARM-based SH-Mobile and R-Mobile SoCs.  The next step planned is
to add DT support.

This has been tested on the R-Mobile A1-based Atmark Techno
Armadillo-800-EVA development board, using a temporary
platform-enablement patch[1].

Thanks for your comments!

[1] https://lore.kernel.org/r/c03d4edbd650836bf6a96504df82338ec6d800ff.1680272980.git.geert+renesas@glider.be

Geert Uytterhoeven (5):
  drm: shmobile: Use %p4cc to print fourcc codes
  drm: shmobile: Add support for DRM_FORMAT_XRGB8888
  drm: shmobile: Switch to drm_crtc_init_with_planes()
  drm: shmobile: Add missing call to drm_fbdev_generic_setup()
  drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms

 drivers/gpu/drm/shmobile/Kconfig           |  2 +-
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 35 +++++++++++++++++++---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c   |  3 ++
 drivers/gpu/drm/shmobile/shmob_drm_kms.c   |  9 ++++--
 drivers/gpu/drm/shmobile/shmob_drm_plane.c |  5 ++++
 5 files changed, 47 insertions(+), 7 deletions(-)

-- 
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
@ 2023-03-31 14:48 ` Geert Uytterhoeven
  2023-04-05  3:05   ` Laurent Pinchart
  2023-03-31 14:48 ` [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888 Geert Uytterhoeven
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Replace the printing of hexadecimal fourcc format codes by
pretty-printed format names, using the "%p4cc" format specifier.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 ++--
 drivers/gpu/drm/shmobile/shmob_drm_kms.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index d354ab3077cecf94..713a7612244c647a 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -355,8 +355,8 @@ static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
 
 	format = shmob_drm_format_info(crtc->primary->fb->format->format);
 	if (format == NULL) {
-		dev_dbg(sdev->dev, "mode_set: unsupported format %08x\n",
-			crtc->primary->fb->format->format);
+		dev_dbg(sdev->dev, "mode_set: unsupported format %p4cc\n",
+			&crtc->primary->fb->format->format);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
index 60a2c8d8a0d947d2..3c5fe3bc183c7c13 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
@@ -96,8 +96,8 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
 	format = shmob_drm_format_info(mode_cmd->pixel_format);
 	if (format == NULL) {
-		dev_dbg(dev->dev, "unsupported pixel format %08x\n",
-			mode_cmd->pixel_format);
+		dev_dbg(dev->dev, "unsupported pixel format %p4cc\n",
+			&mode_cmd->pixel_format);
 		return ERR_PTR(-EINVAL);
 	}
 
-- 
2.34.1


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

* [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
  2023-03-31 14:48 ` [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes Geert Uytterhoeven
@ 2023-03-31 14:48 ` Geert Uytterhoeven
  2023-04-05  3:06   ` Laurent Pinchart
  2023-03-31 14:48 ` [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Geert Uytterhoeven
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

DRM_FORMAT_XRGB8888 aka XR24 is the modus francus of DRM, and should be
supported by all drivers.

The handling for DRM_FORMAT_XRGB8888 is similar to DRM_FORMAT_ARGB8888,
just ignore the alpha channel.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 1 +
 drivers/gpu/drm/shmobile/shmob_drm_kms.c   | 5 +++++
 drivers/gpu/drm/shmobile/shmob_drm_plane.c | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 713a7612244c647a..08dc1428aa16caf0 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -232,6 +232,7 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
 		value = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
 		break;
 	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XRGB8888:
 	default:
 		value = LDDDSR_LS;
 		break;
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
index 3c5fe3bc183c7c13..99381cc0abf3ae1f 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
@@ -39,6 +39,11 @@ static const struct shmob_drm_format_info shmob_drm_format_infos[] = {
 		.bpp = 32,
 		.yuv = false,
 		.lddfr = LDDFR_PKF_ARGB32,
+	}, {
+		.fourcc = DRM_FORMAT_XRGB8888,
+		.bpp = 32,
+		.yuv = false,
+		.lddfr = LDDFR_PKF_ARGB32,
 	}, {
 		.fourcc = DRM_FORMAT_NV12,
 		.bpp = 12,
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
index 604ae23825daaafd..850986cee848226a 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_plane.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
@@ -80,6 +80,7 @@ static void __shmob_drm_plane_setup(struct shmob_drm_plane *splane,
 		format |= LDBBSIFR_SWPL | LDBBSIFR_SWPW | LDBBSIFR_SWPB;
 		break;
 	case DRM_FORMAT_ARGB8888:
+	case DRM_FORMAT_XRGB8888:
 	default:
 		format |= LDBBSIFR_SWPL;
 		break;
@@ -95,6 +96,9 @@ static void __shmob_drm_plane_setup(struct shmob_drm_plane *splane,
 	case DRM_FORMAT_ARGB8888:
 		format |= LDBBSIFR_AL_PK | LDBBSIFR_RY | LDDFR_PKF_ARGB32;
 		break;
+	case DRM_FORMAT_XRGB8888:
+		format |= LDBBSIFR_AL_1 | LDBBSIFR_RY | LDDFR_PKF_ARGB32;
+		break;
 	case DRM_FORMAT_NV12:
 	case DRM_FORMAT_NV21:
 		format |= LDBBSIFR_AL_1 | LDBBSIFR_CHRR_420;
@@ -231,6 +235,7 @@ static const uint32_t formats[] = {
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_RGB888,
 	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_NV12,
 	DRM_FORMAT_NV21,
 	DRM_FORMAT_NV16,
-- 
2.34.1


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

* [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes()
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
  2023-03-31 14:48 ` [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes Geert Uytterhoeven
  2023-03-31 14:48 ` [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888 Geert Uytterhoeven
@ 2023-03-31 14:48 ` Geert Uytterhoeven
  2023-04-05  3:59   ` Laurent Pinchart
  2023-03-31 14:48 ` [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup() Geert Uytterhoeven
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which
advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as
being supported.

Switch to drm_crtc_init_with_planes(), and advertize all supported
(A)RGB modes, so we can use RGB565 as the default mode for the console.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 30 +++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 08dc1428aa16caf0..11dd2bc803e7cb62 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -18,6 +18,7 @@
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
@@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
 	.disable_vblank = shmob_drm_disable_vblank,
 };
 
+static const uint32_t modeset_formats[] = {
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XRGB8888,
+};
+
+static const struct drm_plane_funcs primary_plane_funcs = {
+	DRM_PLANE_NON_ATOMIC_FUNCS,
+};
+
 int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
 {
 	struct drm_crtc *crtc = &sdev->crtc.crtc;
+	struct drm_plane *primary;
 	int ret;
 
 	sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
 
-	ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
-	if (ret < 0)
+	primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0,
+					      0, &primary_plane_funcs,
+					      modeset_formats,
+					      ARRAY_SIZE(modeset_formats),
+					      NULL, DRM_PLANE_TYPE_PRIMARY,
+					      NULL);
+	if (IS_ERR(primary))
+		return PTR_ERR(primary);
+
+	ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL,
+					&crtc_funcs, NULL);
+	if (ret < 0) {
+		drm_plane_cleanup(primary);
+		kfree(primary);
 		return ret;
+	}
 
 	drm_crtc_helper_add(crtc, &crtc_helper_funcs);
 
-- 
2.34.1


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

* [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup()
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2023-03-31 14:48 ` [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Geert Uytterhoeven
@ 2023-03-31 14:48 ` Geert Uytterhoeven
  2023-04-05  4:00   ` Laurent Pinchart
  2023-03-31 14:48 ` [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms Geert Uytterhoeven
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven,
	Laurent Pinchart

Set up generic fbdev emulation, to enable support for the Linux console.

Use 16 as the preferred depth, as that is a good compromise between
colorfulness and resource utilization, and the default of the fbdev
driver.

Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index faacfee24763b1d4..30493ce874192e3e 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 
 #include <drm/drm_drv.h>
+#include <drm/drm_fbdev_generic.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_module.h>
 #include <drm/drm_probe_helper.h>
@@ -271,6 +272,8 @@ static int shmob_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_irq_uninstall;
 
+	drm_fbdev_generic_setup(ddev, 16);
+
 	return 0;
 
 err_irq_uninstall:
-- 
2.34.1


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

* [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2023-03-31 14:48 ` [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup() Geert Uytterhoeven
@ 2023-03-31 14:48 ` Geert Uytterhoeven
  2023-04-05  4:02   ` Laurent Pinchart
  2023-03-31 15:35 ` [PATCH 0/5] drm: shmobile: Fixes and enhancements Thomas Zimmermann
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-03-31 14:48 UTC (permalink / raw)
  To: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

The LCD Controller supported by the drm-shmob driver is not only present
on SuperH SH-Mobile SoCs, but also on Renesas ARM SH/R-Mobile SoCs.
Make its option visible, so the user can enable support for it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/shmobile/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig
index 4ec5dc74a6b0b880..719d4e7a5cd75aad 100644
--- a/drivers/gpu/drm/shmobile/Kconfig
+++ b/drivers/gpu/drm/shmobile/Kconfig
@@ -2,7 +2,7 @@
 config DRM_SHMOBILE
 	tristate "DRM Support for SH Mobile"
 	depends on DRM && ARM
-	depends on ARCH_SHMOBILE || COMPILE_TEST
+	depends on ARCH_RENESAS || ARCH_SHMOBILE || COMPILE_TEST
 	select BACKLIGHT_CLASS_DEVICE
 	select DRM_KMS_HELPER
 	select DRM_GEM_DMA_HELPER
-- 
2.34.1


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

* Re: [PATCH 0/5] drm: shmobile: Fixes and enhancements
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2023-03-31 14:48 ` [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms Geert Uytterhoeven
@ 2023-03-31 15:35 ` Thomas Zimmermann
  2023-04-03 13:14 ` Thomas Zimmermann
  2023-04-05  4:03 ` Laurent Pinchart
  7 siblings, 0 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2023-03-31 15:35 UTC (permalink / raw)
  To: Geert Uytterhoeven, Laurent Pinchart, Kieran Bingham,
	David Airlie, Daniel Vetter
  Cc: linux-renesas-soc, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1937 bytes --]

Hi

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

for the whole patchset.

Best regards
Thomas

Am 31.03.23 um 16:48 schrieb Geert Uytterhoeven:
> 	Hi all,
> 
> Currently, there are two drivers for the LCD controller on Renesas
> SuperH-based and ARM-based SH-Mobile and R-Mobile SoCs:
>    1. sh_mobile_lcdcfb, using the fbdev framework,
>    2. shmob_drm, using the DRM framework.
> However, only the former driver can be used, as all platform support
> integrates the former.  None of these drivers support DT-based systems.
> 
> This patch series is a first step to enable the SH-Mobile DRM driver for
> Renesas ARM-based SH-Mobile and R-Mobile SoCs.  The next step planned is
> to add DT support.
> 
> This has been tested on the R-Mobile A1-based Atmark Techno
> Armadillo-800-EVA development board, using a temporary
> platform-enablement patch[1].
> 
> Thanks for your comments!
> 
> [1] https://lore.kernel.org/r/c03d4edbd650836bf6a96504df82338ec6d800ff.1680272980.git.geert+renesas@glider.be
> 
> Geert Uytterhoeven (5):
>    drm: shmobile: Use %p4cc to print fourcc codes
>    drm: shmobile: Add support for DRM_FORMAT_XRGB8888
>    drm: shmobile: Switch to drm_crtc_init_with_planes()
>    drm: shmobile: Add missing call to drm_fbdev_generic_setup()
>    drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
> 
>   drivers/gpu/drm/shmobile/Kconfig           |  2 +-
>   drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 35 +++++++++++++++++++---
>   drivers/gpu/drm/shmobile/shmob_drm_drv.c   |  3 ++
>   drivers/gpu/drm/shmobile/shmob_drm_kms.c   |  9 ++++--
>   drivers/gpu/drm/shmobile/shmob_drm_plane.c |  5 ++++
>   5 files changed, 47 insertions(+), 7 deletions(-)
> 

-- 
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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH 0/5] drm: shmobile: Fixes and enhancements
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2023-03-31 15:35 ` [PATCH 0/5] drm: shmobile: Fixes and enhancements Thomas Zimmermann
@ 2023-04-03 13:14 ` Thomas Zimmermann
  2023-04-03 13:52   ` Geert Uytterhoeven
  2023-04-05  4:03 ` Laurent Pinchart
  7 siblings, 1 reply; 18+ messages in thread
From: Thomas Zimmermann @ 2023-04-03 13:14 UTC (permalink / raw)
  To: Geert Uytterhoeven, Laurent Pinchart, Kieran Bingham,
	David Airlie, Daniel Vetter
  Cc: linux-renesas-soc, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1957 bytes --]

Hi Geert

Am 31.03.23 um 16:48 schrieb Geert Uytterhoeven:
> 	Hi all,
> 
> Currently, there are two drivers for the LCD controller on Renesas
> SuperH-based and ARM-based SH-Mobile and R-Mobile SoCs:
>    1. sh_mobile_lcdcfb, using the fbdev framework,
>    2. shmob_drm, using the DRM framework.
> However, only the former driver can be used, as all platform support
> integrates the former.  None of these drivers support DT-based systems.
> 
> This patch series is a first step to enable the SH-Mobile DRM driver for
> Renesas ARM-based SH-Mobile and R-Mobile SoCs.  The next step planned is
> to add DT support.
> 
> This has been tested on the R-Mobile A1-based Atmark Techno
> Armadillo-800-EVA development board, using a temporary
> platform-enablement patch[1].

Since you have the hardware for shmobile, would you be able to test 
patches occasionally?

Best regards
Thomas

> 
> Thanks for your comments!
> 
> [1] https://lore.kernel.org/r/c03d4edbd650836bf6a96504df82338ec6d800ff.1680272980.git.geert+renesas@glider.be
> 
> Geert Uytterhoeven (5):
>    drm: shmobile: Use %p4cc to print fourcc codes
>    drm: shmobile: Add support for DRM_FORMAT_XRGB8888
>    drm: shmobile: Switch to drm_crtc_init_with_planes()
>    drm: shmobile: Add missing call to drm_fbdev_generic_setup()
>    drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
> 
>   drivers/gpu/drm/shmobile/Kconfig           |  2 +-
>   drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 35 +++++++++++++++++++---
>   drivers/gpu/drm/shmobile/shmob_drm_drv.c   |  3 ++
>   drivers/gpu/drm/shmobile/shmob_drm_kms.c   |  9 ++++--
>   drivers/gpu/drm/shmobile/shmob_drm_plane.c |  5 ++++
>   5 files changed, 47 insertions(+), 7 deletions(-)
> 

-- 
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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH 0/5] drm: shmobile: Fixes and enhancements
  2023-04-03 13:14 ` Thomas Zimmermann
@ 2023-04-03 13:52   ` Geert Uytterhoeven
  0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-04-03 13:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Laurent Pinchart, Kieran Bingham, David Airlie, Daniel Vetter,
	linux-renesas-soc, linux-kernel, dri-devel

Hi Thomas,

On Mon, Apr 3, 2023 at 3:14 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Am 31.03.23 um 16:48 schrieb Geert Uytterhoeven:
> > Currently, there are two drivers for the LCD controller on Renesas
> > SuperH-based and ARM-based SH-Mobile and R-Mobile SoCs:
> >    1. sh_mobile_lcdcfb, using the fbdev framework,
> >    2. shmob_drm, using the DRM framework.
> > However, only the former driver can be used, as all platform support
> > integrates the former.  None of these drivers support DT-based systems.
> >
> > This patch series is a first step to enable the SH-Mobile DRM driver for
> > Renesas ARM-based SH-Mobile and R-Mobile SoCs.  The next step planned is
> > to add DT support.
> >
> > This has been tested on the R-Mobile A1-based Atmark Techno
> > Armadillo-800-EVA development board, using a temporary
> > platform-enablement patch[1].
>
> Since you have the hardware for shmobile, would you be able to test
> patches occasionally?

Sure!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes
  2023-03-31 14:48 ` [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes Geert Uytterhoeven
@ 2023-04-05  3:05   ` Laurent Pinchart
  0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  3:05 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

Thank you for the patch.

On Fri, Mar 31, 2023 at 04:48:07PM +0200, Geert Uytterhoeven wrote:
> Replace the printing of hexadecimal fourcc format codes by
> pretty-printed format names, using the "%p4cc" format specifier.

I really like %p4cc :-) I makes things much neater.

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 ++--
>  drivers/gpu/drm/shmobile/shmob_drm_kms.c  | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index d354ab3077cecf94..713a7612244c647a 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -355,8 +355,8 @@ static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
>  
>  	format = shmob_drm_format_info(crtc->primary->fb->format->format);
>  	if (format == NULL) {
> -		dev_dbg(sdev->dev, "mode_set: unsupported format %08x\n",
> -			crtc->primary->fb->format->format);
> +		dev_dbg(sdev->dev, "mode_set: unsupported format %p4cc\n",
> +			&crtc->primary->fb->format->format);
>  		return -EINVAL;
>  	}
>  
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> index 60a2c8d8a0d947d2..3c5fe3bc183c7c13 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> @@ -96,8 +96,8 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>  
>  	format = shmob_drm_format_info(mode_cmd->pixel_format);
>  	if (format == NULL) {
> -		dev_dbg(dev->dev, "unsupported pixel format %08x\n",
> -			mode_cmd->pixel_format);
> +		dev_dbg(dev->dev, "unsupported pixel format %p4cc\n",
> +			&mode_cmd->pixel_format);
>  		return ERR_PTR(-EINVAL);
>  	}
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888
  2023-03-31 14:48 ` [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888 Geert Uytterhoeven
@ 2023-04-05  3:06   ` Laurent Pinchart
  0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  3:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

Thank you for the patch.

On Fri, Mar 31, 2023 at 04:48:08PM +0200, Geert Uytterhoeven wrote:
> DRM_FORMAT_XRGB8888 aka XR24 is the modus francus of DRM, and should be
> supported by all drivers.
> 
> The handling for DRM_FORMAT_XRGB8888 is similar to DRM_FORMAT_ARGB8888,
> just ignore the alpha channel.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 1 +
>  drivers/gpu/drm/shmobile/shmob_drm_kms.c   | 5 +++++
>  drivers/gpu/drm/shmobile/shmob_drm_plane.c | 5 +++++
>  3 files changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index 713a7612244c647a..08dc1428aa16caf0 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -232,6 +232,7 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
>  		value = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
>  		break;
>  	case DRM_FORMAT_ARGB8888:
> +	case DRM_FORMAT_XRGB8888:
>  	default:
>  		value = LDDDSR_LS;
>  		break;
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> index 3c5fe3bc183c7c13..99381cc0abf3ae1f 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
> @@ -39,6 +39,11 @@ static const struct shmob_drm_format_info shmob_drm_format_infos[] = {
>  		.bpp = 32,
>  		.yuv = false,
>  		.lddfr = LDDFR_PKF_ARGB32,
> +	}, {
> +		.fourcc = DRM_FORMAT_XRGB8888,
> +		.bpp = 32,
> +		.yuv = false,
> +		.lddfr = LDDFR_PKF_ARGB32,
>  	}, {
>  		.fourcc = DRM_FORMAT_NV12,
>  		.bpp = 12,
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
> index 604ae23825daaafd..850986cee848226a 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_plane.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
> @@ -80,6 +80,7 @@ static void __shmob_drm_plane_setup(struct shmob_drm_plane *splane,
>  		format |= LDBBSIFR_SWPL | LDBBSIFR_SWPW | LDBBSIFR_SWPB;
>  		break;
>  	case DRM_FORMAT_ARGB8888:
> +	case DRM_FORMAT_XRGB8888:
>  	default:
>  		format |= LDBBSIFR_SWPL;
>  		break;
> @@ -95,6 +96,9 @@ static void __shmob_drm_plane_setup(struct shmob_drm_plane *splane,
>  	case DRM_FORMAT_ARGB8888:
>  		format |= LDBBSIFR_AL_PK | LDBBSIFR_RY | LDDFR_PKF_ARGB32;
>  		break;
> +	case DRM_FORMAT_XRGB8888:
> +		format |= LDBBSIFR_AL_1 | LDBBSIFR_RY | LDDFR_PKF_ARGB32;
> +		break;
>  	case DRM_FORMAT_NV12:
>  	case DRM_FORMAT_NV21:
>  		format |= LDBBSIFR_AL_1 | LDBBSIFR_CHRR_420;
> @@ -231,6 +235,7 @@ static const uint32_t formats[] = {
>  	DRM_FORMAT_RGB565,
>  	DRM_FORMAT_RGB888,
>  	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_XRGB8888,
>  	DRM_FORMAT_NV12,
>  	DRM_FORMAT_NV21,
>  	DRM_FORMAT_NV16,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes()
  2023-03-31 14:48 ` [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Geert Uytterhoeven
@ 2023-04-05  3:59   ` Laurent Pinchart
  2023-04-10  9:35     ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  3:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

Thank you for the patch.

On Fri, Mar 31, 2023 at 04:48:09PM +0200, Geert Uytterhoeven wrote:
> The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which
> advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as
> being supported.
> 
> Switch to drm_crtc_init_with_planes(), and advertize all supported
> (A)RGB modes, so we can use RGB565 as the default mode for the console.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 30 +++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index 08dc1428aa16caf0..11dd2bc803e7cb62 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -18,6 +18,7 @@
>  #include <drm/drm_gem_dma_helper.h>
>  #include <drm/drm_modeset_helper.h>
>  #include <drm/drm_modeset_helper_vtables.h>
> +#include <drm/drm_plane_helper.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_simple_kms_helper.h>
>  #include <drm/drm_vblank.h>
> @@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
>  	.disable_vblank = shmob_drm_disable_vblank,
>  };
>  
> +static const uint32_t modeset_formats[] = {
> +	DRM_FORMAT_RGB565,
> +	DRM_FORMAT_RGB888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_XRGB8888,
> +};
> +
> +static const struct drm_plane_funcs primary_plane_funcs = {
> +	DRM_PLANE_NON_ATOMIC_FUNCS,
> +};
> +
>  int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
>  {
>  	struct drm_crtc *crtc = &sdev->crtc.crtc;
> +	struct drm_plane *primary;
>  	int ret;
>  
>  	sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
>  
> -	ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
> -	if (ret < 0)
> +	primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0,
> +					      0, &primary_plane_funcs,
> +					      modeset_formats,
> +					      ARRAY_SIZE(modeset_formats),
> +					      NULL, DRM_PLANE_TYPE_PRIMARY,
> +					      NULL);
> +	if (IS_ERR(primary))
> +		return PTR_ERR(primary);

This seems like a bit of a hack to me. Why don't you use the planes
created by shmob_drm_plane_create() instead of allocating a new one ?

> +
> +	ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL,
> +					&crtc_funcs, NULL);
> +	if (ret < 0) {
> +		drm_plane_cleanup(primary);
> +		kfree(primary);
>  		return ret;
> +	}
>  
>  	drm_crtc_helper_add(crtc, &crtc_helper_funcs);
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup()
  2023-03-31 14:48 ` [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup() Geert Uytterhoeven
@ 2023-04-05  4:00   ` Laurent Pinchart
  0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  4:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

Thank you for the patch.

On Fri, Mar 31, 2023 at 04:48:10PM +0200, Geert Uytterhoeven wrote:
> Set up generic fbdev emulation, to enable support for the Linux console.
> 
> Use 16 as the preferred depth, as that is a good compromise between
> colorfulness and resource utilization, and the default of the fbdev
> driver.
> 
> Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index faacfee24763b1d4..30493ce874192e3e 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -16,6 +16,7 @@
>  #include <linux/slab.h>
>  
>  #include <drm/drm_drv.h>
> +#include <drm/drm_fbdev_generic.h>
>  #include <drm/drm_gem_dma_helper.h>
>  #include <drm/drm_module.h>
>  #include <drm/drm_probe_helper.h>
> @@ -271,6 +272,8 @@ static int shmob_drm_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		goto err_irq_uninstall;
>  
> +	drm_fbdev_generic_setup(ddev, 16);
> +
>  	return 0;
>  
>  err_irq_uninstall:

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
  2023-03-31 14:48 ` [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms Geert Uytterhoeven
@ 2023-04-05  4:02   ` Laurent Pinchart
  2023-04-10  9:45     ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  4:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

Thank you for the patch.

On Fri, Mar 31, 2023 at 04:48:11PM +0200, Geert Uytterhoeven wrote:
> The LCD Controller supported by the drm-shmob driver is not only present
> on SuperH SH-Mobile SoCs, but also on Renesas ARM SH/R-Mobile SoCs.
> Make its option visible, so the user can enable support for it.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/gpu/drm/shmobile/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig
> index 4ec5dc74a6b0b880..719d4e7a5cd75aad 100644
> --- a/drivers/gpu/drm/shmobile/Kconfig
> +++ b/drivers/gpu/drm/shmobile/Kconfig
> @@ -2,7 +2,7 @@
>  config DRM_SHMOBILE
>  	tristate "DRM Support for SH Mobile"
>  	depends on DRM && ARM

There shouldn't be anything ARM-dependent, could you drop "&& ARM" while
at it ?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> -	depends on ARCH_SHMOBILE || COMPILE_TEST
> +	depends on ARCH_RENESAS || ARCH_SHMOBILE || COMPILE_TEST
>  	select BACKLIGHT_CLASS_DEVICE
>  	select DRM_KMS_HELPER
>  	select DRM_GEM_DMA_HELPER

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 0/5] drm: shmobile: Fixes and enhancements
  2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2023-04-03 13:14 ` Thomas Zimmermann
@ 2023-04-05  4:03 ` Laurent Pinchart
  7 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-05  4:03 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

On Fri, Mar 31, 2023 at 04:48:06PM +0200, Geert Uytterhoeven wrote:
> 	Hi all,
> 
> Currently, there are two drivers for the LCD controller on Renesas
> SuperH-based and ARM-based SH-Mobile and R-Mobile SoCs:
>   1. sh_mobile_lcdcfb, using the fbdev framework,
>   2. shmob_drm, using the DRM framework.
> However, only the former driver can be used, as all platform support
> integrates the former.  None of these drivers support DT-based systems.
> 
> This patch series is a first step to enable the SH-Mobile DRM driver for
> Renesas ARM-based SH-Mobile and R-Mobile SoCs.  The next step planned is
> to add DT support.
> 
> This has been tested on the R-Mobile A1-based Atmark Techno
> Armadillo-800-EVA development board, using a temporary
> platform-enablement patch[1].
> 
> Thanks for your comments!

Thanks for reviving this driver. I'm looking forward to DT and KMS
atomic support :-)

Will you get these patches merged through drm-misc ?

> [1] https://lore.kernel.org/r/c03d4edbd650836bf6a96504df82338ec6d800ff.1680272980.git.geert+renesas@glider.be
> 
> Geert Uytterhoeven (5):
>   drm: shmobile: Use %p4cc to print fourcc codes
>   drm: shmobile: Add support for DRM_FORMAT_XRGB8888
>   drm: shmobile: Switch to drm_crtc_init_with_planes()
>   drm: shmobile: Add missing call to drm_fbdev_generic_setup()
>   drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
> 
>  drivers/gpu/drm/shmobile/Kconfig           |  2 +-
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c  | 35 +++++++++++++++++++---
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c   |  3 ++
>  drivers/gpu/drm/shmobile/shmob_drm_kms.c   |  9 ++++--
>  drivers/gpu/drm/shmobile/shmob_drm_plane.c |  5 ++++
>  5 files changed, 47 insertions(+), 7 deletions(-)

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes()
  2023-04-05  3:59   ` Laurent Pinchart
@ 2023-04-10  9:35     ` Geert Uytterhoeven
  2023-04-10 12:26       ` Laurent Pinchart
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-04-10  9:35 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Laurent,

Thanks for your comments!

On Wed, Apr 5, 2023 at 5:59 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Fri, Mar 31, 2023 at 04:48:09PM +0200, Geert Uytterhoeven wrote:
> > The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which
> > advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as
> > being supported.
> >
> > Switch to drm_crtc_init_with_planes(), and advertize all supported
> > (A)RGB modes, so we can use RGB565 as the default mode for the console.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> > --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > @@ -18,6 +18,7 @@
> >  #include <drm/drm_gem_dma_helper.h>
> >  #include <drm/drm_modeset_helper.h>
> >  #include <drm/drm_modeset_helper_vtables.h>
> > +#include <drm/drm_plane_helper.h>
> >  #include <drm/drm_probe_helper.h>
> >  #include <drm/drm_simple_kms_helper.h>
> >  #include <drm/drm_vblank.h>
> > @@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
> >       .disable_vblank = shmob_drm_disable_vblank,
> >  };
> >
> > +static const uint32_t modeset_formats[] = {
> > +     DRM_FORMAT_RGB565,
> > +     DRM_FORMAT_RGB888,
> > +     DRM_FORMAT_ARGB8888,
> > +     DRM_FORMAT_XRGB8888,
> > +};
> > +
> > +static const struct drm_plane_funcs primary_plane_funcs = {
> > +     DRM_PLANE_NON_ATOMIC_FUNCS,
> > +};
> > +
> >  int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
> >  {
> >       struct drm_crtc *crtc = &sdev->crtc.crtc;
> > +     struct drm_plane *primary;
> >       int ret;
> >
> >       sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
> >
> > -     ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
> > -     if (ret < 0)
> > +     primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0,
> > +                                           0, &primary_plane_funcs,
> > +                                           modeset_formats,
> > +                                           ARRAY_SIZE(modeset_formats),
> > +                                           NULL, DRM_PLANE_TYPE_PRIMARY,
> > +                                           NULL);
> > +     if (IS_ERR(primary))
> > +             return PTR_ERR(primary);
>
> This seems like a bit of a hack to me. Why don't you use the planes

I'm following what Thomas did in the nouveau driver....

> created by shmob_drm_plane_create() instead of allocating a new one ?

Is that possible? shmob_drm_plane_create() creates overlay planes,
while this is for the primary plane.

>
> > +
> > +     ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL,
> > +                                     &crtc_funcs, NULL);
> > +     if (ret < 0) {
> > +             drm_plane_cleanup(primary);
> > +             kfree(primary);
> >               return ret;
> > +     }
> >
> >       drm_crtc_helper_add(crtc, &crtc_helper_funcs);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms
  2023-04-05  4:02   ` Laurent Pinchart
@ 2023-04-10  9:45     ` Geert Uytterhoeven
  0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2023-04-10  9:45 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Laurent,

On Wed, Apr 5, 2023 at 6:02 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Fri, Mar 31, 2023 at 04:48:11PM +0200, Geert Uytterhoeven wrote:
> > The LCD Controller supported by the drm-shmob driver is not only present
> > on SuperH SH-Mobile SoCs, but also on Renesas ARM SH/R-Mobile SoCs.
> > Make its option visible, so the user can enable support for it.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> >  drivers/gpu/drm/shmobile/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig
> > index 4ec5dc74a6b0b880..719d4e7a5cd75aad 100644
> > --- a/drivers/gpu/drm/shmobile/Kconfig
> > +++ b/drivers/gpu/drm/shmobile/Kconfig
> > @@ -2,7 +2,7 @@
> >  config DRM_SHMOBILE
> >       tristate "DRM Support for SH Mobile"
> >       depends on DRM && ARM
>
> There shouldn't be anything ARM-dependent, could you drop "&& ARM" while
> at it ?

Oops, that was added back in 2014, when the driver stopped building on SH.
The build issue seems to be fixed, so I'll drop the dependency on ARM.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes()
  2023-04-10  9:35     ` Geert Uytterhoeven
@ 2023-04-10 12:26       ` Laurent Pinchart
  0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2023-04-10 12:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kieran Bingham, David Airlie, Daniel Vetter, dri-devel,
	linux-renesas-soc, linux-kernel

Hi Geert,

On Mon, Apr 10, 2023 at 11:35:56AM +0200, Geert Uytterhoeven wrote:
> On Wed, Apr 5, 2023 at 5:59 AM Laurent Pinchart wrote:
> > On Fri, Mar 31, 2023 at 04:48:09PM +0200, Geert Uytterhoeven wrote:
> > > The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which
> > > advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as
> > > being supported.
> > >
> > > Switch to drm_crtc_init_with_planes(), and advertize all supported
> > > (A)RGB modes, so we can use RGB565 as the default mode for the console.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> > > --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > > +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > > @@ -18,6 +18,7 @@
> > >  #include <drm/drm_gem_dma_helper.h>
> > >  #include <drm/drm_modeset_helper.h>
> > >  #include <drm/drm_modeset_helper_vtables.h>
> > > +#include <drm/drm_plane_helper.h>
> > >  #include <drm/drm_probe_helper.h>
> > >  #include <drm/drm_simple_kms_helper.h>
> > >  #include <drm/drm_vblank.h>
> > > @@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
> > >       .disable_vblank = shmob_drm_disable_vblank,
> > >  };
> > >
> > > +static const uint32_t modeset_formats[] = {
> > > +     DRM_FORMAT_RGB565,
> > > +     DRM_FORMAT_RGB888,
> > > +     DRM_FORMAT_ARGB8888,
> > > +     DRM_FORMAT_XRGB8888,
> > > +};
> > > +
> > > +static const struct drm_plane_funcs primary_plane_funcs = {
> > > +     DRM_PLANE_NON_ATOMIC_FUNCS,
> > > +};
> > > +
> > >  int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
> > >  {
> > >       struct drm_crtc *crtc = &sdev->crtc.crtc;
> > > +     struct drm_plane *primary;
> > >       int ret;
> > >
> > >       sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
> > >
> > > -     ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs);
> > > -     if (ret < 0)
> > > +     primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0,
> > > +                                           0, &primary_plane_funcs,
> > > +                                           modeset_formats,
> > > +                                           ARRAY_SIZE(modeset_formats),
> > > +                                           NULL, DRM_PLANE_TYPE_PRIMARY,
> > > +                                           NULL);
> > > +     if (IS_ERR(primary))
> > > +             return PTR_ERR(primary);
> >
> > This seems like a bit of a hack to me. Why don't you use the planes
> 
> I'm following what Thomas did in the nouveau driver....
> 
> > created by shmob_drm_plane_create() instead of allocating a new one ?
> 
> Is that possible? shmob_drm_plane_create() creates overlay planes,
> while this is for the primary plane.

You're right, for some reason I overlooked that. Sorry for the noise.

It would be good to move handling of the primary plane to
shmob_drm_plane.c, but that's for later, when moving the driver to the
atomic API. For now,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> > > +
> > > +     ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL,
> > > +                                     &crtc_funcs, NULL);
> > > +     if (ret < 0) {
> > > +             drm_plane_cleanup(primary);
> > > +             kfree(primary);
> > >               return ret;
> > > +     }
> > >
> > >       drm_crtc_helper_add(crtc, &crtc_helper_funcs);

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2023-04-10 12:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 14:48 [PATCH 0/5] drm: shmobile: Fixes and enhancements Geert Uytterhoeven
2023-03-31 14:48 ` [PATCH 1/5] drm: shmobile: Use %p4cc to print fourcc codes Geert Uytterhoeven
2023-04-05  3:05   ` Laurent Pinchart
2023-03-31 14:48 ` [PATCH 2/5] drm: shmobile: Add support for DRM_FORMAT_XRGB8888 Geert Uytterhoeven
2023-04-05  3:06   ` Laurent Pinchart
2023-03-31 14:48 ` [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Geert Uytterhoeven
2023-04-05  3:59   ` Laurent Pinchart
2023-04-10  9:35     ` Geert Uytterhoeven
2023-04-10 12:26       ` Laurent Pinchart
2023-03-31 14:48 ` [PATCH 4/5] drm: shmobile: Add missing call to drm_fbdev_generic_setup() Geert Uytterhoeven
2023-04-05  4:00   ` Laurent Pinchart
2023-03-31 14:48 ` [PATCH 5/5] drm: shmobile: Make DRM_SHMOBILE visible on Renesas SoC platforms Geert Uytterhoeven
2023-04-05  4:02   ` Laurent Pinchart
2023-04-10  9:45     ` Geert Uytterhoeven
2023-03-31 15:35 ` [PATCH 0/5] drm: shmobile: Fixes and enhancements Thomas Zimmermann
2023-04-03 13:14 ` Thomas Zimmermann
2023-04-03 13:52   ` Geert Uytterhoeven
2023-04-05  4:03 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).