linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] drm/vc4: dpi: Various improvements
@ 2022-10-13  9:56 Maxime Ripard
  2022-10-13  9:56 ` [PATCH 1/7] media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI Maxime Ripard
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

Hi,

Those patches have been in the downstream RaspberryPi tree for a while and help
to support more DPI displays.

Let me know what you think,
Maxime

To: Emma Anholt <emma@anholt.net>
To: Maxime Ripard <mripard@kernel.org>
To: David Airlie <airlied@linux.ie>
To: Daniel Vetter <daniel@ffwll.ch>
To: Eric Anholt <eric@anholt.net>
To: Rob Herring <robh@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Chris Morgan <macromorgan@hotmail.com>
Cc: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>

---
Chris Morgan (2):
      media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI
      drm/vc4: dpi: Support RGB565 format

Dave Stevenson (2):
      drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24.
      drm/vc4: dpi: Fix format mapping for RGB565

Joerg Quinten (3):
      media: uapi: add MEDIA_BUS_FMT_BGR666_1X18
      media: uapi: add MEDIA_BUS_FMT_BGR666_1X24_CPADHI
      drm/vc4: dpi: Support BGR666 formats

 drivers/gpu/drm/vc4/vc4_dpi.c         | 16 +++++++++++++---
 include/uapi/linux/media-bus-format.h |  5 ++++-
 2 files changed, 17 insertions(+), 4 deletions(-)
---
base-commit: c9b48b91e2fbb74fb981aa616a6ef3c78194077f
change-id: 20221013-rpi-dpi-improvements-c3d755531c39

Best regards,
-- 
Maxime Ripard <maxime@cerno.tech>

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

* [PATCH 1/7] media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-13  9:56 ` [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18 Maxime Ripard
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Chris Morgan <macromorgan@hotmail.com>

Add the MEDIA_BUS_FMT_RGB565_1X24_CPADHI format used by the Geekworm
MZP280 panel for the Raspberry Pi.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 include/uapi/linux/media-bus-format.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
index ec3323dbb927..b0a945eb7040 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -34,13 +34,14 @@
 
 #define MEDIA_BUS_FMT_FIXED			0x0001
 
-/* RGB - next is	0x1022 */
+/* RGB - next is	0x1023 */
 #define MEDIA_BUS_FMT_RGB444_1X12		0x1016
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE	0x1003
 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE	0x1004
 #define MEDIA_BUS_FMT_RGB565_1X16		0x1017
+#define MEDIA_BUS_FMT_RGB565_1X24_CPADHI	0x1022
 #define MEDIA_BUS_FMT_BGR565_2X8_BE		0x1005
 #define MEDIA_BUS_FMT_BGR565_2X8_LE		0x1006
 #define MEDIA_BUS_FMT_RGB565_2X8_BE		0x1007

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
  2022-10-13  9:56 ` [PATCH 1/7] media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-15 17:07   ` Laurent Pinchart
  2022-10-13  9:56 ` [PATCH 3/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X24_CPADHI Maxime Ripard
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Joerg Quinten <aBUGSworstnightmare@gmail.com>

Add the BGR666 format MEDIA_BUS_FMT_BGR666_1X18 supported by the
RaspberryPi.

Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 include/uapi/linux/media-bus-format.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
index b0a945eb7040..2ee0b38c0a71 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -34,7 +34,7 @@
 
 #define MEDIA_BUS_FMT_FIXED			0x0001
 
-/* RGB - next is	0x1023 */
+/* RGB - next is	0x1024 */
 #define MEDIA_BUS_FMT_RGB444_1X12		0x1016
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
@@ -46,6 +46,7 @@
 #define MEDIA_BUS_FMT_BGR565_2X8_LE		0x1006
 #define MEDIA_BUS_FMT_RGB565_2X8_BE		0x1007
 #define MEDIA_BUS_FMT_RGB565_2X8_LE		0x1008
+#define MEDIA_BUS_FMT_BGR666_1X18		0x1023
 #define MEDIA_BUS_FMT_RGB666_1X18		0x1009
 #define MEDIA_BUS_FMT_RBG888_1X24		0x100e
 #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI	0x1015

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 3/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X24_CPADHI
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
  2022-10-13  9:56 ` [PATCH 1/7] media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI Maxime Ripard
  2022-10-13  9:56 ` [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18 Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-13  9:56 ` [PATCH 4/7] drm/vc4: dpi: Support RGB565 format Maxime Ripard
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Joerg Quinten <aBUGSworstnightmare@gmail.com>

Add the BGR666 format MEDIA_BUS_FMT_BGR666_1X24_CPADHI supported by the
RaspberryPi.

Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 include/uapi/linux/media-bus-format.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
index 2ee0b38c0a71..d4228d038b54 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -34,7 +34,7 @@
 
 #define MEDIA_BUS_FMT_FIXED			0x0001
 
-/* RGB - next is	0x1024 */
+/* RGB - next is	0x1025 */
 #define MEDIA_BUS_FMT_RGB444_1X12		0x1016
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
@@ -49,6 +49,7 @@
 #define MEDIA_BUS_FMT_BGR666_1X18		0x1023
 #define MEDIA_BUS_FMT_RGB666_1X18		0x1009
 #define MEDIA_BUS_FMT_RBG888_1X24		0x100e
+#define MEDIA_BUS_FMT_BGR666_1X24_CPADHI	0x1024
 #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI	0x1015
 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG		0x1010
 #define MEDIA_BUS_FMT_BGR888_1X24		0x1013

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 4/7] drm/vc4: dpi: Support RGB565 format
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
                   ` (2 preceding siblings ...)
  2022-10-13  9:56 ` [PATCH 3/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X24_CPADHI Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-15 17:29   ` Laurent Pinchart
  2022-10-13  9:56 ` [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats Maxime Ripard
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Chris Morgan <macromorgan@hotmail.com>

The RGB565 format with padding over 24 bits
(MEDIA_BUS_FMT_RGB565_1X24_CPADHI) is supported by the vc4 DPI
controller as "mode 3".  This is what the Geekworm MZP280 DPI display
uses, so let's add support for it in the DPI controller driver.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index 1f8f44b7b5a5..7da3dd1db50e 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -182,6 +182,10 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
 				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
 						       DPI_FORMAT);
 				break;
+			case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:
+				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_2,
+						       DPI_FORMAT);
+				break;
 			default:
 				DRM_ERROR("Unknown media bus format %d\n",
 					  bus_format);

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
                   ` (3 preceding siblings ...)
  2022-10-13  9:56 ` [PATCH 4/7] drm/vc4: dpi: Support RGB565 format Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-15 17:26   ` Laurent Pinchart
  2022-10-13  9:56 ` [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24 Maxime Ripard
  2022-10-13  9:56 ` [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565 Maxime Ripard
  6 siblings, 1 reply; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Joerg Quinten <aBUGSworstnightmare@gmail.com>

The VC4 DPI output can support multiple BGR666 variants, but they were
never added to the driver. Let's add the the support for those formats.

Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_dpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index 7da3dd1db50e..ecbe4cd87036 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -170,10 +170,16 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
 				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
 						       DPI_ORDER);
 				break;
+			case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
+				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
+				fallthrough;
 			case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
 				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
 						       DPI_FORMAT);
 				break;
+			case MEDIA_BUS_FMT_BGR666_1X18:
+				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
+				fallthrough;
 			case MEDIA_BUS_FMT_RGB666_1X18:
 				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
 						       DPI_FORMAT);

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24.
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
                   ` (4 preceding siblings ...)
  2022-10-13  9:56 ` [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-15 17:13   ` Laurent Pinchart
  2022-10-13  9:56 ` [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565 Maxime Ripard
  6 siblings, 1 reply; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Dave Stevenson <dave.stevenson@raspberrypi.com>

DPI hasn't really been used up until now, so the default has
been meaningless.
In theory we should be able to pass the desired format for the
adjacent bridge chip through, but framework seems to be missing
for that.

As the main device to use DPI is the VGA666 or Adafruit Kippah,
both of which use RGB666, change the default to being RGB666 instead
of RGB888.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index ecbe4cd87036..fdae02760b6d 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -150,8 +150,8 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
 	}
 	drm_connector_list_iter_end(&conn_iter);
 
-	/* Default to 24bit if no connector or format found. */
-	dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
+	/* Default to 18bit if no connector or format found. */
+	dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1, DPI_FORMAT);
 
 	if (connector) {
 		if (connector->display_info.num_bus_formats) {

-- 
b4 0.11.0-dev-7da52

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

* [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565
  2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
                   ` (5 preceding siblings ...)
  2022-10-13  9:56 ` [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24 Maxime Ripard
@ 2022-10-13  9:56 ` Maxime Ripard
  2022-10-15 17:19   ` Laurent Pinchart
  6 siblings, 1 reply; 17+ messages in thread
From: Maxime Ripard @ 2022-10-13  9:56 UTC (permalink / raw)
  To: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt
  Cc: dri-devel, Joerg Quinten, Chris Morgan, Maxime Ripard,
	Dave Stevenson, linux-kernel, Laurent Pinchart

From: Dave Stevenson <dave.stevenson@raspberrypi.com>

The mapping is incorrect for RGB565_1X16 as it should be
DPI_FORMAT_18BIT_666_RGB_1 instead of DPI_FORMAT_18BIT_666_RGB_3.

Fixes: 08302c35b59d ("drm/vc4: Add DPI driver")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_dpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index fdae02760b6d..a7bebfa5d5b0 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -185,7 +185,7 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
 						       DPI_FORMAT);
 				break;
 			case MEDIA_BUS_FMT_RGB565_1X16:
-				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
+				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
 						       DPI_FORMAT);
 				break;
 			case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:

-- 
b4 0.11.0-dev-7da52

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

* Re: [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18
  2022-10-13  9:56 ` [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18 Maxime Ripard
@ 2022-10-15 17:07   ` Laurent Pinchart
  0 siblings, 0 replies; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:07 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

Hi Maxime,

Thank you for the patch.

On Thu, Oct 13, 2022 at 11:56:46AM +0200, Maxime Ripard wrote:
> From: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> 
> Add the BGR666 format MEDIA_BUS_FMT_BGR666_1X18 supported by the
> RaspberryPi.
> 
> Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  include/uapi/linux/media-bus-format.h | 3 ++-

New formats need documentation in
Documentation/userspace-api/media/v4l/subdev-formats.rst. Same for 
patches 1/7 and 3/7.

Apart from that, the patch looks good to me.

>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
> index b0a945eb7040..2ee0b38c0a71 100644
> --- a/include/uapi/linux/media-bus-format.h
> +++ b/include/uapi/linux/media-bus-format.h
> @@ -34,7 +34,7 @@
>  
>  #define MEDIA_BUS_FMT_FIXED			0x0001
>  
> -/* RGB - next is	0x1023 */
> +/* RGB - next is	0x1024 */
>  #define MEDIA_BUS_FMT_RGB444_1X12		0x1016
>  #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE	0x1001
>  #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE	0x1002
> @@ -46,6 +46,7 @@
>  #define MEDIA_BUS_FMT_BGR565_2X8_LE		0x1006
>  #define MEDIA_BUS_FMT_RGB565_2X8_BE		0x1007
>  #define MEDIA_BUS_FMT_RGB565_2X8_LE		0x1008
> +#define MEDIA_BUS_FMT_BGR666_1X18		0x1023
>  #define MEDIA_BUS_FMT_RGB666_1X18		0x1009
>  #define MEDIA_BUS_FMT_RBG888_1X24		0x100e
>  #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI	0x1015
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24.
  2022-10-13  9:56 ` [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24 Maxime Ripard
@ 2022-10-15 17:13   ` Laurent Pinchart
  2022-10-17 17:03     ` Dave Stevenson
  0 siblings, 1 reply; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:13 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

Hi Maxime (and Dave),

Thank you for the patch.

On Thu, Oct 13, 2022 at 11:56:50AM +0200, Maxime Ripard wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> DPI hasn't really been used up until now, so the default has
> been meaningless.
> In theory we should be able to pass the desired format for the
> adjacent bridge chip through, but framework seems to be missing
> for that.

Doesn't the bridge infrastructure allow that ? Or maybe this commit
message was written a while ago, before it was possible ?

In any case, it would be nice to use the bus format exposed by the next
bridge in the chain, but that can be done in a subsequent step. The new
default seems reasonable.

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

> As the main device to use DPI is the VGA666 or Adafruit Kippah,
> both of which use RGB666, change the default to being RGB666 instead
> of RGB888.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> index ecbe4cd87036..fdae02760b6d 100644
> --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> @@ -150,8 +150,8 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
>  	}
>  	drm_connector_list_iter_end(&conn_iter);
>  
> -	/* Default to 24bit if no connector or format found. */
> -	dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
> +	/* Default to 18bit if no connector or format found. */
> +	dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1, DPI_FORMAT);
>  
>  	if (connector) {
>  		if (connector->display_info.num_bus_formats) {
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565
  2022-10-13  9:56 ` [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565 Maxime Ripard
@ 2022-10-15 17:19   ` Laurent Pinchart
  0 siblings, 0 replies; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

Hi Maxime and Dave,

Thank you for the patch.

On Thu, Oct 13, 2022 at 11:56:51AM +0200, Maxime Ripard wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> The mapping is incorrect for RGB565_1X16 as it should be
> DPI_FORMAT_18BIT_666_RGB_1 instead of DPI_FORMAT_18BIT_666_RGB_3.

The driver includes the following macro definitions and comments:

/* Outputs 00000000rrrrrggggggbbbbb */
# define DPI_FORMAT_16BIT_565_RGB_1     1
/* Outputs 000rrrrr00gggggg000bbbbb */
# define DPI_FORMAT_16BIT_565_RGB_2     2
/* Outputs 00rrrrr000gggggg00bbbbb0 */
# define DPI_FORMAT_16BIT_565_RGB_3     3

MEDIA_BUS_FMT_RGB565_1X16 is defined as described in
https://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/subdev-formats.html#id3:

Bit  | 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
Data | r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 

This seems to match DPI_FORMAT_16BIT_565_RGB_1 indeed.

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

> Fixes: 08302c35b59d ("drm/vc4: Add DPI driver")
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/vc4/vc4_dpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> index fdae02760b6d..a7bebfa5d5b0 100644
> --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> @@ -185,7 +185,7 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
>  						       DPI_FORMAT);
>  				break;
>  			case MEDIA_BUS_FMT_RGB565_1X16:
> -				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
> +				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
>  						       DPI_FORMAT);
>  				break;
>  			case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats
  2022-10-13  9:56 ` [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats Maxime Ripard
@ 2022-10-15 17:26   ` Laurent Pinchart
  2022-10-15 17:30     ` Laurent Pinchart
  0 siblings, 1 reply; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:26 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

Hi Maxime and Joerg,

Thank you for the patch.

On Thu, Oct 13, 2022 at 11:56:49AM +0200, Maxime Ripard wrote:
> From: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> 
> The VC4 DPI output can support multiple BGR666 variants, but they were
> never added to the driver. Let's add the the support for those formats.
> 
> Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

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

> ---
>  drivers/gpu/drm/vc4/vc4_dpi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> index 7da3dd1db50e..ecbe4cd87036 100644
> --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> @@ -170,10 +170,16 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
>  				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
>  						       DPI_ORDER);
>  				break;
> +			case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
> +				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> +				fallthrough;
>  			case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
>  				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
>  						       DPI_FORMAT);
>  				break;
> +			case MEDIA_BUS_FMT_BGR666_1X18:
> +				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> +				fallthrough;
>  			case MEDIA_BUS_FMT_RGB666_1X18:
>  				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
>  						       DPI_FORMAT);
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 4/7] drm/vc4: dpi: Support RGB565 format
  2022-10-13  9:56 ` [PATCH 4/7] drm/vc4: dpi: Support RGB565 format Maxime Ripard
@ 2022-10-15 17:29   ` Laurent Pinchart
  2022-10-17 17:12     ` Dave Stevenson
  0 siblings, 1 reply; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

Hi Maxime and Chris,

Thank you for the patch.

On Thu, Oct 13, 2022 at 11:56:48AM +0200, Maxime Ripard wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> The RGB565 format with padding over 24 bits
> (MEDIA_BUS_FMT_RGB565_1X24_CPADHI) is supported by the vc4 DPI
> controller as "mode 3".  This is what the Geekworm MZP280 DPI display

The code below uses DPI_FORMAT_16BIT_565_RGB_2. Is that mode 3, or
should the commit message refer to mode 2 ?

With this fixed,

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

> uses, so let's add support for it in the DPI controller driver.
> 
> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> index 1f8f44b7b5a5..7da3dd1db50e 100644
> --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> @@ -182,6 +182,10 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
>  				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
>  						       DPI_FORMAT);
>  				break;
> +			case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:
> +				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_2,
> +						       DPI_FORMAT);
> +				break;
>  			default:
>  				DRM_ERROR("Unknown media bus format %d\n",
>  					  bus_format);
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats
  2022-10-15 17:26   ` Laurent Pinchart
@ 2022-10-15 17:30     ` Laurent Pinchart
  2022-10-17 17:26       ` Dave Stevenson
  0 siblings, 1 reply; 17+ messages in thread
From: Laurent Pinchart @ 2022-10-15 17:30 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Maxime Ripard, Eric Anholt, Daniel Vetter, David Airlie,
	Rob Herring, Emma Anholt, dri-devel, Joerg Quinten, Chris Morgan,
	Dave Stevenson, linux-kernel

On Sat, Oct 15, 2022 at 08:26:48PM +0300, Laurent Pinchart wrote:
> Hi Maxime and Joerg,
> 
> Thank you for the patch.
> 
> On Thu, Oct 13, 2022 at 11:56:49AM +0200, Maxime Ripard wrote:
> > From: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> > 
> > The VC4 DPI output can support multiple BGR666 variants, but they were
> > never added to the driver. Let's add the the support for those formats.
> > 
> > Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> >  drivers/gpu/drm/vc4/vc4_dpi.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> > index 7da3dd1db50e..ecbe4cd87036 100644
> > --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> > @@ -170,10 +170,16 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
> >  				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
> >  						       DPI_ORDER);
> >  				break;
> > +			case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
> > +				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> > +				fallthrough;

Upon closer inspection of the code, I think you also need

-			dpi_c &= ~DPI_FORMAT_MASK;
+			dpi_c &= ~(DPI_ORDER_MASK | DPI_FORMAT_MASK);

a few lines above.

> >  			case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
> >  				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
> >  						       DPI_FORMAT);
> >  				break;
> > +			case MEDIA_BUS_FMT_BGR666_1X18:
> > +				dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> > +				fallthrough;
> >  			case MEDIA_BUS_FMT_RGB666_1X18:
> >  				dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
> >  						       DPI_FORMAT);
> > 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24.
  2022-10-15 17:13   ` Laurent Pinchart
