xserver: Branch 'master' - 7 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Feb 27 15:46:16 UTC 2018


 glamor/glamor.c                                  |    6 -
 glamor/glamor_copy.c                             |    9 ++
 glamor/glamor_egl.c                              |    3 
 glamor/glamor_eglmodule.c                        |    2 
 glamor/glamor_render.c                           |    1 
 hw/xfree86/drivers/modesetting/driver.c          |    1 
 hw/xfree86/drivers/modesetting/drmmode_display.c |   17 ++--
 hw/xfree86/glamor_egl/glamor_xf86_xv.c           |    4 
 hw/xfree86/modes/xf86RandR12.c                   |   96 ++++++++++++++++-------
 9 files changed, 100 insertions(+), 39 deletions(-)

New commits:
commit 80d4f4b6c20288aa3e0c9908d5d845fc0088a662
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:32 2018 +0100

    modesetting: Enable screen color depth 30 support.
    
    glamor now supports depth 30, so allow use of it.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk>

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 4c6726ce5..7dce56ed4 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -934,6 +934,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
     case 15:
     case 16:
     case 24:
+    case 30:
         break;
     default:
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 53a245267..7fe16c4a1 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -156,7 +156,8 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
 #ifdef GLAMOR_HAS_GBM
     if (drmmode->glamor) {
         bo->gbm = gbm_bo_create(drmmode->gbm, width, height,
-                                GBM_FORMAT_ARGB8888,
+                                drmmode->scrn->depth == 30 ?
+                                GBM_FORMAT_ARGB2101010 : GBM_FORMAT_ARGB8888,
                                 GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
         return bo->gbm != NULL;
     }
commit 7bc86c7d2346eadb3aafe1550ec55e63f2a3b3e5
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:31 2018 +0100

    modesetting: Adapt xf86HandleColorMaps() for > 24 color depth. (v2)
    
    This retains old behavior for depths <= 24, but allows gamma
    table and colormap updates to work properly at depth 30.
    
    This needs the xf86Randr12CrtcComputeGamma() fix for depth 30
    from a previous commit to work. Otherwise the server will work,
    but gamma table updates will silently fail, iow. the server
    would always run with a default identity gamma lut.
    
    v2: Simplify as proposed by Michel.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk> (v1)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 9c3856378..53a245267 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2262,13 +2262,17 @@ drmmode_load_palette(ScrnInfoPtr pScrn, int numColors,
 Bool
 drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 {
-    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0, "Initializing kms color map\n");
+    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+                   "Initializing kms color map for depth %d, %d bpc.\n",
+                   pScrn->depth, pScrn->rgbBits);
     if (!miCreateDefColormap(pScreen))
         return FALSE;
-    /* all radeons support 10 bit CLUTs */
-    if (!xf86HandleColormaps(pScreen, 256, 10, drmmode_load_palette, NULL,
-                CMAP_PALETTED_TRUECOLOR |
-                CMAP_RELOAD_ON_MODE_SWITCH))
+
+    /* Adapt color map size and depth to color depth of screen. */
+    if (!xf86HandleColormaps(pScreen, 1 << pScrn->rgbBits, 10,
+                             drmmode_load_palette, NULL,
+                             CMAP_PALETTED_TRUECOLOR |
+                             CMAP_RELOAD_ON_MODE_SWITCH))
         return FALSE;
     return TRUE;
 }
