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 support for EXA...



details:   https://anonhg.NetBSD.org/xsrc/rev/942d7f3f0d62
branches:  trunk
changeset: 10725:942d7f3f0d62
user:      jdc <jdc%NetBSD.org@localhost>
date:      Thu May 27 04:48:10 2021 +0000

description:
Add support for EXA, so that the pnozz driver works again with Xorg.
Note, that only minimal acceleration is currently supported.

Thanks to macallan for the pointers to get this working.

diffstat:

 external/mit/xf86-video-pnozz/dist/src/compat-api.h   |   99 +++++++
 external/mit/xf86-video-pnozz/dist/src/pnozz.h        |   24 +-
 external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c  |  155 ++++++++++-
 external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c |    7 +-
 external/mit/xf86-video-pnozz/dist/src/pnozz_driver.c |  180 ++++++-----
 external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c    |  250 ++++++++++++++++++
 6 files changed, 617 insertions(+), 98 deletions(-)

diffs (truncated from 1065 to 300 lines):

diff -r 93fb13996ce9 -r 942d7f3f0d62 external/mit/xf86-video-pnozz/dist/src/compat-api.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/xf86-video-pnozz/dist/src/compat-api.h       Thu May 27 04:48:10 2021 +0000
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER 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.
+ *
+ * Author: Dave Airlie <airlied%redhat.com@localhost>
+ */
+
+/* this file provides API compat between server post 1.13 and pre it,
+   it should be reused inside as many drivers as possible */
+#ifndef COMPAT_API_H
+#define COMPAT_API_H
+
+#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
+#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
+#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
+#endif
+
+#ifndef XF86_HAS_SCRN_CONV
+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
+#endif
+
+#ifndef XF86_SCRN_INTERFACE
+
+#define SCRN_ARG_TYPE int
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
+
+#define SCREEN_ARG_TYPE int
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
+
+#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
+
+#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
+#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
+
+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
+#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
+
+#define FREE_SCREEN_ARGS_DECL int arg, int flags
+
+#define VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
+
+#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
+#else
+#define SCRN_ARG_TYPE ScrnInfoPtr
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
+
+#define SCREEN_ARG_TYPE ScreenPtr
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
+
+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS pScreen
+
+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
+#define SWITCH_MODE_ARGS(arg, m) arg, m
+
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS pScrn
+
+#define XF86_SCRN_ARG(x) (x)
+
+#endif
+
+#endif
diff -r 93fb13996ce9 -r 942d7f3f0d62 external/mit/xf86-video-pnozz/dist/src/pnozz.h
--- a/external/mit/xf86-video-pnozz/dist/src/pnozz.h    Fri May 21 19:09:50 2021 +0000
+++ b/external/mit/xf86-video-pnozz/dist/src/pnozz.h    Thu May 27 04:48:10 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.h,v 1.1 2009/08/26 22:28:26 macallan Exp $ */
+/* $NetBSD: pnozz.h,v 1.2 2021/05/27 04:48:10 jdc Exp $ */
 
 #ifndef PNOZZ_H
 #define PNOZZ_H
@@ -29,10 +29,14 @@
 #include "xf86_OSproc.h"
 #include "xf86RamDac.h"
 #include <X11/Xmd.h>
+#include <dev/sun/fbio.h>
 #include "gcstruct.h"
 #include "pnozz_regs.h"
 #include "xf86sbusBus.h"
+#ifdef HAVE_XAA_H
 #include "xaa.h"
