]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Use intel_get_pipe_timings() and intel_mode_from_pipe_config() in intel_crt...
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 1 Apr 2016 18:48:50 +0000 (21:48 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 9 Oct 2017 14:48:08 +0000 (17:48 +0300)
Eliminate the duplicate code for pipe timing readout in
intel_crtc_mode_get() by using the functions we use for the normal state
readout.

v2: Store dotclock in adjusted_mode instead of the final mode

Cc: dri-devel@lists.freedesktop.org
Cc: Rob Kramer <rob@solution-space.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/1459536530-17754-1-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c

index 10501e8557565d2c9306a17f44f512b65587a714..15844bf924343fa9a5168e1bd80915d61831f7a1 100644 (file)
@@ -10253,10 +10253,8 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       enum transcoder cpu_transcoder;
        struct drm_display_mode *mode;
        struct intel_crtc_state *pipe_config;
-       u32 htot, hsync, vtot, vsync;
        enum pipe pipe = intel_crtc->pipe;
 
        mode = kzalloc(sizeof(*mode), GFP_KERNEL);
@@ -10283,24 +10281,12 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
        pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(pipe));
        i9xx_crtc_clock_get(intel_crtc, pipe_config);
 
-       mode->clock = pipe_config->port_clock / pipe_config->pixel_multiplier;
-
-       cpu_transcoder = pipe_config->cpu_transcoder;
-       htot = I915_READ(HTOTAL(cpu_transcoder));
-       hsync = I915_READ(HSYNC(cpu_transcoder));
-       vtot = I915_READ(VTOTAL(cpu_transcoder));
-       vsync = I915_READ(VSYNC(cpu_transcoder));
+       pipe_config->base.adjusted_mode.crtc_clock =
+               pipe_config->port_clock / pipe_config->pixel_multiplier;
 
-       mode->hdisplay = (htot & 0xffff) + 1;
-       mode->htotal = ((htot & 0xffff0000) >> 16) + 1;
-       mode->hsync_start = (hsync & 0xffff) + 1;
-       mode->hsync_end = ((hsync & 0xffff0000) >> 16) + 1;
-       mode->vdisplay = (vtot & 0xffff) + 1;
-       mode->vtotal = ((vtot & 0xffff0000) >> 16) + 1;
-       mode->vsync_start = (vsync & 0xffff) + 1;
-       mode->vsync_end = ((vsync & 0xffff0000) >> 16) + 1;
+       intel_get_pipe_timings(intel_crtc, pipe_config);
 
-       drm_mode_set_name(mode);
+       intel_mode_from_pipe_config(mode, pipe_config);
 
        kfree(pipe_config);