* [PATCH 1/3] drm/vc4: Add support for DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888
2017-11-16 14:22 [PATCH 0/3] drm/vc4 support for extra formats Dave Stevenson
@ 2017-11-16 14:22 ` Dave Stevenson
2017-11-16 14:22 ` [PATCH 2/3] drm/vc4: Use .pixel_order instead of custom .flip_cbcr Dave Stevenson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dave Stevenson @ 2017-11-16 14:22 UTC (permalink / raw)
To: dri-devel; +Cc: David Airlie, Dave Stevenson
Filling out the list of supported formats based on those the
hardware can support.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 423a23e..513b4b1 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -121,6 +121,14 @@ static const struct hvs_format {
.pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false,
},
{
+ .drm = DRM_FORMAT_RGB888, .hvs = HVS_PIXEL_FORMAT_RGB888,
+ .pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false,
+ },
+ {
+ .drm = DRM_FORMAT_BGR888, .hvs = HVS_PIXEL_FORMAT_RGB888,
+ .pixel_order = HVS_PIXEL_ORDER_XBGR, .has_alpha = false,
+ },
+ {
.drm = DRM_FORMAT_YUV422,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE,
},
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] drm/vc4: Use .pixel_order instead of custom .flip_cbcr
2017-11-16 14:22 [PATCH 0/3] drm/vc4 support for extra formats Dave Stevenson
2017-11-16 14:22 ` [PATCH 1/3] drm/vc4: Add support for DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888 Dave Stevenson
@ 2017-11-16 14:22 ` Dave Stevenson
2017-11-16 14:22 ` [PATCH 3/3] drm/vc4: Add support for NV21 and NV61 Dave Stevenson
2017-11-20 23:51 ` [PATCH 0/3] drm/vc4 support for extra formats Eric Anholt
3 siblings, 0 replies; 5+ messages in thread
From: Dave Stevenson @ 2017-11-16 14:22 UTC (permalink / raw)
To: dri-devel; +Cc: David Airlie, Dave Stevenson
The hardware has enums for altering the Cr and Cb order,
so use this instead of having a flag which swaps the
order the pointers are presented to the hardware
(that only worked for 3 plane formats anyway).
Explicitly sets .pixel_order in each case, rather than
relying on then default XYCBCR order being a value 0.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/gpu/drm/vc4/vc4_plane.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 513b4b1..6373fd5 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -86,7 +86,6 @@ static const struct hvs_format {
u32 hvs; /* HVS_FORMAT_* */
u32 pixel_order;
bool has_alpha;
- bool flip_cbcr;
} hvs_formats[] = {
{
.drm = DRM_FORMAT_XRGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888,
@@ -131,28 +130,32 @@ static const struct hvs_format {
{
.drm = DRM_FORMAT_YUV422,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
{
.drm = DRM_FORMAT_YVU422,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE,
- .flip_cbcr = true,
+ .pixel_order = HVS_PIXEL_ORDER_XYCRCB,
},
{
.drm = DRM_FORMAT_YUV420,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
{
.drm = DRM_FORMAT_YVU420,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE,
- .flip_cbcr = true,
+ .pixel_order = HVS_PIXEL_ORDER_XYCRCB,
},
{
.drm = DRM_FORMAT_NV12,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
{
.drm = DRM_FORMAT_NV16,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
};
@@ -625,15 +628,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
* The pointers may be any byte address.
*/
vc4_state->ptr0_offset = vc4_state->dlist_count;
- if (!format->flip_cbcr) {
- for (i = 0; i < num_planes; i++)
- vc4_dlist_write(vc4_state, vc4_state->offsets[i]);
- } else {
- WARN_ON_ONCE(num_planes != 3);
- vc4_dlist_write(vc4_state, vc4_state->offsets[0]);
- vc4_dlist_write(vc4_state, vc4_state->offsets[2]);
- vc4_dlist_write(vc4_state, vc4_state->offsets[1]);
- }
+ for (i = 0; i < num_planes; i++)
+ vc4_dlist_write(vc4_state, vc4_state->offsets[i]);
/* Pointer Context Word 0/1/2: Written by the HVS */
for (i = 0; i < num_planes; i++)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] drm/vc4: Add support for NV21 and NV61.
2017-11-16 14:22 [PATCH 0/3] drm/vc4 support for extra formats Dave Stevenson
2017-11-16 14:22 ` [PATCH 1/3] drm/vc4: Add support for DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888 Dave Stevenson
2017-11-16 14:22 ` [PATCH 2/3] drm/vc4: Use .pixel_order instead of custom .flip_cbcr Dave Stevenson
@ 2017-11-16 14:22 ` Dave Stevenson
2017-11-20 23:51 ` [PATCH 0/3] drm/vc4 support for extra formats Eric Anholt
3 siblings, 0 replies; 5+ messages in thread
From: Dave Stevenson @ 2017-11-16 14:22 UTC (permalink / raw)
To: dri-devel; +Cc: David Airlie, Dave Stevenson
NV12 (YUV420 2 plane) and NV16 (YUV422 2 plane) were
supported, but NV21 and NV61 (same but with Cb and Cr
swapped) weren't. Add them.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/gpu/drm/vc4/vc4_plane.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 6373fd5..515f979 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -153,10 +153,20 @@ static const struct hvs_format {
.pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
{
+ .drm = DRM_FORMAT_NV21,
+ .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCRCB,
+ },
+ {
.drm = DRM_FORMAT_NV16,
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE,
.pixel_order = HVS_PIXEL_ORDER_XYCBCR,
},
+ {
+ .drm = DRM_FORMAT_NV61,
+ .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE,
+ .pixel_order = HVS_PIXEL_ORDER_XYCRCB,
+ },
};
static const struct hvs_format *vc4_get_hvs_format(u32 drm_format)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] drm/vc4 support for extra formats
2017-11-16 14:22 [PATCH 0/3] drm/vc4 support for extra formats Dave Stevenson
` (2 preceding siblings ...)
2017-11-16 14:22 ` [PATCH 3/3] drm/vc4: Add support for NV21 and NV61 Dave Stevenson
@ 2017-11-20 23:51 ` Eric Anholt
3 siblings, 0 replies; 5+ messages in thread
From: Eric Anholt @ 2017-11-20 23:51 UTC (permalink / raw)
To: dri-devel; +Cc: David Airlie, Dave Stevenson
[-- Attachment #1.1: Type: text/plain, Size: 395 bytes --]
Dave Stevenson <dave.stevenson@raspberrypi.org> writes:
> These are relatively trivial patches that just expand the
> list of formats that the vc4 DRM driver will accept.
> RGB888, BGR888, NV21, and NV61 tested with the modetest app from the libdrm
> repo. YUV422 and YVU422 can't be as they aren't supported.
It worked in my testing, as well. Reviewed and applied to
drm-misc-next. Thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread