diff options
author | Russell King <rmk@armlinux.org.uk> | 2018-06-27 10:48:14 +0100 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2018-06-27 19:17:44 +0100 |
commit | 5763fd037eeec4a3ea4ca5b346ec32da44a01149 (patch) | |
tree | 35761c86cfc8f2d3f17458efae999502e3476006 | |
parent | 23433a192c84b87d4341c93b132de593cd293191 (diff) |
src: read default depth from KMS driver
Read the default depth from the KMS driver, allowing this configuration
to come from the kernel.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | src/common_drm.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/common_drm.c b/src/common_drm.c index 8e98e8b..91b33f4 100644 --- a/src/common_drm.c +++ b/src/common_drm.c @@ -1106,14 +1106,32 @@ int __common_drm_get_cap(ScrnInfoPtr pScrn, uint64_t cap, uint64_t *val, Bool common_drm_PreInit(ScrnInfoPtr pScrn, int flags24) { + struct common_drm_info *drm = GET_DRM_INFO(pScrn); rgb defaultWeight = { 0, 0, 0 }; + uint64_t val; + int depth, bpp; pScrn->monitor = pScrn->confScreen->monitor; pScrn->progClock = TRUE; pScrn->rgbBits = 8; pScrn->displayWidth = 640; - if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) + depth = bpp = 0; + if (drmGetCap(drm->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &val) == 0) { + switch (val) { + case 8: + case 15: + case 16: + bpp = (val + 7) & ~7; + depth = val; + break; + default: + depth = 24; + break; + } + } + + if (!xf86SetDepthBpp(pScrn, depth, depth, bpp, flags24)) return FALSE; xf86PrintDepthBpp(pScrn); |