ImmortalWrt/target/linux/bcm27xx/patches-5.15/950-0780-drm-object-Add-default-color-encoding-and-range-valu.patch
Álvaro Fernández Rojas 20ea6adbf1 bcm27xx: add support for linux v5.15
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-17 15:11:22 +02:00

55 lines
2.1 KiB
Diff

From 2506f4df7531123573ab9f11c9f032ffbb025c1d Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 21 Feb 2022 10:59:14 +0100
Subject: [PATCH] drm/object: Add default color encoding and range
value at reset
Upstream commit 9a48ab11714c955456fefdd4ab532d324fbef563
The drm_plane_create_color_properties() function asks for an initial
value for the color encoding and range, and will set the associated
plane state variable with that value if a state is present.
However, that function is usually called at a time where there's no
state yet. Since the drm_plane_state reset helper doesn't take care of
reading that value when it's called, it means that in most cases the
initial value will be 0 (so DRM_COLOR_YCBCR_BT601 and
DRM_COLOR_YCBCR_LIMITED_RANGE, respectively), or the drivers will have
to work around it.
Let's add some code in __drm_atomic_helper_plane_state_reset() to get
the initial encoding and range value if the property has been attached
in order to fix this.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220221095918.18763-19-maxime@cerno.tech
---
drivers/gpu/drm/drm_atomic_state_helper.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -251,6 +251,20 @@ void __drm_atomic_helper_plane_state_res
plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE;
plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+ if (plane->color_encoding_property) {
+ if (!drm_object_property_get_default_value(&plane->base,
+ plane->color_encoding_property,
+ &val))
+ plane_state->color_encoding = val;
+ }
+
+ if (plane->color_range_property) {
+ if (!drm_object_property_get_default_value(&plane->base,
+ plane->color_range_property,
+ &val))
+ plane_state->color_range = val;
+ }
+
if (plane->zpos_property) {
if (!drm_object_property_get_default_value(&plane->base,
plane->zpos_property,