drm/i915: factor out compute_config from __intel_set_mode
Subsystems (2)
PATCH 1/5 drm/i915: factor out compute_config from __intel_set_mode
So we can call it earlier for use in computing mode config changes.
--- drivers/gpu/drm/i915/intel_display.c | 63 +++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_display.c +41 -22
@@ -10938,6 +10938,42 @@ static void update_scanline_offset(struct intel_crtc *crtc) crtc->scanline_offset =1 ; } +static int intel_modeset_compute_config (struct drm_crtc *crtc, +struct drm_display_mode *mode, +struct drm_framebuffer *fb, +unsigned *modeset_pipes, +unsigned *prepare_pipes, +unsigned *disable_pipes) +{ +struct intel_crtc_config *pipe_config =NULL ; +int ret =0 ; + +intel_modeset_affected_pipes (crtc, modeset_pipes, + prepare_pipes, disable_pipes); + +if (!modeset_pipes) + goto out; + +/* Hack: Because we don't (yet) support global modeset on multiple +* crtcs, we don't keep track of the new mode for more than one crtc. +* Hence simply check whether any bit is set in modeset_pipes in all the +* pieces of code that are not yet converted to deal with mutliple crtcs +* changing their mode at the same time. */ + pipe_config =intel_modeset_pipe_config (crtc, fb, mode); +if (IS_ERR (pipe_config)) { + ret =PTR_ERR (pipe_config); + pipe_config =NULL ; + + goto out; + } +intel_dump_pipe_config (to_intel_crtc (crtc), pipe_config, +"[modeset]" ); +to_intel_crtc (crtc)->new_config = pipe_config; + +out: +return ret; +} +static int __intel_set_mode (struct drm_crtc *crtc,struct drm_display_mode *mode,int x,int y,struct drm_framebuffer *fb)
@@ -10950,33 +10986,17 @@ static int __intel_set_mode(struct drm_crtc *crtc,unsigned disable_pipes, prepare_pipes, modeset_pipes;int ret =0 ; + ret =intel_modeset_compute_config (crtc, mode, fb, &modeset_pipes, + &prepare_pipes, &disable_pipes); +if (ret) +return ret; + saved_mode =kmalloc (sizeof (*saved_mode),GFP_KERNEL );if (!saved_mode)return -ENOMEM ; -intel_modeset_affected_pipes (crtc, &modeset_pipes, - &prepare_pipes, &disable_pipes); - *saved_mode = crtc->mode; -/* Hack: Because we don't (yet) support global modeset on multiple -* crtcs, we don't keep track of the new mode for more than one crtc. -* Hence simply check whether any bit is set in modeset_pipes in all the -* pieces of code that are not yet converted to deal with mutliple crtcs -* changing their mode at the same time. */ -if (modeset_pipes) { - pipe_config =intel_modeset_pipe_config (crtc, fb, mode); -if (IS_ERR (pipe_config)) { - ret =PTR_ERR (pipe_config); - pipe_config =NULL ; - - goto out; - } -intel_dump_pipe_config (to_intel_crtc (crtc), pipe_config, -"[modeset]" ); -to_intel_crtc (crtc)->new_config = pipe_config; - } -/* * See if the config requires any additional preparation, e.g. * to adjust global state with pipes off. We need to do this
@@ -11070,7 +11090,6 @@ done:if (ret && crtc->enabled) crtc->mode = *saved_mode; -out:kfree (pipe_config);kfree (saved_mode);return ret;
Signature · 1 line
1.9.1
PATCH 2/5 drm/i915: factor compute_config out of __intel_mode_set
This allows us to calculate the full pipe config before we do any mode setting work.
--- drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +29 -11
@@ -10976,21 +10976,18 @@ out:static int __intel_set_mode (struct drm_crtc *crtc,struct drm_display_mode *mode, -int x,int y,struct drm_framebuffer *fb) +int x,int y,struct drm_framebuffer *fb, +unsigned disable_pipes, +unsigned prepare_pipes, +unsigned modeset_pipes) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct drm_display_mode *saved_mode;struct intel_crtc_config *pipe_config =NULL ;struct intel_crtc *intel_crtc; -unsigned disable_pipes, prepare_pipes, modeset_pipes;int ret =0 ; - ret =intel_modeset_compute_config (crtc, mode, fb, &modeset_pipes, - &prepare_pipes, &disable_pipes); -if (ret) -return ret; - saved_mode =kmalloc (sizeof (*saved_mode),GFP_KERNEL );if (!saved_mode)return -ENOMEM ;
@@ -11095,13 +11092,17 @@ done:return ret; } -static int intel_set_mode (struct drm_crtc *crtc, -struct drm_display_mode *mode, -int x,int y,struct drm_framebuffer *fb) +static int intel_set_mode_pipes (struct drm_crtc *crtc, +struct drm_display_mode *mode, +int x,int y,struct drm_framebuffer *fb, +unsigned modeset_pipes, +unsigned prepare_pipes, +unsigned disable_pipes) {int ret; - ret =__intel_set_mode (crtc, mode, x, y, fb); + ret =__intel_set_mode (crtc, mode, x, y, fb, modeset_pipes, + prepare_pipes, disable_pipes);if (ret ==0 )intel_modeset_check_state (crtc->dev);
@@ -11109,6 +11110,23 @@ static int intel_set_mode(struct drm_crtc *crtc,return ret; } +static int intel_set_mode (struct drm_crtc *crtc, +struct drm_display_mode *mode, +int x,int y,struct drm_framebuffer *fb) +{ +unsigned modeset_pipes, prepare_pipes, disable_pipes; +int ret; + + ret =intel_modeset_compute_config (crtc, mode, fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); +if (ret) +return ret; + +return intel_set_mode_pipes (crtc, mode, x, y, fb, modeset_pipes, + prepare_pipes, disable_pipes); +} +void intel_crtc_restore_mode (struct drm_crtc *crtc) {intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb);
Signature · 1 line
1.9.1
PATCH 3/5 drm/i915: use compute_config in set_config
In reply to Jesse BarnesThis will allow us to consult more info before deciding whether to flip or do a full mode set.
--- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +30 -6
@@ -11455,6 +11455,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)struct drm_device *dev;struct drm_mode_set save_set;struct intel_set_config *config; +unsigned modeset_pipes, prepare_pipes, disable_pipes;int ret;BUG_ON (!set);
@@ -11500,9 +11501,17 @@ static int intel_crtc_set_config(struct drm_mode_set *set)if (ret) goto fail; + ret =intel_modeset_compute_config (set->crtc, set->mode, set->fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); +if (ret) + goto fail; +if (config->mode_changed) { - ret =intel_set_mode (set->crtc, set->mode, - set->x, set->y, set->fb); + ret =intel_set_mode_pipes (set->crtc, set->mode, + set->x, set->y, set->fb, + modeset_pipes, prepare_pipes, + disable_pipes); }else if (config->fb_changed) {struct intel_crtc *intel_crtc =to_intel_crtc (set->crtc);
@@ -11549,8 +11558,10 @@ fail:/* Try to restore the config */ if (config->mode_changed && -intel_set_mode (save_set.crtc, save_set.mode, - save_set.x, save_set.y, save_set.fb)) +intel_set_mode_pipes (save_set.crtc, save_set.mode, + save_set.x, save_set.y, save_set.fb, + modeset_pipes, prepare_pipes, + disable_pipes))DRM_ERROR ("failed to restore config after modeset failure\n" ); }
@@ -13361,14 +13372,27 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,for_each_pipe (dev_priv, pipe) {struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +unsigned modeset_pipes, prepare_pipes, disable_pipes; +int ret; + + ret =intel_modeset_compute_config (crtc, &crtc->mode, + crtc->primary->fb, + &modeset_pipes, + &prepare_pipes, + &disable_pipes); +if (ret) { +DRM_DEBUG_KMS ("prepare failed\n" ); + goto out; + }__intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->fb, modeset_pipes, + prepare_pipes, disable_pipes); } }else {intel_modeset_update_staged_output_state (dev); } - +out:intel_modeset_check_state (dev); }
Signature · 1 line
1.9.1
Re: [PATCH 3/5] drm/i915: use compute_config in set_config
Quoted 64 lines · Jesse Barnes
This will allow us to consult more info before deciding whether to flip or do a full mode set.
Signed-off-by Jesse Barnes <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +22
-4@@ -11455,6 +11455,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)struct drm_device *dev;struct drm_mode_set save_set;struct intel_set_config *config; +unsigned modeset_pipes, prepare_pipes, disable_pipes;int ret;BUG_ON (!set);@@ -11500,9 +11501,17 @@ static int intel_crtc_set_config(struct drm_mode_set *set)if (ret) goto fail; + ret =intel_modeset_compute_config (set->crtc, set->mode, set->fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); +if (ret) + goto fail; +if (config->mode_changed) { - ret =intel_set_mode (set->crtc, set->mode, - set->x, set->y, set->fb); + ret =intel_set_mode_pipes (set->crtc, set->mode, + set->x, set->y, set->fb, + modeset_pipes, prepare_pipes, + disable_pipes); }else if (config->fb_changed) {struct intel_crtc *intel_crtc =to_intel_crtc (set->crtc);@@ -11549,8 +11558,10 @@ fail:/* Try to restore the config */ if (config->mode_changed && -intel_set_mode (save_set.crtc, save_set.mode, - save_set.x, save_set.y, save_set.fb)) +intel_set_mode_pipes (save_set.crtc, save_set.mode, + save_set.x, save_set.y, save_set.fb, + modeset_pipes, prepare_pipes, + disable_pipes))DRM_ERROR ("failed to restore config after modeset failure\n" ); }@@ -13361,14 +13372,27 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,for_each_pipe (dev_priv, pipe) {struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +unsigned modeset_pipes, prepare_pipes, disable_pipes; +int ret; + + ret = intel_modeset_compute_config(crtc, &crtc->mode, + crtc->primary->fb, + &modeset_pipes, + &prepare_pipes,
drivers/gpu/drm/i915/intel_display.c void intel_modeset_setup_hw_state(struct drm_device *dev, · line 13390
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-1+ &disable_pipes); +if (ret) { +DRM_DEBUG_KMS ("prepare failed\n" ); + goto out; + }__intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->fb, modeset_pipes, + prepare_pipes, disable_pipes);
This doesn't make sense -- where's the change in function definition? I am pretty sure that as we iterate over each pipe, we only want to operate on that pipe here.
How I wish we didn't need force_restore.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 3/5] drm/i915: use compute_config in set_config
Quoted 80 lines · On Thu, 23 Oct 2014 19:28:18 +0100 Chris Wilson <[email protected]>…
Quoted 64 lines · Jesse Barnes
This will allow us to consult more info before deciding whether to flip or do a full mode set.
Signed-off-by Jesse Barnes <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +22
-4@@ -11455,6 +11455,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)struct drm_device *dev;struct drm_mode_set save_set;struct intel_set_config *config; +unsigned modeset_pipes, prepare_pipes, disable_pipes;int ret;BUG_ON (!set);@@ -11500,9 +11501,17 @@ static int intel_crtc_set_config(struct drm_mode_set *set)if (ret) goto fail; + ret =intel_modeset_compute_config (set->crtc, set->mode, set->fb, + &modeset_pipes, &prepare_pipes, + &disable_pipes); +if (ret) + goto fail; +if (config->mode_changed) { - ret =intel_set_mode (set->crtc, set->mode, - set->x, set->y, set->fb); + ret =intel_set_mode_pipes (set->crtc, set->mode, + set->x, set->y, set->fb, + modeset_pipes, prepare_pipes, + disable_pipes); }else if (config->fb_changed) {struct intel_crtc *intel_crtc =to_intel_crtc (set->crtc);@@ -11549,8 +11558,10 @@ fail:/* Try to restore the config */ if (config->mode_changed && -intel_set_mode (save_set.crtc, save_set.mode, - save_set.x, save_set.y, save_set.fb)) +intel_set_mode_pipes (save_set.crtc, save_set.mode, + save_set.x, save_set.y, save_set.fb, + modeset_pipes, prepare_pipes, + disable_pipes))DRM_ERROR ("failed to restore config after modeset failure\n" ); }@@ -13361,14 +13372,27 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,for_each_pipe (dev_priv, pipe) {struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +unsigned modeset_pipes, prepare_pipes, disable_pipes; +int ret; + + ret = intel_modeset_compute_config(crtc, &crtc->mode, + crtc->primary->fb, + &modeset_pipes, + &prepare_pipes,drivers/gpu/drm/i915/intel_display.c void intel_modeset_setup_hw_state(struct drm_device *dev, · line 13390
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7
-1+ &disable_pipes); +if (ret) { +DRM_DEBUG_KMS ("prepare failed\n" ); + goto out; + }__intel_set_mode (crtc, &crtc->mode, crtc->x, crtc->y, - crtc->primary->fb); + crtc->primary->fb, modeset_pipes, + prepare_pipes, disable_pipes);This doesn't make sense -- where's the change in function definition? I am pretty sure that as we iterate over each pipe, we only want to operate on that pipe here.
Quoted 1 line
How I wish we didn't need
force_restore.
Hm, let's see, this was a mechanical conversion leftover from an earlier patch. I don't think it's needed, but it should be equivalent, given the changes to __intel_set_mode() right?
Ah I see, some patch series fail on my part. 2/5 didn't get posted and should have been squashed with 1/5. Let's see if I can make this clearer.
I'll post an updated series with some pfit changes as well.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 4/5 drm/i915/hdmi: fetch infoframe status in get_config
In reply to Jesse BarnesThis is useful for checking things later.
--- drivers/gpu/drm/i915/intel_drv.h | 4 +++ drivers/gpu/drm/i915/intel_hdmi.c | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -290,6 +290,9 @@ struct intel_crtc_config {* between pch encoders and cpu encoders. */ bool has_pch_encoder; +/* Are we sending infoframes on the attached port */ +bool has_infoframe; +/* CPU Transcoder for the pipe. Currently this can only differ from the * pipe on Haswell (where we have a special eDP transcoder). */ enum transcoder cpu_transcoder;
@@ -541,6 +544,7 @@ struct intel_hdmi {void (*set_infoframes)(struct drm_encoder *encoder,bool enable,struct drm_display_mode *adjusted_mode); +bool (*infoframe_enabled)(struct drm_encoder *encoder); };struct intel_dp_mst_encoder ;
drivers/gpu/drm/i915/intel_hdmi.c +61 -0
115 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 5/5 drm/i915: check for audio and infoframe changes across mode sets
In reply to Jesse BarnesIf these change (e.g. after a modeset following a fastboot), we need to do a full mode set.
--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_display.c +10 -0
@@ -11507,6 +11507,16 @@ static int intel_crtc_set_config(struct drm_mode_set *set)if (ret) goto fail; +if (to_intel_crtc (set->crtc)->new_config->has_audio != +to_intel_crtc (set->crtc)->config.has_audio) + config->mode_changed = true; + +/* Force mode sets for any infoframe stuff */ +if (to_intel_crtc (set->crtc)->new_config->has_infoframe || +to_intel_crtc (set->crtc)->config.has_infoframe) + config->mode_changed = true; + +if (config->mode_changed) { ret = intel_set_mode_pipes(set->crtc, set->mode, set->x, set->y, set->fb,
Signature · 1 line
1.9.1