Source-Changes-HG archive

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

[src/trunk]: src drm(4): allow limiting maximum X/Y resolution



details:   https://anonhg.NetBSD.org/src/rev/ae6b350631b2
branches:  trunk
changeset: 953477:ae6b350631b2
user:      wiz <wiz%NetBSD.org@localhost>
date:      Wed Mar 10 07:23:42 2021 +0000

description:
drm(4): allow limiting maximum X/Y resolution

With some drivers (at least radeon(4)), in some cases the driver
does not choose the resolution correctly.  The options
DRM_MAX_RESOLUTION_HORIZONTAL and DRM_MAX_RESOLUTION_VERTICAL allow
limiting the maximum resolution in X and Y direction.

diffstat:

 share/man/man4/drm.4                       |  15 +++++++++++++--
 sys/arch/amd64/conf/GENERIC                |   7 +++++--
 sys/external/bsd/drm2/dist/drm/drm_modes.c |  14 ++++++++++++--
 3 files changed, 30 insertions(+), 6 deletions(-)

diffs (109 lines):

diff -r dce8c55e6a41 -r ae6b350631b2 share/man/man4/drm.4
--- a/share/man/man4/drm.4      Wed Mar 10 06:38:44 2021 +0000
+++ b/share/man/man4/drm.4      Wed Mar 10 07:23:42 2021 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: drm.4,v 1.17 2018/07/18 16:41:53 wiz Exp $
+.\"    $NetBSD: drm.4,v 1.18 2021/03/10 07:23:42 wiz Exp $
 .\"
 .\" Copyright (c) 2007, 2013 Thomas Klausner
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 10, 2018
+.Dd March 10, 2021
 .Dt DRM 4
 .Os
 .Sh NAME
@@ -41,6 +41,8 @@
 .Pp
 .Cd options        DRM_DEBUG
 .Cd options        DRM_NO_AGP
+.Cd options        DRM_MAX_RESOLUTION_HORIZONTAL=integer
+.Cd options        DRM_MAX_RESOLUTION_VERTICAL=integer
 .Sh DESCRIPTION
 The Direct Rendering Manager is part of the Direct Rendering
 Infrastructure for supporting video acceleration (3d acceleration,
@@ -88,6 +90,15 @@
 .Xr pkgsrc 7
 do so automatically where supported.
 .Pp
+With some drivers (at least
+.Xr radeon 4 ) ,
+in some cases the driver does not choose the resolution correctly.
+The options
+.Dv DRM_MAX_RESOLUTION_HORIZONTAL
+and
+.Dv DRM_MAX_RESOLUTION_VERTICAL
+allow limiting the maximum resolution in X and Y direction.
+.Pp
 .Xr X 7
 will attempt to create the device node automatically.
 To create the device node manually:
diff -r dce8c55e6a41 -r ae6b350631b2 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC       Wed Mar 10 06:38:44 2021 +0000
+++ b/sys/arch/amd64/conf/GENERIC       Wed Mar 10 07:23:42 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.587 2021/03/10 06:38:44 msaitoh Exp $
+# $NetBSD: GENERIC,v 1.588 2021/03/10 07:23:42 wiz Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "GENERIC-$Revision: 1.587 $"
+#ident         "GENERIC-$Revision: 1.588 $"
 
 maxusers       64              # estimated number of users
 
@@ -456,6 +456,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
diff -r dce8c55e6a41 -r ae6b350631b2 sys/external/bsd/drm2/dist/drm/drm_modes.c
--- a/sys/external/bsd/drm2/dist/drm/drm_modes.c        Wed Mar 10 06:38:44 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_modes.c        Wed Mar 10 07:23:42 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $  */
+/*     $NetBSD: drm_modes.c,v 1.9 2021/03/10 07:23:42 wiz Exp $        */
 
 /*
  * Copyright © 1997-2003 by The XFree86 Project, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.9 2021/03/10 07:23:42 wiz Exp $");
 
 #include <linux/list.h>
 #include <linux/list_sort.h>
@@ -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);



Home | Main Index | Thread Index | Old Index