Skip to contentSkip to conversation

video: zynqmp: Add support for ZynqMP DP

PATCH Applied Michal Simek 1 participant 8 messages May 17, 2023 – Jun 5, 2023

Subsystems (2)
lore
Share & tools
lore

Michal Simek

author maintainer
#0 lore raw

cover video: zynqmp: Add support for ZynqMP DP

Hi,

this series is adding initial support for Diplay port. As of today it is working on fixed configuration but working on making it more flexible to be able to fully configure it via DT only.

Thanks,
Michal

Michal Simek (3):
video: Add support for RGBA8888 format
video: bmp: Support rgba8888 pixel format
video: zynqmp: Enable 1024x768 resolution

Venkatesh Yadav Abbarapu (3):
video: move zynqmp files to subdirectory
video: zynqmp: Driver for Xilinx ZynqMP DisplayPort Subsystem
xilinx: zynqmp: Enable the vidconsole by default

 MAINTAINERS                         |    1 +
 drivers/video/Kconfig               |    9 +-
 drivers/video/Makefile              |    2 +-
 drivers/video/video-uclass.c        |   10 +-
 drivers/video/video_bmp.c           |   36 +
 drivers/video/zynqmp/Kconfig        |    8 +
 drivers/video/zynqmp/Makefile       |    5 +
 drivers/video/zynqmp/zynqmp_dpsub.c | 2225 +++++++++++++++++++++++++++
 drivers/video/zynqmp/zynqmp_dpsub.h |  680 ++++++++
 drivers/video/zynqmp_dpsub.c        |   66 -
 include/configs/xilinx_zynqmp.h     |    3 +
 include/video.h                     |    1 +
 12 files changed, 2969 insertions(+), 77 deletions(-)
 create mode 100644 drivers/video/zynqmp/Kconfig
 create mode 100644 drivers/video/zynqmp/Makefile
 create mode 100644 drivers/video/zynqmp/zynqmp_dpsub.c
 create mode 100644 drivers/video/zynqmp/zynqmp_dpsub.h
 delete mode 100644 drivers/video/zynqmp_dpsub.c
Signature · 1 line
2.36.1
author maintainer
#1 lore raw

PATCH 1/6 video: Add support for RGBA8888 format

Add support for RGBA8888 32bpp format where pixels are picked in 32-bit integers, where the colors are stored in memory such that R is at lowest address, G after that, B after that, and A last.

---

 drivers/video/video-uclass.c | 10 ++++++++--
 include/video.h              |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/video/video-uclass.c +8 -2
index 8396bdfb11e1..1b66a8061a74 100644
@@ -220,14 +220,20 @@ u32 video_index_to_colour(struct video_priv *priv, unsigned int idx)
 		break;
 	case VIDEO_BPP32:
 		if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
-			if (priv->format == VIDEO_X2R10G10B10)
+			switch (priv->format) {
+			case VIDEO_X2R10G10B10:
 				return (colours[idx].r << 22) |
 				       (colours[idx].g << 12) |
 				       (colours[idx].b <<  2);
-			else
+			case VIDEO_RGBA8888:
+				return (colours[idx].r << 24) |
+				       (colours[idx].g << 16) |
+				       (colours[idx].b << 8) | 0xff;
+			default:
 				return (colours[idx].r << 16) |
 				       (colours[idx].g <<  8) |
 				       (colours[idx].b <<  0);
+			}
 		}
 		break;
 	default:
include/video.h +1 -0
index 29c4f51efb08..03434a81234f 100644
@@ -64,6 +64,7 @@ enum video_log2_bpp {
 
 enum video_format {
 	VIDEO_UNKNOWN,
+	VIDEO_RGBA8888,
 	VIDEO_X8B8G8R8,
 	VIDEO_X8R8G8B8,
 	VIDEO_X2R10G10B10,
Signature · 1 line
2.36.1
author maintainer
#2 lore raw

PATCH 2/6 video: bmp: Support rgba8888 pixel format

In reply to Michal Simek

Adding the support for RGBA8888 format for BMP decoding.

---

 drivers/video/video_bmp.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/video/video_bmp.c +36 -0
index 47e52c4f69c9..45f003c8251a 100644
@@ -42,6 +42,18 @@ static u32 get_bmp_col_x2r10g10b10(struct bmp_color_table_entry *cte)
 		(cte->blue << 2U));
 }
 
