configure.ac | 2 src/via_driver.c | 132 +++++++++++++++++++++++++++++++++++-------------------- src/via_kms.h | 2 src/via_ums.c | 39 ++++++---------- 4 files changed, 103 insertions(+), 72 deletions(-)
New commits: commit 21ae2b4c3c02812a69e9162791c6db2e6ec36842 Author: Kevin Brace <kevinbr...@gmx.com> Date: Sun May 29 00:44:08 2016 -0700 Version bumped to 0.4.158 This version includes initial support for RandR and a fix for runtime screen resize bug. Please start testing this version since there will be a feature freeze for Version 0.5 soon. Enjoy!!! Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/configure.ac b/configure.ac index d9b12e7..9673ce6 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ(2.57) AC_INIT([xf86-video-openchrome], - [0.4.157], + [0.4.158], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome], [xf86-video-openchrome]) commit 19065ceb96cce922191121f917f1ce079e7a4876 Author: Kevin Brace <kevinbr...@gmx.com> Date: Sun May 29 00:30:51 2016 -0700 Limit X and Y direction screen resolution In order to support RandR properly, the supported X direction total screen size will be limited to 2048 dots for 32-bit color mode and 4096 dots for 16-bit color mode. For now, Y direction total screen size will be symmetrical with respect to the X direction total screen size. With this fix, RandR should work for most users, and you can now use 2 monitors to display your extended desktop screen. Enjoy!!! Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_ums.c b/src/via_ums.c index 5e42381..7473e45 100644 --- a/src/via_ums.c +++ b/src/via_ums.c @@ -985,30 +985,6 @@ umsCrtcInit(ScrnInfoPtr pScrn) iga2_rec->index = 1; iga2->driver_private = iga2_rec; - /* - * CLE266A: - * Max Line Pitch: 4080, (FB corruption when higher, driver problem?) - * Max Height: 4096 (and beyond) - * - * CLE266A: primary AdjustFrame can use only 24 bits, so we are limited - * to 12x11 bits; 4080x2048 (~2:1), 3344x2508 (4:3), or 2896x2896 (1:1). - * TODO Test CLE266Cx, KM400, KM400A, K8M800, CN400 please. - * - * We should be able to limit the memory available for a mode to 32 MB, - * but miScanLineWidth fails to catch this properly (apertureSize). - */ - switch (pVia->Chipset) { - case VIA_CLE266: - case VIA_KM400: - max_pitch = 3344; - max_height = 2508; - break; - default: - max_pitch = 16384 / (pScrn->bitsPerPixel >> 3); - max_height = max_pitch; - break; - } - /* Init HI_X0 for cursor */ switch (pVia->Chipset) { case VIA_CX700: @@ -1039,6 +1015,21 @@ umsCrtcInit(ScrnInfoPtr pScrn) break; } + /* + * CLE266A: + * Max Line Pitch: 4080, (FB corruption when higher, driver problem?) + * Max Height: 4096 (and beyond) + * + * CLE266A: primary AdjustFrame can use only 24 bits, so we are limited + * to 12x11 bits; 4080x2048 (~2:1), 3344x2508 (4:3), or 2896x2896 (1:1). + * TODO Test CLE266Cx, KM400, KM400A, K8M800, CN400 please. + * + * We should be able to limit the memory available for a mode to 32 MB, + * but miScanLineWidth fails to catch this properly (apertureSize). + */ + max_pitch = 8192 / ((pScrn->bitsPerPixel + 7) >> 3); + max_height = max_pitch; + xf86CrtcSetSizeRange(pScrn, 320, 200, max_pitch, max_height); viaOutputDetect(pScrn); commit 25787b7ada1e114d5e0f3692ec96e8d0c1420a8b Author: Kevin Brace <kevinbr...@gmx.com> Date: Sun May 29 00:10:47 2016 -0700 Fix a fatal regression impacting runtime screen resize It was discovered that a commit done between Version 0.3.2 and Version 0.3.3 broke the screen resize functionality (Commit cee0a1fab9cade87e6de16c67cd34c84cf697531). This led to an X Server crash if the screen was resized from a screen resize utility. With this fix, the screen resolution can now be changed from the screen resize utility safely. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_driver.c b/src/via_driver.c index 2390b43..2893abd 100644 --- a/src/via_driver.c +++ b/src/via_driver.c @@ -781,87 +781,108 @@ static Bool via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - struct buffer_object *old_front = NULL, *new_front = NULL; - int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i; - int old_width, old_height, old_dwidth, format; + xf86CrtcPtr crtc = NULL; ScreenPtr screen = scrn->pScreen; VIAPtr pVia = VIAPTR(scrn); + drmmode_crtc_private_ptr drmmode_crtc + = xf86_config->crtc[0]->driver_private; + drmmode_ptr drmmode = drmmode_crtc->drmmode; + struct buffer_object *old_front = NULL; void *new_pixels = NULL; + PixmapPtr ppix; + int old_width, old_height, old_displayWidth, old_fd; uint32_t old_fb_id; + int format, i; Bool ret = FALSE; - PixmapPtr ppix; - if (scrn->virtualX == width && scrn->virtualY == height) + DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Entered via_xf86crtc_resize.\n")); + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Now attempting to resize the screen . . .\n"); + + if ((scrn->virtualX == width) && (scrn->virtualY == height)) { + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "It was determined that there is no need to resize the " + "screen.\n"); + DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Exiting via_xf86crtc_resize.\n")); return TRUE; + } + + /* Preserve the old screen information just in case they need to + * be restored. */ + old_width = scrn->virtualX; + old_height = scrn->virtualY; + old_displayWidth = scrn->displayWidth; + old_fd = drmmode->fd; + old_fb_id = drmmode->fb_id; + old_front = drmmode->front_bo; format = map_legacy_formats(scrn->bitsPerPixel, scrn->depth); - new_front = drm_bo_alloc_surface(scrn, width, height, format, + drmmode->front_bo = drm_bo_alloc_surface(scrn, width, height, format, 16, TTM_PL_FLAG_VRAM); - if (!new_front) + if (!drmmode->front_bo) { goto fail; + } xf86DrvMsg(scrn->scrnIndex, X_INFO, - "Allocate new frame buffer %dx%d stride %lu\n", - width, height, new_front->pitch); + "Allocated a new frame buffer: %dx%d\n", + width, height); - new_pixels = drm_bo_map(scrn, new_front); - if (!new_pixels) + new_pixels = drm_bo_map(scrn, drmmode->front_bo); + if (!new_pixels) { goto fail; + } if (pVia->shadowFB) { - new_pixels = malloc(height * new_front->pitch); - if (!new_pixels) + new_pixels = malloc(height * drmmode->front_bo->pitch); + if (!new_pixels) { goto fail; + } + free(pVia->ShadowPtr); pVia->ShadowPtr = new_pixels; } + scrn->virtualX = width; + scrn->virtualY = height; + scrn->displayWidth = (drmmode->front_bo->pitch) + / ((scrn->bitsPerPixel + 7) >> 3); + ppix = screen->GetScreenPixmap(screen); if (!screen->ModifyPixmapHeader(ppix, width, height, -1, -1, - new_front->pitch, - new_pixels)) + drmmode->front_bo->pitch, + new_pixels)) { goto fail; + } #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0) scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr; #endif - scrn->virtualX = width; - scrn->virtualY = height; - scrn->displayWidth = new_front->pitch / cpp; + for (i = 0; i < xf86_config->num_crtc; i++) { - xf86CrtcPtr crtc = xf86_config->crtc[i]; - drmmode_crtc_private_ptr drmmode_crtc; - drmmode_ptr drmmode; + crtc = xf86_config->crtc[i]; - if (!xf86CrtcInUse(crtc) || !crtc->driver_private) + if (!xf86CrtcInUse(crtc)) { continue; - - drmmode_crtc = crtc->driver_private; - drmmode = drmmode_crtc->drmmode; - - if (drmmode->front_bo != new_front) { - old_front = drmmode->front_bo; - old_fb_id = drmmode->fb_id; - fd = drmmode->fd; - - drmmode->front_bo = new_front; - drmmode->fb_id = 0; } - ret = xf86CrtcSetMode(crtc, &crtc->desiredMode, crtc->rotation, - crtc->x, crtc->y); + ret = xf86CrtcSetMode(crtc, + &crtc->desiredMode, + crtc->desiredRotation, + crtc->desiredX, crtc->desiredY); if (!ret) { - drmmode->front_bo = old_front; - drmmode->fb_id = old_fb_id; - xf86DrvMsg(scrn->scrnIndex, X_INFO, "xf86CrtcSetMode failed\n"); + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Mode setting failed.\n"); goto fail; } } #ifdef HAVE_DRI - if (pVia->KMS && old_fb_id) - drmModeRmFB(fd, old_fb_id); + if (pVia->KMS && old_fb_id) { + drmModeRmFB(old_fd, old_fb_id); + } #endif if (old_front) { @@ -869,17 +890,36 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) drm_bo_free(scrn, old_front); } - return ret; + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Screen resize successful.\n"); + DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Exiting via_xf86crtc_resize.\n")); + return TRUE; fail: - if (new_front) { - drm_bo_unmap(scrn, new_front); - drm_bo_free(scrn, new_front); + if (drmmode->front_bo) { + drm_bo_unmap(scrn, drmmode->front_bo); + drm_bo_free(scrn, drmmode->front_bo); } - scrn->virtualY = old_height; scrn->virtualX = old_width; - scrn->displayWidth = old_dwidth; + scrn->virtualY = old_height; + scrn->displayWidth = old_displayWidth; + +#ifdef HAVE_DRI + if (pVia->KMS && (old_fb_id != drmmode->fb_id)) { + drmModeRmFB(old_fd, old_fb_id); + } +#endif + + drmmode->fd = old_fd; + drmmode->fb_id = old_fb_id; + drmmode->front_bo = old_front; + + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "An error occurred during screen resize.\n"); + DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Exiting via_xf86crtc_resize.\n")); return FALSE; } diff --git a/src/via_kms.h b/src/via_kms.h index 1511a8f..2085f62 100644 --- a/src/via_kms.h +++ b/src/via_kms.h @@ -36,7 +36,7 @@ typedef struct { int fd; - unsigned fb_id; + uint32_t fb_id; #ifdef HAVE_DRI drmModeResPtr mode_res; drmModeFBPtr mode_fb; _______________________________________________ Openchrome-devel mailing list Openchrome-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/openchrome-devel