Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-video-pnozz/dist/src Add some accelerati...



details:   https://anonhg.NetBSD.org/xsrc/rev/952732e6fee9
branches:  trunk
changeset: 10736:952732e6fee9
user:      jdc <jdc%NetBSD.org@localhost>
date:      Wed Jun 09 07:25:57 2021 +0000

description:
Add some acceleration using the P9100 quad and blit commands:
- for solid fill (quad)
- for pixmap copy (blit) when source and destination pitch are the same

diffstat:

 external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c  |  70 ++++++++++++--------
 external/mit/xf86-video-pnozz/dist/src/pnozz_regs.h |   6 +-
 2 files changed, 48 insertions(+), 28 deletions(-)

diffs (181 lines):

diff -r 1cee9752dc3c -r 952732e6fee9 external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c
--- a/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c        Wed Jun 02 15:01:18 2021 +0000
+++ b/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c        Wed Jun 09 07:25:57 2021 +0000
@@ -1,7 +1,6 @@
 /*
  * SBus Weitek P9100 EXA support
- */
-/*-
+ *
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -79,11 +78,9 @@
 #define waitReady(pPnozz) while((pnozz_read_4(pPnozz, ENGINE_STATUS) & \
                                (ENGINE_BUSY | BLITTER_BUSY)) !=0 )
 
-void PnozzInitEngine(PnozzPtr);
+/* From pnozz_accel.c */
 void pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour);
 
-extern CARD32 MaxClip, junk;
-
 static void
 PnozzWaitMarker(ScreenPtr pScreen, int Marker)
 {
@@ -110,8 +107,10 @@
     waitReady(pPnozz);
     pnozz_write_4(pPnozz, RASTER_OP, (PnozzCopyROP[alu] & 0xff));
     pnozz_write_4(pPnozz, PLANE_MASK, planemask);
-    pPnozz->srcoff = exaGetPixmapOffset(pSrcPixmap) / pPnozz->width;
+    pPnozz->srcoff = exaGetPixmapOffset(pSrcPixmap);
 
+    if (exaGetPixmapPitch(pSrcPixmap) != exaGetPixmapPitch(pDstPixmap))
+       return FALSE;
     return TRUE;
 }
 
@@ -130,24 +129,25 @@
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
     PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
     CARD32 src, dst, srcw, dstw;
-    int doff = exaGetPixmapOffset(pDstPixmap) / pPnozz->width;
+    int soff = pPnozz->srcoff / exaGetPixmapPitch(pDstPixmap);
+    int doff = exaGetPixmapOffset(pDstPixmap) / exaGetPixmapPitch(pDstPixmap);
     
     src = (((xSrc << pPnozz->depthshift) & 0x1fff) << 16) |
-       ((ySrc + pPnozz->srcoff) & 0x1fff);
+       ((ySrc + soff) & 0x1fff);
     dst = (((xDst << pPnozz->depthshift) & 0x1fff) << 16) |
        ((yDst + doff) & 0x1fff);
-    srcw = ((((xSrc + w) << pPnozz->depthshift) - 1) << 16) | 
-        ((ySrc + pPnozz->srcoff + h - 1) & 0x1fff);
+    srcw = ((((xSrc + w) << pPnozz->depthshift) - 1) << 16) |
+       ((ySrc + soff + h) & 0x1fff);
     dstw = ((((xDst + w) << pPnozz->depthshift) - 1) << 16) |
-        ((yDst + doff + h - 1) & 0x1fff);
+       ((yDst + doff + h) & 0x1fff);
 
     waitReady(pPnozz);
-
     pnozz_write_4(pPnozz, ABS_XY0, src);
     pnozz_write_4(pPnozz, ABS_XY1, srcw);
     pnozz_write_4(pPnozz, ABS_XY2, dst);
     pnozz_write_4(pPnozz, ABS_XY3, dstw);
-    junk = pnozz_read_4(pPnozz, COMMAND_BLIT);
+    pnozz_read_4(pPnozz, COMMAND_BLIT);
+
     exaMarkSync(pDstPixmap->drawable.pScreen);
 }
 
@@ -172,7 +172,8 @@
     
     waitReady(pPnozz);
     pnozz_write_colour(pPnozz, FOREGROUND_COLOR, fg);
-    pnozz_write_4(pPnozz, RASTER_OP, PnozzDrawROP[alu] & 0xff);
+    pnozz_write_colour(pPnozz, BACKGROUND_COLOR, fg);
+    pnozz_write_4(pPnozz, RASTER_OP, ROP_PAT);
     pnozz_write_4(pPnozz, PLANE_MASK, planemask);
     pnozz_write_4(pPnozz, COORD_INDEX, 0);
 
