All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xf86-video-ati 1/2] Refactor radeon_mode_hotplug
Date: Wed,  9 Nov 2016 16:16:59 +0900	[thread overview]
Message-ID: <20161109071700.24235-1-michel@daenzer.net> (raw)

From: Michel Dänzer <michel.daenzer@amd.com>

Preparation for the next change, no functional change intended.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 58 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 34 insertions(+), 24 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 28b932e..fd5c80e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2543,6 +2543,37 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
     return TRUE;
 }
 
+static Bool
+drmmode_find_output(ScrnInfoPtr scrn, int output_id, int *num_dvi,
+		    int *num_hdmi)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+	int i;
+
+	for (i = 0; i < config->num_output; i++) {
+		xf86OutputPtr output = config->output[i];
+		drmmode_output_private_ptr drmmode_output = output->driver_private;
+
+		if (drmmode_output->output_id == output_id) {
+			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;
+			}
+
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
 void
 radeon_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 {
@@ -2590,35 +2621,14 @@ restart_destroy:
 
 		for (s = 0; !found && s < xf86NumScreens; s++) {
 			ScrnInfoPtr loop_scrn = xf86Screens[s];
-			xf86CrtcConfigPtr loop_config =
-				XF86_CRTC_CONFIG_PTR(loop_scrn);
 
 			if (strcmp(loop_scrn->driverName, scrn->driverName) ||
 			    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;
-					}
-				}
-			}
+			found = drmmode_find_output(loop_scrn,
+						    mode_res->connectors[i],
+						    &num_dvi, &num_hdmi);
 		}
 		if (found)
 			continue;
-- 
2.10.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2016-11-09  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09  7:16 Michel Dänzer [this message]
     [not found] ` <20161109071700.24235-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-11-09  7:17   ` [PATCH xf86-video-ati 2/2] Use pRADEONEnt to find both screens of a GPU in radeon_mode_hotplug Michel Dänzer
     [not found]     ` <20161109071700.24235-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-11-09 13:58       ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161109071700.24235-1-michel@daenzer.net \
    --to=michel-otuistvhuppr7s880joybq@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.