tech-x11 archive

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

Re: s3_drv of xorg



Hi! all,


From: KIYOHARA Takashi <kiyohara%kk.iij4u.or.jp@localhost>
Date: Wed, 10 Dec 2008 01:12:56 +0900 (JST)

> the s3 was not included in SRCS though s3_accel.c was necessary.
> Moreover, s3_accel.c has a lot of ugly codes in which '#ifdef S3_NEWMMIO'
> is done.  This will not be able to support Trio64/964(older) and Trio64V2/
> 968(newmmio) at the same time perhaps.  bebox use Trio64.

I made this patches.
My machine(bebox) works with S3 Trio64.  Can you test with Trio64V2 or 968?

Thanks,
--
kiyohara

Index: external/mit/xorg/server/drivers/xf86-video-s3/Makefile
===================================================================
RCS file: /cvsroot/src/external/mit/xorg/server/drivers/xf86-video-s3/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- external/mit/xorg/server/drivers/xf86-video-s3/Makefile     3 Aug 2008 
09:24:14 -0000       1.3
+++ external/mit/xorg/server/drivers/xf86-video-s3/Makefile     14 Dec 2008 
16:58:11 -0000
@@ -5,6 +5,7 @@
 
 SRCS=          s3_bios.c s3_cursor.c s3_dga.c s3_driver.c s3_IBMRGB.c
 SRCS+=         s3_Ti.c s3_Trio64DAC.c s3_video.c
+SRCS+=         s3_accel.c
 
 CPPFLAGS.s3_driver.c=  -Wno-error      # XXX fix me please
 .include "../Makefile.xf86-driver"
Index: external/mit/xf86-video-s3/dist/src/s3_accel.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xf86-video-s3/dist/src/s3_accel.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 s3_accel.c
--- external/mit/xf86-video-s3/dist/src/s3_accel.c      2 Aug 2008 05:15:15 
-0000       1.1.1.1
+++ external/mit/xf86-video-s3/dist/src/s3_accel.c      14 Dec 2008 17:00:15 
-0000
@@ -68,7 +68,7 @@
 static void S3SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
                                      int w, int h)
 {
-#ifdef S3_NEWMMIO
+#if defined(S3_NEWMMIO) || defined(S3_NETBSD_NEWMMIO)
        S3Ptr pS3 = S3PTR(pScrn);
 #endif
 
@@ -185,7 +185,7 @@
        }
 }
 
-#ifdef S3_NEWMMIO
+#if defined(S3_NEWMMIO) || defined(S3_NETBSD_NEWMMIO)
 static void S3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
                                                 int fg, int bg,
                                                 int rop,
@@ -307,7 +307,7 @@
                                           int major, int minor,
                                           int err, int len, int octant)
 {
-#ifdef S3_NEWMMIO
+#if defined(S3_NEWMMIO) || defined(S3_NETBSD_NEWMMIO)
        S3Ptr pS3 = S3PTR(pScrn);
 #endif
        unsigned short cmd;
@@ -541,7 +541,7 @@
 
 #endif
        
-#ifdef S3_NEWMMIO
+#if defined(S3_NEWMMIO) || defined(S3_NETBSD_NEWMMIO)
 Bool S3AccelInitNewMMIO(ScreenPtr pScreen)
 #else
 Bool S3AccelInitPIO(ScreenPtr pScreen)
@@ -575,6 +575,10 @@
        pXAA->SetupForColor8x8PatternFill = S3SetupForColor8x8PatternFill;
        pXAA->SubsequentColor8x8PatternFillRect = 
S3SubsequentColor8x8PatternFillRect;
 
+#if defined(S3_NETBSD_NEWMMIO)
+       if (!pS3->S3NewMMIO)
+               goto skip_no_mmio;
+#endif
 #ifdef S3_NEWMMIO
        pXAA->SetupForCPUToScreenColorExpandFill =
                S3SetupForCPUToScreenColorExpandFill;
@@ -586,6 +590,9 @@
                                                BIT_ORDER_IN_BYTE_MSBFIRST |
                                                SCANLINE_PAD_DWORD;
 #endif
+#if defined(S3_NETBSD_NEWMMIO)
+skip_no_mmio:
+#endif
 
 #if 0
 #ifndef S3_NEWMMIO
@@ -614,3 +621,11 @@
 
        return XAAInit(pScreen, pXAA);
 }
