[PATCH xserver 5/6] modesetting: Remove mode_output member from drmmode_output

Daniel Martin consume.noise at gmail.com
Mon Nov 20 09:54:05 UTC 2017


We failed to handle the mode_output member properly a few times. We can
retrieve it at any time, which we do at various places anyway. Remove
it.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 21 ++++++++-------------
 hw/xfree86/drivers/modesetting/drmmode_display.h |  1 -
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index b2a563713..829cef0b1 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -624,8 +624,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
             drmmode_output = output->driver_private;
             if (drmmode_output->output_id == -1)
                 continue;
-            output_ids[output_count] =
-                drmmode_output->mode_output->connector_id;
+            output_ids[output_count] = drmmode_output->output_id;
             output_count++;
         }
 
@@ -1353,7 +1352,6 @@ drmmode_output_destroy(xf86OutputPtr output)
     drmmode_output_private_ptr drmmode_output = output->driver_private;
     int i;
 
-    drmModeFreeConnector(drmmode_output->mode_output);
     drmModeFreePropertyBlob(drmmode_output->edid_blob);
     drmModeFreePropertyBlob(drmmode_output->tile_blob);
 
@@ -1376,14 +1374,13 @@ static void
 drmmode_output_dpms(xf86OutputPtr output, int mode)
 {
     drmmode_output_private_ptr drmmode_output = output->driver_private;
-    xf86CrtcPtr crtc = output->crtc;
-    drmModeConnectorPtr koutput = drmmode_output->mode_output;
     drmmode_ptr drmmode = drmmode_output->drmmode;
+    xf86CrtcPtr crtc = output->crtc;
 
-    if (!koutput)
+    if (drmmode_output->output_id == -1)
         return;
 
-    drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id,
+    drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
                                 drmmode_output->dpms_enum_id, mode);
 
     if (crtc) {
@@ -1740,7 +1737,6 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
             drmmode_output = output->driver_private;
             drmmode_output->output_id = mode_res->connectors[num];
-            drmmode_output->mode_output = koutput;
             return 1;
         }
     }
@@ -1781,7 +1777,6 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
     }
 
     drmmode_output->output_id = mode_res->connectors[num];
-    drmmode_output->mode_output = koutput;
     drmmode_output->num_encoders = koutput->count_encoders;
     drmmode_output->mode_encoders = kencoders;
     drmmode_output->drmmode = drmmode;
@@ -1805,6 +1800,8 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
     if (dynamic)
         output->randr_output = RROutputCreate(xf86ScrnToScreen(pScrn), output->name, strlen(output->name), output);
+
+    drmModeFreeConnector(koutput);
     return 1;
 
  out_free_encoders:
@@ -2261,10 +2258,10 @@ drmmode_handle_uevents(int fd, void *closure)
         uint32_t con_id, idx;
         drmModeConnectorPtr koutput;
 
-        if (crtc == NULL || drmmode_output->mode_output == NULL)
+        if (crtc == NULL || drmmode_output->output_id == -1)
             continue;
 
-        con_id = drmmode_output->mode_output->connector_id;
+        con_id = drmmode_output->output_id;
         /* Get an updated view of the properties for the current connector and
          * look for the link-status property
          */
@@ -2316,8 +2313,6 @@ drmmode_handle_uevents(int fd, void *closure)
         if (found)
             continue;
 
-        drmModeFreeConnector(drmmode_output->mode_output);
-        drmmode_output->mode_output = NULL;
         drmmode_output->output_id = -1;
 
         changed = TRUE;
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 2174fe07e..c2a15adf7 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -129,7 +129,6 @@ typedef struct {
 typedef struct {
     drmmode_ptr drmmode;
     int output_id;
-    drmModeConnectorPtr mode_output;
     int num_encoders;
     drmModeEncoderPtr *mode_encoders;
     drmModePropertyBlobPtr edid_blob;
-- 
2.13.6



More information about the xorg-devel mailing list