Skip to content

Commit da2b763

Browse files
6by9popcornmix
authored andcommitted
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>
1 parent c48ca48 commit da2b763

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

‎drivers/gpu/drm/vc4/vc4_firmware_kms.c‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ static const struct vc_image_format {
216216
.vc_image = VC_IMAGE_YUV420SP,
217217
.is_vu = 1,
218218
},
219+
{
220+
.drm = DRM_FORMAT_P030,
221+
.vc_image = VC_IMAGE_YUV10COL,
222+
},
219223
};
220224

221225
static const struct vc_image_format *vc4_get_vc_image_fmt(u32 drm_format)
@@ -605,7 +609,15 @@ static int vc4_plane_to_mb(struct drm_plane *plane,
605609
}
606610
break;
607611
case DRM_FORMAT_MOD_BROADCOM_SAND128:
608-
mb->plane.vc_image_type = VC_IMAGE_YUV_UV;
612+
switch (mb->plane.vc_image_type) {
613+
case VC_IMAGE_YUV420SP:
614+
mb->plane.vc_image_type = VC_IMAGE_YUV_UV;
615+
break;
616+
/* VC_IMAGE_YUV10COL could be included in here, but it is only
617+
* valid as a SAND128 format, so the table at the top will have
618+
* already set the correct format.
619+
*/
620+
}
609621
/* Note that the column pitch is passed across in lines, not
610622
* bytes.
611623
*/
@@ -692,6 +704,13 @@ static bool vc4_fkms_format_mod_supported(struct drm_plane *plane,
692704
default:
693705
return false;
694706
}
707+
case DRM_FORMAT_P030:
708+
switch (fourcc_mod_broadcom_mod(modifier)) {
709+
case DRM_FORMAT_MOD_BROADCOM_SAND128:
710+
return true;
711+
default:
712+
return false;
713+
}
695714
case DRM_FORMAT_NV21:
696715
case DRM_FORMAT_RGB888:
697716
case DRM_FORMAT_BGR888:

‎drivers/gpu/drm/vc4/vc_image_types.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ enum {
139139
VC_IMAGE_YUV_UV_16,
140140
/* YUV4:2:0 with U,V in side-by-side format */
141141
VC_IMAGE_YUV420_S,
142+
/* 10-bit YUV 420 column image format */
143+
VC_IMAGE_YUV10COL,
144+
/* 32-bpp, 10-bit R/G/B, 2-bit Alpha */
145+
VC_IMAGE_RGBA1010102,
142146

143147
VC_IMAGE_MAX, /* bounds for error checking */
144148
VC_IMAGE_FORCE_ENUM_16BIT = 0xffff,

0 commit comments

Comments
 (0)