Skip to contentSkip to conversation

Depth 30 enablement for ati-ddx + exa. Rev 2

PATCH In review Mario Kleiner 2 participants 9 messages Dec 23, 2017 – Dec 28, 2017 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20171223060737.12271-1-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/3 Skip xf86HandleColormaps() at color depth 30.

The hardware gamma luts get bypassed at color
depth 30 anyway, so skip their setup.

Also skip drmmode_crtc_gamma_set() for a screen
with depth 30.

---
 src/drmmode_display.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/drmmode_display.c +8 -2
index 7ad3235..e5f9dbe 100644
@@ -1275,6 +1275,10 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
 	RADEONInfoPtr info = RADEONPTR(scrn);
 	int i;
 
+	/* Hw gamma lut's are bypassed at color depth 30 */
+	if (scrn->depth == 30)
+		return;
+
 	drmmode_crtc_gamma_do_set(crtc, red, green, blue, size);
 
 	/* Compute index of this CRTC into xf86_config->crtc */
@@ -2730,8 +2734,10 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 		       "Initializing kms color map\n");
 	if (!miCreateDefColormap(pScreen))
 	    return FALSE;
-	/* all radeons support 10 bit CLUTs */
-	if (!xf86HandleColormaps(pScreen, 256, 10,
+
+	/* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */
+	if (pScrn->depth != 30 &&
+	    !xf86HandleColormaps(pScreen, 256, 10,
 				 NULL, NULL,
 				 CMAP_PALETTED_TRUECOLOR
 #if 0 /* This option messes up text mode! ([email protected]) */
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171223060737.12271-2-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 1/3] Skip xf86HandleColormaps() at color depth 30.

Quoted 16 lines · Mario Kleiner

The hardware gamma luts get bypassed at color
depth 30 anyway, so skip their setup.

Also skip drmmode_crtc_gamma_set() for a screen
with depth 30.

---
 src/drmmode_display.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/drmmode_display.c +0 -0
index 7ad3235..e5f9dbe 100644

src/drmmode_display.c drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green, · line 1280

Quoted 6 lines
src/drmmode_display.c +3 -0
@@ -1275,6 +1275,10 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
 	RADEONInfoPtr info = RADEONPTR(scrn);
 	int i;
 
+	/* Hw gamma lut's are bypassed at color depth 30 */
+	if (scrn->depth == 30)
+		return;

It's better to set xf86CrtcFuncsRec::gamma_set = NULL in this case, to prevent the X server from wasting work calculating gamma tables that will never be used.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): f15625f4-c8fa-38b2-6a35-05bdbcaa9a1e-otUistvHUpPR7s880joybQ@public.gmane.org

#6 lore raw

Re: [PATCH 1/3] Skip xf86HandleColormaps() at color depth 30.

Quoted 20 lines · Michel Dänzer
Quoted 19 lines · Mario Kleiner

The hardware gamma luts get bypassed at color
depth 30 anyway, so skip their setup.

Also skip drmmode_crtc_gamma_set() for a screen
with depth 30.

---
  src/drmmode_display.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
src/drmmode_display.c +0 -0
index 7ad3235..e5f9dbe 100644
@@ -1275,6 +1275,10 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
  	RADEONInfoPtr info = RADEONPTR(scrn);
  	int i;
 
Quoted 7 lines

src/drmmode_display.c drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green, · line 1280

Quoted 3 lines
src/drmmode_display.c +3 -0
+	/* Hw gamma lut's are bypassed at color depth 30 */
+	if (scrn->depth == 30)
+		return;

It's better to set xf86CrtcFuncsRec::gamma_set = NULL in this case, to prevent the X server from wasting work calculating gamma tables that will never be used.

I looked at that, but as far as i understand, wouldn't NULL'ing that entry affect all active X-Screens, not only the depth 30 ones, as each screen only references the same shared static struct with function pointers in the driver? At least for the use cases of many of "my" users, two separate x-screens, with ZaphodHeads and different color depth wouldn't be an unexpected setup.

Or maybe i just overlook something (not with my code/test-machine atm.)? -mario
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): bae0a477-fa06-5ddd-6202-ebb29576e432-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#8 lore raw

Re: [PATCH 1/3] Skip xf86HandleColormaps() at color depth 30.

Quoted 29 lines · Mario Kleiner
Quoted 12 lines · Michel Dänzer
Quoted 11 lines · Mario Kleiner

The hardware gamma luts get bypassed at color
depth 30 anyway, so skip their setup.

Also skip drmmode_crtc_gamma_set() for a screen
with depth 30.

---
  src/drmmode_display.c | 10 ++++++++--

  1 file changed, 8 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 11 lines
src/drmmode_display.c +0 -0
index 7ad3235..e5f9dbe 100644
@@ -1275,6 +1275,10 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc,
 uint16_t *red, uint16_t *green,
       RADEONInfoPtr info = RADEONPTR(scrn);
       int i;

  +    /* Hw gamma lut's are bypassed at color depth 30 */ +    if (scrn->depth == 30)
+        return;

It's better to set xf86CrtcFuncsRec::gamma_set = NULL in this case, to prevent the X server from wasting work calculating gamma tables that will never be used.

Quoted 4 lines

I looked at that, but as far as i understand, wouldn't NULL'ing that entry affect all active X-Screens, not only the depth 30 ones, as each screen only references the same shared static struct with function pointers in the driver?

That's right.

Quoted 3 lines

At least for the use cases of many of "my" users, two separate x-screens, with ZaphodHeads and different color depth wouldn't be an unexpected setup.

Then we'll need to use a different xf86CrtcFuncsRec instance per screen instead of a single one for all screens.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#9 lore raw

PATCH 2/3 exa: Accelerate ARGB2101010 pictures (v2)

In reply to a message not in the archive

From: Fredrik Höglund <[email protected]>

Tested by Mario on a Radeon HD 4000 series for the r600 exa path, and on Radeon HD 5770 for the evergreen exa path.

v2: Add format handling in XXXSetSolidConsts() as well,
as suggested by Fredrik.

---
 src/evergreen_exa.c | 22 ++++++++++++++++++++++
 src/r600_exa.c      | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
src/evergreen_exa.c +22 -0
index 90c9b6d..eed2ae5 100644
@@ -668,6 +668,10 @@ struct formatinfo {
 };
 
 static struct formatinfo EVERGREENTexFormats[] = {
+    {PICT_a2r10g10b10,	FMT_2_10_10_10},
+    {PICT_x2r10g10b10,	FMT_2_10_10_10},
+    {PICT_a2b10g10r10,	FMT_2_10_10_10},
+    {PICT_x2b10g10r10,	FMT_2_10_10_10},
     {PICT_a8r8g8b8,	FMT_8_8_8_8},
     {PICT_x8r8g8b8,	FMT_8_8_8_8},
     {PICT_a8b8g8r8,	FMT_8_8_8_8},
@@ -723,6 +727,12 @@ static uint32_t EVERGREENGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_for
 static Bool EVERGREENGetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format)
 {
     switch (pDstPicture->format) {
+    case PICT_a2r10g10b10:
+    case PICT_x2r10g10b10:
+    case PICT_a2b10g10r10:
+    case PICT_x2b10g10r10:
+	*dst_format = COLOR_2_10_10_10;
+	break;
     case PICT_a8r8g8b8:
     case PICT_x8r8g8b8:
     case PICT_a8b8g8r8:
@@ -891,6 +901,7 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
 
     /* component swizzles */
     switch (pPict->format) {
+    case PICT_a2r10g10b10:
     case PICT_a1r5g5b5:
     case PICT_a8r8g8b8:
 	pix_r = SQ_SEL_Z; /* R */
@@ -898,12 +909,14 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
 	pix_b = SQ_SEL_X; /* B */
 	pix_a = SQ_SEL_W; /* A */
 	break;
+    case PICT_a2b10g10r10:
     case PICT_a8b8g8r8:
 	pix_r = SQ_SEL_X; /* R */
 	pix_g = SQ_SEL_Y; /* G */
 	pix_b = SQ_SEL_Z; /* B */
 	pix_a = SQ_SEL_W; /* A */
 	break;
+    case PICT_x2b10g10r10:
     case PICT_x8b8g8r8:
 	pix_r = SQ_SEL_X; /* R */
 	pix_g = SQ_SEL_Y; /* G */
@@ -922,6 +935,7 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
 	pix_b = SQ_SEL_W; /* B */
 	pix_a = SQ_SEL_1; /* A */
 	break;
+    case PICT_x2r10g10b10:
     case PICT_x1r5g5b5:
     case PICT_x8r8g8b8:
     case PICT_r5g6b5:
@@ -1153,18 +1167,21 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u
     switch (format) {
 	case PICT_a1r5g5b5:
 	case PICT_a8r8g8b8:
+	case PICT_a2r10g10b10:
 	    pix_r = zf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = xf; /* B */
 	    pix_a = wf; /* A */
 	    break;
 	case PICT_a8b8g8r8:
+	case PICT_a2b10g10r10:
 	    pix_r = xf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = zf; /* B */
 	    pix_a = wf; /* A */
 	    break;
 	case PICT_x8b8g8r8:
+	case PICT_x2b10g10r10:
 	    pix_r = xf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = zf; /* B */
@@ -1184,6 +1201,7 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u
 	    break;
 	case PICT_x1r5g5b5:
 	case PICT_x8r8g8b8:
+	case PICT_x2r10g10b10:
 	case PICT_r5g6b5:
 	    pix_r = zf; /* R */
 	    pix_g = yf; /* G */
@@ -1425,6 +1443,8 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
     cb_conf.surface = accel_state->dst_obj.surface;
 
     switch (pDstPicture->format) {
+    case PICT_a2r10g10b10:
+    case PICT_x2r10g10b10:
     case PICT_a8r8g8b8:
     case PICT_x8r8g8b8:
     case PICT_a1r5g5b5:
@@ -1432,6 +1452,8 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
     default:
 	cb_conf.comp_swap = 1; /* ARGB */
 	break;
+    case PICT_a2b10g10r10:
+    case PICT_x2b10g10r10:
     case PICT_a8b8g8r8:
     case PICT_x8b8g8r8:
 	cb_conf.comp_swap = 0; /* ABGR */
src/r600_exa.c +22 -0
index 22d4b31..6572951 100644
@@ -727,6 +727,10 @@ struct formatinfo {
 };
 
 static struct formatinfo R600TexFormats[] = {
+    {PICT_a2r10g10b10,	FMT_2_10_10_10},
+    {PICT_x2r10g10b10,	FMT_2_10_10_10},
+    {PICT_a2b10g10r10,	FMT_2_10_10_10},
+    {PICT_x2b10g10r10,	FMT_2_10_10_10},
     {PICT_a8r8g8b8,	FMT_8_8_8_8},
     {PICT_x8r8g8b8,	FMT_8_8_8_8},
     {PICT_a8b8g8r8,	FMT_8_8_8_8},
@@ -782,6 +786,12 @@ static uint32_t R600GetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format)
 static Bool R600GetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format)
 {
     switch (pDstPicture->format) {
+    case PICT_a2r10g10b10:
+    case PICT_x2r10g10b10:
+    case PICT_a2b10g10r10:
+    case PICT_x2b10g10r10:
+	*dst_format = COLOR_2_10_10_10;
+	break;
     case PICT_a8r8g8b8:
     case PICT_x8r8g8b8:
     case PICT_a8b8g8r8:
@@ -906,6 +916,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
 
     /* component swizzles */
     switch (pPict->format) {
+    case PICT_a2r10g10b10:
     case PICT_a1r5g5b5:
     case PICT_a8r8g8b8:
 	pix_r = SQ_SEL_Z; /* R */
@@ -913,12 +924,14 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
 	pix_b = SQ_SEL_X; /* B */
 	pix_a = SQ_SEL_W; /* A */
 	break;
+    case PICT_a2b10g10r10:
     case PICT_a8b8g8r8:
 	pix_r = SQ_SEL_X; /* R */
 	pix_g = SQ_SEL_Y; /* G */
 	pix_b = SQ_SEL_Z; /* B */
 	pix_a = SQ_SEL_W; /* A */
 	break;
+    case PICT_x2b10g10r10:
     case PICT_x8b8g8r8:
 	pix_r = SQ_SEL_X; /* R */
 	pix_g = SQ_SEL_Y; /* G */
@@ -937,6 +950,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
 	pix_b = SQ_SEL_W; /* B */
 	pix_a = SQ_SEL_1; /* A */
 	break;
+    case PICT_x2r10g10b10:
     case PICT_x1r5g5b5:
     case PICT_x8r8g8b8:
     case PICT_r5g6b5:
@@ -1197,18 +1211,21 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32
     switch (format) {
 	case PICT_a1r5g5b5:
 	case PICT_a8r8g8b8:
+	case PICT_a2r10g10b10:
 	    pix_r = zf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = xf; /* B */
 	    pix_a = wf; /* A */
 	    break;
 	case PICT_a8b8g8r8:
+	case PICT_a2b10g10r10:
 	    pix_r = xf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = zf; /* B */
 	    pix_a = wf; /* A */
 	    break;
 	case PICT_x8b8g8r8:
+	case PICT_x2b10g10r10:
 	    pix_r = xf; /* R */
 	    pix_g = yf; /* G */
 	    pix_b = zf; /* B */
@@ -1228,6 +1245,7 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32
 	    break;
 	case PICT_x1r5g5b5:
 	case PICT_x8r8g8b8:
+	case PICT_x2r10g10b10:
 	case PICT_r5g6b5:
 	    pix_r = zf; /* R */
 	    pix_g = yf; /* G */
@@ -1464,6 +1482,8 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
     cb_conf.surface = accel_state->dst_obj.surface;
 
     switch (pDstPicture->format) {
+    case PICT_a2r10g10b10:
+    case PICT_x2r10g10b10:
     case PICT_a8r8g8b8:
     case PICT_x8r8g8b8:
     case PICT_a1r5g5b5:
@@ -1471,6 +1491,8 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
     default:
 	cb_conf.comp_swap = 1; /* ARGB */
 	break;
+    case PICT_a2b10g10r10:
+    case PICT_x2b10g10r10:
     case PICT_a8b8g8r8:
     case PICT_x8b8g8r8:
 	cb_conf.comp_swap = 0; /* ABGR */
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171223060737.12271-3-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#11 lore raw

Re: [PATCH 2/3] exa: Accelerate ARGB2101010 pictures (v2)

Quoted 11 lines · Mario Kleiner

From: Fredrik Höglund <[email protected]>

Tested by Mario on a Radeon HD 4000 series for the r600 exa path, and on Radeon HD 5770 for the evergreen exa path.

v2: Add format handling in XXXSetSolidConsts() as well,
as suggested by Fredrik.

As Fredrik mentioned, this isn't necessary, because solid pictures currently always have format a8r8g8b8 (see CreateSolidPicture => createSourcePicture in xserver/render/picture.c).

I'll just take v1 of this patch with Fredrik's Signed-off-by (thanks).

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw

PATCH 3/3 Support exa screen color depth 30 on Linux 3.16 and later. (v2)

In reply to a message not in the archive

Linux 3.16's radeon-kms introduced 10 bpc fb support. Currently, as of X-Server 1.19, this works with exa accel, but not yet when using glamor acceleration.

v2: Style fixes, check for glamor first, as suggested
by Michel.

---
 man/radeon.man   |  3 ++-
 src/radeon_kms.c | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
man/radeon.man +2 -1
index f4441c4..889355b 100644
@@ -18,7 +18,8 @@ following features:
 .PD 0
 .TP 2
 \(bu
-Full support for 8-, 15-, 16- and 24-bit pixel depths;
+Full support for 8-, 15-, 16- and 24-bit pixel depths, and for 30-bit depth on Linux 3.16
+and later with EXA acceleration;
 .TP
 \(bu
 RandR 1.2 and RandR 1.3 support;
src/radeon_kms.c +17 -0
index a9300d4..07a490a 100644
@@ -1248,6 +1248,7 @@ static Bool RADEONPreInitVisual(ScrnInfoPtr pScrn)
     case 15:
     case 16:
     case 24:
+    case 30:
 	break;
 
     default:
@@ -1763,6 +1764,22 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 
     if (!RADEONPreInitAccel_KMS(pScrn))              goto fail;
 
+    /* Depth 30 not yet supported under glamor. */
+    if (pScrn->depth == 30 && info->use_glamor) {
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		   "Given depth (%d) is not supported under GLAMOR accel. Select EXA.\n",
+		   pScrn->depth);
+	goto fail;
+    }
+
+    /* Depth 30 only supported since Linux 3.16 / kms driver minor version 39 */
+    if (pScrn->depth == 30 && info->dri2.pKernelDRMVersion->version_minor < 39) {
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		   "Given depth (%d) is not supported. Kernel too old. Needs Linux 3.16+\n",
+		   pScrn->depth);
+	goto fail;
+    }
+
     radeon_drm_queue_init();
 
     info->allowColorTiling2D = FALSE;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171223060737.12271-4-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#14 lore raw

Re: [PATCH 3/3] Support exa screen color depth 30 on Linux 3.16 and later. (v2)

Quoted 8 lines · Mario Kleiner

Linux 3.16's radeon-kms introduced 10 bpc fb support. Currently, as of X-Server 1.19, this works with exa accel, but not yet when using glamor acceleration.

v2: Style fixes, check for glamor first, as suggested
by Michel.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx