[Openchrome-devel] xf86-video-openchrome: 3 commits - configure.ac src/openchrome.man src/via_driver.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Mar 9 23:31:16 UTC 2018


 configure.ac       |    2 -
 src/openchrome.man |   45 -------------------------
 src/via_driver.c   |   95 ++++++++++++++++++++++++++---------------------------
 3 files changed, 49 insertions(+), 93 deletions(-)

New commits:
commit 8bf1854926d2739bcc5e70f5d7159112e4392cf5
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Mar 9 15:29:43 2018 -0800

    Version bumped to 0.6.171
    
    The bug that causes X Server to crash when the screen resolution is
    changed during runtime with KMS (Kernel Mode Setting) is finally fixed.
    Now, dual screen mode is working with KMS. This is a huge fix for
    OpenChrome DDX and DRM.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 457eec3..2cabc8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.6.170],
+        [0.6.171],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 3632093862e4711f2585bef2523fc65f2e3ac061
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Mar 9 15:22:51 2018 -0800

    Fix for runtime screen resolution change with KMS causing a crash
    
    There was a bug in the screen resize code that causes X Server to crash
    when screen resolution is changed during runtime with KMS (Kernel
    Mode Setting). Now, dual screen mode is working with KMS. This is a
    huge fix for OpenChrome DDX and DRM.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index a8ce9b2..733a6b5 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -792,40 +792,35 @@ static Bool
 via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-    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;
+    Bool ret;
+    ScreenPtr screen = xf86ScrnToScreen(scrn);
     uint32_t old_fb_id;
-    int format, i;
-    Bool ret = FALSE;
+    int i, pitch, old_width, old_height, old_pitch;
+    int cpp = (scrn->bitsPerPixel + 7) / 8;
+    PixmapPtr ppix = screen->GetScreenPixmap(screen);;
+    void *new_pixels;
+    VIAPtr pVia = VIAPTR(scrn);
+    xf86CrtcPtr crtc = NULL;
+    int format;
 
     DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                        "Entered via_xf86crtc_resize.\n"));
-    xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                "Now attempting to resize the screen . . .\n");
+                        "Entered %s.\n", __func__));
 
     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"));
+                            "Exiting %s.\n", __func__));
         return TRUE;
     }
 
-    /* Preserve the old screen information just in case they need to
+    /* Preserve the old screen information just in case it needs to
      * be restored. */
     old_width = scrn->virtualX;
     old_height = scrn->virtualY;
-    old_displayWidth = scrn->displayWidth;
-    old_fd = drmmode->fd;
+    old_pitch = drmmode->front_bo->pitch;
     old_fb_id = drmmode->fb_id;
     old_front = drmmode->front_bo;
 
@@ -836,36 +831,50 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
         goto fail;
     }
 
-    xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                "Allocated a new frame buffer: %dx%d\n",
-                width, height);
+    pitch = drmmode->front_bo->pitch;
+
+    scrn->virtualX = width;
+    scrn->virtualY = height;
+    scrn->displayWidth = pitch / cpp;
+
+#ifdef HAVE_DRI
+    if (pVia->KMS) {
+        ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
+                            scrn->bitsPerPixel, drmmode->front_bo->pitch,
+                            drmmode->front_bo->handle,
+                            &drmmode->fb_id);
+        if (ret) {
+            goto fail;
+        }
+    }
+#endif
 
     new_pixels = drm_bo_map(scrn, drmmode->front_bo);
     if (!new_pixels) {
         goto fail;
     }
 
-    if (pVia->shadowFB) {
-        new_pixels = malloc(height * drmmode->front_bo->pitch);
+    if (!pVia->shadowFB) {
+        screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+                                    pitch, new_pixels);
+    } else {
+        new_pixels = malloc(scrn->displayWidth * scrn->virtualY *
+                            ((scrn->bitsPerPixel + 7) >> 3));
         if (!new_pixels) {
             goto fail;
         }
 
         free(pVia->ShadowPtr);
         pVia->ShadowPtr = new_pixels;
+        screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+                                    pitch, pVia->ShadowPtr);
+
     }
 
-    scrn->virtualX = width;
-    scrn->virtualY = height;
-    scrn->displayWidth = (drmmode->front_bo->pitch)
-                            / ((scrn->bitsPerPixel + 7) >> 3);
+    xf86DrvMsg(scrn->scrnIndex, X_INFO,
+                "Allocated a new frame buffer: %dx%d\n",
+                width, height);
 
-    ppix = screen->GetScreenPixmap(screen);
-    if (!screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
-                                    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;
@@ -892,11 +901,11 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 
 #ifdef HAVE_DRI
     if (pVia->KMS && old_fb_id) {
-        drmModeRmFB(old_fd, old_fb_id);
+        drmModeRmFB(drmmode->fd, old_fb_id);
     }
 #endif
 
-    if (old_front) {
+    if (old_fb_id) {
         drm_bo_unmap(scrn, old_front);
         drm_bo_free(scrn, old_front);
     }
@@ -904,7 +913,7 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
     xf86DrvMsg(scrn->scrnIndex, X_INFO,
                 "Screen resize successful.\n");
     DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                        "Exiting via_xf86crtc_resize.\n"));
+                        "Exiting %s.\n", __func__));
     return TRUE;
 
 fail:
@@ -915,22 +924,14 @@ fail:
 
     scrn->virtualX = old_width;
     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;
+    scrn->displayWidth = old_pitch / cpp;
     drmmode->fb_id = old_fb_id;
     drmmode->front_bo = old_front;
 
-    xf86DrvMsg(scrn->scrnIndex, X_INFO,
+    xf86DrvMsg(scrn->scrnIndex, X_ERROR,
                 "An error occurred during screen resize.\n");
     DEBUG(xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                        "Exiting via_xf86crtc_resize.\n"));