+
+#if defined(S3_NETBSD_NEWMMIO)
+Bool S3AccelInitPIO(ScreenPtr pScreen)
+{
+
+       S3AccelInitNewMMIO(pScreen);
+}
+#endif
Index: external/mit/xf86-video-s3/dist/src/s3_reg.h
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xf86-video-s3/dist/src/s3_reg.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 s3_reg.h
--- external/mit/xf86-video-s3/dist/src/s3_reg.h        2 Aug 2008 05:15:16 
-0000       1.1.1.1
+++ external/mit/xf86-video-s3/dist/src/s3_reg.h        14 Dec 2008 17:00:16 
-0000
@@ -180,7 +180,7 @@
 #define SET_DOUBLE_BUFFER(val)  
((mmtr)s3MmioMem)->streams_regs.regs.double_buffer = (val)
 #define SET_OPAQUE_OVERLAY(val) 
((mmtr)s3MmioMem)->streams_regs.regs.opaq_overlay_cntl = (val)
 
-#else
+#elif !defined(__NetBSD__)
 
 #define CMD_REG_WIDTH  0x0000
 
@@ -256,6 +256,173 @@
 #define SET_ERR_TERM2(err)     S3_OUTW(ERR_TERM2, err)
 
 #define SET_MAJ_AXIS_PCNT(maj) S3_OUTW(MAJ_AXIS_PCNT, maj)
