[PATCH xf86-video-amdgpu 1/3] xf86-video-modesetting: Record non-desktop kernel property at PreInit time [v2]

Keith Packard keithp at keithp.com
Sat Jul 7 00:36:45 UTC 2018


Save any value of the kernel non-desktop property in the xf86Output
structure to avoid non-desktop outputs in the default configuration.

v2: Support X server 1.13

Signed-off-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Adam Jackson <ajax at nwnk.net>
---
 configure.ac          |  6 ++++++
 src/drmmode_display.c | 15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 2593f52..378b5aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,12 @@ AC_CHECK_DECL(RegionDuplicate,
 	      [#include <xorg-server.h>
 	       #include <regionstr.h>])
 
+AC_CHECK_DECL(RROutputSetNonDesktop,
+	      [AC_DEFINE(HAVE_NONDESKTOP, 1,
+	      [Have non-desktop property support API])], [],
+	      [#include <xorg-server.h>
+	       #include <randrstr.h>])
+
 AC_CHECK_DECL(fbGlyphs,
 	      [AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [],
 	      [#include <X11/Xmd.h>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9364a88..92cb947 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2597,6 +2597,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	drmModePropertyBlobPtr path_blob = NULL;
 	char name[32];
 	int i;
+#ifdef HAVE_NONDESKTOP
+	Bool nonDesktop = FALSE;
+#endif
 	const char *s;
 
 	koutput =
@@ -2606,6 +2609,11 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 		return 0;
 
 	path_blob = koutput_get_prop_blob(pAMDGPUEnt->fd, koutput, "PATH");
+#ifdef HAVE_NONDESKTOP
+	i = koutput_get_prop_idx(pAMDGPUEnt->fd, koutput, DRM_MODE_PROP_RANGE, RR_PROPERTY_NON_DESKTOP);
+	if (i >= 0)
+		nonDesktop = koutput->prop_values[i] != 0;
+#endif
 
 	kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
 	if (!kencoders) {
@@ -2638,6 +2646,9 @@ 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;
+#ifdef HAVE_NONDESKTOP
+			output->non_desktop = nonDesktop;
+#endif
 			for (i = 0; i < koutput->count_encoders; i++) {
 				drmModeFreeEncoder(kencoders[i]);
 			}
@@ -2681,7 +2692,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	output->interlaceAllowed = TRUE;
 	output->doubleScanAllowed = TRUE;
 	output->driver_private = drmmode_output;
-
+#ifdef HAVE_NONDESKTOP
+	output->non_desktop = nonDesktop;
+#endif
 	output->possible_crtcs = 0xffffffff;
 	for (i = 0; i < koutput->count_encoders; i++) {
 		output->possible_crtcs &= kencoders[i]->possible_crtcs;
-- 
2.17.1



More information about the xorg-devel mailing list