tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Limit DRM resolution



Hi!

I'd like to commit the attached diff.

I need this as a workaround for an older graphics card which supports
only a smaller resolution than the monitor, but our DRM code is not
smart enough to check the card doesn't support it.

Without this diff, the graphical console is not displayed for me (just
a black screen) because the DRM code wants to use a higher resolution
than the card supports.

Ok to commit?
 Thomas
? sys/arch/amd64/conf/MIAU
Index: sys/external/bsd/drm2/dist/drm/drm_modes.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/drm_modes.c,v
retrieving revision 1.8
diff -u -r1.8 drm_modes.c
--- sys/external/bsd/drm2/dist/drm/drm_modes.c	14 Feb 2020 04:38:36 -0000	1.8
+++ sys/external/bsd/drm2/dist/drm/drm_modes.c	19 Mar 2020 22:45:55 -0000
@@ -1019,9 +1019,19 @@
 	if (maxX > 0 && mode->hdisplay > maxX)
 		return MODE_VIRTUAL_X;
 
+#if defined(DRM_MAX_RESOLUTION_HORIZONTAL)
+	if (mode->hdisplay > DRM_MAX_RESOLUTION_HORIZONTAL)
+		return MODE_VIRTUAL_X;
+#endif
+
 	if (maxY > 0 && mode->vdisplay > maxY)
 		return MODE_VIRTUAL_Y;
 
+#if defined(DRM_MAX_RESOLUTION_VERTICAL)
+	if (mode->vdisplay > DRM_MAX_RESOLUTION_VERTICAL)
+		return MODE_VIRTUAL_Y;
+#endif
+
 	return MODE_OK;
 }
 EXPORT_SYMBOL(drm_mode_validate_size);
Index: sys/arch/amd64/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/GENERIC,v
retrieving revision 1.563
diff -u -r1.563 GENERIC
--- sys/arch/amd64/conf/GENERIC	17 Feb 2020 06:32:46 -0000	1.563
+++ sys/arch/amd64/conf/GENERIC	19 Mar 2020 22:45:56 -0000
@@ -444,6 +444,9 @@
 # DRMUMS drivers
 #viadrmums*	at drm?
 
+#options 	DRM_MAX_RESOLUTION_HORIZONTAL=1920	# Limit DRM size in horizontal dimension
+#options 	DRM_MAX_RESOLUTION_VERTICAL=1080	# Limit DRM size in vertical dimension
+
 # Cryptographic Devices
 
 # PCI cryptographic devices


Home | Main Index | Thread Index | Old Index