diff mbox series

[v3,13/20] drm/i915: Prep for C8 palette readout

Message ID 20221114153732.11773-14-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Finish (de)gamma readout | expand

Commit Message

Ville Syrjala Nov. 14, 2022, 3:37 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add the approproate c8_planes checks to make the LUT
code ready for C8 palette readout. Note we currently
lack the actual c8_planes readout, so this won't work
yet. But no harm in making the code somewhat more ready
for the day when we do get c8_planes readout.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

Comments

Shankar, Uma Nov. 18, 2022, 5:51 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville Syrjala
> Sent: Monday, November 14, 2022 9:07 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH v3 13/20] drm/i915: Prep for C8 palette readout
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add the approproate c8_planes checks to make the LUT code ready for C8 palette
> readout. Note we currently lack the actual c8_planes readout, so this won't work
> yet. But no harm in making the code somewhat more ready for the day when we do
> get c8_planes readout.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_color.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c
> b/drivers/gpu/drm/i915/display/intel_color.c
> index ef171837ef45..ca01b3e6b585 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1801,7 +1801,7 @@ static int icl_color_check(struct intel_crtc_state
> *crtc_state)
> 
>  static int i9xx_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)  {
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return 0;
> 
>  	switch (crtc_state->gamma_mode) {
> @@ -1817,6 +1817,9 @@ static int i9xx_post_csc_lut_precision(const struct
> intel_crtc_state *crtc_state
> 
>  static bool ilk_has_post_csc_lut(const struct intel_crtc_state *crtc_state)  {
> +	if (crtc_state->c8_planes)
> +		return true;
> +
>  	return crtc_state->gamma_enable &&
>  		(crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) != 0;  }
> @@ -1847,7 +1850,7 @@ static int chv_post_csc_lut_precision(const struct
> intel_crtc_state *crtc_state)
> 
>  static int glk_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)  {
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return 0;
> 
>  	switch (crtc_state->gamma_mode) {
> @@ -1863,6 +1866,9 @@ static int glk_post_csc_lut_precision(const struct
> intel_crtc_state *crtc_state)
> 
>  static bool icl_has_post_csc_lut(const struct intel_crtc_state *crtc_state)  {
> +	if (crtc_state->c8_planes)
> +		return true;
> +
>  	return crtc_state->gamma_mode & POST_CSC_GAMMA_ENABLE;  }
> 
> @@ -2009,7 +2015,7 @@ static void i9xx_read_luts(struct intel_crtc_state
> *crtc_state)  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	crtc_state->post_csc_lut = i9xx_read_lut_8(crtc); @@ -2049,7 +2055,7 @@
> static void i965_read_luts(struct intel_crtc_state *crtc_state)  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT) @@ -2180,7
> +2186,7 @@ static void ilk_read_luts(struct intel_crtc_state *crtc_state)
>  		ilk_has_post_csc_lut(crtc_state) ?
>  		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	switch (crtc_state->gamma_mode) {
> @@ -2240,7 +2246,7 @@ static void ivb_read_luts(struct intel_crtc_state
> *crtc_state)
>  		ilk_has_post_csc_lut(crtc_state) ?
>  		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	switch (crtc_state->gamma_mode) {
> @@ -2303,7 +2309,7 @@ static void bdw_read_luts(struct intel_crtc_state
> *crtc_state)
>  		ilk_has_post_csc_lut(crtc_state) ?
>  		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	switch (crtc_state->gamma_mode) {
> @@ -2372,7 +2378,7 @@ static void glk_read_luts(struct intel_crtc_state
> *crtc_state)
>  	if (crtc_state->csc_enable)
>  		crtc_state->pre_csc_lut = glk_read_degamma_lut(crtc);
> 
> -	if (!crtc_state->gamma_enable)
> +	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
>  		return;
> 
>  	switch (crtc_state->gamma_mode) {
> --
> 2.37.4
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index ef171837ef45..ca01b3e6b585 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1801,7 +1801,7 @@  static int icl_color_check(struct intel_crtc_state *crtc_state)
 
 static int i9xx_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)
 {
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return 0;
 
 	switch (crtc_state->gamma_mode) {
@@ -1817,6 +1817,9 @@  static int i9xx_post_csc_lut_precision(const struct intel_crtc_state *crtc_state
 
 static bool ilk_has_post_csc_lut(const struct intel_crtc_state *crtc_state)
 {
+	if (crtc_state->c8_planes)
+		return true;
+
 	return crtc_state->gamma_enable &&
 		(crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) != 0;
 }
@@ -1847,7 +1850,7 @@  static int chv_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)
 
 static int glk_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)
 {
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return 0;
 
 	switch (crtc_state->gamma_mode) {
@@ -1863,6 +1866,9 @@  static int glk_post_csc_lut_precision(const struct intel_crtc_state *crtc_state)
 
 static bool icl_has_post_csc_lut(const struct intel_crtc_state *crtc_state)
 {
+	if (crtc_state->c8_planes)
+		return true;
+
 	return crtc_state->gamma_mode & POST_CSC_GAMMA_ENABLE;
 }
 
@@ -2009,7 +2015,7 @@  static void i9xx_read_luts(struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	crtc_state->post_csc_lut = i9xx_read_lut_8(crtc);
@@ -2049,7 +2055,7 @@  static void i965_read_luts(struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
@@ -2180,7 +2186,7 @@  static void ilk_read_luts(struct intel_crtc_state *crtc_state)
 		ilk_has_post_csc_lut(crtc_state) ?
 		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	switch (crtc_state->gamma_mode) {
@@ -2240,7 +2246,7 @@  static void ivb_read_luts(struct intel_crtc_state *crtc_state)
 		ilk_has_post_csc_lut(crtc_state) ?
 		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	switch (crtc_state->gamma_mode) {
@@ -2303,7 +2309,7 @@  static void bdw_read_luts(struct intel_crtc_state *crtc_state)
 		ilk_has_post_csc_lut(crtc_state) ?
 		&crtc_state->post_csc_lut : &crtc_state->pre_csc_lut;
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	switch (crtc_state->gamma_mode) {
@@ -2372,7 +2378,7 @@  static void glk_read_luts(struct intel_crtc_state *crtc_state)
 	if (crtc_state->csc_enable)
 		crtc_state->pre_csc_lut = glk_read_degamma_lut(crtc);
 
-	if (!crtc_state->gamma_enable)
+	if (!crtc_state->gamma_enable && !crtc_state->c8_planes)
 		return;
 
 	switch (crtc_state->gamma_mode) {