[PATCH] Handle CRTC DPMS from output DPMS hooks

Alex Deucher alexdeucher at gmail.com
Mon Jun 30 08:34:36 PDT 2014


On Mon, Jun 30, 2014 at 4:31 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> This fixes at least two issues:
>
> The CRTC DPMS hook isn't called after a modeset, so the vertical blank
> interrupt emulation code considered the CRTC disabled after a modeset. As
> a side effect, page flipping was no longer used after a modeset.
>
> This change also makes sure the vertical blank interrupt emulation code
> runs before the hardware CRTC is disabled and after it's enabled from the
> output DPMS hook. The wrong order could cause gnome-shell to hang after
> a suspend/resume and/or DPMS off/on cycle.
>

This may also fix some dpm issues since the dpm updates are handled in
the crtc dpms.

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  src/drmmode_display.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index bd8e701..c366203 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -247,7 +247,7 @@ int drmmode_get_current_ust(int drm_fd, CARD64 *ust)
>  }
>
>  static void
> -drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
> +drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
>  {
>         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>         ScrnInfoPtr scrn = crtc->scrn;
> @@ -308,6 +308,12 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
>         drmmode_crtc->dpms_mode = mode;
>  }
>
> +static void
> +drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
> +{
> +       /* Nothing to do. drmmode_do_crtc_dpms() is called as appropriate */
> +}
> +
>  static PixmapPtr
>  create_pixmap_for_fbcon(drmmode_ptr drmmode,
>                         ScrnInfoPtr pScrn, int fbcon_id)
> @@ -973,9 +979,14 @@ drmmode_output_dpms(xf86OutputPtr output, int mode)
>         drmModeConnectorPtr koutput = drmmode_output->mode_output;
>         drmmode_ptr drmmode = drmmode_output->drmmode;
>
> +       if (mode != DPMSModeOn && output->crtc)
> +               drmmode_do_crtc_dpms(output->crtc, mode);
> +
>         drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id,
>                                     drmmode_output->dpms_enum_id, mode);
> -       return;
> +
> +       if (mode == DPMSModeOn && output->crtc)
> +               drmmode_do_crtc_dpms(output->crtc, mode);
>  }
>
>
> @@ -1833,6 +1844,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
>
>                 /* Skip disabled CRTCs */
>                 if (!crtc->enabled) {
> +                       drmmode_do_crtc_dpms(crtc, DPMSModeOff);
>                         drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
>                                        0, 0, 0, NULL, 0, NULL);
>                         continue;
> --
> 2.0.0
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list