diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-08-23 21:00:48 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-08-23 21:00:48 +0000 |
commit | b1c7b06d60bf08fbd59f53a13ea6e881f174590e (patch) | |
tree | 8bb1bea114774e694463d27e80522524754f64ad /driver/xf86-video-ast | |
parent | ee8f8c1de54a945896b5ac093b93a292ff7fef7f (diff) |
xf86-video-ast 0.85.0
Diffstat (limited to 'driver/xf86-video-ast')
-rw-r--r-- | driver/xf86-video-ast/ChangeLog | 29 | ||||
-rw-r--r-- | driver/xf86-video-ast/configure.ac | 14 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/Makefile.am | 1 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast.h | 28 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_2dtool.c | 2 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_2dtool.h | 123 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_accel.c | 45 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_cursor.c | 8 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_driver.c | 91 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_mode.c | 22 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_mode.h | 3 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_pcirename.h | 122 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_tool.c | 45 | ||||
-rw-r--r-- | driver/xf86-video-ast/src/ast_vgatool.c | 12 |
14 files changed, 427 insertions, 118 deletions
diff --git a/driver/xf86-video-ast/ChangeLog b/driver/xf86-video-ast/ChangeLog index ea39c1c08..4237daf27 100644 --- a/driver/xf86-video-ast/ChangeLog +++ b/driver/xf86-video-ast/ChangeLog @@ -1,3 +1,32 @@ +2008-03-18 Y.C. Chen <yc_chen@aspeedtech.com> + * src/ast_2dtool.c + * src/ast_tool.c + Compiler Warning Fixed + +2008-03-01 Y.C. Chen <yc_chen@aspeedtech.com> + * src/ast_driver.c: + Add _X_EXPORT for symbols public visibility + +2007-08-24 Y.C. Chen <yc_chen@aspeedtech.com> + + * configure.ac: + * src/ast.h: + * src/ast_2dtool.c: + * src/ast_accel.c: + * src/ast_cursor.c: + * src/ast_driver.c: + * src/ast_mode.c: + * src/ast_tool.c: + * src/ast_vgatool.c: + * src/ast_2dtool.h + * src/ast_mode.h: + Support AST2100 + +2006-04-17 Y.C. Chen <yc_chen@aspeedtech.com> + + * src/ast_vgatool.c: (GetMaxDCLK): + Fixed can't get correct MCLK in some platforms + 2006-04-07 Adam Jackson <ajax@freedesktop.org> * configure.ac: diff --git a/driver/xf86-video-ast/configure.ac b/driver/xf86-video-ast/configure.ac index 61b7a3906..0f88d18f7 100644 --- a/driver/xf86-video-ast/configure.ac +++ b/driver/xf86-video-ast/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-ast], - 0.81.0, + 0.85.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-ast) @@ -58,10 +58,22 @@ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_M sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" +AC_CHECK_DECL(XSERVER_LIBPCIACCESS, + [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], + [#include "xorg-server.h"]) +CPPFLAGS="$SAVE_CPPFLAGS" # Checks for header files. AC_HEADER_STDC +if test "x$XSERVER_LIBPCIACCESS" = xyes; then + PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) + XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" +fi +AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) + AC_SUBST([XORG_CFLAGS]) AC_SUBST([moduledir]) diff --git a/driver/xf86-video-ast/src/Makefile.am b/driver/xf86-video-ast/src/Makefile.am index 039617351..4cd7075cc 100644 --- a/driver/xf86-video-ast/src/Makefile.am +++ b/driver/xf86-video-ast/src/Makefile.am @@ -39,6 +39,7 @@ ast_drv_la_SOURCES = \ ast_driver.c \ ast_mode.c \ ast_mode.h \ + ast_pcirename.h \ ast_tool.c \ ast_vgatool.c \ ast_vgatool.h diff --git a/driver/xf86-video-ast/src/ast.h b/driver/xf86-video-ast/src/ast.h index e1f0426c4..cc878e958 100644 --- a/driver/xf86-video-ast/src/ast.h +++ b/driver/xf86-video-ast/src/ast.h @@ -23,10 +23,13 @@ #include <string.h> #include <stdlib.h> +#include "ast_pcirename.h" + /* Compiler Options */ #define Accel_2D /* #define MMIO_2D */ #define HWC +/* #define PATCH_ABI_VERSION */ /* Vendor & Device Info */ #ifndef PCI_VENDOR_AST @@ -37,12 +40,18 @@ #define PCI_CHIP_AST2000 0x2000 #endif +typedef enum _CHIP_ID { + VGALegacy, + AST2000, + AST2100 +} CHIP_ID; + /* AST REC Info */ #define AST_NAME "AST" #define AST_DRIVER_NAME "ast" -#define AST_MAJOR_VERSION 0 -#define AST_MINOR_VERSION 81 -#define AST_PATCH_VERSION 0 +#define AST_MAJOR_VERSION PACKAGE_VERSION_MAJOR +#define AST_MINOR_VERSION PACKAGE_VERSION_MINOR +#define AST_PATCH_VERSION PACKAGE_VERSION_PATCHLEVEL #define AST_VERSION \ ((AST_MAJOR_VERSION << 20) | (AST_MINOR_VERSION << 10) | AST_PATCH_VERSION) @@ -54,6 +63,9 @@ #define CMD_QUEUE_GUARD_BAND 0x00000020 #define DEFAULT_HWC_NUM 0x00000002 +/* Patch Info */ +#define ABI_VIDEODRV_VERSION_PATCH SET_ABI_VERSION(0, 5) + /* Data Type Definition */ typedef INT32 LONG; typedef CARD8 UCHAR; @@ -120,8 +132,12 @@ typedef struct { typedef struct _ASTRec { EntityInfoPtr pEnt; - pciVideoPtr PciInfo; - PCITAG PciTag; +#ifndef XSERVER_LIBPCIACCESS + pciVideoPtr PciInfo; + PCITAG PciTag; +#else + struct pci_device *PciInfo; +#endif OptionInfoPtr Options; DisplayModePtr ModePtr; @@ -132,6 +148,8 @@ typedef struct _ASTRec { CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; + + UCHAR jChipType; Bool noAccel; Bool noHWC; diff --git a/driver/xf86-video-ast/src/ast_2dtool.c b/driver/xf86-video-ast/src/ast_2dtool.c index afbac7cbe..a8b5838aa 100644 --- a/driver/xf86-video-ast/src/ast_2dtool.c +++ b/driver/xf86-video-ast/src/ast_2dtool.c @@ -254,7 +254,7 @@ Exit_vWaitEngIdle: } /* ULONG ulGetCMDQLength() */ -__inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG ulWritePointer, ULONG ulCMDQMask) +static __inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG ulWritePointer, ULONG ulCMDQMask) { ULONG ulReadPointer, ulReadPointer2; diff --git a/driver/xf86-video-ast/src/ast_2dtool.h b/driver/xf86-video-ast/src/ast_2dtool.h index 193d3cd47..b6ca79df0 100644 --- a/driver/xf86-video-ast/src/ast_2dtool.h +++ b/driver/xf86-video-ast/src/ast_2dtool.h @@ -61,23 +61,28 @@ typedef struct _PKT_SC } PKT_SC, *PPKT_SC; /* Eng Reg. Limitation */ -#define MAX_SRC_PITCH 0x1FFF -#define MAX_DST_PITCH 0x1FFF -#define MAX_DST_HEIGHT 0x7FF #define MAX_SRC_X 0x7FF #define MAX_SRC_Y 0x7FF #define MAX_DST_X 0x7FF #define MAX_DST_Y 0x7FF -#define MAX_RECT_WIDTH 0x7FF -#define MAX_RECT_HEIGHT 0x7FF -#define MAX_CLIP 0xFFF -#define MAX_LINE_X 0x7FF -#define MAX_LINE_Y 0x7FF -#define MAX_LINE_ERR 0x3FFFFF -#define MAX_LINE_WIDTH 0x7FF -#define MAX_LINE_K1 0x3FFFFF -#define MAX_LINE_K2 0x3FFFFF +#define MASK_SRC_PITCH 0x1FFF +#define MASK_DST_PITCH 0x1FFF +#define MASK_DST_HEIGHT 0x7FF +#define MASK_SRC_X 0xFFF +#define MASK_SRC_Y 0xFFF +#define MASK_DST_X 0xFFF +#define MASK_DST_Y 0xFFF +#define MASK_RECT_WIDTH 0x7FF +#define MASK_RECT_HEIGHT 0x7FF +#define MASK_CLIP 0xFFF + +#define MASK_LINE_X 0xFFF +#define MASK_LINE_Y 0xFFF +#define MASK_LINE_ERR 0x3FFFFF +#define MASK_LINE_WIDTH 0x7FF +#define MASK_LINE_K1 0x3FFFFF +#define MASK_LINE_K2 0x3FFFFF #define MAX_PATReg_Size 256 @@ -195,10 +200,10 @@ typedef struct _LINEPARAM { typedef struct { - ULONG X1; - ULONG Y1; - ULONG X2; - ULONG Y2; + LONG X1; + LONG Y1; + LONG X2; + LONG Y2; } _LINEInfo; @@ -208,91 +213,91 @@ typedef struct { { \ do { \ *(ULONG *)(MMIOREG_SRC_BASE) = (ULONG) (base); \ - } while (*(ULONG *)(MMIOREG_SRC_BASE) != (ULONG) (base)); \ + } while (*(volatile ULONG *)(MMIOREG_SRC_BASE) != (ULONG) (base)); \ } #define ASTSetupSRCPitch_MMIO(pitch) \ { \ do { \ *(ULONG *)(MMIOREG_SRC_PITCH) = (ULONG)(pitch << 16); \ - } while (*(ULONG *)(MMIOREG_SRC_PITCH) != (ULONG)(pitch << 16)); \ + } while (*(volatile ULONG *)(MMIOREG_SRC_PITCH) != (ULONG)(pitch << 16)); \ } #define ASTSetupDSTBase_MMIO(base) \ { \ do { \ *(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \ - } while (*(ULONG *)(MMIOREG_DST_BASE) != (ULONG)(base)); \ + } while (*(volatile ULONG *)(MMIOREG_DST_BASE) != (ULONG)(base)); \ } #define ASTSetupDSTPitchHeight_MMIO(pitch, height) \ { \ ULONG dstpitch; \ - dstpitch = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \ + dstpitch = (ULONG)((pitch << 16) + ((height) & MASK_DST_HEIGHT)); \ do { \ *(ULONG *)(MMIOREG_DST_PITCH) = dstpitch; \ - } while (*(ULONG *)(MMIOREG_DST_PITCH) != dstpitch); \ + } while (*(volatile ULONG *)(MMIOREG_DST_PITCH) != dstpitch); \ } #define ASTSetupDSTXY_MMIO(x, y) \ { \ ULONG dstxy; \ - dstxy = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \ + dstxy = (ULONG)(((x & MASK_DST_X) << 16) + (y & MASK_DST_Y)); \ do { \ *(ULONG *)(MMIOREG_DST_XY) = dstxy; \ - } while (*(ULONG *)(MMIOREG_DST_XY) != dstxy); \ + } while (*(volatile ULONG *)(MMIOREG_DST_XY) != dstxy); \ } #define ASTSetupSRCXY_MMIO(x, y) \ { \ ULONG srcxy; \ - srcxy = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \ + srcxy = (ULONG)(((x & MASK_SRC_X) << 16) + (y & MASK_SRC_Y)); \ do { \ *(ULONG *)(MMIOREG_SRC_XY) = srcxy; \ - } while (*(ULONG *)(MMIOREG_SRC_XY) != srcxy); \ + } while (*(volatile ULONG *)(MMIOREG_SRC_XY) != srcxy); \ } #define ASTSetupRECTXY_MMIO(x, y) \ { \ ULONG rectxy; \ - rectxy = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \ + rectxy = (ULONG)(((x & MASK_RECT_WIDTH) << 16) + (y & MASK_RECT_WIDTH)); \ do { \ *(ULONG *)(MMIOREG_RECT_XY) = rectxy; \ - } while (*(ULONG *)(MMIOREG_RECT_XY) != rectxy); \ + } while (*(volatile ULONG *)(MMIOREG_RECT_XY) != rectxy); \ } #define ASTSetupFG_MMIO(color) \ { \ do { \ *(ULONG *)(MMIOREG_FG) = (ULONG)(color); \ - } while (*(ULONG *)(MMIOREG_FG) != (ULONG)(color)); \ + } while (*(volatile ULONG *)(MMIOREG_FG) != (ULONG)(color)); \ } #define ASTSetupBG_MMIO(color) \ { \ do { \ *(ULONG *)(MMIOREG_BG) = (ULONG)(color); \ - } while (*(ULONG *)(MMIOREG_BG) != (ULONG)(color)); \ + } while (*(volatile ULONG *)(MMIOREG_BG) != (ULONG)(color)); \ } #define ASTSetupMONO1_MMIO(pat) \ { \ do { \ *(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \ - } while (*(ULONG *)(MMIOREG_MONO1) != (ULONG)(pat)); \ + } while (*(volatile ULONG *)(MMIOREG_MONO1) != (ULONG)(pat)); \ } #define ASTSetupMONO2_MMIO(pat) \ { \ do { \ *(ULONG *)(MMIOREG_MONO2) = (ULONG)(pat); \ - } while (*(ULONG *)(MMIOREG_MONO2) != (ULONG)(pat)); \ + } while (*(volatile ULONG *)(MMIOREG_MONO2) != (ULONG)(pat)); \ } #define ASTSetupCLIP1_MMIO(left, top) \ { \ ULONG clip1; \ - clip1 = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \ + clip1 = (ULONG)(((left & MASK_CLIP) << 16) + (top & MASK_CLIP)); \ do { \ *(ULONG *)(MMIOREG_CLIP1) = clip1; \ - } while (*(ULONG *)(MMIOREG_CLIP1) != clip1); \ + } while (*(volatile ULONG *)(MMIOREG_CLIP1) != clip1); \ } #define ASTSetupCLIP2_MMIO(right, bottom) \ { \ ULONG clip2; \ - clip2 = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \ + clip2 = (ULONG)(((right & MASK_CLIP) << 16) + (bottom & MASK_CLIP)); \ do { \ *(ULONG *)(MMIOREG_CLIP2) = clip2; \ - } while (*(ULONG *)(MMIOREG_CLIP2) != clip2); \ + } while (*(volatile ULONG *)(MMIOREG_CLIP2) != clip2); \ } #define ASTSetupCMDReg_MMIO(reg) \ { \ @@ -302,57 +307,57 @@ typedef struct { { \ do { \ *(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \ - } while (*(ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \ + } while (*(volatile ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \ } /* Line CMD */ #define ASTSetupLineXY_MMIO(x, y) \ { \ ULONG linexy; \ - linexy = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \ + linexy = (ULONG)(((x & MASK_LINE_X) << 16) + (y & MASK_LINE_Y)); \ do { \ *(ULONG *)(MMIOREG_LINE_XY) = linexy; \ - } while (*(ULONG *)(MMIOREG_LINE_XY) != linexy); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_XY) != linexy); \ } #define ASTSetupLineXMErrTerm_MMIO(xm, err) \ { \ ULONG lineerr; \ - lineerr = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \ + lineerr = (ULONG)((xm << 24) + (err & MASK_LINE_ERR)); \ do { \ *(ULONG *)(MMIOREG_LINE_Err) = lineerr; \ - } while (*(ULONG *)(MMIOREG_LINE_Err) != lineerr); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_Err) != lineerr); \ } #define ASTSetupLineWidth_MMIO(width) \ { \ ULONG linewidth; \ - linewidth = (ULONG)((width & MAX_LINE_WIDTH) << 16); \ + linewidth = (ULONG)((width & MASK_LINE_WIDTH) << 16); \ do { \ *(ULONG *)(MMIOREG_LINE_WIDTH) = linewidth; \ - } while (*(ULONG *)(MMIOREG_LINE_WIDTH) != linewidth); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_WIDTH) != linewidth); \ } #define ASTSetupLineK1Term_MMIO(err) \ { \ do { \ - *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MAX_LINE_K1); \ - } while (*(ULONG *)(MMIOREG_LINE_K1) != (ULONG)(err & MAX_LINE_K1)); \ + *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MASK_LINE_K1); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_K1) != (ULONG)(err & MASK_LINE_K1)); \ } #define ASTSetupLineK2Term_MMIO(err) \ { \ do { \ - *(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MAX_LINE_K2); \ - } while (*(ULONG *)(MMIOREG_LINE_K2) != (ULONG)(err & MAX_LINE_K2)); \ + *(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MASK_LINE_K2); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_K2) != (ULONG)(err & MASK_LINE_K2)); \ } #define ASTSetupLineStyle1_MMIO(pat) \ { \ do { \ *(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \ - } while (*(ULONG *)(MMIOREG_LINE_STYLE1) != (ULONG)(pat)); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE1) != (ULONG)(pat)); \ } #define ASTSetupLineStyle2_MMIO(pat) \ { \ do { \ *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \ - } while (*(ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \ + } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \ } /* CMDQ Mode Macro */ @@ -377,22 +382,22 @@ typedef struct { #define ASTSetupDSTPitchHeight(addr, pitch, height) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_PITCH); \ - addr->PKT_SC_dwData[0] = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \ + addr->PKT_SC_dwData[0] = (ULONG)((pitch << 16) + ((height) & MASK_DST_HEIGHT)); \ } #define ASTSetupDSTXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_XY); \ - addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_DST_X) << 16) + (y & MASK_DST_Y)); \ } #define ASTSetupSRCXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_XY); \ - addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_SRC_X) << 16) + (y & MASK_SRC_Y)); \ } #define ASTSetupRECTXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_RECT_XY); \ - addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_RECT_WIDTH) << 16) + (y & MASK_RECT_WIDTH)); \ } #define ASTSetupFG(addr, color) \ { \ @@ -417,12 +422,12 @@ typedef struct { #define ASTSetupCLIP1(addr, left, top) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP1); \ - addr->PKT_SC_dwData[0] = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((left & MASK_CLIP) << 16) + (top & MASK_CLIP)); \ } #define ASTSetupCLIP2(addr, right, bottom) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP2); \ - addr->PKT_SC_dwData[0] = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((right & MASK_CLIP) << 16) + (bottom & MASK_CLIP)); \ } #define ASTSetupCMDReg(addr, reg) \ { \ @@ -439,27 +444,27 @@ typedef struct { #define ASTSetupLineXY(addr, x, y) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_XY); \ - addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \ + addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_LINE_X) << 16) + (y & MASK_LINE_Y)); \ } #define ASTSetupLineXMErrTerm(addr, xm, err) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_Err); \ - addr->PKT_SC_dwData[0] = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \ + addr->PKT_SC_dwData[0] = (ULONG)((xm << 24) + (err & MASK_LINE_ERR)); \ } #define ASTSetupLineWidth(addr, width) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_WIDTH); \ - addr->PKT_SC_dwData[0] = (ULONG)((width & MAX_LINE_WIDTH) << 16); \ + addr->PKT_SC_dwData[0] = (ULONG)((width & MASK_LINE_WIDTH) << 16); \ } #define ASTSetupLineK1Term(addr, err) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K1); \ - addr->PKT_SC_dwData[0] = (ULONG)(err & MAX_LINE_K1); \ + addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K1); \ } #define ASTSetupLineK2Term(addr, err) \ { \ addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K2); \ - addr->PKT_SC_dwData[0] = (ULONG)(err & MAX_LINE_K2); \ + addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K2); \ } #define ASTSetupLineStyle1(addr, pat) \ { \ diff --git a/driver/xf86-video-ast/src/ast_accel.c b/driver/xf86-video-ast/src/ast_accel.c index 689235e14..1ef309521 100644 --- a/driver/xf86-video-ast/src/ast_accel.c +++ b/driver/xf86-video-ast/src/ast_accel.c @@ -256,7 +256,6 @@ ASTAccelInit(ScreenPtr pScreen) infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | HARDWARE_CLIP_MONO_8x8_FILL | HARDWARE_CLIP_COLOR_8x8_FILL | - HARDWARE_CLIP_SOLID_FILL | HARDWARE_CLIP_SOLID_LINE | HARDWARE_CLIP_DASHED_LINE | HARDWARE_CLIP_SOLID_LINE; @@ -338,11 +337,13 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, /* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n"); */ - + /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; srcbase = dstbase = 0; if (y1 >= MAX_SRC_Y) @@ -479,7 +480,9 @@ ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn, /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if (dst_y >= pScrn->virtualY) @@ -587,7 +590,9 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, /* Modify Reg. Value */ cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if(dir == DEGREES_0) { /* horizontal */ @@ -659,6 +664,8 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; + else + ulCommand &= ~CMD_ENABLE_CLIP; dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; @@ -667,7 +674,7 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, y1 -= miny; y2 -= miny; } - + LineInfo.X1 = x1; LineInfo.Y1 = y1; LineInfo.X2 = x2; @@ -703,6 +710,9 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, /* Update Write Pointer */ mUpdateWritePointer; + + /* Patch KDE pass abnormal point, ycchen@052507 */ + vWaitEngIdle(pScrn, pAST); } else @@ -814,6 +824,8 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; if (pAST->EnableClip) ulCommand |= CMD_ENABLE_CLIP; + else + ulCommand &= ~CMD_ENABLE_CLIP; dstbase = 0; miny = (y1 > y2) ? y2 : y1; maxy = (y1 > y2) ? y1 : y2; @@ -822,7 +834,7 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, y1 -= miny; y2 -= miny; } - + LineInfo.X1 = x1; LineInfo.Y1 = y1; LineInfo.X2 = x2; @@ -858,7 +870,10 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, /* Update Write Pointer */ mUpdateWritePointer; - + + /* Patch KDE pass abnormal point, ycchen@052507 */ + vWaitEngIdle(pScrn, pAST); + } else { @@ -951,7 +966,9 @@ ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn, /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if (dst_y >= pScrn->virtualY) @@ -1070,7 +1087,9 @@ ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if (dst_y >= pScrn->virtualY) @@ -1184,7 +1203,9 @@ ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if (dst_y >= pScrn->virtualY) @@ -1308,7 +1329,9 @@ ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, /* Modify Reg. Value */ cmdreg = pAST->ulCMDReg; if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; + cmdreg |= CMD_ENABLE_CLIP; + else + cmdreg &= ~CMD_ENABLE_CLIP; dstbase = 0; if (dst_y >= pScrn->virtualY) { diff --git a/driver/xf86-video-ast/src/ast_cursor.c b/driver/xf86-video-ast/src/ast_cursor.c index 9d30e5c9c..aaa9cb3b0 100644 --- a/driver/xf86-video-ast/src/ast_cursor.c +++ b/driver/xf86-video-ast/src/ast_cursor.c @@ -62,7 +62,7 @@ Bool ASTCursorInit(ScreenPtr pScreen); Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST); static void ASTShowCursor(ScrnInfoPtr pScrn); -static void ASTHideCursor(ScrnInfoPtr pScrn); +void ASTHideCursor(ScrnInfoPtr pScrn); static void ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); static void ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); static void ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src); @@ -146,7 +146,7 @@ ASTShowCursor(ScrnInfoPtr pScrn) } -static void +void ASTHideCursor(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); @@ -235,8 +235,8 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src) for (k=7; k>0; k-=2) { jTempSrcAnd32 = *((UCHAR *) pjSrcAnd); - jTempSrcXor32 = *((UCHAR *) pjSrcXor); - ulTempDstAnd32[0] = ((jTempSrcAnd32 >> k) & 0x01) ? 0x00008000L:0x00L; + jTempSrcXor32 = *((UCHAR *) pjSrcXor); + ulTempDstAnd32[0] = ((jTempSrcAnd32 >> k) & 0x01) ? 0x00008000L:0x00L; ulTempDstXor32[0] = ((jTempSrcXor32 >> k) & 0x01) ? 0x00004000L:0x00L; ulTempDstData32[0] = ((jTempSrcXor32 >> k) & 0x01) ? pAST->HWCInfo.fg:pAST->HWCInfo.bg; ulTempDstAnd32[1] = ((jTempSrcAnd32 >> (k-1)) & 0x01) ? 0x80000000L:0x00L; diff --git a/driver/xf86-video-ast/src/ast_driver.c b/driver/xf86-video-ast/src/ast_driver.c index 8967c9b5b..5ae07e3fb 100644 --- a/driver/xf86-video-ast/src/ast_driver.c +++ b/driver/xf86-video-ast/src/ast_driver.c @@ -78,6 +78,7 @@ extern void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST); extern Bool ASTAccelInit(ScreenPtr pScreen); extern Bool ASTCursorInit(ScreenPtr pScreen); +extern void ASTHideCursor(ScrnInfoPtr pScrn); /* Mandatory functions */ static void ASTIdentify(int flags); @@ -108,7 +109,7 @@ static Bool ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. */ -DriverRec AST = { +_X_EXPORT DriverRec AST = { AST_VERSION, AST_DRIVER_NAME, ASTIdentify, @@ -248,12 +249,16 @@ static XF86ModuleVersionInfo astVersRec = { XORG_VERSION_CURRENT, AST_MAJOR_VERSION, AST_MINOR_VERSION, AST_PATCH_VERSION, ABI_CLASS_VIDEODRV, +#ifdef PATCH_ABI_VERSION + ABI_VIDEODRV_VERSION_PATCH, +#else ABI_VIDEODRV_VERSION, +#endif MOD_CLASS_VIDEODRV, {0, 0, 0, 0} }; -XF86ModuleData astModuleData = { &astVersRec, astSetup, NULL }; +_X_EXPORT XF86ModuleData astModuleData = { &astVersRec, astSetup, NULL }; static pointer astSetup(pointer module, pointer opts, int *errmaj, int *errmin) @@ -334,6 +339,7 @@ ASTProbe(DriverPtr drv, int flags) return FALSE; } +#ifndef XSERVER_LIBPCIACCESS /* * This probing is just checking the PCI data the server already * collected. @@ -341,6 +347,7 @@ ASTProbe(DriverPtr drv, int flags) if (xf86GetPciVideoInfo() == NULL) { return FALSE; } +#endif numUsed = xf86MatchPciInstances(AST_NAME, PCI_VENDOR_AST, ASTChipsets, ASTPciChipsets, @@ -512,8 +519,10 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pAST = ASTPTR(pScrn); pAST->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); pAST->PciInfo = xf86GetPciInfoForEntity(pAST->pEnt->index); +#ifndef XSERVER_LIBPCIACCESS pAST->PciTag = pciTag(pAST->PciInfo->bus, pAST->PciInfo->device, pAST->PciInfo->func); +#endif /* Process the options * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities, @@ -544,7 +553,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) } else { from = X_PROBED; pScrn->chipset = (char *)xf86TokenToString(ASTChipsets, - pAST->PciInfo->chipType); + PCI_DEV_DEVICE_ID(pAST->PciInfo)); } if (pAST->pEnt->device->chipRev >= 0) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", @@ -563,16 +572,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) /* "Patch" the PIOOffset inside vgaHW in order to force * the vgaHW module to use our relocated i/o ports. */ - VGAHWPTR(pScrn)->PIOOffset = pAST->PIOOffset = pAST->IODBase + pAST->PciInfo->ioBase[2] - 0x380; + VGAHWPTR(pScrn)->PIOOffset = pAST->PIOOffset = pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380; - pAST->RelocateIO = (IOADDRESS)(pAST->PciInfo->ioBase[2] + pAST->IODBase); + pAST->RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) + pAST->IODBase); if (pAST->pEnt->device->MemBase != 0) { pAST->FBPhysAddr = pAST->pEnt->device->MemBase; from = X_CONFIG; } else { - if (pAST->PciInfo->memBase[0] != 0) { - pAST->FBPhysAddr = pAST->PciInfo->memBase[0] & 0xFFF00000; + if (PCI_REGION_BASE(pAST->PciInfo, 0, REGION_MEM) != 0) { + pAST->FBPhysAddr = PCI_REGION_BASE(pAST->PciInfo, 0, REGION_MEM) & 0xFFF00000; from = X_PROBED; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -588,8 +597,8 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pAST->MMIOPhysAddr = pAST->pEnt->device->IOBase; from = X_CONFIG; } else { - if (pAST->PciInfo->memBase[1]) { - pAST->MMIOPhysAddr = pAST->PciInfo->memBase[1] & 0xFFFF0000; + if (PCI_REGION_BASE(pAST->PciInfo, 1, REGION_MEM)) { + pAST->MMIOPhysAddr = PCI_REGION_BASE(pAST->PciInfo, 1, REGION_IO) & 0xFFFF0000; from = X_PROBED; } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -627,6 +636,12 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->memPhysBase = (ULONG)pAST->FBPhysAddr; pScrn->fbOffset = 0; + /* Get Revision */ + if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10) + pAST->jChipType = AST2100; + else + pAST->jChipType = AST2000; + /* Do DDC * should be done after xf86CollectOptions */ @@ -641,12 +656,21 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = FALSE; - i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + /* Add for AST2100, ycchen@061807 */ + if (pAST->jChipType == AST2100) + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, - 0, 320, 1600, 8 * pScrn->bitsPerPixel, + 0, 320, 1920, 8 * pScrn->bitsPerPixel, 200, 1200, pScrn->display->virtualX, pScrn->display->virtualY, pAST->FbMapSize, LOOKUP_BEST_REFRESH); + else + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + 0, 320, 1600, 8 * pScrn->bitsPerPixel, + 200, 1200, + pScrn->display->virtualX, pScrn->display->virtualY, + pAST->FbMapSize, LOOKUP_BEST_REFRESH); if (i == -1) { ASTFreeRec(pScrn); @@ -884,7 +908,8 @@ ASTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ pAST->pHWCPtr = NULL; - } + } + ASTHideCursor(pScrn); #endif #ifdef Accel_2D @@ -942,7 +967,8 @@ ASTLeaveVT(int scrnIndex, int flags) if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ pAST->pHWCPtr = NULL; - } + } + ASTHideCursor(pScrn); #endif #ifdef Accel_2D @@ -971,6 +997,8 @@ static ModeStatus ASTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ASTRecPtr pAST = ASTPTR(pScrn); Bool Flags = MODE_NOMODE; if (mode->Flags & V_INTERLACE) { @@ -988,6 +1016,13 @@ ASTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) } return Flags; } + + /* Add for AST2100, ycchen@061807 */ + if (pAST->jChipType == AST2100) + { + if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1200) ) + return MODE_OK; + } switch (mode->CrtcHDisplay) { @@ -1064,7 +1099,8 @@ ASTCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pAST->pHWCPtr) { xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */ pAST->pHWCPtr = NULL; - } + } + ASTHideCursor(pScrn); #endif #ifdef Accel_2D @@ -1103,7 +1139,7 @@ ASTSave(ScrnInfoPtr pScrn) ASTRecPtr pAST; vgaRegPtr vgaReg; ASTRegPtr astReg; - int i; + int i, icount=0; pAST = ASTPTR(pScrn); vgaReg = &VGAHWPTR(pScrn)->SavedReg; @@ -1115,9 +1151,13 @@ ASTSave(ScrnInfoPtr pScrn) /* Ext. Save */ vASTOpenKey(pScrn); - for (i=0; i<0x50; i++) - GetIndexReg(CRTC_PORT, (UCHAR) (i+0x80), astReg->ExtCRTC[i]); - + /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */ + for (i=0x81; i<=0xB6; i++) + GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); + for (i=0xBC; i<=0xC1; i++) + GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); + GetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]); + } static void @@ -1126,7 +1166,7 @@ ASTRestore(ScrnInfoPtr pScrn) ASTRecPtr pAST; vgaRegPtr vgaReg; ASTRegPtr astReg; - int i; + int i, icount=0; pAST = ASTPTR(pScrn); vgaReg = &VGAHWPTR(pScrn)->SavedReg; @@ -1140,9 +1180,13 @@ ASTRestore(ScrnInfoPtr pScrn) /* Ext. restore */ vASTOpenKey(pScrn); - for (i=0; i<0x50; i++) - SetIndexReg(CRTC_PORT, (UCHAR) (i+0x80), astReg->ExtCRTC[i]); - + /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */ + for (i=0x81; i<=0xB6; i++) + SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); + for (i=0xBC; i<=0xC1; i++) + SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]); + SetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]); + } static void @@ -1193,7 +1237,8 @@ vFillASTModeInfo (ScrnInfoPtr pScrn) pAST->VideoModeInfo.ScreenWidth = pScrn->virtualX; pAST->VideoModeInfo.ScreenHeight = pScrn->virtualY; pAST->VideoModeInfo.bitsPerPixel = pScrn->bitsPerPixel; - pAST->VideoModeInfo.ScreenPitch = pScrn->virtualX * ((pScrn->bitsPerPixel + 1) / 8) ; + /* Fixed screen pitch incorrect in some specific monitor, ycchen@071707 */ + pAST->VideoModeInfo.ScreenPitch = pScrn->displayWidth * ((pScrn->bitsPerPixel + 1) / 8) ; } diff --git a/driver/xf86-video-ast/src/ast_mode.c b/driver/xf86-video-ast/src/ast_mode.c index 776ac39f3..624c4655c 100644 --- a/driver/xf86-video-ast/src/ast_mode.c +++ b/driver/xf86-video-ast/src/ast_mode.c @@ -130,7 +130,7 @@ VBIOS_STDTABLE_STRUCT StdTable[] = { }; VBIOS_ENHTABLE_STRUCT Res640x480Table[] = { - { 800, 640, 8, 96, 525, 480, 2, 2, VCLK28_322, /* 60Hz */ + { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */ (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E }, { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */ (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E }, @@ -167,7 +167,7 @@ VBIOS_ENHTABLE_STRUCT Res1024x768Table[] = { {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */ (SyncPP | Charx8Dot), 75, 3, 0x31 }, {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */ - (SyncPP | Charx8Dot), 85, 4, 0x31 }, + (SyncPP | Charx8Dot), 84, 4, 0x31 }, {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */ (SyncPP | Charx8Dot), 0xFF, 4, 0x31 }, }; @@ -187,7 +187,14 @@ VBIOS_ENHTABLE_STRUCT Res1600x1200Table[] = { {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */ (SyncPP | Charx8Dot), 60, 1, 0x33 }, {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */ - (SyncPP | Charx8Dot), 60, 1, 0x33 }, + (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, +}; + +VBIOS_ENHTABLE_STRUCT Res1920x1200Table[] = { + {2592, 1920,136, 200, 1245, 1200, 3, 6, VCLK193_25, /* 60Hz */ + (SyncPP | Charx8Dot), 60, 1, 0x33 }, + {2592, 1920,136, 200, 1245, 1200, 3, 6, VCLK193_25, /* end */ + (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, }; VBIOS_DCLK_INFO DCLKTable [] = { @@ -207,6 +214,7 @@ VBIOS_DCLK_INFO DCLKTable [] = { {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ + {0x61, 0x2C, 0x81}, /* 10: VCLK193_25 */ }; VBIOS_DAC_INFO DAC_TEXT[] = { @@ -423,8 +431,10 @@ Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_ break; case 1600: pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x1200Table[ulRefreshRateIndex]; - break; - default: + break; + case 1920: + pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1920x1200Table[ulRefreshRateIndex]; + break; default: return (FALSE); } @@ -633,7 +643,7 @@ void vSetDCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMo SetIndexRegMask(CRTC_PORT,0xC0, 0x00, pDCLKPtr->Param1); SetIndexRegMask(CRTC_PORT,0xC1, 0x00, pDCLKPtr->Param2); - SetIndexRegMask(CRTC_PORT,0xBB, 0xCF, ((pDCLKPtr->Param3 & 0x03) << 4)); + SetIndexRegMask(CRTC_PORT,0xBB, 0x0F, (pDCLKPtr->Param3 & 0x80) | ((pDCLKPtr->Param3 & 0x03) << 4) ); } diff --git a/driver/xf86-video-ast/src/ast_mode.h b/driver/xf86-video-ast/src/ast_mode.h index 0a8e20c96..b1926a3d2 100644 --- a/driver/xf86-video-ast/src/ast_mode.h +++ b/driver/xf86-video-ast/src/ast_mode.h @@ -21,7 +21,7 @@ */ /* Mode Limitation */ -#define MAX_HResolution 1600 +#define MAX_HResolution 1920 #define MAX_VResolution 1200 /* Std. Table Index Definition */ @@ -48,6 +48,7 @@ #define VCLK135 0x0D #define VCLK157_5 0x0E #define VCLK162 0x0F +#define VCLK193_25 0x10 /* Flags Definition */ #define Charx8Dot 0x00000001 diff --git a/driver/xf86-video-ast/src/ast_pcirename.h b/driver/xf86-video-ast/src/ast_pcirename.h new file mode 100644 index 000000000..f5085bdda --- /dev/null +++ b/driver/xf86-video-ast/src/ast_pcirename.h @@ -0,0 +1,122 @@ +/* + * Copyright 2007 George Sapountzis + * + * 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. + */ + +/** + * Macros for porting drivers from legacy xfree86 PCI code to the pciaccess + * library. The main purpose being to facilitate source code compatibility. + */ + +#ifndef ASTPCIRENAME_H +#define ASTPCIRENAME_H + +enum region_type { + REGION_MEM, + REGION_IO +}; + +#ifndef XSERVER_LIBPCIACCESS + +/* pciVideoPtr */ +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->chipType) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->chipRev) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subsysVendor) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subsysCard) + +#define PCI_DEV_TAG(_pcidev) pciTag((_pcidev)->bus, \ + (_pcidev)->device, \ + (_pcidev)->func) +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->device) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pciConfigPtr */ +#define PCI_CFG_TAG(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->tag) +#define PCI_CFG_BUS(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->busnum) +#define PCI_CFG_DEV(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->devnum) +#define PCI_CFG_FUNC(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->funcnum) + +/* region addr: xfree86 uses different fields for memory regions and I/O ports */ +#define PCI_REGION_BASE(_pcidev, _b, _type) \ + (((_type) == REGION_MEM) ? (_pcidev)->memBase[(_b)] \ + : (_pcidev)->ioBase[(_b)]) + +/* region size: xfree86 uses the log2 of the region size, + * but with zero meaning no region, not size of one XXX */ +#define PCI_REGION_SIZE(_pcidev, _b) \ + (((_pcidev)->size[(_b)] > 0) ? (1 << (_pcidev)->size[(_b)]) : 0) + +/* read/write PCI configuration space */ +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadByte(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadLong(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pciWriteLong(PCI_CFG_TAG(_pcidev), (_offset), (_value)) + +#else /* XSERVER_LIBPCIACCESS */ + +typedef struct pci_device *pciVideoPtr; + +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor_id) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->device_id) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->revision) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subvendor_id) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subdevice_id) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_DEV_TAG(_pcidev) (_pcidev) + +/* PCI_DEV macros, typically used in printf's, add domain ? XXX */ +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_CFG_TAG(_pcidev) (_pcidev) + +/* PCI_CFG macros, typically used in DRI init, contain the domain */ +#define PCI_CFG_BUS(_pcidev) (((_pcidev)->domain << 8) | \ + (_pcidev)->bus) +#define PCI_CFG_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_CFG_FUNC(_pcidev) ((_pcidev)->func) + +#define PCI_REGION_BASE(_pcidev, _b, _type) ((_pcidev)->regions[(_b)].base_addr) +#define PCI_REGION_SIZE(_pcidev, _b) ((_pcidev)->regions[(_b)].size) + +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u8((_pcidev), (_value_ptr), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u32((_pcidev), (_value_ptr), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pci_device_cfg_write_u32((_pcidev), (_value), (_offset)) + +#endif /* XSERVER_LIBPCIACCESS */ + +#endif /* ASTPCIRENAME_H */ diff --git a/driver/xf86-video-ast/src/ast_tool.c b/driver/xf86-video-ast/src/ast_tool.c index 7a2165d5e..157a8692f 100644 --- a/driver/xf86-video-ast/src/ast_tool.c +++ b/driver/xf86-video-ast/src/ast_tool.c @@ -67,10 +67,24 @@ ASTMapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - +#ifndef XSERVER_LIBPCIACCESS pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pAST->PciTag, pAST->FBPhysAddr, pAST->FbMapSize); +#else + { + void** result = (void**)&pAST->FBVirtualAddr; + int err = pci_device_map_range(pAST->PciInfo, + pAST->FBPhysAddr, + pAST->FbMapSize, + PCI_DEV_MAP_FLAG_WRITABLE | + PCI_DEV_MAP_FLAG_WRITE_COMBINE, + result); + + if (err) + return FALSE; + } +#endif if (!pAST->FBVirtualAddr) return FALSE; @@ -82,9 +96,13 @@ Bool ASTUnmapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - + +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr, pAST->FbMapSize); +#else + pci_device_unmap_range(pAST->PciInfo, pAST->FBVirtualAddr, pAST->FbMapSize); +#endif pAST->FBVirtualAddr = 0; @@ -94,8 +112,9 @@ ASTUnmapMem(ScrnInfoPtr pScrn) Bool ASTMapMMIO(ScrnInfoPtr pScrn) { - int mmioFlags; ASTRecPtr pAST = ASTPTR(pScrn); +#ifndef XSERVER_LIBPCIACCESS + int mmioFlags; #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; @@ -103,9 +122,25 @@ ASTMapMMIO(ScrnInfoPtr pScrn) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif + pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pAST->PciTag, pAST->MMIOPhysAddr, pAST->MMIOMapSize); + +#else + { + void** result = (void**)&pAST->MMIOVirtualAddr; + int err = pci_device_map_range(pAST->PciInfo, + pAST->MMIOPhysAddr, + pAST->MMIOMapSize, + PCI_DEV_MAP_FLAG_WRITABLE, + result); + + if (err) + return FALSE; + } + +#endif if (!pAST->MMIOVirtualAddr) return FALSE; @@ -117,8 +152,12 @@ ASTUnmapMMIO(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->MMIOVirtualAddr, pAST->MMIOMapSize); +#else + pci_device_unmap_range(pAST->PciInfo, pAST->MMIOVirtualAddr, pAST->MMIOMapSize); +#endif pAST->MMIOVirtualAddr = 0; } diff --git a/driver/xf86-video-ast/src/ast_vgatool.c b/driver/xf86-video-ast/src/ast_vgatool.c index a464a01e9..a833b3bd3 100644 --- a/driver/xf86-video-ast/src/ast_vgatool.c +++ b/driver/xf86-video-ast/src/ast_vgatool.c @@ -128,7 +128,13 @@ GetMaxDCLK(ScrnInfoPtr pScrn) *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000; *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x00000001; - + + *(ULONG *) (pAST->MMIOVirtualAddr + 0x10100) = 0x000000A8; + + do { + ; + } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10100) != 0x000000A8); + /* Get BusWidth */ ulData = *(ULONG * ) (pAST->MMIOVirtualAddr + 0x10004); if (ulData & 0x40) @@ -137,9 +143,7 @@ GetMaxDCLK(ScrnInfoPtr pScrn) ulDRAMBusWidth = 32; /* Get MCLK */ - { - *(ULONG *) (pAST->MMIOVirtualAddr + 0x10100) = 0x000000A8; - + { ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10120); ulData2 = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10170); if (ulData2 & 0x2000) |