[PATCH] modesetting: Add common 16by9 and 16by10 resolutions to mode list

2017-08-22 Thread Michael Cronenworth
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1339930

Signed-off-by: Michael Cronenworth 
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 78 +++-
 1 file changed, 76 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index fec7ac276..7e5f0565e 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -50,6 +50,35 @@
 
 #include "driver.h"
 
+static struct pixel_count {
+int16_t width, height;
+} common_16_9[] = {
+{ 640, 360 },
+{ 720, 405 },
+{ 864, 486 },
+{ 960, 540 },
+{ 1024, 576 },
+{ 1280, 720 },
+{ 1366, 768 },
+{ 1600, 900 },
+{ 1920, 1080 },
+{ 2048, 1152 },
+{ 2560, 1440 },
+{ 2880, 1620 },
+{ 3200, 1800 },
+{ 3840, 2160 },
+{ 4096, 2304 },
+{ 5120, 2880 },
+{ 7680, 4320 },
+{ 15360, 8640 },
+}, common_16_10[] = {
+{ 1280, 800 },
+{ 1400, 900 },
+{ 1680, 1050 },
+{ 1920, 1200 },
+{ 2560, 1600 },
+};
+
 static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height);
 static PixmapPtr drmmode_create_pixmap_header(ScreenPtr pScreen, int width, 
int height,
   int depth, int bitsPerPixel, int 
devKind,
@@ -1267,7 +1296,10 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, 
DisplayModePtr Modes)
 {
 xf86MonPtr mon = output->MonInfo;
 DisplayModePtr i, m, preferred = NULL;
-int max_x = 0, max_y = 0;
+drmmode_output_private_ptr drmmode_output = output->driver_private;
+drmmode_ptr drmmode = drmmode_output->drmmode;
+ScrnInfoPtr pScrn = drmmode->scrn;
+int max_x = 0, max_y = 0, n;
 float max_vrefresh = 0.0;
 
 if (mon && GTF_SUPPORTED(mon->features.msc))
@@ -1302,7 +1334,49 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, 
DisplayModePtr Modes)
 
 xf86PruneInvalidModes(output->scrn, &m, FALSE);
 
-return xf86ModesAdd(Modes, m);
+Modes = xf86ModesAdd(Modes, m);
+
+if (preferred->VDisplay * 16 > preferred->HDisplay*9 - 
preferred->HDisplay/32 &&
+preferred->VDisplay * 16 < preferred->HDisplay*9 + 
preferred->HDisplay/32) {
+xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG,
+   "Adding 16:9 modes -- %d < %d > %d\n",
+   preferred->HDisplay*9 - preferred->HDisplay/32,
+   preferred->VDisplay * 16,
+   preferred->HDisplay*9 + preferred->HDisplay/32);
+for (n = 0; n < ARRAY_SIZE(common_16_9); n++) {
+if (preferred->HDisplay <= common_16_9[n].width ||
+preferred->VDisplay <= common_16_9[n].height)
+break;
+
+m = xf86GTFMode(common_16_9[n].width,
+common_16_9[n].height,
+xf86ModeVRefresh(preferred),
+FALSE, FALSE);
+Modes = xf86ModesAdd(Modes, m);
+}
+}
+
+if (preferred->VDisplay * 16 > preferred->HDisplay*10 - 
preferred->HDisplay/32 &&
+preferred->VDisplay * 16 < preferred->HDisplay*10 + 
preferred->HDisplay/32) {
+xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG,
+   "Adding 16:10 modes -- %d < %d > %d\n",
+   preferred->HDisplay*10 - preferred->HDisplay/32,
+   preferred->VDisplay * 16,
+   preferred->HDisplay*10 + preferred->HDisplay/32);
+for (n = 0; n < ARRAY_SIZE(common_16_10); n++) {
+if (preferred->HDisplay <= common_16_10[n].width ||
+preferred->VDisplay <= common_16_10[n].height)
+break;
+
+m = xf86GTFMode(common_16_10[n].width,
+common_16_10[n].height,
+xf86ModeVRefresh(preferred),
+FALSE, FALSE);
+Modes = xf86ModesAdd(Modes, m);
+}
+}
+
+return Modes;
 }
 
 static DisplayModePtr
