[PATCH xserver 2/6] modesetting: Retrieve drm connector in drmmode_output_get_modes()

Daniel Martin consume.noise at gmail.com
Mon Nov 20 09:54:02 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 | 28 +++++++++++-------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 1ce41793b..f17598c23 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1223,18 +1223,12 @@ koutput_get_prop_blob(int fd, drmModeConnectorPtr koutput, const char *name)
 }
 
 static void
-drmmode_output_attach_tile(xf86OutputPtr output)
+drmmode_output_attach_tile(xf86OutputPtr output, drmModeConnectorPtr koutput)
 {
     drmmode_output_private_ptr drmmode_output = output->driver_private;
-    drmModeConnectorPtr koutput = drmmode_output->mode_output;
     drmmode_ptr drmmode = drmmode_output->drmmode;
     struct xf86CrtcTileInfo tile_info, *set = NULL;
 
-    if (!koutput) {
-        xf86OutputSetTile(output, NULL);
-        return;
-    }
-
     drmModeFreePropertyBlob(drmmode_output->tile_blob);
 
     /* look for a TILE property */
@@ -1249,10 +1243,9 @@ drmmode_output_attach_tile(xf86OutputPtr output)
 }
 
 static Bool
-has_panel_fitter(xf86OutputPtr output)
+has_panel_fitter(xf86OutputPtr output, drmModeConnectorPtr koutput)
 {
     drmmode_output_private_ptr drmmode_output = output->driver_private;
-    drmModeConnectorPtr koutput = drmmode_output->mode_output;
     drmmode_ptr drmmode = drmmode_output->drmmode;
     int idx;
 
@@ -1266,7 +1259,8 @@ has_panel_fitter(xf86OutputPtr output)
 }
 
 static DisplayModePtr
-drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes)
+drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes,
+        drmModeConnectorPtr koutput)
 {
     xf86MonPtr mon = output->MonInfo;
     DisplayModePtr i, m, preferred = NULL;
@@ -1276,7 +1270,7 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes)
     if (mon && GTF_SUPPORTED(mon->features.msc))
         return Modes;
 
-    if (!has_panel_fitter(output))
+    if (!has_panel_fitter(output, koutput))
         return Modes;
 
     for (m = Modes; m; m = m->next) {
@@ -1312,12 +1306,13 @@ static DisplayModePtr
 drmmode_output_get_modes(xf86OutputPtr output)
 {
     drmmode_output_private_ptr drmmode_output = output->driver_private;
-    drmModeConnectorPtr koutput = drmmode_output->mode_output;
+    drmModeConnectorPtr koutput;
     drmmode_ptr drmmode = drmmode_output->drmmode;
     int i;
-    DisplayModePtr Modes = NULL, Mode;
+    DisplayModePtr Modes = NULL, Mode, ret;
     xf86MonPtr mon = NULL;
 
+    koutput = drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
     if (!koutput)
         return NULL;
 
@@ -1335,7 +1330,7 @@ drmmode_output_get_modes(xf86OutputPtr output)
     }
     xf86OutputSetEDID(output, mon);
 
-    drmmode_output_attach_tile(output);
+    drmmode_output_attach_tile(output, koutput);
 
     /* modes should already be available */
     for (i = 0; i < koutput->count_modes; i++) {
@@ -1346,7 +1341,10 @@ drmmode_output_get_modes(xf86OutputPtr output)
 
     }
 
-    return drmmode_output_add_gtf_modes(output, Modes);
+    ret = drmmode_output_add_gtf_modes(output, Modes, koutput);
+
+    drmModeFreeConnector(koutput);
+    return ret;
 }
 
 static void
-- 
2.13.6



More information about the xorg-devel mailing list