[PATCH xf86-video-ati] Handle Zaphod mode correctly in radeon_mode_hotplug

Alex Deucher alexdeucher at gmail.com
Tue Apr 19 13:58:26 UTC 2016


On Tue, Apr 19, 2016 at 3:41 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> We need to scan both screens of the entity for existing connectors, and
> enumerate DVI & HDMI connectors consistently regardless of which screen
> they're assigned to.
>
> Fixes crash when hot-(un)plugging DVI or HDMI connector in Zaphod mode.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93415
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

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


> ---
>  src/drmmode_display.c | 45 +++++++++++++++++++++++++++++++++++----------
>  1 file changed, 35 insertions(+), 10 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 4c66ca7..84c07c6 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -36,6 +36,7 @@
>  #include "damagestr.h"
>  #include "micmap.h"
>  #include "xf86cmap.h"
> +#include "xf86Priv.h"
>  #include "radeon.h"
>  #include "radeon_bo_helper.h"
>  #include "radeon_glamor.h"
> @@ -2514,10 +2515,12 @@ void
>  radeon_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
>  {
>         xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
> +       RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
>         drmModeResPtr mode_res;
> -       int i, j;
> +       int i, j, s;
>         Bool found;
>         Bool changed = FALSE;
> +       int num_dvi = 0, num_hdmi = 0;
>
>         mode_res = drmModeGetResources(drmmode->fd);
>         if (!mode_res)
> @@ -2553,21 +2556,43 @@ restart_destroy:
>         for (i = 0; i < mode_res->count_connectors; i++) {
>                 found = FALSE;
>
> -               for (j = 0; j < config->num_output; j++) {
> -                       xf86OutputPtr output = config->output[j];
> -                       drmmode_output_private_ptr drmmode_output;
> +               for (s = 0; !found && s < xf86NumScreens; s++) {
> +                       ScrnInfoPtr loop_scrn = xf86Screens[s];
> +                       xf86CrtcConfigPtr loop_config =
> +                               XF86_CRTC_CONFIG_PTR(loop_scrn);
>
> -                       drmmode_output = output->driver_private;
> -                       if (mode_res->connectors[i] == drmmode_output->output_id) {
> -                               found = TRUE;
> -                               break;
> +                       if (RADEONEntPriv(loop_scrn) != pRADEONEnt)
> +                               continue;
> +
> +                       for (j = 0; !found && j < loop_config->num_output; j++) {
> +                               xf86OutputPtr output = loop_config->output[j];
> +                               drmmode_output_private_ptr drmmode_output;
> +
> +                               drmmode_output = output->driver_private;
> +                               if (mode_res->connectors[i] ==
> +                                   drmmode_output->output_id) {
> +                                       found = TRUE;
> +
> +                                       switch(drmmode_output->mode_output->connector_type) {
> +                                       case DRM_MODE_CONNECTOR_DVII:
> +                                       case DRM_MODE_CONNECTOR_DVID:
> +                                       case DRM_MODE_CONNECTOR_DVIA:
> +                                               num_dvi++;
> +                                               break;
> +                                       case DRM_MODE_CONNECTOR_HDMIA:
> +                                       case DRM_MODE_CONNECTOR_HDMIB:
> +                                               num_hdmi++;
> +                                               break;
> +                                       }
> +                               }
>                         }
>                 }
>                 if (found)
>                         continue;
>
> -               changed = TRUE;
> -               drmmode_output_init(scrn, drmmode, mode_res, i, NULL, NULL, 1);
> +               if (drmmode_output_init(scrn, drmmode, mode_res, i, &num_dvi,
> +                                       &num_hdmi, 1) != 0)
> +                       changed = TRUE;
>         }
>
>         if (changed) {
> --
> 2.8.0.rc3
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> https://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list