+/**
+ * get_bmp_col_rgba8888() - Convert a colour-table entry into a rgba8888 pixel value
+ *
+ * Return: value to write to the rgba8888 frame buffer for this palette entry
+ */
+static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte)
+{
+	return ((cte->red) |
+		(cte->green << 8U) |
+		(cte->blue << 16U) | 0xff << 24U);
+}
+
 /**
  * write_pix8() - Write a pixel from a BMP image into the framebuffer
  *
@@ -71,6 +83,8 @@ static void write_pix8(u8 *fb, uint bpix, enum video_format eformat,
 			*fb++ = cte->blue;
 		} else if (eformat == VIDEO_X2R10G10B10) {
 			*(u32 *)fb = get_bmp_col_x2r10g10b10(cte);
+		} else if (eformat == VIDEO_RGBA8888) {
+			*(u32 *)fb = get_bmp_col_rgba8888(cte);
 		} else {
 			*fb++ = cte->blue;
 			*fb++ = cte->green;
@@ -382,6 +396,17 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 						*fb++ = (pix >> 8) & 0xff;
 						*fb++ = (pix >> 16) & 0xff;
 						*fb++ = pix >> 24;
+					} else if (eformat == VIDEO_RGBA8888) {
+						u32 pix;
+
+						pix = *bmap++ << 8U; /* blue */
+						pix |= *bmap++ << 16U; /* green */
+						pix |= *bmap++ << 24U; /* red */
+
+						*fb++ = (pix >> 24) & 0xff;
+						*fb++ = (pix >> 16) & 0xff;
+						*fb++ = (pix >> 8) & 0xff;
+						*fb++ = 0xff;
 					} else {
 						*fb++ = *bmap++;
 						*fb++ = *bmap++;
@@ -409,6 +434,17 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 						*fb++ = (pix >> 8) & 0xff;
 						*fb++ = (pix >> 16) & 0xff;
 						*fb++ = pix >> 24;
+					} else if (eformat == VIDEO_RGBA8888) {
+						u32 pix;
+
+						pix = *bmap++ << 8U; /* blue */
+						pix |= *bmap++ << 16U; /* green */
+						pix |= *bmap++ << 24U; /* red */
+						bmap++;
+						*fb++ = (pix >> 24) & 0xff;
+						*fb++ = (pix >> 16) & 0xff;
+						*fb++ = (pix >> 8) & 0xff;
+						*fb++ = 0xff; /* opacity */
 					} else {
 						*fb++ = *bmap++;
 						*fb++ = *bmap++;
Signature · 1 line
2.36.1
author maintainer
#3 lore raw

PATCH 3/6 video: move zynqmp files to subdirectory

In reply to Michal Simek

From: Venkatesh Yadav Abbarapu <[email protected]>

Place zynqmp files and headers in custom driver subdirectory.

---

 drivers/video/Kconfig                     | 9 +--------
 drivers/video/Makefile                    | 2 +-
 drivers/video/zynqmp/Kconfig              | 8 ++++++++
 drivers/video/zynqmp/Makefile             | 5 +++++
 drivers/video/{ => zynqmp}/zynqmp_dpsub.c | 0
 5 files changed, 15 insertions(+), 9 deletions(-)
 create mode 100644 drivers/video/zynqmp/Kconfig
 create mode 100644 drivers/video/zynqmp/Makefile
 rename drivers/video/{ => zynqmp}/zynqmp_dpsub.c (100%)
drivers/video/Kconfig +1 -8
index 1e2f4e6de4a5..49762950719e 100644
@@ -740,14 +740,7 @@ config VIDEO_SEPS525
 	  Enable support for the Syncoam PM-OLED display driver (RGB 160x128).
 	  Currently driver is supporting only SPI interface.
 
-config VIDEO_ZYNQMP_DPSUB
-	bool "Enable video support for ZynqMP Display Port"
-	depends on ZYNQMP_POWER_DOMAIN
-	help
-	  Enable support for Xilinx ZynqMP Display Port. Currently this file
-	  is used as placeholder for driver. The main reason is to record
-	  compatible string and calling power domain driver.
-
+source "drivers/video/zynqmp/Kconfig"
 source "drivers/video/nexell/Kconfig"
 
 config CONSOLE_SCROLL_LINES
drivers/video/Makefile +1 -1
index 9a53cd141875..f99d7e3c3d90 100644
@@ -73,7 +73,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
 obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
 obj-$(CONFIG_VIDEO_VESA) += vesa.o
 obj-$(CONFIG_VIDEO_SEPS525) += seps525.o
-obj-$(CONFIG_VIDEO_ZYNQMP_DPSUB) += zynqmp_dpsub.o
+obj-$(CONFIG_VIDEO_ZYNQMP_DPSUB) += zynqmp/
 
 obj-y += bridge/
 obj-y += sunxi/
drivers/video/zynqmp/Kconfig new file +8 -0
new file mode 100644
index 000000000000..b35cd1fb3429
@@ -0,0 +1,8 @@
+
+config VIDEO_ZYNQMP_DPSUB
+	bool "Enable video support for ZynqMP Display Port"
+	depends on ZYNQMP_POWER_DOMAIN
+	help
+	Enable support for Xilinx ZynqMP Display Port. Currently this file
+	is used as placeholder for driver. The main reason is to record
+	compatible string and calling power domain driver.
drivers/video/zynqmp/Makefile new file +5 -0
new file mode 100644
index 000000000000..cc057f53560d
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2023, Advanced Micro Devices, Inc.
+
+obj-y += zynqmp_dpsub.o
drivers/video/zynqmp/zynqmp_dpsub.c renamed from drivers/video/zynqmp_dpsub.c +0 -0
similarity index 100%
rename from drivers/video/zynqmp_dpsub.c
rename to drivers/video/zynqmp/zynqmp_dpsub.c
Signature · 1 line
2.36.1
author maintainer
#5 lore raw

PATCH 5/6 xilinx: zynqmp: Enable the vidconsole by default

In reply to Michal Simek

From: Venkatesh Yadav Abbarapu <[email protected]>

Add the vidconsole flags for video serial console.

---

 include/configs/xilinx_zynqmp.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/xilinx_zynqmp.h +3 -0
index 011f0034c509..995427db63c8 100644
@@ -60,6 +60,9 @@
 	"scriptaddr=0x20000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
 	"script_size_f=0x80000\0" \
+	"stdin=serial\0" \
+	"stdout=serial,vidconsole\0" \
+	"stderr=serial,vidconsole\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
Signature · 1 line
2.36.1
author maintainer
#6 lore raw

PATCH 6/6 video: zynqmp: Enable 1024x768 resolution

In reply to Michal Simek

Add support for 1024x768 60p resolution and set it up this resolution by default. This resolution is still able to use only one GT line. But for example 800x600 60p has some issues with settings. That's why extend this table by tested resolutions.

---

 drivers/video/zynqmp/zynqmp_dpsub.c | 6 +++---
 drivers/video/zynqmp/zynqmp_dpsub.h | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/video/zynqmp/zynqmp_dpsub.c +3 -3
index c287b475a8d7..def4dcf6261a 100644
@@ -27,8 +27,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Maximum supported resolution */
-#define WIDTH				640
-#define HEIGHT				480
+#define WIDTH				1024
+#define HEIGHT				768
 
 static struct dp_dma dp_dma;
 static struct dp_dma_descriptor cur_desc __aligned(256);
@@ -1995,7 +1995,7 @@ static void init_run_config(struct udevice *dev)
 	struct zynqmp_dpsub_priv *dp_sub = dev_get_priv(dev);
 
 	dp_sub->dp_dma               = &dp_dma;
-	dp_sub->video_mode           = VIDC_VM_640x480_60_P;
+	dp_sub->video_mode           = VIDC_VM_1024x768_60_P;
 	dp_sub->bpc                  = VIDC_BPC_8;
 	dp_sub->color_encode         = DP_CENC_RGB;
 	dp_sub->use_max_cfg_caps     = 1;
drivers/video/zynqmp/zynqmp_dpsub.h +5 -1
index d2a6f1f4c7c8..7d2737e31aac 100644
@@ -9,6 +9,7 @@
 
 enum video_mode {
 	VIDC_VM_640x480_60_P = 0,
+	VIDC_VM_1024x768_60_P = 1,
 };
 
 enum {
@@ -644,7 +645,7 @@ struct zynqmp_dpsub_priv {
 #define VIDEO_REF_CTRL_DIVISOR0_SHIFT					8
 #define PSS_REF_CLK							0
 #define FPD_CTRL_OFFSET							12
-#define VIDC_VM_NUM_SUPPORTED						1
+#define VIDC_VM_NUM_SUPPORTED						2
 
 static const u32 vs[4][4] = {
 	{ 0x2a, 0x27, 0x24, 0x20 },
@@ -664,6 +665,9 @@ const struct video_timing_mode vidc_video_timing_modes[VIDC_VM_NUM_SUPPORTED] =
 	{ VIDC_VM_640x480_60_P, "640x480@60Hz", VIDC_FR_60HZ,
 	{640, 16, 96, 48, 800, 0,
 	 480, 10, 2, 33, 525, 0, 0, 0, 0, 0} },
+	{ VIDC_VM_1024x768_60_P, "1024x768@60Hz", VIDC_FR_60HZ,
+	{1024, 24, 136, 160, 1344, 0,
+	 768, 3, 6, 29, 806, 0, 0, 0, 0, 0} },
 };
 
 const struct av_buf_vid_attribute avbuf_supported_formats[] = {
Signature · 1 line
2.36.1
author maintainer
#4 lore raw

PATCH 4/6 video: zynqmp: Driver for Xilinx ZynqMP DisplayPort Subsystem

In reply to Michal Simek

From: Venkatesh Yadav Abbarapu <[email protected]>

The Xilinx ZynqMP SoC has a hardened display pipeline named DisplayPort Subsystem. It includes a buffer manager, blender, an audio mixer and a DisplayPort source controller (transmitter). The DisplayPort controller can source data from memory (non-live input) or the stream (live input). The DisplayPort controller is responsible for managing the link and physical layer functionality. The controller packs audio/video data into transfer units and sends them over the main link. The link rate and lane counts can be selected based on the application bandwidth requirements. The DisplayPort pipeline consists of the DisplayPort direct memory access (DMA) for fetching data from memory. The DisplayPort DMA controller (DPDMA) supports up to six input channels as non-live input.

This driver supports the DisplayPort Subsystem and implements 1)640x480 resolution
2)RGBA8888 32bpp format
3)DPDMA channel 3 for Graphics
4)Non-live input
5)Fixed 5.4G link rate
6)Tested on ZCU102 board