-- 
2.13.5

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] modesetting: Add common 16by9 and 16by10 resolutions to mode list

2017-08-22 Thread Michael Cronenworth

On 08/22/2017 02:28 PM, Adam Jackson wrote:

On Tue, 2017-08-22 at 13:20 -0500, Michael Cronenworth wrote:

Related:https://bugzilla.redhat.com/show_bug.cgi?id=1339930

Nak, at least in this form. If these are really common modes then the
DMT spec or similar should define real timings for them, and we should
use those timings rather than pretend GTF can handle it. For example:


+{ 15360, 8640 },

hyoscyamine:~% gtf 15360 8640 60

   # 15360x8640 @ 60.00 Hz (GTF) hsync: 536.16 kHz; pclk: 11675.42 MHz
   Modeline "15360x8640_60.00"  11675.42  15360 16824 18568 21776  8640 8641 
8644 8936  -HSync +Vsync

An 11GHz dotclock is slightly unrealistic.

Ideally xf86DefaultModes would be replaced by DMTModes (and the latter
synced with a newer version of that list, eg from drm), because then
you wouldn't have needed to change the ms driver at all.


Thanks for the review. It was adopted from the Intel driver.

Today, the ms driver and xf86GetDefaultModes() grabs 4:3 modes only and appends the 
current display mode on the end, which happens to be a 16:9 mode on the system I'm 
using. Using a 2560x1440 mode to play any 3D application on an Intel IGP does not 
net a lot of frames per second. Downscaling to a 4:3 mode to end up with black bars 
on the monitor is not ideal either.


What direction do you want this patch to take? Update the DMT list (if it needs it) 
and switch xf86GetDefaultModes() to use DMT?



___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] modesetting: Add common 16by9 and 16by10 resolutions to mode list

2017-08-31 Thread Michael Cronenworth

Sorry for the delay.

On 08/23/2017 03:14 PM, Adam Jackson wrote:

No it doesn't? There exist non-4:3 modes in the xf86DefaultModes list,
and nothing in the driver looks like it has any preference for 4:3
modes. How are you reaching this conclusion?


I should have been specific. My VGA/DVI/HDMI devices report all modes while my eDP 
device only reports 4:3 modes.



Apparently I thought this was such a good idea that I'd implemented it
in RHEL6:

https://people.freedesktop.org/~ajax/0006-modes-Combine-xf86DefaultModes-and-DMTModes.patch

The "name compat" stuff there is just for binary compatibility with
upstream's Xorg and it's not bothering to delete the default mode
table, but otherwise that's pretty much the right idea I think.


Would it be appropriate to adopt your patch now? What is it missing?


As far as updating the DMT list, I think we're missing the equivalent
of bfcd74d2aeda25a78f7cc92f80650218b1bce0ca from drm, which would add
several more non-4:3 modes.


Yes, at first glance that may be the core issue. I'll attempt to update it and see 
if my issue is resolved.


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] xfree86: add default modes for 16:9 and 16:10

2018-01-18 Thread Michael Cronenworth

On 01/15/2018 03:09 PM, Martin Wilck wrote:

On Tue, 2018-01-09 at 20:33 +0100, Martin Wilck wrote:

Improve the user experience for users with wide screens by adding
standard
16:9 and 16:10 modes to extramodes, as suggested previously
(https://lists.x.org/archives/xorg-devel/2016-February/048866.html).
Tested successfully on my laptop. Feedback welcome.

See alsohttps://bugs.freedesktop.org/show_bug.cgi?id=37858.

Signed-off-by: Martin Wilck
---
  hw/xfree86/common/extramodes | 142
+++
  1 file changed, 142 insertions(+)

No opinions on this patch?


Ping.

I've tested it. It's a much better solution, and one that I believe Adam requested 
the previous time 16:9/16:10 mode patches have been presented here.


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel