aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-02-20 08:48:16 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-03-08 11:25:04 -0500
commit9aecbc45a3ceefe57f27ddc232e26e08513c9137 (patch)
treea08c58b9369b3f4ebb85fdc0ee1cf2150cee7333
parentdf99dd9202216f54eaf672e07808e9198d868af6 (diff)
drm/nouveau: Replace the iturbt_709 prop with the standard COLOR_ENCODING prop
Replace the ad-hoc iturbt_709 property with the new standard COLOR_ENCODING property. Compiles, but not tested. v2: Fix typos (Ilia) Cc: Daniel Vetter <daniel@ffwll.ch> Cc: nouveau@lists.freedesktop.org Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180220134816.15229-1-ville.syrjala@linux.intel.com Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Acked-by: Ben Skeggs <bskeggs@redhat.com> #irc
-rw-r--r--drivers/gpu/drm/nouveau/dispnv04/overlay.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
index c8c2333f24ee..df4358e31075 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
@@ -46,7 +46,6 @@ struct nouveau_plane {
46 struct drm_property *brightness; 46 struct drm_property *brightness;
47 struct drm_property *hue; 47 struct drm_property *hue;
48 struct drm_property *saturation; 48 struct drm_property *saturation;
49 struct drm_property *iturbt_709;
50 } props; 49 } props;
51 50
52 int colorkey; 51 int colorkey;
@@ -54,7 +53,7 @@ struct nouveau_plane {
54 int brightness; 53 int brightness;
55 int hue; 54 int hue;
56 int saturation; 55 int saturation;
57 int iturbt_709; 56 enum drm_color_encoding color_encoding;
58 57
59 void (*set_params)(struct nouveau_plane *); 58 void (*set_params)(struct nouveau_plane *);
60}; 59};
@@ -166,7 +165,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
166 if (fb->format->format == DRM_FORMAT_NV12 || 165 if (fb->format->format == DRM_FORMAT_NV12 ||
167 fb->format->format == DRM_FORMAT_NV21) 166 fb->format->format == DRM_FORMAT_NV21)
168 format |= NV_PVIDEO_FORMAT_PLANAR; 167 format |= NV_PVIDEO_FORMAT_PLANAR;
169 if (nv_plane->iturbt_709) 168 if (nv_plane->color_encoding == DRM_COLOR_YCBCR_BT709)
170 format |= NV_PVIDEO_FORMAT_MATRIX_ITURBT709; 169 format |= NV_PVIDEO_FORMAT_MATRIX_ITURBT709;
171 if (nv_plane->colorkey & (1 << 24)) 170 if (nv_plane->colorkey & (1 << 24))
172 format |= NV_PVIDEO_FORMAT_DISPLAY_COLOR_KEY; 171 format |= NV_PVIDEO_FORMAT_DISPLAY_COLOR_KEY;
@@ -229,7 +228,7 @@ nv10_set_params(struct nouveau_plane *plane)
229 nvif_wr32(dev, NV_PVIDEO_COLOR_KEY, plane->colorkey & 0xffffff); 228 nvif_wr32(dev, NV_PVIDEO_COLOR_KEY, plane->colorkey & 0xffffff);
230 229
231 if (plane->cur) { 230 if (plane->cur) {
232 if (plane->iturbt_709) 231 if (plane->color_encoding == DRM_COLOR_YCBCR_BT709)
233 format |= NV_PVIDEO_FORMAT_MATRIX_ITURBT709; 232 format |= NV_PVIDEO_FORMAT_MATRIX_ITURBT709;
234 if (plane->colorkey & (1 << 24)) 233 if (plane->colorkey & (1 << 24))
235 format |= NV_PVIDEO_FORMAT_DISPLAY_COLOR_KEY; 234 format |= NV_PVIDEO_FORMAT_DISPLAY_COLOR_KEY;
@@ -258,8 +257,8 @@ nv_set_property(struct drm_plane *plane,
258 nv_plane->hue = value; 257 nv_plane->hue = value;
259 else if (property == nv_plane->props.saturation) 258 else if (property == nv_plane->props.saturation)
260 nv_plane->saturation = value; 259 nv_plane->saturation = value;
261 else if (property == nv_plane->props.iturbt_709) 260 else if (property == nv_plane->base.color_encoding_property)
262 nv_plane->iturbt_709 = value; 261 nv_plane->color_encoding = value;
263 else 262 else
264 return -EINVAL; 263 return -EINVAL;
265 264
@@ -313,14 +312,11 @@ nv10_overlay_init(struct drm_device *device)
313 device, 0, "hue", 0, 359); 312 device, 0, "hue", 0, 359);
314 plane->props.saturation = drm_property_create_range( 313 plane->props.saturation = drm_property_create_range(
315 device, 0, "saturation", 0, 8192 - 1); 314 device, 0, "saturation", 0, 8192 - 1);
316 plane->props.iturbt_709 = drm_property_create_range(
317 device, 0, "iturbt_709", 0, 1);
318 if (!plane->props.colorkey || 315 if (!plane->props.colorkey ||
319 !plane->props.contrast || 316 !plane->props.contrast ||
320 !plane->props.brightness || 317 !plane->props.brightness ||
321 !plane->props.hue || 318 !plane->props.hue ||
322 !plane->props.saturation || 319 !plane->props.saturation)
323 !plane->props.iturbt_709)
324 goto cleanup; 320 goto cleanup;
325 321
326 plane->colorkey = 0; 322 plane->colorkey = 0;
@@ -343,9 +339,13 @@ nv10_overlay_init(struct drm_device *device)
343 drm_object_attach_property(&plane->base.base, 339 drm_object_attach_property(&plane->base.base,
344 plane->props.saturation, plane->saturation); 340 plane->props.saturation, plane->saturation);
345 341
346 plane->iturbt_709 = 0; 342 plane->color_encoding = DRM_COLOR_YCBCR_BT601;
347 drm_object_attach_property(&plane->base.base, 343 drm_plane_create_color_properties(&plane->base,
348 plane->props.iturbt_709, plane->iturbt_709); 344 BIT(DRM_COLOR_YCBCR_BT601) |
345 BIT(DRM_COLOR_YCBCR_BT709),
346 BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),
347 DRM_COLOR_YCBCR_BT601,
348 DRM_COLOR_YCBCR_LIMITED_RANGE);
349 349
350 plane->set_params = nv10_set_params; 350 plane->set_params = nv10_set_params;
351 nv10_set_params(plane); 351 nv10_set_params(plane);