There will be additional work to configure GT lines based on DT, higher resolutions, support for more compressed video formats, spliting code to more files, add support for EDID, audio support, using clock framework for all clocks and in general code clean up.

---

 MAINTAINERS                         |    1 +
 drivers/video/zynqmp/zynqmp_dpsub.c | 2197 ++++++++++++++++++++++++++-
 drivers/video/zynqmp/zynqmp_dpsub.h |  676 +++++++++
 3 files changed, 2855 insertions(+), 19 deletions(-)
 create mode 100644 drivers/video/zynqmp/zynqmp_dpsub.h
MAINTAINERS +1 -0
index c8f72e9ec6a2..b0f0390a68c9 100644
@@ -755,6 +755,7 @@ F:	drivers/spi/zynq_qspi.c
 F:	drivers/spi/zynq_spi.c
 F:	drivers/timer/cadence-ttc.c
 F:	drivers/video/seps525.c
+F:	drivers/video/zynqmp/
 F:	drivers/watchdog/cdns_wdt.c
 F:	include/zynqmppl.h
 F:	include/zynqmp_firmware.h
drivers/video/zynqmp/zynqmp_dpsub.c +2178 -19

2,240 lines not on this page · raw message

drivers/video/zynqmp/zynqmp_dpsub.h new file +676 -0