+#else  /* __NetBSD__ */
+
+#define S3_NETBSD_NEWMMIO
+
+#include "newmmio.h"
+#undef CMD_REG_WIDTH
+#undef SET_AXIS_PCNT
+#undef SET_CMD
+#undef SET_COLOR_CMP
+#undef SET_CUR_X
+#undef SET_CUR_Y
+#undef SET_CURPT
+#undef SET_FRGD_COLOR
+#undef SET_BKGD_COLOR
+#undef SET_FRGD_MIX
+#undef SET_DESTSTP
+#undef SET_ERR_TERM
+#undef SET_MULT_MISC
+#undef SET_MAJ_AXIS_PCNT
+#undef SET_PIX_CNTL
+#undef SET_PIX_TRANS_L
+#undef SET_SCISSORS
+#undef SET_WRT_MASK
+#undef WaitQueue
+
+#define CMD_REG_WIDTH  (pS3->S3NewMMIO ? 0x200 : 0x0000)
+
+#define SET_AXIS_PCNT(maj, min)        do {                                    
\
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.axis_pcnt =         \
+                   ((min) & 0xffff) | ((maj) << 16);                   \
+       else {                                                          \
+               S3_OUTW(MAJ_AXIS_PCNT, maj);                            \
+               S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (min));         \
+       }                                                               \
+} while (0)
+
+#define SET_CMD(cmd)   do {                                            \
+       if (pS3->S3NewMMIO) {                                           \
+               mem_barrier();                                          \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.command = (cmd);    \
+       } else                                                          \
+               S3_OUTW(CMD, cmd);                                      \
+} while (0)
+
+#define SET_COLOR_CMP(color)   do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.color_cmp = (color);\
+       else                                                            \
+               S3_OUTW32(COLOR_CMP, color);                            \
+} while (0)
+
+#define SET_CUR_X(cur_x)       do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->enh_regs.regs.cur_x = (cur_x);       \
+       else                                                            \
+               S3_OUTW(CUR_X, cur_x);                                  \
+} while (0)
+#define SET_CUR_Y(cur_y)       do {                            \
+       if (pS3->S3NewMMIO)                                     \
+               ((mmtr)s3MmioMem)->cur_y.cur_y = (cur_y);       \
+       else                                                    \
+               S3_OUTW(CUR_Y, cur_y);                          \
+} while (0)
+#define SET_CURPT(cur_x, cur_y)        do {                            \
+       if (pS3->S3NewMMIO)                                     \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.cur_point = \
+                   ((cur_y) & 0xffff) | ((cur_x) << 16);       \
+       else {                                                  \
+               S3_OUTW(CUR_X, cur_x);                          \
+               S3_OUTW(CUR_Y, cur_y);                          \
+       }                                                       \
+} while (0)
+
+#define SET_FRGD_COLOR(col)    do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.frgd_color = (col); \
+       else                                                            \
+               S3_OUTW32(FRGD_COLOR, col);                             \
+} while (0)
+#define SET_BKGD_COLOR(col)    do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.bkgd_color = (col); \
+       else                                                            \
+               S3_OUTW32(BKGD_COLOR, col);                             \
+} while (0)
+
+#define SET_FRGD_MIX(fmix)     do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->enh_regs.regs.fore_mix = (fmix);     \
+       else                                                            \
+               S3_OUTW(FRGD_MIX, (fmix));                              \
+} while (0)
+
+#define SET_DESTSTP(x, y)      do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.dest_stp =          \
+                   ((y) & 0xffff) | ((x) << 16);                       \
+       else {                                                          \
+               S3_OUTW(DESTX_DIASTP, x);                               \
+               S3_OUTW(DESTY_AXSTP, y);                                \
+       }                                                               \
+} while (0)
+
+#define SET_ERR_TERM(err)      do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.err_term = (err);   \
+       else                                                            \
+               S3_OUTW(ERR_TERM, err);                                 \
+} while (0)
+
+#define SET_MULT_MISC(val)     do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.mult_misc = (val);  \
+       else                                                            \
+               S3_OUTW(MULTIFUNC_CNTL, MULT_MISC | (val));             \
+} while (0)
+
+#define SET_MAJ_AXIS_PCNT(maj) do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->enh_regs.regs.mj_ax_pcnt = (maj);    \
+       else                                                            \
+               S3_OUTW(MAJ_AXIS_PCNT, maj);                            \
+} while (0)
+
+#define SET_PIX_CNTL(val)      do {                            \
+       if (pS3->S3NewMMIO)                                     \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.pix_mult =  \
+                   (val) | (MULT_MISC2 << 16);                 \
+       else                                                    \
+               S3_OUTW(MULTIFUNC_CNTL, PIX_CNTL | (val));      \
+} while (0)
+
+#define SET_PIX_TRANS_L(val)   do {                    \
+       if (pS3->S3NewMMIO)                             \
+               ((mmtr)s3MmioMem)->img[0] = (val);      \
+       else                                            \
+               outl(PIX_TRANS, val);                   \
+} while (0)
+
+#define SET_SCISSORS(x1,y1,x2,y2)      do {                            \
+       if (pS3->S3NewMMIO) {                                           \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_topleft  =    \
+                   ((y1) & 0xffff) | ((x1) << 16);                     \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.sciss_botright =    \
+                   ((y2) & 0xffff) | ((x2) << 16);                     \
+       } else {                                                        \
+               S3_OUTW(MULTIFUNC_CNTL, SCISSORS_T | (y1));             \
+               S3_OUTW(MULTIFUNC_CNTL, SCISSORS_L | (x1));             \
+               S3_OUTW(MULTIFUNC_CNTL, SCISSORS_R | (x2));             \
+               S3_OUTW(MULTIFUNC_CNTL, SCISSORS_B | (y2));             \
+       }                                                               \
+} while (0)
+
+#define SET_WRT_MASK(mask)     do {                                    \
+       if (pS3->S3NewMMIO)                                             \
+               ((mmtr)s3MmioMem)->pk_enh_regs.regs.wrt_mask = (mask);  \
+       else                                                            \
+               S3_OUTW32(WRT_MASK, mask);                              \
+} while (0)
+
+#define WaitQueue(n)   do {                            \
+       if (!pS3->S3NewMMIO || !pS3->PCIRetry) {        \
+               mem_barrier();                          \
+               while(inb(GP_STAT) & (0x0100 >> (n)));  \
+       }                                               \
+} while (0)
 #endif
 
 


Home | Main Index | Thread Index | Old Index