* [PATCH 1/4] drm: try to restore previous CRTC config if mode set fails
@ 2011-11-07 18:39 Jesse Barnes
2011-11-07 20:22 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Jesse Barnes @ 2011-11-07 18:39 UTC (permalink / raw)
To: dri-devel
We restore the CRTC, encoder, and connector configurations, but if the
mode set failed, the attached display may have been turned off, so we
need to try set_config again to restore things to the way they were.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/gpu/drm/drm_crtc_helper.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index f88a9b2..edaf903 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -479,6 +479,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
struct drm_connector *save_connectors, *connector;
int count = 0, ro, fail = 0;
struct drm_crtc_helper_funcs *crtc_funcs;
+ struct drm_mode_set save_set;
int ret = 0;
int i;
@@ -551,6 +552,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
save_connectors[count++] = *connector;
}
+ save_set.crtc = set->crtc;
+ save_set.mode = &set->crtc->mode;
+ save_set.x = set->crtc->x;
+ save_set.y = set->crtc->y;
+ save_set.fb = set->crtc->fb;
+
/* We should be able to check here if the fb has the same properties
* and then just flip_or_move it */
if (set->crtc->fb != set->fb) {
@@ -716,6 +723,12 @@ fail:
*connector = save_connectors[count++];
}
+ /* Try to restore the config */
+ if (mode_changed &&
+ !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
+ save_set.y, save_set.fb))
+ DRM_ERROR("failed to restore config after modeset failure\n");
+
kfree(save_connectors);
kfree(save_encoders);
kfree(save_crtcs);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/4] drm: try to restore previous CRTC config if mode set fails
2011-11-07 18:39 [PATCH 1/4] drm: try to restore previous CRTC config if mode set fails Jesse Barnes
@ 2011-11-07 20:22 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2011-11-07 20:22 UTC (permalink / raw)
To: Jesse Barnes; +Cc: dri-devel
On Mon, Nov 7, 2011 at 1:39 PM, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> We restore the CRTC, encoder, and connector configurations, but if the
> mode set failed, the attached display may have been turned off, so we
> need to try set_config again to restore things to the way they were.
>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
> ---
> drivers/gpu/drm/drm_crtc_helper.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index f88a9b2..edaf903 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -479,6 +479,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
> struct drm_connector *save_connectors, *connector;
> int count = 0, ro, fail = 0;
> struct drm_crtc_helper_funcs *crtc_funcs;
> + struct drm_mode_set save_set;
> int ret = 0;
> int i;
>
> @@ -551,6 +552,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
> save_connectors[count++] = *connector;
> }
>
> + save_set.crtc = set->crtc;
> + save_set.mode = &set->crtc->mode;
> + save_set.x = set->crtc->x;
> + save_set.y = set->crtc->y;
> + save_set.fb = set->crtc->fb;
> +
> /* We should be able to check here if the fb has the same properties
> * and then just flip_or_move it */
> if (set->crtc->fb != set->fb) {
> @@ -716,6 +723,12 @@ fail:
> *connector = save_connectors[count++];
> }
>
> + /* Try to restore the config */
> + if (mode_changed &&
> + !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
> + save_set.y, save_set.fb))
> + DRM_ERROR("failed to restore config after modeset failure\n");
> +
> kfree(save_connectors);
> kfree(save_encoders);
> kfree(save_crtcs);
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-07 20:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 18:39 [PATCH 1/4] drm: try to restore previous CRTC config if mode set fails Jesse Barnes
2011-11-07 20:22 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.