summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2017-02-27 12:50:19 +0000
committerRussell King <rmk@armlinux.org.uk>2017-02-28 11:58:28 +0000
commit7282633efd1c702a770b046505d7330fed028de0 (patch)
tree8e3a74e3f7b2b75dc0da85224c0c08f89c87f62e
parent691087979d0a5031f9c2f380e5f2ddbf43903105 (diff)
src: Xv: add colorimetry configuration
Add colorimetry configuration to the Xv backend, so that gstreamer and other media players can configure the ITU 601 vs ITU 709 colorimetry information for the overlaid video. Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--man/armada.man4
-rw-r--r--src/armada_drm_xv.c35
2 files changed, 36 insertions, 3 deletions
diff --git a/man/armada.man b/man/armada.man
index 8e2acab..6f0e05f 100644
--- a/man/armada.man
+++ b/man/armada.man
@@ -162,6 +162,10 @@ the overlay window. Other values select an explicit CRTC. Default: -1.
These options can be used to adjust the overlaid picture brightness,
contrast and saturation levels. These options are dependent on their
presence in the Linux kernel drm driver.
+.SS "XV_ITURBT_709"
+XV_ITURBT_709 sets the colorimetry for YUV format video. A value of 0
+selects ITU-R BT.601 colorspace. A value of 1 selects ITU-R BT.709
+colorspace. This option is dependent on the Linux kernel drm driver.
.SH XV TEXTURED VIDEO ATTRIBUTES
diff --git a/src/armada_drm_xv.c b/src/armada_drm_xv.c
index ccd0e4b..ad28a56 100644
--- a/src/armada_drm_xv.c
+++ b/src/armada_drm_xv.c
@@ -40,6 +40,7 @@ enum armada_drm_properties {
PROP_DRM_SATURATION,
PROP_DRM_BRIGHTNESS,
PROP_DRM_CONTRAST,
+ PROP_DRM_ITURBT_709,
PROP_DRM_COLORKEY,
NR_DRM_PROPS
};
@@ -48,6 +49,7 @@ static const char *armada_drm_property_names[NR_DRM_PROPS] = {
[PROP_DRM_SATURATION] = "saturation",
[PROP_DRM_BRIGHTNESS] = "brightness",
[PROP_DRM_CONTRAST] = "contrast",
+ [PROP_DRM_ITURBT_709] = "iturbt_709",
[PROP_DRM_COLORKEY] = "colorkey",
};
@@ -105,6 +107,7 @@ enum {
attr_saturation,
attr_brightness,
attr_contrast,
+ attr_iturbt_709,
attr_autopaint_colorkey,
attr_colorkey,
attr_pipe,
@@ -244,6 +247,7 @@ static XF86AttributeRec OverlayAttributes[] = {
{ XvSettable | XvGettable, -16384, 16383, "XV_SATURATION" },
{ XvSettable | XvGettable, -256, 255, "XV_BRIGHTNESS" },
{ XvSettable | XvGettable, -16384, 16383, "XV_CONTRAST" },
+ { XvSettable | XvGettable, 0, 1, "XV_ITURBT_709" },
{ XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"},
{ XvSettable | XvGettable, 0, 0x00ffffff, "XV_COLORKEY" },
{ XvSettable | XvGettable, -1, 2, "XV_PIPE" },
@@ -281,6 +285,13 @@ static struct xv_attr_data armada_drm_xv_attributes[] = {
.get = armada_drm_prop_get,
.attr = &OverlayAttributes[attr_contrast],
},
+ [attr_iturbt_709] = {
+ .name = "XV_ITURBT_709",
+ .id = PROP_DRM_ITURBT_709,
+ .set = armada_drm_prop_set,
+ .get = armada_drm_prop_get,
+ .attr = &OverlayAttributes[attr_iturbt_709],
+ },
[attr_autopaint_colorkey] = {
.name = "XV_AUTOPAINT_COLORKEY",
.set = armada_drm_set_autopaint,
@@ -1029,8 +1040,9 @@ armada_drm_XvInitPlane(ScrnInfoPtr pScrn, DevUnion *priv, struct drm_xv *drmxv,
drmModePlanePtr mode_plane)
{
XF86VideoAdaptorPtr p;
+ XF86AttributeRec *attrs;
XF86ImageRec *images;
- unsigned i, num_images;
+ unsigned i, num_images, num_attrs;
p = xf86XVAllocateVideoAdaptorRec(pScrn);
if (!p)
@@ -1057,6 +1069,23 @@ armada_drm_XvInitPlane(ScrnInfoPtr pScrn, DevUnion *priv, struct drm_xv *drmxv,
if (drmxv->has_xvbo)
images[num_images++] = (XF86ImageRec)XVIMAGE_XVBO;
+ attrs = calloc(ARRAY_SIZE(armada_drm_xv_attributes), sizeof(*attrs));
+ if (!attrs) {
+ free(images);
+ free(p);
+ return NULL;
+ }
+
+ for (num_attrs = i = 0; i < ARRAY_SIZE(armada_drm_xv_attributes); i++) {
+ struct xv_attr_data *d = &armada_drm_xv_attributes[i];
+
+ if (d->get == armada_drm_prop_get &&
+ drmxv->props[d->id].prop_id == 0)
+ continue;
+
+ attrs[num_attrs++] = *d->attr;
+ }
+
p->type = XvWindowMask | XvInputMask | XvImageMask;
p->flags = VIDEO_OVERLAID_IMAGES;
p->name = "Marvell Armada Overlay Video";
@@ -1066,8 +1095,8 @@ armada_drm_XvInitPlane(ScrnInfoPtr pScrn, DevUnion *priv, struct drm_xv *drmxv,
p->pFormats = OverlayFormats;
p->nPorts = 1;
p->pPortPrivates = priv;
- p->nAttributes = sizeof(OverlayAttributes) / sizeof(XF86AttributeRec);
- p->pAttributes = OverlayAttributes;
+ p->nAttributes = num_attrs;
+ p->pAttributes = attrs;
p->nImages = num_images;
p->pImages = images;
p->StopVideo = armada_drm_plane_StopVideo;