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.
This commit is contained in:
parent
334d1ee9f2
commit
279c4abbec
|
@ -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 @@ and compiled from
|
|||
.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:
|
||||
|
|
|
@ -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 @@ include "arch/amd64/conf/std.amd64"
|
|||
|
||||
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 @@ nouveaufb* at nouveaufbbus?
|
|||
# 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
|
||||
|
|
|
@ -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 @@ drm_mode_validate_size(const struct drm_display_mode *mode,
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue