[PATCH xserver 09/11] modesetting: Retrieve drm connector in drmmode_output_detect()

Daniel Martin consume.noise at gmail.com
Tue Nov 7 09:38:40 UTC 2017


So, we don't rely on the mode_output member.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 763f5c526..02edaeb1e 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1142,21 +1142,19 @@ drmmode_output_detect(xf86OutputPtr output)
     /* go to the hw and retrieve a new output struct */
     drmmode_output_private_ptr drmmode_output = output->driver_private;
     drmmode_ptr drmmode = drmmode_output->drmmode;
+    drmModeConnectorPtr koutput;
     xf86OutputStatus status;
 
     if (drmmode_output->output_id == -1)
         return XF86OutputStatusDisconnected;
 
-    drmModeFreeConnector(drmmode_output->mode_output);
-
-    drmmode_output->mode_output =
-        drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
-    if (!drmmode_output->mode_output) {
+    koutput = drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
+    if (!koutput) {
         drmmode_output->output_id = -1;
         return XF86OutputStatusDisconnected;
     }
 
-    switch (drmmode_output->mode_output->connection) {
+    switch (koutput->connection) {
     case DRM_MODE_CONNECTED:
         status = XF86OutputStatusConnected;
         break;
@@ -1168,6 +1166,8 @@ drmmode_output_detect(xf86OutputPtr output)
         status = XF86OutputStatusUnknown;
         break;
     }
+
+    drmModeFreeConnector(koutput);
     return status;
 }
 
-- 
2.13.6



More information about the xorg-devel mailing list