@ 2022-10-17 17:03     ` Dave Stevenson
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Stevenson @ 2022-10-17 17:03 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Maxime Ripard, Maxime Ripard, Eric Anholt, Daniel Vetter,
	David Airlie, Rob Herring, Emma Anholt, dri-devel, Joerg Quinten,
	Chris Morgan, linux-kernel

Hi Laurent

On Sat, 15 Oct 2022 at 18:14, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Maxime (and Dave),
>
> Thank you for the patch.
>
> On Thu, Oct 13, 2022 at 11:56:50AM +0200, Maxime Ripard wrote:
> > From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> >
> > DPI hasn't really been used up until now, so the default has
> > been meaningless.
> > In theory we should be able to pass the desired format for the
> > adjacent bridge chip through, but framework seems to be missing
> > for that.
>
> Doesn't the bridge infrastructure allow that ? Or maybe this commit
> message was written a while ago, before it was possible ?

Infrastructure may do, but it isn't always implemented.
Rightly or wrongly, the driver is currently finding the associated
connector, as commented as [1].

The main chain I'm looking is:
vc4_dpi -> dumb-vga-dac -> vga-connector
Unless I'm missing something, nothing in that chain defines the format
for the output. vga-connector (display-connector driver) tries to ask
the previous bridge for formats via atomic_get_output_bus_fmts and
atomic_get_input_fmts, but dumb-vga-dac (simple-bridge) doesn't
implement them.
So even if we tried following the chain it dies due to , and currently
the connector has no bus_formats defined in display_info, hence we end
up needing a default.
(Why do I get deja vu with panel-dpi and bus-format discussions?!)

Panels are fine as they do generally have a bus_format defined in display_info.

[1] https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/vc4/vc4_dpi.c#L139

> In any case, it would be nice to use the bus format exposed by the next
> bridge in the chain, but that can be done in a subsequent step. The new
> default seems reasonable.

I'll add having a look at atomic_get_output_bus_fmts and
atomic_get_input_fmts to my list of tasks again.

  Dave

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> > As the main device to use DPI is the VGA666 or Adafruit Kippah,
> > both of which use RGB666, change the default to being RGB666 instead
> > of RGB888.
> >
> > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> > index ecbe4cd87036..fdae02760b6d 100644
> > --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> > @@ -150,8 +150,8 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
> >       }
> >       drm_connector_list_iter_end(&conn_iter);
> >
> > -     /* Default to 24bit if no connector or format found. */
> > -     dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
> > +     /* Default to 18bit if no connector or format found. */
> > +     dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1, DPI_FORMAT);
> >
> >       if (connector) {
> >               if (connector->display_info.num_bus_formats) {
> >
>
> --
> Regards,
>
> Laurent Pinchart

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

* Re: [PATCH 4/7] drm/vc4: dpi: Support RGB565 format
  2022-10-15 17:29   ` Laurent Pinchart