+#endif
+#include "exa.h"
 
 typedef struct {
        unsigned int fg, bg;                    /* FG/BG colors for stipple */
@@ -53,19 +57,29 @@
        int             width;
        int             height, scanlinesize, maxheight;
        int             depthshift;
+       int             vidmem;
 
        sbusDevicePtr   psdp;
+       struct fbcursor Cursor;
        Bool            HWCursor;
        Bool            NoAccel;
+       Bool            useXAA;
        CloseScreenProcPtr CloseScreen;
        
        xf86CursorInfoPtr CursorInfoRec;
-       struct fbcursor Cursor;
+       unsigned int    CursorXY;
+       int             CursorBg, CursorFg;
+       Bool            CursorEnabled;
+       unsigned int    cursmask[32];   /* cursor mask bits */
+       unsigned int    cursbits[32];   /* what to show where mask enabled */
        unsigned char pal[9];
        
        OptionInfoPtr   Options;
-       XAAInfoRecPtr   pXAA;
+       ExaDriverPtr    pExa;
+       int             srcoff;
+#ifdef HAVE_XAA_H
        unsigned char   *buffers[2];
+#endif
        /*
         * XXX this is enough for everything a SPARCbook could do on it's
         * internal display but not necessarily for an external one
@@ -114,7 +128,9 @@
 void pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int);
 
 int PnozzAccelInit(ScrnInfoPtr);
+Bool PnozzDGAInit(ScreenPtr);
+int PnozzEXAInit(ScreenPtr);
 void PnozzHideCursor(ScrnInfoPtr);
 void PnozzShowCursor(ScrnInfoPtr);
 
-#endif /* CG6_H */
+#endif /* PNOZZ_H */
diff -r 93fb13996ce9 -r 942d7f3f0d62 external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c
--- a/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c      Fri May 21 19:09:50 2021 +0000
+++ b/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c      Thu May 27 04:48:10 2021 +0000
@@ -20,15 +20,15 @@
  * 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_accel.c,v 1.2 2011/05/25 14:15:26 christos Exp $ */
+/* $NetBSD: pnozz_accel.c,v 1.3 2021/05/27 04:48:10 jdc Exp $ */
 
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <dev/sun/fbio.h>
-#include <dev/wscons/wsconsio.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "pnozz.h"
+#include "pnozz_regs.h"
+#include "dgaproc.h"
 
 static CARD32 PnozzCopyROP[] = {
        /*GXclear*/             0,
@@ -68,6 +68,31 @@
        /*GXset*/               ROP_PAT
 };
 
+/* DGA stuff */
+
+static Bool Pnozz_OpenFramebuffer(ScrnInfoPtr pScrn, char **,
+    unsigned char **mem, int *, int *, int *);
+static Bool Pnozz_SetMode(ScrnInfoPtr, DGAModePtr);
+static void Pnozz_SetViewport(ScrnInfoPtr, int, int, int);
+static int Pnozz_GetViewport(ScrnInfoPtr);
+static void Pnozz_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+static void Pnozz_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+
+static void PnozzSync(ScrnInfoPtr);
+
+static DGAFunctionRec Pnozz_DGAFuncs = {
+        Pnozz_OpenFramebuffer,
+        NULL,
+        Pnozz_SetMode,
+        Pnozz_SetViewport,
+        Pnozz_GetViewport,
+        PnozzSync,
+        Pnozz_FillRect,
+        Pnozz_BlitRect,
+        NULL
+};
+
+
 CARD32 MaxClip, junk;
 
 void
@@ -84,7 +109,7 @@
  * registers we need to juggle bytes ourselves.
  */
 
-static void
+void
 pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour)
 {
     CARD32 c2;
@@ -117,7 +142,7 @@
     pnozz_write_4(pPnozz, BYTE_CLIP_MAX, MaxClip);
 }
 
-static void
+void
 PnozzInitEngine(PnozzPtr pPnozz)
 {
     unClip(pPnozz);
@@ -223,6 +248,8 @@
     junk = pnozz_read_4(pPnozz, COMMAND_QUAD);
 }
 
+#ifdef HAVE_XAA_H
+
 static void 
 PnozzSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
                        int fg, int bg,
@@ -441,7 +468,6 @@
 /*
  * TODO:
  * - CPU to VRAM colour blits
- * - DGA support
  */
 
 int
@@ -535,3 +561,114 @@
     
     return 0;
 }
+
+#endif /* HAVE_XAA_H */
+
+Bool
+PnozzDGAInit(ScreenPtr pScreen)
+{
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
+    DGAModePtr mode;
+    int result;
+    
+    mode = xnfcalloc(sizeof(DGAModeRec), 1);
+    if (mode == NULL) {
+        xf86Msg(X_WARNING, "%s: DGA setup failed, cannot allocate memory\n",
+            pPnozz->psdp->device);
+        return FALSE;
+    }
+    
+    mode->mode = pScrn->modes;
+    mode->flags = DGA_PIXMAP_AVAILABLE | DGA_CONCURRENT_ACCESS;
+    if(!pPnozz->NoAccel) {
+        mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+    }
+    
+    mode->imageWidth = mode->pixmapWidth = mode->viewportWidth =
+       pScrn->virtualX;
+    mode->imageHeight = mode->pixmapHeight = mode->viewportHeight =
+       pScrn->virtualY;
+
+    mode->bytesPerScanline = mode->imageWidth;
+



Home | Main Index | Thread Index | Old Index