676 lines not on this page · raw message

Signature · 1 line
2.36.1
author maintainer Applied
#7 lore raw
In reply to Michal Simek
Quoted 33 lines · Michal Simek

Hi,

this series is adding initial support for Diplay port. As of today it is working on fixed configuration but working on making it more flexible to be able to fully configure it via DT only.

Thanks,
Michal

Michal Simek (3):
video: Add support for RGBA8888 format
video: bmp: Support rgba8888 pixel format
video: zynqmp: Enable 1024x768 resolution

Venkatesh Yadav Abbarapu (3):
video: move zynqmp files to subdirectory
video: zynqmp: Driver for Xilinx ZynqMP DisplayPort Subsystem
xilinx: zynqmp: Enable the vidconsole by default

  MAINTAINERS                         |    1 +
  drivers/video/Kconfig               |    9 +-
  drivers/video/Makefile              |    2 +-
  drivers/video/video-uclass.c        |   10 +-
  drivers/video/video_bmp.c           |   36 +
  drivers/video/zynqmp/Kconfig        |    8 +
  drivers/video/zynqmp/Makefile       |    5 +
  drivers/video/zynqmp/zynqmp_dpsub.c | 2225 +++++++++++++++++++++++++++
  drivers/video/zynqmp/zynqmp_dpsub.h |  680 ++++++++
  drivers/video/zynqmp_dpsub.c        |   66 -
  include/configs/xilinx_zynqmp.h     |    3 +
  include/video.h                     |    1 +
  12 files changed, 2969 insertions(+), 77 deletions(-)
Quoted 6 lines

create mode 100644 drivers/video/zynqmp/Kconfig create mode 100644 drivers/video/zynqmp/Makefile create mode 100644 drivers/video/zynqmp/zynqmp_dpsub.c create mode 100644 drivers/video/zynqmp/zynqmp_dpsub.h delete mode 100644 drivers/video/zynqmp_dpsub.c

Applied.
M