@ 2022-10-17 17:12     ` Dave Stevenson
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Stevenson @ 2022-10-17 17:12 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Maxime Ripard, Maxime Ripard, Eric Anholt, Daniel Vetter,
	David Airlie, Rob Herring, Emma Anholt, dri-devel, Joerg Quinten,
	Chris Morgan, linux-kernel

Hi Laurent

On Sat, 15 Oct 2022 at 18:29, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Maxime and Chris,
>
> Thank you for the patch.
>
> On Thu, Oct 13, 2022 at 11:56:48AM +0200, Maxime Ripard wrote:
> > From: Chris Morgan <macromorgan@hotmail.com>
> >
> > The RGB565 format with padding over 24 bits
> > (MEDIA_BUS_FMT_RGB565_1X24_CPADHI) is supported by the vc4 DPI
> > controller as "mode 3".  This is what the Geekworm MZP280 DPI display
>
> The code below uses DPI_FORMAT_16BIT_565_RGB_2. Is that mode 3, or
> should the commit message refer to mode 2 ?

It's a mis-mash of documentation from the firmware stack.
[1] lists the firmware modes, which start at 1 for the equivalent of
DPI_FORMAT_9BIT_666_RGB, so there padded RGB565 is mode 3.

I'd advocate dropping the reference to which mode it is:
The RGB565 format with padding over 24 bits
(MEDIA_BUS_FMT_RGB565_1X24_CPADHI) is supported by the vc4 DPI controller.

  Dave

[1] https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#parallel-display-interface-dpi

> With this fixed,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> > uses, so let's add support for it in the DPI controller driver.
> >
> > Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/gpu/drm/vc4/vc4_dpi.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> > index 1f8f44b7b5a5..7da3dd1db50e 100644
> > --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> > @@ -182,6 +182,10 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
> >                               dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
> >                                                      DPI_FORMAT);
> >                               break;
> > +                     case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:
> > +                             dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_2,
> > +                                                    DPI_FORMAT);
> > +                             break;
> >                       default:
> >                               DRM_ERROR("Unknown media bus format %d\n",
> >                                         bus_format);
> >
>
> --
> Regards,
>
> Laurent Pinchart

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

* Re: [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats
  2022-10-15 17:30     ` Laurent Pinchart
