[PATCH xf86-video-amdgpu] Handle CRTC DPMS from output DPMS hooks

Alex Deucher alexdeucher at gmail.com
Wed Jun 24 08:59:59 PDT 2015


On Mon, Jun 15, 2015 at 11:42 PM, 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.
>
> (imported from commit c4ae0e2cbcc0e2ebf9f13ee92d59b5120254a1dc)
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

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

> ---
>  src/drmmode_display.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 19f0f19..c418dfd 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -235,7 +235,8 @@ int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc)
>         return Success;
>  }
>
> -static void drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
> +static void
> +drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
>  {
>         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>         ScrnInfoPtr scrn = crtc->scrn;
> @@ -296,6 +297,12 @@ static void 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 */
> +}
> +
>  /* TODO: currently this function only clear the front buffer to zero */
>  /* Moving forward, we might to look into making the copy with glamor instead */
>  void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
> @@ -959,9 +966,14 @@ static void 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);
>  }
>
>  static Bool drmmode_property_ignore(drmModePropertyPtr prop)
> @@ -1681,6 +1693,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);
> --
> 2.1.4
>
> _______________________________________________
> 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