drm/i915: pipe_config, adjusted_mode vs. requested_mode, etc. v2
Subsystems (2)
cover drm/i915: pipe_config, adjusted_mode vs. requested_mode, etc. v2
Same as before with a few minor fixes, and rebased on top of the "drm/i915: adjusted_mode.clock vs. port_clock v2" series.
I also included the cursor fixes since the second one depends on pipe_src_{w,h} being available.
PATCH 2/14 drm/i915: Use adjusted_mode->clock in lpt_program_iclkip
From: Ville Syrjälä <[email protected]>
lpt_program_iclkip() wants to know the pixel clock. It should get that information from adjusted_mode, not crtc->mode.
--- drivers/gpu/drm/i915/intel_display.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -4
@@ -2875,6 +2875,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;u32 divsel, phaseinc, auxdiv, phasedir =0 ;u32 temp;
@@ -2892,13 +2893,13 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) SBI_ICLK);/* 20MHz is a corner case which is out of range for the 7-bit divisor */ -if (crtc->mode.clock ==20000 ) { +if (clock ==20000 ) { auxdiv =1 ; divsel =0x41 ; phaseinc =0x20 ; }else {/* The iCLK virtual clock root frequency is in MHz, -* but the crtc->mode.clock in in KHz. To get the divisors, +* but the adjusted_mode->clock in in KHz. To get the divisors, * it is necessary to divide one by another, so we * convert the virtual clock precision to KHz here for higher * precision.
@@ -2907,7 +2908,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)u32 iclk_pi_range =64 ;u32 desired_divisor, msb_divisor_value, pi_value; - desired_divisor = (iclk_virtual_root_freq / crtc->mode.clock); + desired_divisor = (iclk_virtual_root_freq / clock); msb_divisor_value = desired_divisor / iclk_pi_range; pi_value = desired_divisor % iclk_pi_range;
@@ -2923,7 +2924,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) ~SBI_SSCDIVINTPHASE_INCVAL_MASK); DRM_DEBUG_KMS("iCLKIP clock: found settings for %dKHz refresh rate: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n", - crtc->mode.clock, + clock, auxdiv, divsel, phasedir,
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/14] drm/i915: Use adjusted_mode->clock in lpt_program_iclkip
Quoted 6 lines · On Wed, Sep 04, 2013 at 06:25:19PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
lpt_program_iclkip()wants to know the pixel clock. It should get that information fromadjusted_mode, notcrtc->mode.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 57 lines
--- drivers/gpu/drm/i915/intel_display.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +5
-4@@ -2875,6 +2875,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;u32 divsel, phaseinc, auxdiv, phasedir =0 ;u32 temp;@@ -2892,13 +2893,13 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) SBI_ICLK);/* 20MHz is a corner case which is out of range for the 7-bit divisor */ -if (crtc->mode.clock ==20000 ) { +if (clock ==20000 ) { auxdiv =1 ; divsel =0x41 ; phaseinc =0x20 ; }else {/* The iCLK virtual clock root frequency is in MHz, -* but the crtc->mode.clock in in KHz. To get the divisors, +* but the adjusted_mode->clock in in KHz. To get the divisors, * it is necessary to divide one by another, so we * convert the virtual clock precision to KHz here for higher * precision. @@ -2907,7 +2908,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)u32 iclk_pi_range =64 ;u32 desired_divisor, msb_divisor_value, pi_value; - desired_divisor = (iclk_virtual_root_freq / crtc->mode.clock); + desired_divisor = (iclk_virtual_root_freq / clock); msb_divisor_value = desired_divisor / iclk_pi_range; pi_value = desired_divisor % iclk_pi_range;@@ -2923,7 +2924,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) ~SBI_SSCDIVINTPHASE_INCVAL_MASK); DRM_DEBUG_KMS("iCLKIP clock: found settings for %dKHz refresh rate: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n", - crtc->mode.clock, + clock, auxdiv, divsel, phasedir,Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/14 drm/i915: Use adjusted_mode in HDMI 12bpc clock check
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The pixel clock should come from adjusted_mode not requested_mode. In this case the two should be the same as we don't currently overwrite the clock in the case of HDMI. But let's make the code safe against such things happening in the future.
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -865,7 +865,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_device *dev = encoder->base.dev;struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; -int clock_12bpc = pipe_config->requested_mode.clock *3 /2 ; +int clock_12bpc = pipe_config->adjusted_mode.clock *3 /2 ;int portclock_limit =hdmi_portclock_limit (intel_hdmi);int desired_bpp;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/14] drm/i915: Use adjusted_mode in HDMI 12bpc clock check
Quoted 8 lines · On Wed, Sep 04, 2013 at 06:25:20PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The pixel clock should come from
adjusted_modenotrequested_mode. In this case the two should be the same as we don't currently overwrite the clock in the case of HDMI. But let's make the code safe against such things happening in the future.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 24 lines
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_hdmi.c +1
-1@@ -865,7 +865,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_device *dev = encoder->base.dev;struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; -int clock_12bpc = pipe_config->requested_mode.clock *3 /2 ; +int clock_12bpc = pipe_config->adjusted_mode.clock *3 /2 ;int portclock_limit =hdmi_portclock_limit (intel_hdmi);int desired_bpp;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/14 drm/i915: Use adjusted_mode in intel_update_fbc()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Check the mode flags from the adjusted_mode, not user requested mode. The hdisplay/vdisplay check actually checkes the primary plane size, so those still need to come from the user requested mode.
Extract both modes from pipe config instead of the drm_crtc.
--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +8 -4
@@ -458,6 +458,8 @@ void intel_update_fbc(struct drm_device *dev)struct drm_framebuffer *fb;struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj; +const struct drm_display_mode *mode; +const struct drm_display_mode *adjusted_mode;unsigned int max_hdisplay, max_vdisplay;if (!I915_HAS_FBC (dev)) {
@@ -502,6 +504,8 @@ void intel_update_fbc(struct drm_device *dev) fb = crtc->fb; intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj; + mode = &intel_crtc->config.requested_mode; + adjusted_mode = &intel_crtc->config.adjusted_mode;if (i915_enable_fbc <0 &&INTEL_INFO (dev)->gen <=7 && !IS_HASWELL (dev)) {
@@ -514,8 +518,8 @@ void intel_update_fbc(struct drm_device *dev)DRM_DEBUG_KMS ("fbc disabled per module param\n" ); goto out_disable; } -if ((crtc->mode.flags &DRM_MODE_FLAG_INTERLACE ) || - (crtc->mode.flags &DRM_MODE_FLAG_DBLSCAN )) { +if ((adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) || + (adjusted_mode->flags &DRM_MODE_FLAG_DBLSCAN )) {if (set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED_MODE ))DRM_DEBUG_KMS ("mode incompatible with compression, " "disabling\n" );
@@ -529,8 +533,8 @@ void intel_update_fbc(struct drm_device *dev) max_hdisplay =2048 ; max_vdisplay =1536 ; } -if ((crtc->mode.hdisplay > max_hdisplay) || - (crtc->mode.vdisplay > max_vdisplay)) { +if ((mode->hdisplay > max_hdisplay) || + (mode->vdisplay > max_vdisplay)) {if (set_no_fbc_reason (dev_priv,FBC_MODE_TOO_LARGE ))DRM_DEBUG_KMS ("mode too large for compression, disabling\n" ); goto out_disable;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/14] drm/i915: Use adjusted_mode in intel_update_fbc()
Quoted 9 lines · On Wed, Sep 04, 2013 at 06:25:21PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Check the mode flags from the
adjusted_mode, not user requested mode. The hdisplay/vdisplay check actually checkes the primary plane size, so those still need to come from the user requested mode.Extract both modes from pipe config instead of the
drm_crtc.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 55 lines
--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_pm.c +8
-4@@ -458,6 +458,8 @@ void intel_update_fbc(struct drm_device *dev)struct drm_framebuffer *fb;struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj; +const struct drm_display_mode *mode; +const struct drm_display_mode *adjusted_mode;unsigned int max_hdisplay, max_vdisplay;if (!I915_HAS_FBC (dev)) {@@ -502,6 +504,8 @@ void intel_update_fbc(struct drm_device *dev) fb = crtc->fb; intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj; + mode = &intel_crtc->config.requested_mode; + adjusted_mode = &intel_crtc->config.adjusted_mode;if (i915_enable_fbc <0 &&INTEL_INFO (dev)->gen <=7 && !IS_HASWELL (dev)) {@@ -514,8 +518,8 @@ void intel_update_fbc(struct drm_device *dev)DRM_DEBUG_KMS ("fbc disabled per module param\n" ); goto out_disable; } -if ((crtc->mode.flags &DRM_MODE_FLAG_INTERLACE ) || - (crtc->mode.flags &DRM_MODE_FLAG_DBLSCAN )) { +if ((adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) || + (adjusted_mode->flags &DRM_MODE_FLAG_DBLSCAN )) {if (set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED_MODE ))DRM_DEBUG_KMS ("mode incompatible with compression, " "disabling\n" );@@ -529,8 +533,8 @@ void intel_update_fbc(struct drm_device *dev) max_hdisplay =2048 ; max_vdisplay =1536 ; } -if ((crtc->mode.hdisplay > max_hdisplay) || - (crtc->mode.vdisplay > max_vdisplay)) { +if ((mode->hdisplay > max_hdisplay) || + (mode->vdisplay > max_vdisplay)) {if (set_no_fbc_reason (dev_priv,FBC_MODE_TOO_LARGE ))DRM_DEBUG_KMS ("mode too large for compression, disabling\n" ); goto out_disable;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/14 drm/i915: Grab the pixel clock from adjusted_mode not requested_mode
In reply to [email protected]From: Ville Syrjälä <[email protected]>
i9xx_set_pipeconf() attempts to get the current pixel clock from requested_mode. requested_mode.clock may be totally bogus, so the clock should come from adjusted_mode.
v2: Dropped the intel_compute_config() hunk due to killing of the
INTEL_FDI_FREQ check
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -4786,7 +4786,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)* XXX: No double-wide on 915GM pipe B. Is that the only reason for the * pipe == 0 check? */ -if (intel_crtc->config.requested_mode.clock > +if (intel_crtc->config.adjusted_mode.clock > dev_priv->display.get_display_clock_speed (dev) *9 /10 ) pipeconf |=PIPECONF_DOUBLE_WIDE ; }
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 01/14] drm/i915: Grab the pixel clock from adjusted_mode not requested_mode
Quoted 10 lines · On Wed, Sep 04, 2013 at 06:25:18PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
i9xx_set_pipeconf()attempts to get the current pixel clock fromrequested_mode. requested_mode.clock may be totally bogus, so the clock should come fromadjusted_mode.v2: Dropped the
intel_compute_config()hunk due to killing of the
INTEL_FDI_FREQcheckSigned-off-by Ville Syrjälä <[email protected]>
If you feel brave enough you could also have reindent the comment above the modified line to 80 chars.
Signature · 1 line
Damien
Quoted 24 lines
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -4786,7 +4786,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)* XXX: No double-wide on 915GM pipe B. Is that the only reason for the * pipe == 0 check? */ -if (intel_crtc->config.requested_mode.clock > +if (intel_crtc->config.adjusted_mode.clock > dev_priv->display.get_display_clock_speed (dev) *9 /10 ) pipeconf |=PIPECONF_DOUBLE_WIDE ; }Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/14 drm/i915: Use adjusted_mode appropriately when computing watermarks
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Currently most of the watermark code looks at crtc->mode which is the user requested mode. The only piece of information there that is relevant is hdisplay, the rest must come from adjusted_mode. Convert all of the code to use requested_mode and adjusted_mode from pipe config appropriately.
--- drivers/gpu/drm/i915/intel_pm.c | 55 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +33 -22
@@ -1109,7 +1109,7 @@ static void pineview_update_wm(struct drm_device *dev) crtc =single_enabled_crtc (dev);if (crtc) { -int clock = crtc->mode.clock; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;int pixel_size = crtc->fb->bits_per_pixel /8 ;/* Display SR */
@@ -1170,6 +1170,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, int *cursor_wm) {struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int htotal, hdisplay, clock, pixel_size;int line_time_us, line_count;int entries, tlb_miss;
@@ -1181,9 +1182,10 @@ static bool g4x_compute_wm0(struct drm_device *dev,return false; } - htotal = crtc->mode.htotal; - hdisplay = crtc->mode.hdisplay; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */
@@ -1254,6 +1256,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int hdisplay, htotal, pixel_size, clock;unsigned long line_time_us;int line_count, line_size;
@@ -1266,9 +1269,10 @@ static bool g4x_compute_srwm(struct drm_device *dev, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;
@@ -1307,7 +1311,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,if (!intel_crtc_active (crtc))return false; - clock = crtc->mode.clock;/* VESA DOT Clock */ + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock; pixel_size = crtc->fb->bits_per_pixel /8 ;/* BPP */ entries = (clock /1000 ) * pixel_size;
@@ -1492,9 +1496,11 @@ static void i965_update_wm(struct drm_device *dev)if (crtc) {/* self-refresh has much higher latency */ static const int sr_latency_ns =12000 ; -int clock = crtc->mode.clock; -int htotal = crtc->mode.htotal; -int hdisplay = crtc->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (crtc)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;
@@ -1570,7 +1576,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planea_wm =intel_calculate_wm (crtc->mode.clock, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns); enabled = crtc;
@@ -1584,7 +1590,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planeb_wm =intel_calculate_wm (crtc->mode.clock, + planeb_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns);if (enabled ==NULL )
@@ -1611,9 +1617,11 @@ static void i9xx_update_wm(struct drm_device *dev)if (HAS_FW_BLC (dev) && enabled) {/* self-refresh has much higher latency */ static const int sr_latency_ns =6000 ; -int clock = enabled->mode.clock; -int htotal = enabled->mode.htotal; -int hdisplay = enabled->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (enabled)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;
@@ -1673,7 +1681,8 @@ static void i830_update_wm(struct drm_device *dev)if (crtc ==NULL )return ; - planea_wm =intel_calculate_wm (crtc->mode.clock, &i830_wm_info, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, + &i830_wm_info, dev_priv->display.get_fifo_size (dev,0 ),4 , latency_ns); fwater_lo =I915_READ (FW_BLC ) & ~0xfff ;
@@ -1745,6 +1754,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, int *fbc_wm, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;unsigned long line_time_us;int hdisplay, htotal, pixel_size, clock;int line_count, line_size;
@@ -1757,9 +1767,10 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;
@@ -2902,7 +2913,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,return false; } - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;/* Use the small buffer method to calculate the sprite watermark */ entries = ((clock * pixel_size /1000 ) * display_latency_ns) /1000 ;
@@ -2937,7 +2948,7 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;if (!clock) { *sprite_wm =0 ;return false;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/14] drm/i915: Use adjusted_mode appropriately when computing watermarks
Quoted 7 lines · On Wed, Sep 04, 2013 at 06:25:22PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Currently most of the watermark code looks at
crtc->modewhich is the user requested mode. The only piece of information there that is relevant is hdisplay, the rest must come fromadjusted_mode. Convert all of the code to userequested_modeandadjusted_modefrom pipe config appropriately.
I'm not quite sure why you single out hdisplay here, would you mind explaining why?
Signature · 1 line
Damien
Quoted 177 lines
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 55 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 22 deletions(-)drivers/gpu/drm/i915/intel_pm.c +33
-22@@ -1109,7 +1109,7 @@ static void pineview_update_wm(struct drm_device *dev) crtc =single_enabled_crtc (dev);if (crtc) { -int clock = crtc->mode.clock; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;int pixel_size = crtc->fb->bits_per_pixel /8 ;/* Display SR */ @@ -1170,6 +1170,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, int *cursor_wm) {struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int htotal, hdisplay, clock, pixel_size;int line_time_us, line_count;int entries, tlb_miss;@@ -1181,9 +1182,10 @@ static bool g4x_compute_wm0(struct drm_device *dev,return false; } - htotal = crtc->mode.htotal; - hdisplay = crtc->mode.hdisplay; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */ @@ -1254,6 +1256,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int hdisplay, htotal, pixel_size, clock;unsigned long line_time_us;int line_count, line_size;@@ -1266,9 +1269,10 @@ static bool g4x_compute_srwm(struct drm_device *dev, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -1307,7 +1311,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,if (!intel_crtc_active (crtc))return false; - clock = crtc->mode.clock;/* VESA DOT Clock */ + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock; pixel_size = crtc->fb->bits_per_pixel /8 ;/* BPP */ entries = (clock /1000 ) * pixel_size;@@ -1492,9 +1496,11 @@ static void i965_update_wm(struct drm_device *dev)if (crtc) {/* self-refresh has much higher latency */ static const int sr_latency_ns =12000 ; -int clock = crtc->mode.clock; -int htotal = crtc->mode.htotal; -int hdisplay = crtc->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (crtc)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1570,7 +1576,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planea_wm =intel_calculate_wm (crtc->mode.clock, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns); enabled = crtc;@@ -1584,7 +1590,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planeb_wm =intel_calculate_wm (crtc->mode.clock, + planeb_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns);if (enabled ==NULL )@@ -1611,9 +1617,11 @@ static void i9xx_update_wm(struct drm_device *dev)if (HAS_FW_BLC (dev) && enabled) {/* self-refresh has much higher latency */ static const int sr_latency_ns =6000 ; -int clock = enabled->mode.clock; -int htotal = enabled->mode.htotal; -int hdisplay = enabled->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (enabled)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1673,7 +1681,8 @@ static void i830_update_wm(struct drm_device *dev)if (crtc ==NULL )return ; - planea_wm =intel_calculate_wm (crtc->mode.clock, &i830_wm_info, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, + &i830_wm_info, dev_priv->display.get_fifo_size (dev,0 ),4 , latency_ns); fwater_lo =I915_READ (FW_BLC ) & ~0xfff ;@@ -1745,6 +1754,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, int *fbc_wm, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;unsigned long line_time_us;int hdisplay, htotal, pixel_size, clock;int line_count, line_size;@@ -1757,9 +1767,10 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -2902,7 +2913,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,return false; } - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;/* Use the small buffer method to calculate the sprite watermark */ entries = ((clock * pixel_size /1000 ) * display_latency_ns) /1000 ;@@ -2937,7 +2948,7 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;if (!clock) { *sprite_wm =0 ;return false;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/14] drm/i915: Use adjusted_mode appropriately when computing watermarks
Quoted 11 lines · Damien Lespiau
Quoted 7 lines · On Wed, Sep 04, 2013 at 06:25:22PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Currently most of the watermark code looks at
crtc->modewhich is the user requested mode. The only piece of information there that is relevant is hdisplay, the rest must come fromadjusted_mode. Convert all of the code to userequested_modeandadjusted_modefrom pipe config appropriately.I'm not quite sure why you single out hdisplay here, would you mind explaining why?
The watermark code is usually interested in the primary plane width. requested_mode.hdisplay is the closest thing we have at the momemnt.
Quoted 181 lines
Signature · 2 lines
-- DamienQuoted 177 lines
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 55 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 22 deletions(-)drivers/gpu/drm/i915/intel_pm.c +33
-22@@ -1109,7 +1109,7 @@ static void pineview_update_wm(struct drm_device *dev) crtc =single_enabled_crtc (dev);if (crtc) { -int clock = crtc->mode.clock; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;int pixel_size = crtc->fb->bits_per_pixel /8 ;/* Display SR */ @@ -1170,6 +1170,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, int *cursor_wm) {struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int htotal, hdisplay, clock, pixel_size;int line_time_us, line_count;int entries, tlb_miss;@@ -1181,9 +1182,10 @@ static bool g4x_compute_wm0(struct drm_device *dev,return false; } - htotal = crtc->mode.htotal; - hdisplay = crtc->mode.hdisplay; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */ @@ -1254,6 +1256,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int hdisplay, htotal, pixel_size, clock;unsigned long line_time_us;int line_count, line_size;@@ -1266,9 +1269,10 @@ static bool g4x_compute_srwm(struct drm_device *dev, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -1307,7 +1311,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,if (!intel_crtc_active (crtc))return false; - clock = crtc->mode.clock;/* VESA DOT Clock */ + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock; pixel_size = crtc->fb->bits_per_pixel /8 ;/* BPP */ entries = (clock /1000 ) * pixel_size;@@ -1492,9 +1496,11 @@ static void i965_update_wm(struct drm_device *dev)if (crtc) {/* self-refresh has much higher latency */ static const int sr_latency_ns =12000 ; -int clock = crtc->mode.clock; -int htotal = crtc->mode.htotal; -int hdisplay = crtc->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (crtc)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1570,7 +1576,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planea_wm =intel_calculate_wm (crtc->mode.clock, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns); enabled = crtc;@@ -1584,7 +1590,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planeb_wm =intel_calculate_wm (crtc->mode.clock, + planeb_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns);if (enabled ==NULL )@@ -1611,9 +1617,11 @@ static void i9xx_update_wm(struct drm_device *dev)if (HAS_FW_BLC (dev) && enabled) {/* self-refresh has much higher latency */ static const int sr_latency_ns =6000 ; -int clock = enabled->mode.clock; -int htotal = enabled->mode.htotal; -int hdisplay = enabled->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (enabled)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1673,7 +1681,8 @@ static void i830_update_wm(struct drm_device *dev)if (crtc ==NULL )return ; - planea_wm =intel_calculate_wm (crtc->mode.clock, &i830_wm_info, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, + &i830_wm_info, dev_priv->display.get_fifo_size (dev,0 ),4 , latency_ns); fwater_lo =I915_READ (FW_BLC ) & ~0xfff ;@@ -1745,6 +1754,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, int *fbc_wm, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;unsigned long line_time_us;int hdisplay, htotal, pixel_size, clock;int line_count, line_size;@@ -1757,9 +1767,10 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -2902,7 +2913,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,return false; } - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;/* Use the small buffer method to calculate the sprite watermark */ entries = ((clock * pixel_size /1000 ) * display_latency_ns) /1000 ;@@ -2937,7 +2948,7 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;if (!clock) { *sprite_wm =0 ;return false;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 05/14] drm/i915: Use adjusted_mode appropriately when computing watermarks
In reply to [email protected]Quoted 9 lines · On Wed, Sep 04, 2013 at 06:25:22PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Currently most of the watermark code looks at
crtc->modewhich is the user requested mode. The only piece of information there that is relevant is hdisplay, the rest must come fromadjusted_mode. Convert all of the code to userequested_modeandadjusted_modefrom pipe config appropriately.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 175 lines
--- drivers/gpu/drm/i915/intel_pm.c | 55 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 22 deletions(-)drivers/gpu/drm/i915/intel_pm.c +33
-22@@ -1109,7 +1109,7 @@ static void pineview_update_wm(struct drm_device *dev) crtc =single_enabled_crtc (dev);if (crtc) { -int clock = crtc->mode.clock; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;int pixel_size = crtc->fb->bits_per_pixel /8 ;/* Display SR */ @@ -1170,6 +1170,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, int *cursor_wm) {struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int htotal, hdisplay, clock, pixel_size;int line_time_us, line_count;int entries, tlb_miss;@@ -1181,9 +1182,10 @@ static bool g4x_compute_wm0(struct drm_device *dev,return false; } - htotal = crtc->mode.htotal; - hdisplay = crtc->mode.hdisplay; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */ @@ -1254,6 +1256,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;int hdisplay, htotal, pixel_size, clock;unsigned long line_time_us;int line_count, line_size;@@ -1266,9 +1269,10 @@ static bool g4x_compute_srwm(struct drm_device *dev, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -1307,7 +1311,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,if (!intel_crtc_active (crtc))return false; - clock = crtc->mode.clock;/* VESA DOT Clock */ + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock; pixel_size = crtc->fb->bits_per_pixel /8 ;/* BPP */ entries = (clock /1000 ) * pixel_size;@@ -1492,9 +1496,11 @@ static void i965_update_wm(struct drm_device *dev)if (crtc) {/* self-refresh has much higher latency */ static const int sr_latency_ns =12000 ; -int clock = crtc->mode.clock; -int htotal = crtc->mode.htotal; -int hdisplay = crtc->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (crtc)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1570,7 +1576,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planea_wm =intel_calculate_wm (crtc->mode.clock, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns); enabled = crtc;@@ -1584,7 +1590,7 @@ static void i9xx_update_wm(struct drm_device *dev)if (IS_GEN2 (dev)) cpp =4 ; - planeb_wm =intel_calculate_wm (crtc->mode.clock, + planeb_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, wm_info, fifo_size, cpp, latency_ns);if (enabled ==NULL )@@ -1611,9 +1617,11 @@ static void i9xx_update_wm(struct drm_device *dev)if (HAS_FW_BLC (dev) && enabled) {/* self-refresh has much higher latency */ static const int sr_latency_ns =6000 ; -int clock = enabled->mode.clock; -int htotal = enabled->mode.htotal; -int hdisplay = enabled->mode.hdisplay; +const struct drm_display_mode *adjusted_mode = + &to_intel_crtc (enabled)->config.adjusted_mode; +int clock = adjusted_mode->clock; +int htotal = adjusted_mode->htotal; +int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1673,7 +1681,8 @@ static void i830_update_wm(struct drm_device *dev)if (crtc ==NULL )return ; - planea_wm =intel_calculate_wm (crtc->mode.clock, &i830_wm_info, + planea_wm =intel_calculate_wm (to_intel_crtc (crtc)->config.adjusted_mode.clock, + &i830_wm_info, dev_priv->display.get_fifo_size (dev,0 ),4 , latency_ns); fwater_lo =I915_READ (FW_BLC ) & ~0xfff ;@@ -1745,6 +1754,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, int *fbc_wm, int *display_wm, int *cursor_wm) { struct drm_crtc *crtc; +const struct drm_display_mode *adjusted_mode;unsigned long line_time_us;int hdisplay, htotal, pixel_size, clock;int line_count, line_size;@@ -1757,9 +1767,10 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - hdisplay = crtc->mode.hdisplay; - htotal = crtc->mode.htotal; - clock = crtc->mode.clock; + adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; + clock = adjusted_mode->clock; + htotal = adjusted_mode->htotal; + hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -2902,7 +2913,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,return false; } - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;/* Use the small buffer method to calculate the sprite watermark */ entries = ((clock * pixel_size /1000 ) * display_latency_ns) /1000 ;@@ -2937,7 +2948,7 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, } crtc =intel_get_crtc_for_plane (dev, plane); - clock = crtc->mode.clock; + clock =to_intel_crtc (crtc)->config.adjusted_mode.clock;if (!clock) { *sprite_wm =0 ;return false;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 8/14 drm/i915: Make intel_crtc_active() available outside intel_pm.c
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Move intel_crtc_active() to intel_display.c and make it available elsewhere as well.
intel_edp_psr_match_conditions() already has one open coded copy, so replace that one with a call to intel_crtc_active().
v2: Copy paste a big comment from danvet's mail explaining
when we can ditch the extra checks
--- drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 11 ----------- 4 files changed, 19 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_display.c +17 -0
@@ -733,6 +733,23 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,return true; } +bool intel_crtc_active (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +/* Be paranoid as we can arrive here with only partial +* state retrieved from the hardware during setup. +* +* We can ditch the adjusted_mode.clock check as soon +* as Haswell has gained clock readout/fastboot support. +* +* We can ditch the crtc->fb check as soon as we can +* properly reconstruct framebuffers. +*/ +return intel_crtc->active && crtc->fb && + intel_crtc->config.adjusted_mode.clock; +} +enum transcoder intel_pipe_to_cpu_transcoder (struct drm_i915_private *dev_priv,enum pipe pipe) {
drivers/gpu/drm/i915/intel_dp.c +1 -2
@@ -1570,8 +1570,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) } intel_crtc =to_intel_crtc (crtc); -if (!intel_crtc->active || !crtc->fb || - !intel_crtc->config.adjusted_mode.clock) { +if (!intel_crtc_active (crtc)) {DRM_DEBUG_KMS ("crtc not active for PSR\n" ); dev_priv->no_psr_reason =PSR_CRTC_NOT_ACTIVE ;return false;
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -801,5 +801,6 @@ extern void hsw_pc8_disable_interrupts(struct drm_device *dev);extern void hsw_pc8_restore_interrupts (struct drm_device *dev);extern void intel_aux_display_runtime_get (struct drm_i915_private *dev_priv);extern void intel_aux_display_runtime_put (struct drm_i915_private *dev_priv); +extern bool intel_crtc_active (struct drm_crtc *crtc);#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_pm.c +0 -11
@@ -43,17 +43,6 @@* i915.i915_enable_fbc parameter */ -static bool intel_crtc_active (struct drm_crtc *crtc) -{ -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); - -/* Be paranoid as we can arrive here with only partial -* state retrieved from the hardware during setup. -*/ -return intel_crtc->active && crtc->fb && - intel_crtc->config.adjusted_mode.clock; -} -static void i8xx_disable_fbc (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 08/14] drm/i915: Make intel_crtc_active() available outside intel_pm.c
Quoted 5 lines · On Wed, Sep 04, 2013 at 06:25:25PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Move
intel_crtc_active()tointel_display.cand make it available elsewhere as well.
Quoted 7 lines
intel_edp_psr_match_conditions()already has one open coded copy, so replace that one with a call tointel_crtc_active().v2: Copy paste a big comment from danvet's mail explaining
when we can ditch the extra checksSigned-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 89 lines
--- drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 3 +-- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 11 ----------- 4 files changed, 19 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/intel_display.c +17
-0@@ -733,6 +733,23 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,return true; } +bool intel_crtc_active (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +/* Be paranoid as we can arrive here with only partial +* state retrieved from the hardware during setup. +* +* We can ditch the adjusted_mode.clock check as soon +* as Haswell has gained clock readout/fastboot support. +* +* We can ditch the crtc->fb check as soon as we can +* properly reconstruct framebuffers. +*/ +return intel_crtc->active && crtc->fb && + intel_crtc->config.adjusted_mode.clock; +} +enum transcoder intel_pipe_to_cpu_transcoder (struct drm_i915_private *dev_priv,enum pipe pipe) {drivers/gpu/drm/i915/intel_dp.c +1
-2@@ -1570,8 +1570,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) } intel_crtc =to_intel_crtc (crtc); -if (!intel_crtc->active || !crtc->fb || - !intel_crtc->config.adjusted_mode.clock) { +if (!intel_crtc_active (crtc)) {DRM_DEBUG_KMS ("crtc not active for PSR\n" ); dev_priv->no_psr_reason =PSR_CRTC_NOT_ACTIVE ;return false;drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -801,5 +801,6 @@ extern void hsw_pc8_disable_interrupts(struct drm_device *dev);extern void hsw_pc8_restore_interrupts (struct drm_device *dev);extern void intel_aux_display_runtime_get (struct drm_i915_private *dev_priv);extern void intel_aux_display_runtime_put (struct drm_i915_private *dev_priv); +extern bool intel_crtc_active (struct drm_crtc *crtc);#endif /* __INTEL_DRV_H__ */ drivers/gpu/drm/i915/intel_pm.c +0
-11@@ -43,17 +43,6 @@* i915.i915_enable_fbc parameter */ -static bool intel_crtc_active (struct drm_crtc *crtc) -{ -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); - -/* Be paranoid as we can arrive here with only partial -* state retrieved from the hardware during setup. -*/ -return intel_crtc->active && crtc->fb && - intel_crtc->config.adjusted_mode.clock; -} -static void i8xx_disable_fbc (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/14 drm/i915: Check the clock from adjusted mode in intel_crtc_active()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The clock in crtc->mode doesn't necessarily mean anything. Let's look at the clock in adjusted_mode instead.
--- drivers/gpu/drm/i915/intel_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +4 -1
@@ -45,10 +45,13 @@static bool intel_crtc_active (struct drm_crtc *crtc) { +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +/* Be paranoid as we can arrive here with only partial * state retrieved from the hardware during setup. */ -return to_intel_crtc (crtc)->active && crtc->fb && crtc->mode.clock; +return intel_crtc->active && crtc->fb && + intel_crtc->config.adjusted_mode.clock; }static void i8xx_disable_fbc (struct drm_device *dev)
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/14] drm/i915: Check the clock from adjusted mode in intel_crtc_active()
Quoted 6 lines · On Wed, Sep 04, 2013 at 06:25:23PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The clock in
crtc->modedoesn't necessarily mean anything. Let's look at the clock inadjusted_modeinstead.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 30 lines
--- drivers/gpu/drm/i915/intel_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_pm.c +4
-1@@ -45,10 +45,13 @@static bool intel_crtc_active (struct drm_crtc *crtc) { +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +/* Be paranoid as we can arrive here with only partial * state retrieved from the hardware during setup. */ -return to_intel_crtc (crtc)->active && crtc->fb && crtc->mode.clock; +return intel_crtc->active && crtc->fb && + intel_crtc->config.adjusted_mode.clock; }static void i8xx_disable_fbc (struct drm_device *dev)Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/14 drm/i915: Use adjusted_mode when checking conditions for PSR
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_edp_psr_match_conditions() currently looks at crtc->mode when it really needs to look at adjusted_mode. Fix it.
--- drivers/gpu/drm/i915/intel_dp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -2
@@ -1570,7 +1570,8 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) } intel_crtc =to_intel_crtc (crtc); -if (!intel_crtc->active || !crtc->fb || !crtc->mode.clock) { +if (!intel_crtc->active || !crtc->fb || + !intel_crtc->config.adjusted_mode.clock) {DRM_DEBUG_KMS ("crtc not active for PSR\n" ); dev_priv->no_psr_reason =PSR_CRTC_NOT_ACTIVE ;return false;
@@ -1597,7 +1598,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)return false; } -if (crtc->mode.flags &DRM_MODE_FLAG_INTERLACE ) { +if (intel_crtc->config.adjusted_mode.flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); dev_priv->no_psr_reason =PSR_INTERLACED_ENABLED ;return false;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/14] drm/i915: Use adjusted_mode when checking conditions for PSR
Quoted 6 lines · On Wed, Sep 04, 2013 at 06:25:24PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
intel_edp_psr_match_conditions()currently looks atcrtc->modewhen it really needs to look atadjusted_mode. Fix it.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 34 lines
--- drivers/gpu/drm/i915/intel_dp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_dp.c +3
-2@@ -1570,7 +1570,8 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) } intel_crtc =to_intel_crtc (crtc); -if (!intel_crtc->active || !crtc->fb || !crtc->mode.clock) { +if (!intel_crtc->active || !crtc->fb || + !intel_crtc->config.adjusted_mode.clock) {DRM_DEBUG_KMS ("crtc not active for PSR\n" ); dev_priv->no_psr_reason =PSR_CRTC_NOT_ACTIVE ;return false;@@ -1597,7 +1598,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)return false; } -if (crtc->mode.flags &DRM_MODE_FLAG_INTERLACE ) { +if (intel_crtc->config.adjusted_mode.flags &DRM_MODE_FLAG_INTERLACE ) {DRM_DEBUG_KMS ("PSR condition failed: Interlaced is Enabled\n" ); dev_priv->no_psr_reason =PSR_INTERLACED_ENABLED ;return false;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/14 drm/i915: Use pipe config in sprite code
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather than dig up the pipe source size from crtc->mode, use intel_crtc->config.requested_mode.
--- drivers/gpu/drm/i915/intel_sprite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_sprite.c +2 -2
@@ -652,8 +652,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, .y2 = crtc_y + crtc_h, };const struct drm_rect clip = { - .x2 = crtc->mode.hdisplay, - .y2 = crtc->mode.vdisplay, + .x2 = intel_crtc->config.requested_mode.hdisplay, + .y2 = intel_crtc->config.requested_mode.vdisplay, }; intel_fb =to_intel_framebuffer (fb);
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/14] drm/i915: Use pipe config in sprite code
Quoted 6 lines · On Wed, Sep 04, 2013 at 06:25:26PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Rather than dig up the pipe source size from
crtc->mode, useintel_crtc->config.requested_mode.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 26 lines
--- drivers/gpu/drm/i915/intel_sprite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +2
-2@@ -652,8 +652,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, .y2 = crtc_y + crtc_h, };const struct drm_rect clip = { - .x2 = crtc->mode.hdisplay, - .y2 = crtc->mode.vdisplay, + .x2 = intel_crtc->config.requested_mode.hdisplay, + .y2 = intel_crtc->config.requested_mode.vdisplay, }; intel_fb =to_intel_framebuffer (fb);Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/14 drm/i915: Use adjusted_mode in DSI PLL calculations
In reply to [email protected]From: Ville Syrjälä <[email protected]>
adjusted_mode contains our real timings, not requested_mode. Use the correct thing in DSI PLL code.
Also constify adjusted_mode since we don't change it.
--- drivers/gpu/drm/i915/intel_dsi_pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dsi_pll.c +2 -2
@@ -50,7 +50,7 @@ static const u32 lfsr_converts[] = { 71, 35 /* 91 - 92 */ }; -static u32 dsi_rr_formula (struct drm_display_mode *mode, +static u32 dsi_rr_formula (const struct drm_display_mode *mode,int pixel_format,int video_mode_format,int lane_count,bool eotp) {
@@ -245,7 +245,7 @@ static void vlv_configure_dsi_pll(struct intel_encoder *encoder) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); -struct drm_display_mode *mode = &intel_crtc->config.requested_mode; +const struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base);int ret;struct dsi_mnp dsi_mnp;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/14] drm/i915: Use adjusted_mode in DSI PLL calculations
Quoted 8 lines · On Wed, Sep 04, 2013 at 06:25:27PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
adjusted_modecontains our real timings, notrequested_mode. Use the correct thing in DSI PLL code.Also constify
adjusted_modesince we don't change it.Signed-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 33 lines
--- drivers/gpu/drm/i915/intel_dsi_pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_dsi_pll.c +2
-2@@ -50,7 +50,7 @@ static const u32 lfsr_converts[] = { 71, 35 /* 91 - 92 */ }; -static u32 dsi_rr_formula (struct drm_display_mode *mode, +static u32 dsi_rr_formula (const struct drm_display_mode *mode,int pixel_format,int video_mode_format,int lane_count,bool eotp) {@@ -245,7 +245,7 @@ static void vlv_configure_dsi_pll(struct intel_encoder *encoder) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); -struct drm_display_mode *mode = &intel_crtc->config.requested_mode; +const struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base);int ret;struct dsi_mnp dsi_mnp;Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/14 drm/i915: Document the inteded use of requested_mode
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Try to clarify the purpose of requested_mode.
--- drivers/gpu/drm/i915/intel_drv.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +5 -0
@@ -211,6 +211,11 @@ struct intel_crtc_config {#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0)/* unreliable sync mode.flags */ unsigned long quirks; +/* User requested mode, only valid as a starting point to +* compute adjusted_mode, except in the case of (S)DVO where +* it's also for the output timings of the (S)DVO chip. +* adjusted_mode will then correspond to the S(DVO) chip's +* preferred input timings. */ struct drm_display_mode requested_mode;/* Actual pipe timings ie. what we program into the pipe timing * registers. adjusted_mode.clock is the pipe pixel clock. */
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/14] drm/i915: Document the inteded use of requested_mode
Quoted 5 lines · On Wed, Sep 04, 2013 at 06:25:29PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Try to clarify the purpose of
requested_mode.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/i915/intel_drv.h | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc_config { · line 218
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +5
-0@@ -211,6 +211,11 @@ struct intel_crtc_config {#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0)/* unreliable sync mode.flags */ unsigned long quirks; +/* User requested mode, only valid as a starting point to +* compute adjusted_mode, except in the case of (S)DVO where +* it's also for the output timings of the (S)DVO chip. +* adjusted_mode will then correspond to the S(DVO) chip's +* preferred input timings. */
That looks quite weird, maybe we should introduce another mode for this, and only this, case?
FWIW, I've been recently reminded that:
/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines. */
except in net/ and drivers/net/ where the style in this patch is used.
Signature · 1 line
Damien
Re: [PATCH 12/14] drm/i915: Document the inteded use of requested_mode
Quoted 21 lines · Damien Lespiau
Quoted 5 lines · On Wed, Sep 04, 2013 at 06:25:29PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Try to clarify the purpose of
requested_mode.Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Damien Lespiau <[email protected]>Quoted 12 lines
--- drivers/gpu/drm/i915/intel_drv.h | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -211,6 +211,11 @@ struct intel_crtc_config {#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0)/* unreliable sync mode.flags */ unsigned long quirks;
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc_config { · line 218
Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +5
-0+/* User requested mode, only valid as a starting point to +* compute adjusted_mode, except in the case of (S)DVO where +* it's also for the output timings of the (S)DVO chip. +* adjusted_mode will then correspond to the S(DVO) chip's +* preferred input timings. */ That looks quite weird, maybe we should introduce another mode for this, and only this, case?
I was thinking about it, but then decided that I don't care enough about it to make another patch. Maybe if I ever manage to get some SDVO cards I might care, or if we simply decide to kill requested_mode (ie. we'd just rename it to sdvo_output_mode or something).
Quoted 12 lines
FWIW, I've been recently reminded that:
/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines. */
Quoted 1 line
except in
net/anddrivers/net/where the style in this patch is used.
Yeah I tried it. But it looked funny since the other comments there already used the wrong style. So you can blame Daniel or whoever wrote the other comments ;)
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 12/14] drm/i915: Document the inteded use of requested_mode
Quoted 11 lines · Ville Syrjälä
Quoted 11 lines
FWIW, I've been recently reminded that:
/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines. */
Quoted 5 lines
Quoted 1 line
except in
net/anddrivers/net/where the style in this patch is used.Yeah I tried it. But it looked funny since the other comments there already used the wrong style. So you can blame Daniel or whoever wrote the other comments ;)
For new comments I've started to use official kernel style ... so will look a bit funny while we transition ;-)
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 12/14] drm/i915: Document the inteded use of requested_mode
In reply to [email protected]Quoted 5 lines · On Wed, Sep 04, 2013 at 06:25:29PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Try to clarify the purpose of
requested_mode.Signed-off-by Ville Syrjälä <[email protected]>
(and intended in the summary)
Signature · 1 line
Damien
PATCH v2 11/14 drm/i915: Add explicit pipe src size to pipe config
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather that mess about with hdisplay/vdisplay from requested_mode, add explicit pipe src size information to pipe config.
Now requested_mode is only really relevant for dvo/sdvo output timings. For everything else either adjusted_mode or pipe src size should be used.
In many places where we end up using pipe source size, we should actually use the primary plane size, but we don't currently store that information explicitly. As long as we treat primaries as full screen only, we can get away with this. Eventually when we move primaries over to drm_plane, we need to fix it all up.
v2: Add a comment to explain what pipe_src_{w,h} are
Add a note about primary planes to commit message
--- drivers/gpu/drm/i915/intel_display.c | 26 +++++++++++------ drivers/gpu/drm/i915/intel_drv.h | 6 ++++ drivers/gpu/drm/i915/intel_panel.c | 56 +++++++++++++++++------------------- drivers/gpu/drm/i915/intel_pm.c | 33 ++++++++++----------- drivers/gpu/drm/i915/intel_sprite.c | 4 +-- 5 files changed, 67 insertions(+), 58 deletions(-)
drivers/gpu/drm/i915/intel_display.c +17 -9
@@ -4673,7 +4673,6 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode; -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end;/* We need to be careful not to changed the adjusted mode, for otherwise
@@ -4726,7 +4725,8 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)* always be the user's requested size. */ I915_WRITE (PIPESRC (pipe), - ((mode->hdisplay -1 ) <<16 ) | (mode->vdisplay -1 )); + ((intel_crtc->config.pipe_src_w -1 ) <<16 ) | + (intel_crtc->config.pipe_src_h -1 )); } static void intel_get_pipe_timings(struct intel_crtc *crtc,
@@ -4764,8 +4764,11 @@ static void intel_get_pipe_timings(struct intel_crtc *crtc, } tmp =I915_READ (PIPESRC (crtc->pipe)); - pipe_config->requested_mode.vdisplay = (tmp &0xffff ) +1 ; - pipe_config->requested_mode.hdisplay = ((tmp >>16 ) &0xffff ) +1 ; + pipe_config->pipe_src_h = (tmp &0xffff ) +1 ; + pipe_config->pipe_src_w = ((tmp >>16 ) &0xffff ) +1 ; + + pipe_config->requested_mode.vdisplay = pipe_config->pipe_src_h; + pipe_config->requested_mode.hdisplay = pipe_config->pipe_src_w; } static void intel_crtc_mode_from_pipe_config(struct intel_crtc *intel_crtc,
@@ -4861,7 +4864,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int refclk, num_connectors =0 ;
@@ -4960,8 +4962,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,* which should always be the user's requested size. */ I915_WRITE (DSPSIZE (plane), - ((mode->vdisplay -1 ) <<16 ) | - (mode->hdisplay -1 )); + ((intel_crtc->config.pipe_src_h -1 ) <<16 ) | + (intel_crtc->config.pipe_src_w -1 ));I915_WRITE (DSPPOS (plane),0 );i9xx_set_pipeconf (intel_crtc);
@@ -8281,6 +8283,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,DRM_DEBUG_KMS ("adjusted mode:\n" );drm_mode_debug_printmodeline (&pipe_config->adjusted_mode);DRM_DEBUG_KMS ("port clock: %d\n" , pipe_config->port_clock); +DRM_DEBUG_KMS ("pipe src size: %dx%d\n" , + pipe_config->pipe_src_w, pipe_config->pipe_src_h); DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n", pipe_config->gmch_pfit.control, pipe_config->gmch_pfit.pgm_ratios,
@@ -8332,6 +8336,10 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,drm_mode_copy (&pipe_config->adjusted_mode, mode);drm_mode_copy (&pipe_config->requested_mode, mode); + + pipe_config->pipe_src_w = mode->hdisplay; + pipe_config->pipe_src_h = mode->vdisplay; + pipe_config->cpu_transcoder = (enum transcoder )to_intel_crtc (crtc)->pipe; pipe_config->shared_dpll =DPLL_ID_PRIVATE ;
@@ -8681,8 +8689,8 @@ intel_pipe_config_compare(struct drm_device *dev, DRM_MODE_FLAG_NVSYNC); } -PIPE_CONF_CHECK_I (requested_mode.hdisplay); -PIPE_CONF_CHECK_I (requested_mode.vdisplay); +PIPE_CONF_CHECK_I (pipe_src_w); +PIPE_CONF_CHECK_I (pipe_src_h);PIPE_CONF_CHECK_I (gmch_pfit.control);/* pfit ratios are autocomputed by the hw on gen4+ */
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -215,6 +215,12 @@ struct intel_crtc_config {/* Actual pipe timings ie. what we program into the pipe timing * registers. adjusted_mode.clock is the pipe pixel clock. */ struct drm_display_mode adjusted_mode; + +/* Pipe source size (ie. panel fitter input size) +* All planes will be positioned inside this space, +* and get clipped at the edges. */ +int pipe_src_w, pipe_src_h; +/* Whether to set up the PCH/FDI. Note that we never allow sharing * between pch encoders and cpu encoders. */ bool has_pch_encoder;
drivers/gpu/drm/i915/intel_panel.c +27 -29
139 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.c +15 -18
@@ -450,9 +450,8 @@ void intel_update_fbc(struct drm_device *dev)struct drm_framebuffer *fb;struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj; -const struct drm_display_mode *mode;const struct drm_display_mode *adjusted_mode; -unsigned int max_hdisplay, max_vdisplay; +unsigned int max_width, max_height;if (!I915_HAS_FBC (dev)) {set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED );
@@ -496,7 +495,6 @@ void intel_update_fbc(struct drm_device *dev) fb = crtc->fb; intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj; - mode = &intel_crtc->config.requested_mode; adjusted_mode = &intel_crtc->config.adjusted_mode; if (i915_enable_fbc < 0 &&
@@ -519,14 +517,14 @@ void intel_update_fbc(struct drm_device *dev) }if (IS_G4X (dev) ||INTEL_INFO (dev)->gen >=5 ) { - max_hdisplay =4096 ; - max_vdisplay =2048 ; + max_width =4096 ; + max_height =2048 ; }else { - max_hdisplay =2048 ; - max_vdisplay =1536 ; + max_width =2048 ; + max_height =1536 ; } -if ((mode->hdisplay > max_hdisplay) || - (mode->vdisplay > max_vdisplay)) { +if (intel_crtc->config.pipe_src_w > max_width || + intel_crtc->config.pipe_src_h > max_height) {if (set_no_fbc_reason (dev_priv,FBC_MODE_TOO_LARGE ))DRM_DEBUG_KMS ("mode too large for compression, disabling\n" ); goto out_disable;
@@ -1177,7 +1175,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */
@@ -1264,7 +1262,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;
@@ -1492,7 +1490,7 @@ static void i965_update_wm(struct drm_device *dev) &to_intel_crtc (crtc)->config.adjusted_mode;int clock = adjusted_mode->clock;int htotal = adjusted_mode->htotal; -int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; +int hdisplay =to_intel_crtc (crtc)->config.pipe_src_w;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;
@@ -1613,7 +1611,7 @@ static void i9xx_update_wm(struct drm_device *dev) &to_intel_crtc (enabled)->config.adjusted_mode;int clock = adjusted_mode->clock;int htotal = adjusted_mode->htotal; -int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; +int hdisplay =to_intel_crtc (crtc)->config.pipe_src_w;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;
@@ -1762,7 +1760,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;
@@ -2114,8 +2112,8 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev,if (pfit_size) {uint64_t pipe_w, pipe_h, pfit_w, pfit_h; - pipe_w = intel_crtc->config.requested_mode.hdisplay; - pipe_h = intel_crtc->config.requested_mode.vdisplay; + pipe_w = intel_crtc->config.pipe_src_w; + pipe_h = intel_crtc->config.pipe_src_h; pfit_w = (pfit_size >>16 ) &0xFFFF ; pfit_h = pfit_size &0xFFFF ;if (pipe_w < pfit_w)
@@ -2640,8 +2638,7 @@ static void hsw_compute_wm_parameters(struct drm_device *dev, p->pixel_rate =ilk_pipe_pixel_rate (dev, crtc); p->pri.bytes_per_pixel = crtc->fb->bits_per_pixel /8 ; p->cur.bytes_per_pixel =4 ; - p->pri.horiz_pixels = - intel_crtc->config.requested_mode.hdisplay; + p->pri.horiz_pixels = intel_crtc->config.pipe_src_w; p->cur.horiz_pixels =64 ;/* TODO: for now, assume primary and cursor planes are always enabled. */ p->pri.enabled = true;
drivers/gpu/drm/i915/intel_sprite.c +2 -2
@@ -652,8 +652,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, .y2 = crtc_y + crtc_h, };const struct drm_rect clip = { - .x2 = intel_crtc->config.requested_mode.hdisplay, - .y2 = intel_crtc->config.requested_mode.vdisplay, + .x2 = intel_crtc->config.pipe_src_w, + .y2 = intel_crtc->config.pipe_src_h, }; intel_fb =to_intel_framebuffer (fb);
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 11/14] drm/i915: Add explicit pipe src size to pipe config
Quoted 15 lines · On Wed, Sep 04, 2013 at 06:25:28PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Rather that mess about with hdisplay/vdisplay from
requested_mode, add explicit pipe src size information to pipe config.Now
requested_modeis only really relevant for dvo/sdvo output timings. For everything else eitheradjusted_modeor pipe src size should be used.In many places where we end up using pipe source size, we should actually use the primary plane size, but we don't currently store that information explicitly. As long as we treat primaries as full screen only, we can get away with this. Eventually when we move primaries over to
drm_plane, we need to fix it all up.
Quoted 4 lines
v2: Add a comment to explain what pipe_src_{w,h} are
Add a note about primary planes to commit messageSigned-off-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
Quoted 394 lines
--- drivers/gpu/drm/i915/intel_display.c | 26 +++++++++++------ drivers/gpu/drm/i915/intel_drv.h | 6 ++++ drivers/gpu/drm/i915/intel_panel.c | 56 +++++++++++++++++------------------- drivers/gpu/drm/i915/intel_pm.c | 33 ++++++++++----------- drivers/gpu/drm/i915/intel_sprite.c | 4 +-- 5 files changed, 67 insertions(+), 58 deletions(-)drivers/gpu/drm/i915/intel_display.c +17
-9@@ -4673,7 +4673,6 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode; -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end;/* We need to be careful not to changed the adjusted mode, for otherwise @@ -4726,7 +4725,8 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)* always be the user's requested size. */ I915_WRITE (PIPESRC (pipe), - ((mode->hdisplay -1 ) <<16 ) | (mode->vdisplay -1 )); + ((intel_crtc->config.pipe_src_w -1 ) <<16 ) | + (intel_crtc->config.pipe_src_h -1 )); } static void intel_get_pipe_timings(struct intel_crtc *crtc,@@ -4764,8 +4764,11 @@ static void intel_get_pipe_timings(struct intel_crtc *crtc, } tmp =I915_READ (PIPESRC (crtc->pipe)); - pipe_config->requested_mode.vdisplay = (tmp &0xffff ) +1 ; - pipe_config->requested_mode.hdisplay = ((tmp >>16 ) &0xffff ) +1 ; + pipe_config->pipe_src_h = (tmp &0xffff ) +1 ; + pipe_config->pipe_src_w = ((tmp >>16 ) &0xffff ) +1 ; + + pipe_config->requested_mode.vdisplay = pipe_config->pipe_src_h; + pipe_config->requested_mode.hdisplay = pipe_config->pipe_src_w; } static void intel_crtc_mode_from_pipe_config(struct intel_crtc *intel_crtc,@@ -4861,7 +4864,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_display_mode *mode = &intel_crtc->config.requested_mode;int pipe = intel_crtc->pipe;int plane = intel_crtc->plane;int refclk, num_connectors =0 ;@@ -4960,8 +4962,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,* which should always be the user's requested size. */ I915_WRITE (DSPSIZE (plane), - ((mode->vdisplay -1 ) <<16 ) | - (mode->hdisplay -1 )); + ((intel_crtc->config.pipe_src_h -1 ) <<16 ) | + (intel_crtc->config.pipe_src_w -1 ));I915_WRITE (DSPPOS (plane),0 );i9xx_set_pipeconf (intel_crtc);@@ -8281,6 +8283,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,DRM_DEBUG_KMS ("adjusted mode:\n" );drm_mode_debug_printmodeline (&pipe_config->adjusted_mode);DRM_DEBUG_KMS ("port clock: %d\n" , pipe_config->port_clock); +DRM_DEBUG_KMS ("pipe src size: %dx%d\n" , + pipe_config->pipe_src_w, pipe_config->pipe_src_h); DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n", pipe_config->gmch_pfit.control, pipe_config->gmch_pfit.pgm_ratios,@@ -8332,6 +8336,10 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,drm_mode_copy (&pipe_config->adjusted_mode, mode);drm_mode_copy (&pipe_config->requested_mode, mode); + + pipe_config->pipe_src_w = mode->hdisplay; + pipe_config->pipe_src_h = mode->vdisplay; + pipe_config->cpu_transcoder = (enum transcoder )to_intel_crtc (crtc)->pipe; pipe_config->shared_dpll =DPLL_ID_PRIVATE ;@@ -8681,8 +8689,8 @@ intel_pipe_config_compare(struct drm_device *dev, DRM_MODE_FLAG_NVSYNC); } -PIPE_CONF_CHECK_I (requested_mode.hdisplay); -PIPE_CONF_CHECK_I (requested_mode.vdisplay); +PIPE_CONF_CHECK_I (pipe_src_w); +PIPE_CONF_CHECK_I (pipe_src_h);PIPE_CONF_CHECK_I (gmch_pfit.control);/* pfit ratios are autocomputed by the hw on gen4+ */ drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -215,6 +215,12 @@ struct intel_crtc_config {/* Actual pipe timings ie. what we program into the pipe timing * registers. adjusted_mode.clock is the pipe pixel clock. */ struct drm_display_mode adjusted_mode; + +/* Pipe source size (ie. panel fitter input size) +* All planes will be positioned inside this space, +* and get clipped at the edges. */ +int pipe_src_w, pipe_src_h; +/* Whether to set up the PCH/FDI. Note that we never allow sharing * between pch encoders and cpu encoders. */ bool has_pch_encoder;drivers/gpu/drm/i915/intel_panel.c +27
-29@@ -50,23 +50,22 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_config *pipe_config, int fitting_mode) { -struct drm_display_mode *mode, *adjusted_mode; +struct drm_display_mode *adjusted_mode;int x, y, width, height; - mode = &pipe_config->requested_mode; adjusted_mode = &pipe_config->adjusted_mode; x = y = width = height =0 ;/* Native modes don't need fitting */ -if (adjusted_mode->hdisplay == mode->hdisplay && - adjusted_mode->vdisplay == mode->vdisplay) +if (adjusted_mode->hdisplay == pipe_config->pipe_src_w && + adjusted_mode->vdisplay == pipe_config->pipe_src_h) goto done;switch (fitting_mode) {case DRM_MODE_SCALE_CENTER : - width = mode->hdisplay; - height = mode->vdisplay; + width = pipe_config->pipe_src_w; + height = pipe_config->pipe_src_h; x = (adjusted_mode->hdisplay - width +1 )/2 ; y = (adjusted_mode->vdisplay - height +1 )/2 ;break ;@@ -74,17 +73,17 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,case DRM_MODE_SCALE_ASPECT :/* Scale but preserve the aspect ratio */ { -u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay; -u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; +u32 scaled_width = adjusted_mode->hdisplay * pipe_config->pipe_src_h; +u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->vdisplay;if (scaled_width > scaled_height) {/* pillar */ - width = scaled_height / mode->vdisplay; + width = scaled_height / pipe_config->pipe_src_h;if (width &1 ) width++; x = (adjusted_mode->hdisplay - width +1 ) /2 ; y =0 ; height = adjusted_mode->vdisplay; }else if (scaled_width < scaled_height) {/* letter */ - height = scaled_width / mode->hdisplay; + height = scaled_width / pipe_config->pipe_src_w;if (height &1 ) height++; y = (adjusted_mode->vdisplay - height +1 ) /2 ;@@ -176,14 +175,13 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, {struct drm_device *dev = intel_crtc->base.dev;u32 pfit_control =0 , pfit_pgm_ratios =0 , border =0 ; -struct drm_display_mode *mode, *adjusted_mode; +struct drm_display_mode *adjusted_mode; - mode = &pipe_config->requested_mode; adjusted_mode = &pipe_config->adjusted_mode;/* Native modes don't need fitting */ -if (adjusted_mode->hdisplay == mode->hdisplay && - adjusted_mode->vdisplay == mode->vdisplay) +if (adjusted_mode->hdisplay == pipe_config->pipe_src_w && + adjusted_mode->vdisplay == pipe_config->pipe_src_h) goto out;switch (fitting_mode) {@@ -192,16 +190,16 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,* For centered modes, we have to calculate border widths & * heights and modify the values programmed into the CRTC. */ -centre_horizontally (adjusted_mode, mode->hdisplay); -centre_vertically (adjusted_mode, mode->vdisplay); +centre_horizontally (adjusted_mode, pipe_config->pipe_src_w); +centre_vertically (adjusted_mode, pipe_config->pipe_src_h); border =LVDS_BORDER_ENABLE ;break ;case DRM_MODE_SCALE_ASPECT :/* Scale but preserve the aspect ratio */ if (INTEL_INFO (dev)->gen >=4 ) {u32 scaled_width = adjusted_mode->hdisplay * - mode->vdisplay; -u32 scaled_height = mode->hdisplay * + pipe_config->pipe_src_h; +u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->vdisplay;/* 965+ is easy, it does everything in hw */ @@ -211,12 +209,12 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,else if (scaled_width < scaled_height) pfit_control |=PFIT_ENABLE |PFIT_SCALING_LETTER ; -else if (adjusted_mode->hdisplay != mode->hdisplay) +else if (adjusted_mode->hdisplay != pipe_config->pipe_src_w) pfit_control |=PFIT_ENABLE |PFIT_SCALING_AUTO ; }else {u32 scaled_width = adjusted_mode->hdisplay * - mode->vdisplay; -u32 scaled_height = mode->hdisplay * + pipe_config->pipe_src_h; +u32 scaled_height = pipe_config->pipe_src_w * adjusted_mode->vdisplay;/* * For earlier chips we have to calculate the scaling @@ -226,11 +224,11 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,if (scaled_width > scaled_height) {/* pillar */ centre_horizontally (adjusted_mode, scaled_height / - mode->vdisplay); + pipe_config->pipe_src_h); border =LVDS_BORDER_ENABLE ; -if (mode->vdisplay != adjusted_mode->vdisplay) { -u32 bits =panel_fitter_scaling (mode->vdisplay, adjusted_mode->vdisplay); +if (pipe_config->pipe_src_h != adjusted_mode->vdisplay) { +u32 bits =panel_fitter_scaling (pipe_config->pipe_src_h, adjusted_mode->vdisplay); pfit_pgm_ratios |= (bits <<PFIT_HORIZ_SCALE_SHIFT | bits <<PFIT_VERT_SCALE_SHIFT ); pfit_control |= (PFIT_ENABLE |@@ -240,11 +238,11 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, }else if (scaled_width < scaled_height) {/* letter */ centre_vertically (adjusted_mode, scaled_width / - mode->hdisplay); + pipe_config->pipe_src_w); border =LVDS_BORDER_ENABLE ; -if (mode->hdisplay != adjusted_mode->hdisplay) { -u32 bits =panel_fitter_scaling (mode->hdisplay, adjusted_mode->hdisplay); +if (pipe_config->pipe_src_w != adjusted_mode->hdisplay) { +u32 bits =panel_fitter_scaling (pipe_config->pipe_src_w, adjusted_mode->hdisplay); pfit_pgm_ratios |= (bits <<PFIT_HORIZ_SCALE_SHIFT | bits <<PFIT_VERT_SCALE_SHIFT ); pfit_control |= (PFIT_ENABLE |@@ -265,8 +263,8 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,* Full scaling, even if it changes the aspect ratio. * Fortunately this is all done for us in hw. */ -if (mode->vdisplay != adjusted_mode->vdisplay || - mode->hdisplay != adjusted_mode->hdisplay) { +if (pipe_config->pipe_src_h != adjusted_mode->vdisplay || + pipe_config->pipe_src_w != adjusted_mode->hdisplay) { pfit_control |=PFIT_ENABLE ;if (INTEL_INFO (dev)->gen >=4 ) pfit_control |=PFIT_SCALING_AUTO ;drivers/gpu/drm/i915/intel_pm.c +15
-18@@ -450,9 +450,8 @@ void intel_update_fbc(struct drm_device *dev)struct drm_framebuffer *fb;struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj; -const struct drm_display_mode *mode;const struct drm_display_mode *adjusted_mode; -unsigned int max_hdisplay, max_vdisplay; +unsigned int max_width, max_height;if (!I915_HAS_FBC (dev)) {set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED );@@ -496,7 +495,6 @@ void intel_update_fbc(struct drm_device *dev) fb = crtc->fb; intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj; - mode = &intel_crtc->config.requested_mode; adjusted_mode = &intel_crtc->config.adjusted_mode; if (i915_enable_fbc < 0 &&@@ -519,14 +517,14 @@ void intel_update_fbc(struct drm_device *dev) }if (IS_G4X (dev) ||INTEL_INFO (dev)->gen >=5 ) { - max_hdisplay =4096 ; - max_vdisplay =2048 ; + max_width =4096 ; + max_height =2048 ; }else { - max_hdisplay =2048 ; - max_vdisplay =1536 ; + max_width =2048 ; + max_height =1536 ; } -if ((mode->hdisplay > max_hdisplay) || - (mode->vdisplay > max_vdisplay)) { +if (intel_crtc->config.pipe_src_w > max_width || + intel_crtc->config.pipe_src_h > max_height) {if (set_no_fbc_reason (dev_priv,FBC_MODE_TOO_LARGE ))DRM_DEBUG_KMS ("mode too large for compression, disabling\n" ); goto out_disable;@@ -1177,7 +1175,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ;/* Use the small buffer method to calculate plane watermark */ @@ -1264,7 +1262,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -1492,7 +1490,7 @@ static void i965_update_wm(struct drm_device *dev) &to_intel_crtc (crtc)->config.adjusted_mode;int clock = adjusted_mode->clock;int htotal = adjusted_mode->htotal; -int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; +int hdisplay =to_intel_crtc (crtc)->config.pipe_src_w;int pixel_size = crtc->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1613,7 +1611,7 @@ static void i9xx_update_wm(struct drm_device *dev) &to_intel_crtc (enabled)->config.adjusted_mode;int clock = adjusted_mode->clock;int htotal = adjusted_mode->htotal; -int hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; +int hdisplay =to_intel_crtc (crtc)->config.pipe_src_w;int pixel_size = enabled->fb->bits_per_pixel /8 ;unsigned long line_time_us;int entries;@@ -1762,7 +1760,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, adjusted_mode = &to_intel_crtc (crtc)->config.adjusted_mode; clock = adjusted_mode->clock; htotal = adjusted_mode->htotal; - hdisplay =to_intel_crtc (crtc)->config.requested_mode.hdisplay; + hdisplay =to_intel_crtc (crtc)->config.pipe_src_w; pixel_size = crtc->fb->bits_per_pixel /8 ; line_time_us = (htotal *1000 ) / clock;@@ -2114,8 +2112,8 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev,if (pfit_size) {uint64_t pipe_w, pipe_h, pfit_w, pfit_h; - pipe_w = intel_crtc->config.requested_mode.hdisplay; - pipe_h = intel_crtc->config.requested_mode.vdisplay; + pipe_w = intel_crtc->config.pipe_src_w; + pipe_h = intel_crtc->config.pipe_src_h; pfit_w = (pfit_size >>16 ) &0xFFFF ; pfit_h = pfit_size &0xFFFF ;if (pipe_w < pfit_w)@@ -2640,8 +2638,7 @@ static void hsw_compute_wm_parameters(struct drm_device *dev, p->pixel_rate =ilk_pipe_pixel_rate (dev, crtc); p->pri.bytes_per_pixel = crtc->fb->bits_per_pixel /8 ; p->cur.bytes_per_pixel =4 ; - p->pri.horiz_pixels = - intel_crtc->config.requested_mode.hdisplay; + p->pri.horiz_pixels = intel_crtc->config.pipe_src_w; p->cur.horiz_pixels =64 ;/* TODO: for now, assume primary and cursor planes are always enabled. */ p->pri.enabled = true;drivers/gpu/drm/i915/intel_sprite.c +2
-2@@ -652,8 +652,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, .y2 = crtc_y + crtc_h, };const struct drm_rect clip = { - .x2 = intel_crtc->config.requested_mode.hdisplay, - .y2 = intel_crtc->config.requested_mode.vdisplay, + .x2 = intel_crtc->config.pipe_src_w, + .y2 = intel_crtc->config.pipe_src_h, }; intel_fb =to_intel_framebuffer (fb);Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/14 drm/i915: Fix cursor visibility check with negative coordinates
In reply to [email protected]From: Ville Syrjälä <[email protected]>
When the cursor x coordinate is exactly -cursor_width, the cursor is invisible. And obviously the same holds for the y coordinate and cursor_height.
--- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -7016,7 +7016,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, base =0 ;if (x <0 ) { -if (x + intel_crtc->cursor_width <0 ) +if (x + intel_crtc->cursor_width <=0 ) base =0 ; pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ;
@@ -7025,7 +7025,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, pos |= x <<CURSOR_X_SHIFT ;if (y <0 ) { -if (y + intel_crtc->cursor_height <0 ) +if (y + intel_crtc->cursor_height <=0 ) base =0 ; pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ;
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/14 drm/i915: Fix cursor visibility checks also for the right/bottom screen edges
In reply to [email protected]From: Ville Syrjälä <[email protected]>
First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use
Quoted 1 line
= for the comparison.
So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.
--- drivers/gpu/drm/i915/intel_display.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -9
@@ -7000,19 +7000,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int x = intel_crtc->cursor_x;int y = intel_crtc->cursor_y; -u32 base, pos; +u32 base =0 , pos =0 ;bool visible; - pos =0 ; - -if (on && crtc->enabled && crtc->fb) { +if (on) base = intel_crtc->cursor_addr; -if (x > (int ) crtc->fb->width) - base =0 ; -if (y > (int ) crtc->fb->height) - base =0 ; - }else +if (x >= intel_crtc->config.pipe_src_w) + base =0 ; + +if (y >= intel_crtc->config.pipe_src_h) base =0 ;if (x <0 ) {
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/14] drm/i915: Fix cursor visibility checks also for the right/bottom screen edges
Quoted 11 lines · On Wed, Sep 04, 2013 at 06:25:31PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use
Quoted 1 line
= for the comparison.
So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.
Reviewed-by Chris Wilson <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Merged the entire series to dinq, thanks for patches&review. I've also made a small note that we should have an igt testcase for these cursor corner-cases somewhere ...
Cheers, Daniel
Quoted 41 lines
--- drivers/gpu/drm/i915/intel_display.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_display.c +6
-9@@ -7000,19 +7000,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,int pipe = intel_crtc->pipe;int x = intel_crtc->cursor_x;int y = intel_crtc->cursor_y; -u32 base, pos; +u32 base =0 , pos =0 ;bool visible; - pos =0 ; - -if (on && crtc->enabled && crtc->fb) { +if (on) base = intel_crtc->cursor_addr; -if (x > (int ) crtc->fb->width) - base =0 ; -if (y > (int ) crtc->fb->height) - base =0 ; - }else +if (x >= intel_crtc->config.pipe_src_w) + base =0 ; + +if (y >= intel_crtc->config.pipe_src_h) base =0 ;if (x <0 ) {Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 14/14] drm/i915: Fix cursor visibility checks also for the right/bottom screen edges
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · On Wed, Sep 04, 2013 at 06:25:31PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use
Quoted 1 line
= for the comparison.
So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.
Quoted 6 lines
Quoted 2 lines
Reviewed-by Chris Wilson <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Merged the entire series to dinq, thanks for patches&review. I've also made a small note that we should have an igt testcase for these cursor corner-cases somewhere ...
Which reminds me that I started to write one. Need to finish it up...
Signature · 2 lines
Ville Syrjälä Intel OTC