Current-Users archive

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

Re: graphical console: limit resolution?



On Thu, Nov 28, 2019 at 06:07:16PM -0000, Michael van Elst wrote:
> wiz%NetBSD.org@localhost (Thomas Klausner) writes:
> 
> >The card's limit is 2560x1440 (I think), but the graphical console
> >code doesn't care and tries to switch to 3840x2160 and the screen is
> >just black afterwards.
> 
> >Is there a way to limit the resolution for the graphical console
> >(e.g., a kernel config parameter)?
> 
> I don't think so.
> 
> drm_helper_probe_single_connector_modes_merge_bits() filters the
> modes reported by the monitor.
> 
> - drm_mode_validate_basic()
> checks for sane timings
> 
> - drm_mode_validate_size()
> checks against max dimension. You could add arbitrary additional limits here.
> 
> - drm_mode_validate_flag()
> checks for special modes (interlace, double scan, 3D).
> 
> - driver specific mode_valid()
> checks for card and port limits, e.g. pixel clock or sync timings. This
> probably may need to be fixed to handle your card correctly.
> 
> 
> drm_fb_helper_single_fb_probe() later selects the largest width and largest
> height (not necessarily from the same mode, which seems to be bogus).

Thank you for the explanations!

I've tried limiting the X and Y (see attached diff).

The kernel dmesg now says:

radeondrmkmsfb0: framebuffer at 0xffffdc0909ca8000, size 1920x1080, depth 32, stride 7680

but I don't get a picture either.
What is the stride?

Any other ideas?

Thanks,
 Thomas

More context:
radeon0: info: WB enabled
radeon0: info: fence driver on ring 0 use gpu addr 0x0000000040000c00 and cpu addr 0x0xfffffcf3b0f4ec00
radeon0: info: fence driver on ring 3 use gpu addr 0x0000000040000c0c and cpu addr 0x0xfffffcf3b0f4ec0c
radeon0: info: fence driver on ring 5 use gpu addr 0x000000000005c598 and cpu addr 0x0xffffdc090967c598
kern info: [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
kern info: [drm] Driver supports precise vblank timestamp query.
radeon0: info: radeon: MSI limited to 32-bit
radeon0: interrupting at ioapic2 pin 0 (radeon0)
kern info: [drm] radeon: irq initialized.
kern info: [drm] ring test on 0 succeeded in 0 usecs
kern info: [drm] ring test on 3 succeeded in 2 usecs
kern info: [drm] ring test on 5 succeeded in 1 usecs
kern info: [drm] UVD initialized successfully.
kern info: [drm] ib test on ring 0 succeeded in 0 usecs
kern info: [drm] ib test on ring 3 succeeded in 0 usecs
kern info: [drm] ib test on ring 5 succeeded
kern info: [drm] Radeon Display Connectors
kern info: [drm] Connector 0:
kern info: [drm]   DVI-I-1
kern info: [drm]   HPD1
kern info: [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28 0x7e2c 0x7e2c
kern info: [drm]   Encoders:
kern info: [drm]     CRT1: INTERNAL_KLDSCP_DAC1
kern info: [drm]     DFP1: INTERNAL_UNIPHY
kern info: [drm] Connector 1:
kern info: [drm]   DP-1
kern info: [drm]   HPD2
kern info: [drm]   DDC: 0x7e50 0x7e50 0x7e54 0x7e54 0x7e58 0x7e58 0x7e5c 0x7e5c
kern info: [drm]   Encoders:
kern info: [drm]     DFP2: INTERNAL_UNIPHY1
kern info: [drm] Connector 2:
kern info: [drm]   DP-2
kern info: [drm]   HPD3
kern info: [drm]   DDC: 0x7f10 0x7f10 0x7f14 0x7f14 0x7f18 0x7f18 0x7f1c 0x7f1c
kern info: [drm]   Encoders:
kern info: [drm]     DFP3: INTERNAL_UNIPHY1
radeondrmkmsfb0 at radeon0
radeondrmkmsfb0: framebuffer at 0xffffdc0909ca8000, size 1920x1080, depth 32, stride 7680
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.7
diff -u -r1.7 drm_modes.c
--- sys/external/bsd/drm2/dist/drm/drm_modes.c	27 Aug 2018 04:58:19 -0000	1.7
+++ sys/external/bsd/drm2/dist/drm/drm_modes.c	2 Dec 2019 16:38:34 -0000
@@ -1016,10 +1016,10 @@
 drm_mode_validate_size(const struct drm_display_mode *mode,
 		       int maxX, int maxY)
 {
-	if (maxX > 0 && mode->hdisplay > maxX)
+	if ((maxX > 0 && mode->hdisplay > maxX) || (mode->hdisplay > 1920))
 		return MODE_VIRTUAL_X;
 
-	if (maxY > 0 && mode->vdisplay > maxY)
+	if ((maxY > 0 && mode->vdisplay > maxY) || (mode->vdisplay > 1080))
 		return MODE_VIRTUAL_Y;
 
 	return MODE_OK;


Home | Main Index | Thread Index | Old Index