drm/i915: move HSW+ gamma mode read to intel_color
authorJani Nikula <jani.nikula@intel.com>
Thu, 17 Aug 2023 15:53:05 +0000 (18:53 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 25 Aug 2023 10:12:21 +0000 (13:12 +0300)
Abstract the platform specific register access better. The separate
hsw_read_gamma_mode() will make more sense with the following changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b7ddcc8b0fb783eb149864070821bdb695c40366.1692287501.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_display.c

index 73110bf..c96ad13 100644 (file)
@@ -1018,6 +1018,20 @@ static void hsw_color_commit_arm(const struct intel_crtc_state *crtc_state)
                          crtc_state->csc_mode);
 }
 
+static u32 hsw_read_gamma_mode(struct intel_crtc *crtc)
+{
+       struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+
+       return intel_de_read(i915, GAMMA_MODE(crtc->pipe));
+}
+
+static void hsw_get_config(struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+       crtc_state->gamma_mode = hsw_read_gamma_mode(crtc);
+}
+
 static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -3625,6 +3639,7 @@ static const struct intel_color_funcs tgl_color_funcs = {
        .read_luts = icl_read_luts,
        .lut_equal = icl_lut_equal,
        .read_csc = icl_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs icl_color_funcs = {
@@ -3636,6 +3651,7 @@ static const struct intel_color_funcs icl_color_funcs = {
        .read_luts = icl_read_luts,
        .lut_equal = icl_lut_equal,
        .read_csc = icl_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs glk_color_funcs = {
@@ -3646,6 +3662,7 @@ static const struct intel_color_funcs glk_color_funcs = {
        .read_luts = glk_read_luts,
        .lut_equal = glk_lut_equal,
        .read_csc = skl_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs skl_color_funcs = {
@@ -3656,6 +3673,7 @@ static const struct intel_color_funcs skl_color_funcs = {
        .read_luts = bdw_read_luts,
        .lut_equal = ivb_lut_equal,
        .read_csc = skl_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs bdw_color_funcs = {
@@ -3666,6 +3684,7 @@ static const struct intel_color_funcs bdw_color_funcs = {
        .read_luts = bdw_read_luts,
        .lut_equal = ivb_lut_equal,
        .read_csc = ilk_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs hsw_color_funcs = {
@@ -3676,6 +3695,7 @@ static const struct intel_color_funcs hsw_color_funcs = {
        .read_luts = ivb_read_luts,
        .lut_equal = ivb_lut_equal,
        .read_csc = ilk_read_csc,
+       .get_config = hsw_get_config,
 };
 
 static const struct intel_color_funcs ivb_color_funcs = {
index c7d8eb4..b41482d 100644 (file)
@@ -3735,9 +3735,6 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
 
        pipe_config->sink_format = pipe_config->output_format;
 
-       pipe_config->gamma_mode = intel_de_read(dev_priv,
-                                               GAMMA_MODE(crtc->pipe));
-
        pipe_config->csc_mode = intel_de_read(dev_priv,
                                              PIPE_CSC_MODE(crtc->pipe));