@ 2022-10-17 17:26       ` Dave Stevenson
  0 siblings, 0 replies; 17+ messages in thread
From: Dave Stevenson @ 2022-10-17 17:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Maxime Ripard, Maxime Ripard, Eric Anholt, Daniel Vetter,
	David Airlie, Rob Herring, Emma Anholt, dri-devel, Joerg Quinten,
	Chris Morgan, linux-kernel

Hi Laurent

Thanks for the review.

On Sat, 15 Oct 2022 at 18:31, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> On Sat, Oct 15, 2022 at 08:26:48PM +0300, Laurent Pinchart wrote:
> > Hi Maxime and Joerg,
> >
> > Thank you for the patch.
> >
> > On Thu, Oct 13, 2022 at 11:56:49AM +0200, Maxime Ripard wrote:
> > > From: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> > >
> > > The VC4 DPI output can support multiple BGR666 variants, but they were
> > > never added to the driver. Let's add the the support for those formats.
> > >
> > > Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
> > > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > > ---
> > >  drivers/gpu/drm/vc4/vc4_dpi.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> > > index 7da3dd1db50e..ecbe4cd87036 100644
> > > --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> > > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> > > @@ -170,10 +170,16 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
> > >                             dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
> > >                                                    DPI_ORDER);
> > >                             break;
> > > +                   case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
> > > +                           dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> > > +                           fallthrough;
>
> Upon closer inspection of the code, I think you also need
>
> -                       dpi_c &= ~DPI_FORMAT_MASK;
> +                       dpi_c &= ~(DPI_ORDER_MASK | DPI_FORMAT_MASK);
>
> a few lines above.

Hmm, curious as there appears to be a difference between our vendor
tree and mainline in the contents of a patch with almost the same
commit text.

https://github.com/torvalds/linux/commit/7a70b0b97889a89f397913c971cadfc6db9b310a
vs https://github.com/raspberrypi/linux/commit/9d9dc236a9ee9021363b8601b6188e7be86d1971

Our tree leaves dpi_c effectively clear, and selects the default at
the end. Mainline sets the default first.


Even so, dpi_c gets initialised with
dpi_c = DPI_ENABLE;
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
dpi_c &= ~DPI_FORMAT_MASK;
so at this point in the switch, the DPI_ORDER bits haven't changed
from the default of 0.

  Dave

> > >                     case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
> > >                             dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
> > >                                                    DPI_FORMAT);
> > >                             break;
> > > +                   case MEDIA_BUS_FMT_BGR666_1X18:
> > > +                           dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
> > > +                           fallthrough;
> > >                     case MEDIA_BUS_FMT_RGB666_1X18:
> > >                             dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
> > >                                                    DPI_FORMAT);
> > >
>
> --
> Regards,
>
> Laurent Pinchart

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

end of thread, other threads:[~2022-10-17 17:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13  9:56 [PATCH 0/7] drm/vc4: dpi: Various improvements Maxime Ripard
2022-10-13  9:56 ` [PATCH 1/7] media: uapi: add MEDIA_BUS_FMT_RGB565_1X24_CPADHI Maxime Ripard
2022-10-13  9:56 ` [PATCH 2/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X18 Maxime Ripard
2022-10-15 17:07   ` Laurent Pinchart
2022-10-13  9:56 ` [PATCH 3/7] media: uapi: add MEDIA_BUS_FMT_BGR666_1X24_CPADHI Maxime Ripard
2022-10-13  9:56 ` [PATCH 4/7] drm/vc4: dpi: Support RGB565 format Maxime Ripard
2022-10-15 17:29   ` Laurent Pinchart
2022-10-17 17:12     ` Dave Stevenson
2022-10-13  9:56 ` [PATCH 5/7] drm/vc4: dpi: Support BGR666 formats Maxime Ripard
2022-10-15 17:26   ` Laurent Pinchart
2022-10-15 17:30     ` Laurent Pinchart
2022-10-17 17:26       ` Dave Stevenson
2022-10-13  9:56 ` [PATCH 6/7] drm/vc4: dpi: Change the default DPI format to being 18bpp, not 24 Maxime Ripard
2022-10-15 17:13   ` Laurent Pinchart
2022-10-17 17:03     ` Dave Stevenson
2022-10-13  9:56 ` [PATCH 7/7] drm/vc4: dpi: Fix format mapping for RGB565 Maxime Ripard
2022-10-15 17:19   ` 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).