@@ -189,15 +190,18 @@
 {
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
     PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
-    int w = x2 - x - 1;
-    int h = y2 - y - 1;
+    int doff = exaGetPixmapOffset(pPixmap);
 
     waitReady(pPnozz);
-    pnozz_write_4(pPnozz, RECT_RTW_XY, ((x & 0x1fff) << 16) | 
-        (y & 0x1fff));
-    pnozz_write_4(pPnozz, RECT_RTP_XY, (((w & 0x1fff) << 16) | 
-        (h & 0x1fff)));
-    junk = pnozz_read_4(pPnozz, COMMAND_QUAD);
+    pnozz_write_4(pPnozz, ABS_XY0, (((x + doff) & 0x1fff) << 16) |
+       (y & 0x1fff));
+    pnozz_write_4(pPnozz, ABS_XY1, (((x + doff) & 0x1fff) << 16) |
+       (y2 & 0x1fff));
+    pnozz_write_4(pPnozz, ABS_XY2, (((x2 + doff) & 0x1fff) << 16) |
+       (y2 & 0x1fff));
+    pnozz_write_4(pPnozz, ABS_XY3, (((x2 + doff) & 0x1fff) << 16) |
+       (y & 0x1fff));
+    pnozz_read_4(pPnozz, COMMAND_QUAD);
     exaMarkSync(pPixmap->drawable.pScreen);
 }
 
@@ -208,8 +212,6 @@
     PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
     ExaDriverPtr pExa;
     
-    PnozzInitEngine(pPnozz);
-
     pExa = exaDriverAlloc();
     if (!pExa)
        return FALSE;
@@ -223,7 +225,8 @@
 
     /* round to multiple of pixmap pitch */
     pExa->memorySize = (pPnozz->vidmem / pPnozz->width) * pPnozz->width;
-    pExa->offScreenBase = pPnozz->width * pPnozz->height;
+    pExa->offScreenBase = pPnozz->width * pPnozz->height *
+       (pScrn->bitsPerPixel / 8);
 
     /*
      * our blitter can't deal with variable pitches
@@ -231,10 +234,10 @@
     pExa->pixmapOffsetAlign = pPnozz->width;
     pExa->pixmapPitchAlign = pPnozz->width;
 
-    pExa->flags = EXA_MIXED_PIXMAPS;
+    pExa->flags = EXA_MIXED_PIXMAPS | EXA_OFFSCREEN_PIXMAPS | EXA_SUPPORTS_OFFSCREEN_OVERLAPS;
 
-    pExa->maxX = 4096;
-    pExa->maxY = 4096;
+    pExa->maxX = 1600;
+    pExa->maxY = 1200;
 
     pExa->WaitMarker = PnozzWaitMarker;
 
@@ -246,5 +249,18 @@
     pExa->Copy = PnozzCopy;
     pExa->DoneCopy = PnozzDoneCopy;
 
+    /* Drawing engine defaults */
+    pnozz_write_4(pPnozz, DRAW_MODE, 0);
+    pnozz_write_4(pPnozz, PLANE_MASK, 0xffffffff);     
+    pnozz_write_4(pPnozz, PATTERN0, 0xffffffff);       
+    pnozz_write_4(pPnozz, PATTERN1, 0xffffffff);       
+    pnozz_write_4(pPnozz, PATTERN2, 0xffffffff);       
+    pnozz_write_4(pPnozz, PATTERN3, 0xffffffff);       
+    pnozz_write_4(pPnozz, WINDOW_OFFSET, 0);
+    pnozz_write_4(pPnozz, WINDOW_MIN, 0);
+    pnozz_write_4(pPnozz, WINDOW_MAX, CLIP_MAX);
+    pnozz_write_4(pPnozz, BYTE_CLIP_MIN, 0);
+    pnozz_write_4(pPnozz, BYTE_CLIP_MAX, CLIP_MAX);
+    
     return exaDriverInit(pScreen, pExa);;
 }
diff -r 1cee9752dc3c -r 952732e6fee9 external/mit/xf86-video-pnozz/dist/src/pnozz_regs.h
--- a/external/mit/xf86-video-pnozz/dist/src/pnozz_regs.h       Wed Jun 02 15:01:18 2021 +0000
+++ b/external/mit/xf86-video-pnozz/dist/src/pnozz_regs.h       Wed Jun 09 07:25:57 2021 +0000
@@ -20,7 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-/* $NetBSD: pnozz_regs.h,v 1.1 2009/08/26 22:28:26 macallan Exp $ */
+/* $NetBSD: pnozz_regs.h,v 1.2 2021/06/09 07:25:57 jdc Exp $ */
 
 #ifndef PNOZZ_REGS_H
 #define PNOZZ_REGS_H
@@ -168,6 +168,10 @@
 #define PIXEL_8_REG                    0x221c  /* PIXEL_8 overflow data */
 #define WINDOW_MIN                     0x2220
 #define WINDOW_MAX                     0x2224
+       #define CLIP_MAX                        0x1fff1fff
+
+#define COLOR_2                        0x2230
+#define COLOR_3                        0x2234
 
 #define PATTERN0                       0x2280
 #define PATTERN1                       0x2284



Home | Main Index | Thread Index | Old Index