On Thu, Jul 1, 2010 at 2:49 AM, Ben Skeggs <skeg...@gmail.com> wrote:
> From: Ben Skeggs <bske...@redhat.com>
>
> Original behaviour will be preserved for drivers that don't implement
> disable() hooks for an encoder.
>
> Signed-off-by: Ben Skeggs <bske...@redhat.com>

Reviewed-by: Alex Deucher <alexdeuc...@gmail.com>

> ---
>  drivers/gpu/drm/drm_crtc_helper.c |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 9b2a541..1eaa315 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -201,6 +201,17 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
>  }
>  EXPORT_SYMBOL(drm_helper_crtc_in_use);
>
> +static void
> +drm_encoder_disable(struct drm_encoder *encoder)
> +{
> +       struct drm_encoder_helper_funcs *encoder_funcs = 
> encoder->helper_private;
> +
> +       if (encoder_funcs->disable)
> +               (*encoder_funcs->disable)(encoder);
> +       else
> +               (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
> +}
> +
>  /**
>  * drm_helper_disable_unused_functions - disable unused objects
>  * @dev: DRM device
> @@ -215,7 +226,6 @@ void drm_helper_disable_unused_functions(struct 
> drm_device *dev)
>  {
>        struct drm_encoder *encoder;
>        struct drm_connector *connector;
> -       struct drm_encoder_helper_funcs *encoder_funcs;
>        struct drm_crtc *crtc;
>
>        list_for_each_entry(connector, &dev->mode_config.connector_list, head) 
> {
> @@ -226,12 +236,8 @@ void drm_helper_disable_unused_functions(struct 
> drm_device *dev)
>        }
>
>        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
> -               encoder_funcs = encoder->helper_private;
>                if (!drm_helper_encoder_in_use(encoder)) {
> -                       if (encoder_funcs->disable)
> -                               (*encoder_funcs->disable)(encoder);
> -                       else
> -                               (*encoder_funcs->dpms)(encoder, 
> DRM_MODE_DPMS_OFF);
> +                       drm_encoder_disable(encoder);
>                        /* disconnector encoder from any connector */
>                        encoder->crtc = NULL;
>                }
> @@ -292,11 +298,11 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
>                encoder_funcs = encoder->helper_private;
>                /* Disable unused encoders */
>                if (encoder->crtc == NULL)
> -                       (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
> +                       drm_encoder_disable(encoder);
>                /* Disable encoders whose CRTC is about to change */
>                if (encoder_funcs->get_crtc &&
>                    encoder->crtc != (*encoder_funcs->get_crtc)(encoder))
> -                       (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
> +                       drm_encoder_disable(encoder);
>        }
>  }
>
> --
> 1.7.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to