Module Name: xsrc
Committed By: macallan
Date: Wed Jul 3 02:05:53 UTC 2013
Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c
Log Message:
support PictOpOver with 32bit source without alpha, alpha in mask
now KDE3 looks mostly right
( yes, it's almost usable on a 125MHz HyperSPARC )
gtk2 apps still crash though
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.7 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.8
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.7 Tue Jun 25 12:26:57 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h Wed Jul 3 02:05:52 2013
@@ -138,6 +138,8 @@ void CG14Comp_Over32(Cg14Ptr, uint32_t,
int, int);
void CG14Comp_Over32Mask(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
uint32_t, uint32_t, int, int);
+void CG14Comp_Over32Mask_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
+ uint32_t, uint32_t, uint32_t, int, int);
void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
void CG14Comp_Add32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.3 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.4
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.3 Tue Jun 25 12:31:29 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c Wed Jul 3 02:05:52 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.3 2013/06/25 12:31:29 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.4 2013/07/03 02:05:52 macallan Exp $ */
/*
* Copyright (c) 2013 Michael Lorenz
* All rights reserved.
@@ -293,7 +293,8 @@ CG14PrepareSolid(PixmapPtr pPixmap, int
Cg14Ptr p = GET_CG14_FROM_SCRN(pScrn);
ENTER;
- DPRINTF(X_ERROR, "bits per pixel: %d\n", pPixmap->drawable.bitsPerPixel);
+ DPRINTF(X_ERROR, "bits per pixel: %d\n",
+ pPixmap->drawable.bitsPerPixel);
write_sx_reg(p, SX_QUEUED(8), fg);
write_sx_reg(p, SX_QUEUED(9), fg);
if (planemask != p->last_mask) {
@@ -583,7 +584,8 @@ CG14PrepareComposite(int op, PicturePtr
ENTER;
if (pSrcPicture->format == PICT_a1) {
- xf86Msg(X_ERROR, "src mono, dst %x, op %d\n", pDstPicture->format, op);
+ xf86Msg(X_ERROR, "src mono, dst %x, op %d\n",
+ pDstPicture->format, op);
if (pMaskPicture != NULL) {
xf86Msg(X_ERROR, "msk %x\n", pMaskPicture->format);
}
@@ -674,10 +676,11 @@ CG14Composite(PixmapPtr pDst, int srcX,
break;
default:
xf86Msg(X_ERROR,
- "unsupported mask format\n");
+ "unsupported mask format\n");
}
} else {
- DPRINTF(X_ERROR, "non-solid over with msk %x\n", p->mskformat);
+ DPRINTF(X_ERROR, "non-solid over with msk %x\n",
+ p->mskformat);
switch (p->srcformat) {
case PICT_a8r8g8b8:
case PICT_a8b8g8r8:
@@ -705,7 +708,24 @@ CG14Composite(PixmapPtr pDst, int srcX,
break;
case PICT_x8r8g8b8:
case PICT_x8b8g8r8:
- xf86Msg(X_ERROR, "alpha better be separate\n");
+ src = p->srcoff +
+ (srcY * p->srcpitch) +
+ (srcX << 2);
+ dst = dstoff +
+ (dstY * dstpitch) +
+ (dstX << 2);
+ if (p->mskformat == PICT_a8) {
+ msk = p->mskoff +
+ (maskY * p->mskpitch) +
+ maskX;
+ CG14Comp_Over32Mask_noalpha(p,
+ src, p->srcpitch,
+ msk, p->mskpitch,
+ dst, dstpitch,
+ width, height);
+ } else {
+ xf86Msg(X_ERROR, "no src alpha, mask is %x\n", p->mskformat);
+ }
break;
default:
xf86Msg(X_ERROR, "%s: format %x in non-solid Over op\n",
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.2 Tue Jun 25 12:31:29 2013
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c Wed Jul 3 02:05:52 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.2 2013/06/25 12:31:29 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.3 2013/07/03 02:05:52 macallan Exp $ */
/*
* Copyright (c) 2013 Michael Lorenz
* All rights reserved.
@@ -119,9 +119,9 @@ void CG14Comp_Over32Solid(Cg14Ptr p,
/* fetch destination pixels */
write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx & 7));
/* duplicate them for all channels */
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
/* generate inverted alpha */
write_sx_reg(p, SX_INSTRUCTIONS,
@@ -229,9 +229,9 @@ void CG14Comp_Over8Solid(Cg14Ptr p,
/* fetch destination pixels */
write_sx_io(p, dstx, SX_LDUQ0(60, 3, dstx & 7));
/* duplicate them for all channels */
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
- write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 12, 13, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 16, 17, 2));
+ write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 20, 21, 2));
write_sx_reg(p, SX_INSTRUCTIONS, SX_ORS(0, 24, 25, 2));
/* generate inverted alpha */
write_sx_reg(p, SX_INSTRUCTIONS,
@@ -468,3 +468,51 @@ void CG14Comp_Over32Mask(Cg14Ptr p,
dst += dstpitch;
}
}
+
+void CG14Comp_Over32Mask_noalpha(Cg14Ptr p,
+ uint32_t src, uint32_t srcpitch,
+ uint32_t msk, uint32_t mskpitch,
+ uint32_t dst, uint32_t dstpitch,
+ int width, int height)
+{
+ uint32_t srcx, dstx, mskx, m;
+ int line, x, i;
+
+ ENTER;
+
+ write_sx_reg(p, SX_QUEUED(8), 0xff);
+ for (line = 0; line < height; line++) {
+ srcx = src;
+ mskx = msk;
+ dstx = dst;
+
+ for (x = 0; x < width; x++) {
+ /* fetch source pixel */
+ write_sx_io(p, srcx, SX_LDUQ0(12, 0, srcx & 7));
+ /* fetch mask */
+ write_sx_io(p, mskx & (~7), SX_LDB(9, 0, mskx & 7));
+ /* fetch dst pixel */
+ write_sx_io(p, dstx, SX_LDUQ0(20, 0, dstx & 7));
+ /* write alpha into SCAM */
+ write_sx_reg(p, SX_INSTRUCTIONS,
+ SX_ORS(9, 0, R_SCAM, 0));
+ /* src * alpha + R0 */
+ write_sx_reg(p, SX_INSTRUCTIONS,
+ SX_SAXP16X16SR8(13, 0, 17, 2));
+ /* write inverted alpha into SCAM */
+ write_sx_reg(p, SX_INSTRUCTIONS,
+ SX_XORV(9, 8, R_SCAM, 0));
+ /* dst * (1 - alpha) + R[13:15] */
+ write_sx_reg(p, SX_INSTRUCTIONS,
+ SX_SAXP16X16SR8(21, 17, 25, 2));
+ write_sx_io(p, dstx,
+ SX_STUQ0C(24, 0, dstx & 7));
+ srcx += 4;
+ mskx += 1;
+ dstx += 4;
+ }
+ src += srcpitch;
+ msk += mskpitch;
+ dst += dstpitch;
+ }
+}