[Intel-gfx] [PATCH 18/20] drm/i915: Extract ilk_crtc_has_gamma() & co.
Shankar, Uma
uma.shankar at intel.com
Thu Sep 17 21:03:15 UTC 2020
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Saturday, July 18, 2020 2:44 AM
> To: intel-gfx at lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 18/20] drm/i915: Extract ilk_crtc_has_gamma() & co.
>
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Extract a few helpers to check whether the hw degamma or gamma LUT is
> enabled.
Reviewed-by: Uma Shankar <uma.shankar at intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_color.c | 27 ++++++++++++++++------
> 1 file changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c
> b/drivers/gpu/drm/i915/display/intel_color.c
> index acf3d152edfe..f714c87d8e42 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1628,12 +1628,15 @@ static int i9xx_gamma_precision(const struct
> intel_crtc_state *crtc_state)
> }
> }
>
> +static bool ilk_crtc_has_gamma(const struct intel_crtc_state
> +*crtc_state) {
> + return crtc_state->gamma_enable &&
> + (crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) != 0; }
> +
> static int ilk_gamma_precision(const struct intel_crtc_state *crtc_state) {
> - if (!crtc_state->gamma_enable)
> - return 0;
> -
> - if ((crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) == 0)
> + if (!ilk_crtc_has_gamma(crtc_state))
> return 0;
>
> switch (crtc_state->gamma_mode) {
> @@ -1671,9 +1674,19 @@ static int glk_gamma_precision(const struct
> intel_crtc_state *crtc_state)
> }
> }
>
> +static bool icl_crtc_has_degamma(const struct intel_crtc_state
> +*crtc_state) {
> + return crtc_state->gamma_mode & PRE_CSC_GAMMA_ENABLE; }
> +
> +static bool icl_crtc_has_gamma(const struct intel_crtc_state
> +*crtc_state) {
> + return crtc_state->gamma_mode & POST_CSC_GAMMA_ENABLE; }
> +
> static int icl_gamma_precision(const struct intel_crtc_state *crtc_state) {
> - if ((crtc_state->gamma_mode & POST_CSC_GAMMA_ENABLE) == 0)
> + if (!icl_crtc_has_gamma(crtc_state))
> return 0;
>
> switch (crtc_state->gamma_mode & GAMMA_MODE_MODE_MASK) {
> @@ -2241,10 +2254,10 @@ static void icl_read_luts(struct intel_crtc_state
> *crtc_state) {
> struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>
> - if (crtc_state->gamma_mode & PRE_CSC_GAMMA_ENABLE)
> + if (icl_crtc_has_degamma(crtc_state))
> crtc_state->hw.degamma_lut = glk_read_degamma_lut(crtc);
>
> - if ((crtc_state->gamma_mode & POST_CSC_GAMMA_ENABLE) == 0)
> + if (!icl_crtc_has_gamma(crtc_state))
> return;
>
> switch (crtc_state->gamma_mode & GAMMA_MODE_MODE_MASK) {
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list