commit b5f9fcd50a999a00128c0cc3f6e7d1f66182c9d5
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:30 2018 +0100

    xfree86/modes: Adapt xf86Randr12CrtcComputeGamma() for depth 30. (v2)
    
    At screen depths > 24 bit, the color palettes passed into
    xf86Randr12CrtcComputeGamma() can have a larger number of slots
    than the crtc's hardware lut. E.g., at depth 30, 1024 palette
    slots vs. 256 hw lut slots. This palette size > crtc gamma size
    case is not handled yet and leads to silent failure, so gamma
    table updates do not happen.
    
    Add a new subsampling path for this case.
    
    This makes lut updates work again, as tested with the xgamma
    utility (uses XF86VidMode extension) and some RandR based
    gamma ramp animation.
    
    v2: Better resampling when subsampling the palette, as
        proposed by Ville. Now reaches the max index of the
        palette and deals with non-power-of-two sizes. Thanks.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk> (v1)
    Cc: <ville.syrjala at linux.intel.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index fe8770d61..818048335 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1258,40 +1258,82 @@ xf86RandR12CrtcComputeGamma(xf86CrtcPtr crtc, LOCO *palette,
 
     for (shift = 0; (gamma_size << shift) < (1 << 16); shift++);
 
-    gamma_slots = crtc->gamma_size / palette_red_size;
-    for (i = 0; i < palette_red_size; i++) {
-        value = palette[i].red;
-        if (gamma_red)
-            value = gamma_red[value];
-        else
-            value <<= shift;
+    if (crtc->gamma_size >= palette_red_size) {
+        /* Upsampling of smaller palette to larger hw lut size */
+        gamma_slots = crtc->gamma_size / palette_red_size;
+        for (i = 0; i < palette_red_size; i++) {
+            value = palette[i].red;
+            if (gamma_red)
+                value = gamma_red[value];
+            else
+                value <<= shift;
+
+            for (j = 0; j < gamma_slots; j++)
+                crtc->gamma_red[i * gamma_slots + j] = value;
+        }
+    } else {
+        /* Downsampling of larger palette to smaller hw lut size */
+        for (i = 0; i < crtc->gamma_size; i++) {
+            value = palette[i * (palette_red_size - 1) / (crtc->gamma_size - 1)].red;
+            if (gamma_red)
+                value = gamma_red[value];
+            else
+                value <<= shift;
 
-        for (j = 0; j < gamma_slots; j++)
-            crtc->gamma_red[i * gamma_slots + j] = value;
+            crtc->gamma_red[i] = value;
+        }
     }
 
-    gamma_slots = crtc->gamma_size / palette_green_size;
-    for (i = 0; i < palette_green_size; i++) {
-        value = palette[i].green;
-        if (gamma_green)
-            value = gamma_green[value];
-        else
-            value <<= shift;
+    if (crtc->gamma_size >= palette_green_size) {
+        /* Upsampling of smaller palette to larger hw lut size */
+        gamma_slots = crtc->gamma_size / palette_green_size;
+        for (i = 0; i < palette_green_size; i++) {
+            value = palette[i].green;
+            if (gamma_green)
+                value = gamma_green[value];
+            else
+                value <<= shift;
 
-        for (j = 0; j < gamma_slots; j++)
-            crtc->gamma_green[i * gamma_slots + j] = value;
+            for (j = 0; j < gamma_slots; j++)
+                crtc->gamma_green[i * gamma_slots + j] = value;
+        }
+    } else {
+        /* Downsampling of larger palette to smaller hw lut size */
+        for (i = 0; i < crtc->gamma_size; i++) {
+            value = palette[i * (palette_green_size - 1) / (crtc->gamma_size - 1)].green;
+            if (gamma_green)
+                value = gamma_green[value];
+            else
+                value <<= shift;
+
+            crtc->gamma_green[i] = value;
+        }
     }
 
-    gamma_slots = crtc->gamma_size / palette_blue_size;
-    for (i = 0; i < palette_blue_size; i++) {
-        value = palette[i].blue;
-        if (gamma_blue)
-            value = gamma_blue[value];
-        else
-            value <<= shift;
+    if (crtc->gamma_size >= palette_blue_size) {
+        /* Upsampling of smaller palette to larger hw lut size */
+        gamma_slots = crtc->gamma_size / palette_blue_size;
+        for (i = 0; i < palette_blue_size; i++) {
+            value = palette[i].blue;
+            if (gamma_blue)
+                value = gamma_blue[value];
+            else
+                value <<= shift;
 
-        for (j = 0; j < gamma_slots; j++)
-            crtc->gamma_blue[i * gamma_slots + j] = value;
+            for (j = 0; j < gamma_slots; j++)
+                crtc->gamma_blue[i * gamma_slots + j] = value;
+        }
+    } else {
+        /* Downsampling of larger palette to smaller hw lut size */
+        for (i = 0; i < crtc->gamma_size; i++) {
+            value = palette[i * (palette_blue_size - 1) / (crtc->gamma_size - 1)].blue;
+            if (gamma_blue)
+                value = gamma_blue[value];
+            else
+                value <<= shift;
+
+            crtc->gamma_blue[i] = value;
+        }
     }
 }
 
commit 125201408ddd51ca8ea961a7338a6ad299e5816c
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:29 2018 +0100

    glamor: Bump version to 1.0.1 to signal depth 30 support.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk>

diff --git a/glamor/glamor_eglmodule.c b/glamor/glamor_eglmodule.c
index dd4664b22..326af3aa6 100644
--- a/glamor/glamor_eglmodule.c
+++ b/glamor/glamor_eglmodule.c
@@ -40,7 +40,7 @@ static XF86ModuleVersionInfo VersRec = {
     MODINFOSTRING1,
     MODINFOSTRING2,
     XORG_VERSION_CURRENT,
-    1, 0, 0, /* version */
+    1, 0, 1, /* version */
     ABI_CLASS_ANSIC,            /* Only need the ansic layer */
     ABI_ANSIC_VERSION,
     MOD_CLASS_NONE,
commit 7a687da24c9d3c9e40ffa426631bf355322d470e
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:28 2018 +0100

    glamor: Enable composite acceleration for rgb10 formats. (v2)
    
    Specifically for xrgb2101010 format.
    
    Tested on KDE Plasma-5 with XRender based composite
    acceleration backend. Much smoother and faster.
    
    (v2) Dropped argb2101010, because of depth 32 confusion with
         argb8888, as pointed out by Eric. Thanks!
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk>

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index d8d1a335b..0417df4e6 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -773,6 +773,7 @@ static Bool
 glamor_render_format_is_supported(PictFormatShort format)
 {
     switch (format) {
+    case PICT_x2r10g10b10:
     case PICT_a8r8g8b8:
     case PICT_x8r8g8b8:
     case PICT_a8:
commit c326c717c8dbf4a3f0c64a031fbe6030e73ff355
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:27 2018 +0100

    glamor: Fix loose ends in color depth 30 support.
    
    This makes it work properly with OpenGL based desktop
    compositing, as tested with EGL and GLX based compositing
    under OpenGL-2/3, and also artifact free with XRender
    based 2D compositing.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk>

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 4a41fe783..d61e27563 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -805,7 +805,8 @@ glamor_fd_from_pixmap(ScreenPtr screen,
     switch (pixmap_priv->type) {
     case GLAMOR_TEXTURE_DRM:
     case GLAMOR_TEXTURE_ONLY:
-        if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+        if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
+                                      GL_RGB10_A2 : GL_RGBA, 0))
             return -1;
         return glamor_egl_dri3_fd_name_from_tex(screen,
                                                 pixmap,
@@ -845,7 +846,8 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
     switch (pixmap_priv->type) {
     case GLAMOR_TEXTURE_DRM:
     case GLAMOR_TEXTURE_ONLY:
-        if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+        if (!glamor_pixmap_ensure_fbo(pixmap, pixmap->drawable.depth == 30 ?
+                                      GL_RGB10_A2 : GL_RGBA, 0))
             return -1;
         return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
                                                 pixmap,
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index bd4a0e20f..e050c0220 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -78,6 +78,15 @@ use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
 
     /* XXX handle 2 10 10 10 and 1555 formats; presumably the pixmap private knows this? */
     switch (args->src_pixmap->drawable.depth) {
+    case 30:
+        glUniform4ui(prog->bitplane_uniform,
+                     (args->bitplane >> 20) & 0x3ff,
+                     (args->bitplane >> 10) & 0x3ff,
+                     (args->bitplane      ) & 0x3ff,
+                     0);
+
+        glUniform4f(prog->bitmul_uniform, 0x3ff, 0x3ff, 0x3ff, 0);
+        break;
     case 24:
         glUniform4ui(prog->bitplane_uniform,
                      (args->bitplane >> 16) & 0xff,
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 202b83efd..eb5e68b8e 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -270,7 +270,8 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap)
     }
 
     bo = gbm_bo_create(glamor_egl->gbm, width, height,
-                       GBM_FORMAT_ARGB8888,
+                       (pixmap->drawable.depth == 30) ?
+                       GBM_FORMAT_ARGB2101010 : GBM_FORMAT_ARGB8888,
 #ifdef GLAMOR_HAS_GBM_LINEAR
                        (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ?
                         GBM_BO_USE_LINEAR : 0) |
commit 9ab5d91c6c228e8f5b34e4b30c5104aed6c41958
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 03:05:26 2018 +0100

    glamor: Make Xv extension initialize at depth 30.
    
    Support x-screens of depth 30, so init doesn't fail.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Antoine Martin <antoine at nagafix.co.uk>

diff --git a/hw/xfree86/glamor_egl/glamor_xf86_xv.c b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
index 8535fa0c9..5f8bb8f15 100644
--- a/hw/xfree86/glamor_egl/glamor_xf86_xv.c
+++ b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
@@ -44,10 +44,10 @@
 #include <X11/extensions/Xv.h>
 #include "fourcc.h"
 
-#define NUM_FORMATS 3
+#define NUM_FORMATS 4
 
 static XF86VideoFormatRec Formats[NUM_FORMATS] = {
-    {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+    {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, {30, TrueColor}
 };
 
 static void


More information about the xorg-commit mailing list