aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0474-drm-vc4-Add-DRM_FORMAT_P030-support-to-firmware-kms.patch
blob: f6264ff04a892b54c78f04c282e86b7f989938d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 531d3d5c89825bade52f4257d264bbb06775a6fa Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 24 Jan 2020 14:24:33 +0000
Subject: [PATCH] drm/vc4: Add DRM_FORMAT_P030 support to firmware-kms

Adds support for this format which is 3 10bit samples packed into
4 bytes, as used by the HEVC codec block.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 21 ++++++++++++++++++++-
 drivers/gpu/drm/vc4/vc_image_types.h   |  4 ++++
 2 files changed, 24 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
@@ -216,6 +216,10 @@ static const struct vc_image_format {
 		.vc_image = VC_IMAGE_YUV420SP,
 		.is_vu = 1,
 	},
+	{
+		.drm = DRM_FORMAT_P030,
+		.vc_image = VC_IMAGE_YUV10COL,
+	},
 };
 
 static const struct vc_image_format *vc4_get_vc_image_fmt(u32 drm_format)
@@ -622,7 +626,15 @@ static int vc4_plane_to_mb(struct drm_pl
 		}
 		break;
 	case DRM_FORMAT_MOD_BROADCOM_SAND128:
-		mb->plane.vc_image_type = VC_IMAGE_YUV_UV;
+		switch (mb->plane.vc_image_type) {
+		case VC_IMAGE_YUV420SP:
+			mb->plane.vc_image_type = VC_IMAGE_YUV_UV;
+			break;
+		/* VC_IMAGE_YUV10COL could be included in here, but it is only
+		 * valid as a SAND128 format, so the table at the top will have
+		 * already set the correct format.
+		 */
+		}
 		/* Note that the column pitch is passed across in lines, not
 		 * bytes.
 		 */
@@ -707,6 +719,13 @@ static bool vc4_fkms_format_mod_supporte
 		case DRM_FORMAT_MOD_BROADCOM_SAND128:
 			return true;
 		default:
+			return false;
+		}
+	case DRM_FORMAT_P030:
+		switch (fourcc_mod_broadcom_mod(modifier)) {
+		case DRM_FORMAT_MOD_BROADCOM_SAND128:
+			return true;
+		default:
 			return false;
 		}
 	case DRM_FORMAT_NV21:
--- a/drivers/gpu/drm/vc4/vc_image_types.h
+++ b/drivers/gpu/drm/vc4/vc_image_types.h
@@ -139,6 +139,10 @@ enum {
 	VC_IMAGE_YUV_UV_16,
 	/* YUV4:2:0 with U,V in side-by-side format */
 	VC_IMAGE_YUV420_S,
+	/* 10-bit YUV 420 column image format */
+	VC_IMAGE_YUV10COL,
+	/* 32-bpp, 10-bit R/G/B, 2-bit Alpha */
+	VC_IMAGE_RGBA1010102,
 
 	VC_IMAGE_MAX,     /* bounds for error checking */
 	VC_IMAGE_FORCE_ENUM_16BIT = 0xffff,