+                        "Exiting %s.\n", __func__));
     return FALSE;
 }
 
commit 9d6e36672205cd17718584eb21c0b80adb784d8d
Author: Reimar Döffinger <freedesktop at reimardoeffinger.de>
Date:   Sat Jan 13 20:18:20 2018 -0600

    Remove options no longer existing from man page
    
    Signed-off-by: Reimar Döffinger <freedesktop at reimardoeffinger.de>

diff --git a/src/openchrome.man b/src/openchrome.man
index e20b68e..69300aa 100644
--- a/src/openchrome.man
+++ b/src/openchrome.man
@@ -62,16 +62,6 @@ method is XAA, since EXA is still experimental.  Contrary to XAA, EXA
 implements acceleration for screen uploads and downloads (if DRI is
 enabled) and for the Render/Composite extension.
 .TP
-.BI "Option \*qActiveDevice\*q  \*q" string \*q
-Specifies the active device combination.  Any string containing "CRT",
-"LCD", "DFP", "TV" should be possible. "CRT" represents anything that
-is connected to the VGA port, "LCD" is for laptop panels (not TFT screens
-attached to the VGA port), "DFP" is for screens connected to the DVI port,
-"TV" is self-explanatory.
-The default is to use what is detected.  The driver is currently unable
-to use LCD and TV simultaneously, and will favour the LCD.  The DVI port is
-not properly probed and needs to be enabled with this option.
-.TP
 .BI "Option \*qAGPMem\*q  \*q" integer \*q
 Sets the amount of AGP memory that is allocated at X server startup.
 The allocated memory will be "integer" kB.  This AGP memory is used for
@@ -87,9 +77,6 @@ to accommodate the amount of AGP memory specified here.  Otherwise no
 AGP memory will be available.  It is safe to set a very large AGP
 aperture in the BIOS.
 .TP
-.BI "Option \*qCenter\*q  \*q" boolean \*q
-Enables image centering on DVI displays.  The default is disabled.
-.TP
 .BI "Option \*qDisableIRQ\*q  \*q" boolean \*q
 Disables the vertical blank IRQ.  This is a workaround for some mainboards
 that have problems with IRQs coming from the Unichrome engine.  With IRQs
@@ -121,9 +108,6 @@ over 1024 pixels and use 24 bpp, set this to 8192.  Otherwise you can
 leave this at the default 4096.  The space will be allocated from AGP
 memory if available, otherwise from VRAM.
 .TP
-.BI "Option \*qLCDDualEdge\*q  \*q" boolean \*q
-Enables the use of dual-edge mode to set the LCD.  The default is disabled.
-.TP
 .BI "Option \*qMaxDRIMem\*q  \*q" integer \*q
 Sets the maximum amount of VRAM memory allocated for DRI clients to
 "integer" kB.  Normally DRI clients  get half the available VRAM size,
@@ -142,10 +126,6 @@ possibility is "smart".
 Disables the use of hardware acceleration.  Acceleration is enabled
 by default.
 .TP
-.BI "Option \*qNoAGPFor2D\*q  \*q" boolean \*q
-Disables the use of AGP DMA for 2D acceleration, even when AGP DMA is
-enabled.  The default is enabled.
-.TP
 .BI "Option \*qNoXVDMA\*q  \*q" boolean \*q
 If DRI is enabled, Xv normally uses PCI DMA to transfer video images
 from system to frame-buffer memory.  This is somewhat slower than
@@ -156,11 +136,6 @@ rendering artifacts when PCI DMA is used.  If you experience this,
 or don't want your PCI bus to be stressed with Xv images, set this
 option to "true".  This option has no effect when DRI is not enabled.
 .TP
-.BI "Option \*qPanelSize\*q  \*q" string \*q
-Specifies the size (width x height) of the LCD panel attached to the
-system.  The sizes 640x480, 800x600, 1024x768, 1280x1024, and 1400x1050
-are supported.
-.TP
 .BI "Option \*qRotationType\*q  \*q" string \*q
 Enabled rotation by using RandR. The driver only support unaccelerated
 RandR rotations "SWRandR". Hardware rotations "HWRandR" is currently 
@@ -201,26 +176,6 @@ Specifies TV port.  The driver currently supports "DVP0", "DVP1",
 .BI "Option \*qTVType\*q  \*q" string \*q
 Specifies TV output format.  The driver currently supports "NTSC" and
 "PAL" timings only.
-.TP
-.BI "Option \*qVBEModes\*q  \*q" boolean \*q
-Enables the use of VBE BIOS calls for setting the display mode.  This mimics
-the behaviour of the vesa driver but still provides acceleration and
-other features.  This option may be used if your hardware works with
-the vesa driver but not with the openchrome driver.  It may not work
-on 64-bit systems.  Using "VBEModes" may speed up driver acceleration
-significantly due to a more aggressive hardware setting, particularly
-on systems with low memory bandwidth.  Your refresh rate may be limited
-to 60 Hz on some systems.
-.TP
-.BI "Option \*qVBESaveRestore\*q  \*q" boolean \*q
-Enables the use of VBE BIOS calls for saving and restoring the display state
-when the X server is launched.  This can be extremely slow on some hardware,
-and the system may appear to have locked for 10 seconds or so.  The default
-is to use the driver builtin function.  This option only works if option
-"VBEModes" is enabled.
-.TP
-.BI "Option \*qVideoRAM\*q  \*q" integer \*q
-Overrides the VideoRAM autodetection.  This should never be needed.
 .PP 
 .SH "TV ENCODERS"
 Unichromes tend to be paired with several different TV encoders.


More information about the Openchrome-devel mailing list