[PATCH xserver] modesetting: Honor xorg.conf for 16bpp

Adam Jackson ajax at redhat.com
Tue Mar 21 19:57:30 UTC 2017


The 32->24 support patch messed this up.

Bugzilla: https://bugs.freedesktop.org/100246
Bugzilla: https://bugs.freedesktop.org/100295
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/drivers/modesetting/driver.c          | 4 ++++
 hw/xfree86/drivers/modesetting/drmmode_display.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d7030e5..762b398 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -922,6 +922,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
     if (!check_outputs(ms->fd, &connector_count))
         return FALSE;
 
+    defaultdepth = pScrn->confScreen->defaultdepth;
+    defaultbpp = pScrn->confScreen->defaultbpp;
     drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
     if (defaultdepth == 24 && defaultbpp == 24) {
         ms->drmmode.force_24_32 = TRUE;
@@ -949,6 +951,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
                    pScrn->depth);
         return FALSE;
     }
+    if (ms->drmmode.kbpp == 0)
+        ms->drmmode.kbpp = pScrn->bitsPerPixel;
     xf86PrintDepthBpp(pScrn);
 
     /* Process the options */
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index c1e489e..e6158ab 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2057,6 +2057,8 @@ drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
     xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
 
     drmmode->scrn = pScrn;
+    if (drmmode->force_24_32 && cpp == 4)
+        cpp = 3;
     drmmode->cpp = cpp;
     mode_res = drmModeGetResources(drmmode->fd);
     if (!mode_res)
@@ -2488,6 +2490,10 @@ drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth,
     uint32_t fb_id;
     int ret;
 
+    /* if we've been configured in xorg.conf, trust it */
+    if (*depth || *bpp)
+        return;
+
     /* 16 is fine */
     ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &value);
     if (!ret && (value == 16 || value == 8)) {
-- 
2.9.3



More information about the xorg-devel mailing list