diff options
author | Jon Nettleton <jon.nettleton@gmail.com> | 2007-03-08 19:16:41 +0000 |
---|---|---|
committer | Jon Nettleton <jon.nettleton@gmail.com> | 2007-03-08 19:16:41 +0000 |
commit | e2cd27f99b20e11cf3ba0d6c39582756908959d9 (patch) | |
tree | 12c1ef0fd66d2a73c96ba443393a647295b4195a | |
parent | bcb5992de3335758a2c54c6e15023836597678d0 (diff) |
merged vt3336_branch changes to experimental_branch
-rw-r--r-- | ChangeLog | 193 | ||||
-rw-r--r-- | unichrome/via.h | 13 | ||||
-rw-r--r-- | unichrome/via_accel.c | 179 | ||||
-rw-r--r-- | unichrome/via_bandwidth.c | 8 | ||||
-rw-r--r-- | unichrome/via_driver.c | 46 | ||||
-rw-r--r-- | unichrome/via_id.c | 5 | ||||
-rw-r--r-- | unichrome/via_id.h | 2 | ||||
-rw-r--r-- | unichrome/via_mode.c | 8 | ||||
-rw-r--r-- | unichrome/via_mode.h | 6 | ||||
-rw-r--r-- | unichrome/via_regs.h | 2 | ||||
-rw-r--r-- | unichrome/via_swov.c | 71 | ||||
-rw-r--r-- | unichrome/via_swov.h | 3 | ||||
-rw-r--r-- | unichrome/via_vbe.c | 3 | ||||
-rw-r--r-- | unichrome/via_video.c | 17 | ||||
-rw-r--r-- | unichrome/via_video.h | 2 | ||||
-rw-r--r-- | unichrome/via_xvmc.c | 3 |
16 files changed, 423 insertions, 138 deletions
@@ -65,33 +65,109 @@ Use non-power-of-two textures for EXA whenever possible. -2006-12-07 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-18 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_xvmc.c: + + Thomas needs a good drm test which means we need XvMC. I + have re-enabled it for testing. + +2006-12-15 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via.h: + * unichrome/via_swov.c: + + This is my cleanup committ of the excellent patch that + Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> provided + which finishes the XVideo work on the VT3336 chipset. Nice + Work Gabriel. + +2006-12-13 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_video.c: + + Don't use HQV Offset for HQV_CONTROL + +2006-12-11 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_video.c: + * unichrome/via_swov.c: + + Looks like the VT3336 has the same offset as the VT3259 + for the hardware overlay + +2006-12-10 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_memcpy.c: + * unichrome/via_swov.c: + + Removed the previous changes I am not ready to rewrite + the assembly code for x86_64. + The ColorSpace registers were being setup incorrectly + for VT3336 + +2006-12-09 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_memcpy.c: + + ifdef's in memcpy.c only support i386 arch should + also support i86_64 + +2006-12-09 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_xvmc.c: + + K8M890 does not support XvMC like the other chipsets + disable it for now + +2006-12-09 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_video.h: + * unichrome/via_swov.h: + * unichrome/via_swov.c: + + Made K8M890 XV FIFO settings match K8M800 + Enabled XV_DEBUG + +2006-12-07 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_mode.h: + + Updated the BandwidthTable for K8M890 chipset. + +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIAEnterVT): Initialize the AGP ring buffer before command submission. -2006-12-07 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIAEnterVT): Blank and clear screen when entering VT. + +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> -2006-12-07 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + * unichrome/via_driver.c: (VIAEnterVT): + + Blank and clear screen when entering VT. + +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_accel.c: (viaAccelDMADownload), (viaExaDownloadFromScreen), (viaInitExa): Indent via_accel.c -2006-12-07 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_accel.c: (viaAccelDMADownload): Fix download from screen which was reusing kernel argument data that was altered by the kernel. - -2006-12-07 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-07 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_accel.c: (viaAccelDMADownload), (viaExaDownloadFromScreen): @@ -100,26 +176,26 @@ debuggable. 2006-12-06 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> - + * unichrome/via_driver.c: + + Fixed some of the boolean option changes that are + inverses such as DisableIRQ. - Fix some of the boolean option changes that need to be negated, - such as DisableIRQ. - -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_memory.c: (viaExaFBSave), (viaOffScreenLinear): Cause a "FatalError" if EXA is used with an un-patched Xserver, and an illegal save locked memory action is requested. - -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIAInitialize3DEngine): Proper register names in VIAInitialize3DEngine. - -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIALeaveVT), (VIAWriteMode), (VIACloseScreen): @@ -130,20 +206,20 @@ so that those settings persist. The GPU will be unstable otherwise. Also fix some code comments. - -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIALeaveVT): Force 3D context upload after a VT switch. - -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_dri.c: (viaDRIFBMemcpy), (viaDRIOffscreenSave): Fix up previous commit for > 16MB sizes. -2006-12-06 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-06 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_dri.c: (viaDRIOffscreenSave), (viaDRIOffscreenRestore): @@ -153,8 +229,8 @@ Back up DRI offscreen memory before leaving VT and restore it when entering VT. It may be overwritten in between. Use PCI DMA blit for this if available. - -2006-12-05 Thomas Hellström <thomas-at-tungstengraphics-dot-com> + +2006-12-05 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_driver.c: (VIAWriteMode), (VIAInitialize3DEngine): * unichrome/via_vbe.c: (ViaVbeSetMode): @@ -163,13 +239,13 @@ a mode switch (possibly the soft reset + 2D engine initialization). Otherwise the GPU will hang. -2006-12-05 Thomas Hellström <thomas-at-tungstengraphics-dot-com> - +2006-12-05 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> + * unichrome/via_driver.c: (VIAPreInit): Fix the dma2d option setting. -2006-12-05 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-05 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_bandwidth.c: (ViaSetPrimaryFIFO): @@ -177,7 +253,22 @@ Boosts performance. Please report problems with this. -2006-12-01 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-12-05 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_video.c: + * unichrome/via_swov.c: + + Added missing hardware overlay support for VT3336 + +2006-12-04 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_driver.c: + + Added patch submitted by Gabriel Mansi + <gabriel-dot-mansi-at-gmail-dot-com> to fix the K8M890 hang on + VT switch. + +2006-12-01 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via.man: * unichrome/via_bios.h: @@ -189,8 +280,34 @@ First pass cleaning up option handling. Make most boolean options work as expected; (that is, accepting both a "true" and a "false" argument). + +2006-11-30 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_mode.c: + * unichrome/via_accel.c: + + Added patch submitted by Gabriel Mansi + <gabriel-dot-mansi-at-gmail-dot-com> to fix some of the K8M890 + logic. -2006-10-29 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-11-28 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_bandwidth.c: + * unichrome/via_accel.c: + + Patched via_bandwidth.c for dumb mistake I made thanks Gabriel Mansi + For the second set of eyes. Move HWCursor memory allocation even + further in the driver initialization. + +2006-11-25 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_id.c: + * unichrome/via_accel.c: + + Added additional ID's for the K8M890 cards + Changed memory allocation order for the HW cursor and 2d engine. + +2006-10-29 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * libxvmc/viaLowLevel.c: * libxvmc/viaLowLevelPro.c: @@ -199,7 +316,7 @@ Via managed to mix up the 2D / 3D engine busy status bits. Funny we never noticed this before. -2006-10-24 Thomas Hellström <thomas-at-tungstengraphics-dot-com> +2006-10-24 Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> * unichrome/via_xvmc.c: (ViaXvMCCreateContext): @@ -231,9 +348,9 @@ tweaked comments and debugging lines. 2006-09-27 Thomas Hellström <thomas-at-tungstengraphics-dot-com> - + * unichrome/via_memory.c: - + Don't include drm headers in non-dri build. 2006-09-25 Benno Schulenberg <bensberg-at-justemail-dot-net> @@ -264,6 +381,22 @@ Include stdint.h instead of re-typedefining CARD32. +2006-09-22 Jon Nettleton <jon-dot-nettleton-at-gmail-dot-com> + + * unichrome/via_id.h + * unichrome/via_video.c + * unichrome/via_mode.c + * unichrome/via_mode.h + * unichrome/via_driver.c + * unichrome/via_swov.c + * unichrome/via_bandwidth.c + * unichrome/via_accel.c + * unichrome/via_vbe.c + * unichrome/via_xvmc.c + * unichrome/via_id.c + + Initial code for support of VT3336 cards + 2006-09-17 Benno Schulenberg <bensberg-at-justemail-dot-net> * unichrome/via_driver.c: (VIASave): diff --git a/unichrome/via.h b/unichrome/via.h index a983c29..6a20a68 100644 --- a/unichrome/via.h +++ b/unichrome/via.h @@ -41,12 +41,16 @@ /* Video status flag */ +#define VIDEO_HIDE 0x00000000 /*Video off*/ +#define VIDEO_SHOW 0x80000000 /*Video on*/ +#define VIDEO_ACTIVE 0x10000000 /*Video active*/ #define VIDEO_MPEG_INUSE 0x08000000 /*Video is used with MPEG */ #define VIDEO_HQV_INUSE 0x04000000 /*Video is used with HQV*/ #define VIDEO_CAPTURE0_INUSE 0x02000000 /*Video is used with CAPTURE 0*/ #define VIDEO_CAPTURE1_INUSE 0x00000000 /*Video is used with CAPTURE 1*/ #define VIDEO_1_INUSE 0x01000000 /*Video 1 is used with software flip*/ #define VIDEO_3_INUSE 0x00000000 /*Video 3 is used with software flip*/ +#define VIDEO_ON 0x00100000 #define MPEG_USE_V1 0x00010000 /*[16] : 1:MPEG use V1, 0:MPEG use V3*/ #define MPEG_USE_V3 0x00000000 /*[16] : 1:MPEG use V1, 0:MPEG use V3*/ #define MPEG_USE_HQV 0x00020000 /*[17] : 1:MPEG use HQV,0:MPEG not use HQV*/ @@ -199,7 +203,7 @@ #define RAM_TABLE_CONTROL 0x1C8 #define RAM_TABLE_READ 0x1CC -/* HQV Registers */ +/* HQV Registers*/ #define HQV_CONTROL 0x1D0 #define HQV_SRC_STARTADDR_Y 0x1D4 #define HQV_SRC_STARTADDR_U 0x1D8 @@ -259,6 +263,8 @@ #define V1_ON_SND_DISPLAY 0x80000000 #define V1_FIFO_32V1_32V2 0x00000000 #define V1_FIFO_48V1_32V2 0x00200000 +#define V1_PREFETCH_ON_3336 0x40000000 /*V1_PREFETCH_ON*/ +#define V1_GAMMA_ENABLE_3336 0x20000000 /*V1_Gamma_ENABLE*/ /* V12_QWORD_PER_LINE 0x234 */ #define V1_FETCH_COUNT 0x3ff00000 @@ -318,6 +324,11 @@ #define V1_FIFO_PRETHRESHOLD56 0x38000000 #define V1_FIFO_PRETHRESHOLD61 0x3D000000 +#define VIDEO_FIFO_DEPTH_VT3336 225 +#define VIDEO_FIFO_THRESHOLD_VT3336 200 +#define VIDEO_FIFO_PRETHRESHOLD_VT3336 250 +#define VIDEO_EXPIRE_NUM_VT3336 31 + /* ALPHA_V3_FIFO_CONTROL 0x278 * IA2 has 32 level FIFO for packet mode video format * 32 level FIFO for planar mode video YV12. with extension reg 230 bit 21 enable diff --git a/unichrome/via_accel.c b/unichrome/via_accel.c index e4cf82e..59466e3 100644 --- a/unichrome/via_accel.c +++ b/unichrome/via_accel.c @@ -108,11 +108,15 @@ viaFlushPCI(ViaCommandBuffer * buf) * for an unacceptable amount of time in VIASETREG while * other high priority interrupts may be pending. */ - while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) - && (loop++ < MAXLOOP)) ; - while ((VIAGETREG(VIA_REG_STATUS) & (VIA_CMD_RGTR_BUSY | - VIA_2D_ENG_BUSY)) - && (loop++ < MAXLOOP)) ; + /*if (pVia->Chipset != VIA_K8M890) { + while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) + && (loop++ < MAXLOOP)) ; + } + while ((VIAGETREG(VIA_REG_STATUS) & + (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY)) && + (loop++ < MAXLOOP)) ;*/ + /* Not sure if I want to use the above code or the generic function */ + viaAccelSync(buf->pScrn); } offset = (*bp++ & 0x0FFFFFFF) << 2; value = *bp++; @@ -224,6 +228,13 @@ viaTearDownCBuffer(ViaCommandBuffer * buf) /* * Leftover from VIA's code. */ +static void +viaInitPCIe(VIAPtr pVia) +{ + VIASETREG(0x41c, 0x00100000); + VIASETREG(0x420, 0x680A0000); + VIASETREG(0x420, 0x02000000); +} static void viaInitAgp(VIAPtr pVia) @@ -250,38 +261,60 @@ viaInitAgp(VIAPtr pVia) */ static void -viaEnableVQ(VIAPtr pVia) -{ - CARD32 - vqStartAddr = pVia->VQStart, - vqEndAddr = pVia->VQEnd, - vqStartL = 0x50000000 | (vqStartAddr & 0xFFFFFF), - vqEndL = 0x51000000 | (vqEndAddr & 0xFFFFFF), - vqStartEndH = 0x52000000 | ((vqStartAddr & 0xFF000000) >> 24) | - ((vqEndAddr & 0xFF000000) >> 16), - vqLen = 0x53000000 | (VIA_VQ_SIZE >> 3); - - VIASETREG(VIA_REG_TRANSET, 0x00fe0000); - VIASETREG(VIA_REG_TRANSPACE, 0x080003fe); - VIASETREG(VIA_REG_TRANSPACE, 0x0a00027c); - VIASETREG(VIA_REG_TRANSPACE, 0x0b000260); - VIASETREG(VIA_REG_TRANSPACE, 0x0c000274); - VIASETREG(VIA_REG_TRANSPACE, 0x0d000264); - VIASETREG(VIA_REG_TRANSPACE, 0x0e000000); - VIASETREG(VIA_REG_TRANSPACE, 0x0f000020); - VIASETREG(VIA_REG_TRANSPACE, 0x1000027e); - VIASETREG(VIA_REG_TRANSPACE, 0x110002fe); - VIASETREG(VIA_REG_TRANSPACE, 0x200f0060); - - VIASETREG(VIA_REG_TRANSPACE, 0x00000006); - VIASETREG(VIA_REG_TRANSPACE, 0x40008c0f); - VIASETREG(VIA_REG_TRANSPACE, 0x44000000); - VIASETREG(VIA_REG_TRANSPACE, 0x45080c04); - VIASETREG(VIA_REG_TRANSPACE, 0x46800408); - VIASETREG(VIA_REG_TRANSPACE, vqStartEndH); - VIASETREG(VIA_REG_TRANSPACE, vqStartL); - VIASETREG(VIA_REG_TRANSPACE, vqEndL); - VIASETREG(VIA_REG_TRANSPACE, vqLen); +viaEnableAgpVQ(VIAPtr pVia) +{ + CARD32 + vqStartAddr = pVia->VQStart, + vqEndAddr = pVia->VQEnd, + vqStartL = 0x50000000 | (vqStartAddr & 0xFFFFFF), + vqEndL = 0x51000000 | (vqEndAddr & 0xFFFFFF), + vqStartEndH = 0x52000000 | ((vqStartAddr & 0xFF000000) >> 24) | + ((vqEndAddr & 0xFF000000) >> 16), + vqLen = 0x53000000 | (VIA_VQ_SIZE >> 3); + + + VIASETREG(VIA_REG_TRANSET, 0x00fe0000); + VIASETREG(VIA_REG_TRANSPACE, 0x080003fe); + VIASETREG(VIA_REG_TRANSPACE, 0x0a00027c); + VIASETREG(VIA_REG_TRANSPACE, 0x0b000260); + VIASETREG(VIA_REG_TRANSPACE, 0x0c000274); + VIASETREG(VIA_REG_TRANSPACE, 0x0d000264); + VIASETREG(VIA_REG_TRANSPACE, 0x0e000000); + VIASETREG(VIA_REG_TRANSPACE, 0x0f000020); + VIASETREG(VIA_REG_TRANSPACE, 0x1000027e); + VIASETREG(VIA_REG_TRANSPACE, 0x110002fe); + VIASETREG(VIA_REG_TRANSPACE, 0x200f0060); + VIASETREG(VIA_REG_TRANSPACE, 0x00000006); + VIASETREG(VIA_REG_TRANSPACE, 0x40008c0f); + VIASETREG(VIA_REG_TRANSPACE, 0x44000000); + VIASETREG(VIA_REG_TRANSPACE, 0x45080c04); + VIASETREG(VIA_REG_TRANSPACE, 0x46800408); + + VIASETREG(VIA_REG_TRANSPACE, vqStartEndH); + VIASETREG(VIA_REG_TRANSPACE, vqStartL); + VIASETREG(VIA_REG_TRANSPACE, vqEndL); + VIASETREG(VIA_REG_TRANSPACE, vqLen); +} + +static void +viaEnablePCIeVQ(VIAPtr pVia) +{ + CARD32 + vqStartAddr = pVia->VQStart, + vqEndAddr = pVia->VQEnd, + vqStartL = 0x70000000 | (vqStartAddr & 0xFFFFFF), + vqEndL = 0x71000000 | (vqEndAddr & 0xFFFFFF), + vqStartEndH = 0x72000000 | ((vqStartAddr & 0xFF000000) >> 24) | + ((vqEndAddr & 0xFF000000) >> 16), + vqLen = 0x73000000 | (VIA_VQ_SIZE >> 3); + + VIASETREG(0x41c, 0x00100000); + VIASETREG(0x420, vqStartEndH); + VIASETREG(0x420, vqStartL); + VIASETREG(0x420, vqEndL); + VIASETREG(0x420, vqLen); + VIASETREG(0x420, 0x74301001); + VIASETREG(0x420, 0x00000000); } /* @@ -293,12 +326,21 @@ viaDisableVQ(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); - VIASETREG(VIA_REG_TRANSET, 0x00fe0000); - VIASETREG(VIA_REG_TRANSPACE, 0x00000004); - VIASETREG(VIA_REG_TRANSPACE, 0x40008c0f); - VIASETREG(VIA_REG_TRANSPACE, 0x44000000); - VIASETREG(VIA_REG_TRANSPACE, 0x45080c04); - VIASETREG(VIA_REG_TRANSPACE, 0x46800408); + switch ( pVia->Chipset ) + { + case VIA_K8M890: + VIASETREG(0x41c, 0x00100000); + VIASETREG(0x420, 0x74301000); + break; + default: + VIASETREG(VIA_REG_TRANSET, 0x00fe0000); + VIASETREG(VIA_REG_TRANSPACE, 0x00000004); + VIASETREG(VIA_REG_TRANSPACE, 0x40008c0f); + VIASETREG(VIA_REG_TRANSPACE, 0x44000000); + VIASETREG(VIA_REG_TRANSPACE, 0x45080c04); + VIASETREG(VIA_REG_TRANSPACE, 0x46800408); + break; + } } /* @@ -347,10 +389,24 @@ viaInitialize2DEngine(ScrnInfoPtr pScrn) VIASETREG(i, 0x0); } - viaInitAgp(pVia); + switch( pVia->Chipset ) { + case VIA_K8M890: + viaInitPCIe(pVia); + break; + default: + viaInitAgp(pVia); + break; + } if (pVia->VQStart != 0) { - viaEnableVQ(pVia); + switch( pVia->Chipset ) { + case VIA_K8M890: + viaEnablePCIeVQ(pVia); + break; + default: + viaEnableAgpVQ(pVia); + break; + } } else { viaDisableVQ(pScrn); } @@ -370,12 +426,21 @@ viaAccelSync(ScrnInfoPtr pScrn) mem_barrier(); - while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) - && (loop++ < MAXLOOP)) ; + switch (pVia->Chipset) { + case VIA_K8M890: + while ((VIAGETREG(VIA_REG_STATUS) & + (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY)) && + (loop++ < MAXLOOP)) ; + break; + default: + while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) + && (loop++ < MAXLOOP)) ; - while ((VIAGETREG(VIA_REG_STATUS) & - (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) && - (loop++ < MAXLOOP)) ; + while ((VIAGETREG(VIA_REG_STATUS) & + (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) && + (loop++ < MAXLOOP)) ; + break; + } } /* @@ -1106,7 +1171,7 @@ viaInitXAA(ScreenPtr pScreen) * test with x11perf -shmput500! */ - if (pVia->Chipset != VIA_K8M800) + if (pVia->Chipset != VIA_K8M800 && pVia->Chipset != VIA_K8M890) xaaptr->ImageWriteFlags |= NO_GXCOPY; xaaptr->SetupForImageWrite = viaSetupForImageWrite; @@ -2129,8 +2194,8 @@ viaInitExa(ScreenPtr pScreen) pExa->offScreenBase = pScrn->virtualY * pVia->Bpl; pExa->pixmapOffsetAlign = 32; pExa->pixmapPitchAlign = 16; - pExa->flags = EXA_OFFSCREEN_PIXMAPS | - (pVia->nPOT[1] ? 0 : EXA_OFFSCREEN_ALIGN_POT); + /* This needs to be fixed upstream for now it just causes hangs*/ + pExa->flags = EXA_OFFSCREEN_PIXMAPS | EXA_OFFSCREEN_ALIGN_POT; pExa->maxX = 2047; pExa->maxY = 2047; pExa->WaitMarker = viaAccelWaitMarker; @@ -2174,6 +2239,7 @@ viaInitExa(ScreenPtr pScreen) "[EXA] Disabling EXA accelerated composite.\n"); } + if (!exaDriverInit(pScreen, pExa)) { xfree(pExa); return NULL; @@ -2279,13 +2345,13 @@ viaInitAccel(ScreenPtr pScreen) pVia->FBFreeEnd -= VIA_VQ_SIZE; } - viaInitialize2DEngine(pScrn); - if (pVia->hwcursor) { pVia->FBFreeEnd -= VIA_CURSOR_SIZE; pVia->CursorStart = pVia->FBFreeEnd; } + viaInitialize2DEngine(pScrn); + /* * Sync marker space. */ @@ -2332,6 +2398,9 @@ viaInitAccel(ScreenPtr pScreen) return FALSE; } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[EXA] Trying to enable EXA acceleration.\n"); + pVia->driSize = (pVia->FBFreeEnd - pVia->FBFreeStart) / 2; if ((pVia->driSize > (pVia->maxDriSize * 1024)) diff --git a/unichrome/via_bandwidth.c b/unichrome/via_bandwidth.c index 569d4f5..79b840c 100644 --- a/unichrome/via_bandwidth.c +++ b/unichrome/via_bandwidth.c @@ -226,7 +226,11 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) else ViaSeqMask(hwp, 0x22, 0x00, 0x1F); break; - + case VIA_K8M890: + hwp->writeSeq(hwp, 0x16, 0x92); + hwp->writeSeq(hwp, 0x17, 0xB3); + hwp->writeSeq(hwp, 0x18, 0x8A); + break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaSetPrimaryFIFO:" " Chipset %d not implemented\n", pVia->Chipset); @@ -343,6 +347,8 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) else ViaCrtcMask(hwp, 0x94, 0x20, 0x7F); break; + case VIA_K8M890: + break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaSetSecondaryFIFO:" " Chipset %d not implemented\n", pVia->Chipset); diff --git a/unichrome/via_driver.c b/unichrome/via_driver.c index 765c806..b3897b9 100644 --- a/unichrome/via_driver.c +++ b/unichrome/via_driver.c @@ -105,6 +105,7 @@ static SymTabRec VIAChipsets[] = { {VIA_K8M800, "K8M800"}, {VIA_PM800, "PM800/PM880/CN400"}, {VIA_VM800, "VM800/CN700/P4M800Pro"}, + {VIA_K8M890, "K8M890"}, {-1, NULL } }; @@ -116,6 +117,7 @@ static PciChipsets VIAPciChipsets[] = { {VIA_K8M800, PCI_CHIP_VT3204, RES_SHARED_VGA}, {VIA_PM800, PCI_CHIP_VT3259, RES_SHARED_VGA}, {VIA_VM800, PCI_CHIP_VT3314, RES_SHARED_VGA}, + {VIA_K8M890, PCI_CHIP_VT3336, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED} }; @@ -1428,8 +1430,9 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) if (pBIOSInfo->PanelActive && ((pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) || - (pVia->Chipset == VIA_VM800))) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Panel on K8M800, PM800 or VM800 is" + (pVia->Chipset == VIA_VM800) || + (pVia->Chipset == VIA_K8M890))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Panel on K8M800, PM800 ,VM800, or K8M890 is" " currently not supported.\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Using VBE to set modes to" " work around this.\n"); @@ -1708,8 +1711,8 @@ static void VIALeaveVT(int scrnIndex, int flags) /* * A soft reset helps fix 3D hang on VT switch. */ - - hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); + if (pVia->Chipset != VIA_K8M890) + hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); #ifdef XF86DRI if (pVia->directRenderingEnabled) { @@ -1806,10 +1809,28 @@ VIASave(ScrnInfoPtr pScrn) Regs->SR2E = hwp->readSeq(hwp, 0x2E); - Regs->SR44 = hwp->readSeq(hwp, 0x44); - Regs->SR45 = hwp->readSeq(hwp, 0x45); - Regs->SR46 = hwp->readSeq(hwp, 0x46); - Regs->SR47 = hwp->readSeq(hwp, 0x47); + switch (pVia->Chipset) + { + case VIA_CLE266: + case VIA_KM400: + Regs->SR44 = hwp->readSeq(hwp, 0x44); + Regs->SR45 = hwp->readSeq(hwp, 0x45); + Regs->SR46 = hwp->readSeq(hwp, 0x46); + Regs->SR47 = hwp->readSeq(hwp, 0x47); + break; + default: + Regs->SR44 = hwp->readSeq(hwp, 0x44); + Regs->SR45 = hwp->readSeq(hwp, 0x45); + Regs->SR46 = hwp->readSeq(hwp, 0x46); + Regs->SR47 = hwp->readSeq(hwp, 0x47); + /*Regs->SR4A = hwp->readSeq(hwp, 0x4a); + Regs->SR4B = hwp->readSeq(hwp, 0x4b); + Regs->SR4C = hwp->readSeq(hwp, 0x4c);*/ + break; + } + + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Crtc...\n")); Regs->CR13 = hwp->readCrtc(hwp, 0x13); @@ -2221,10 +2242,11 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!VIAMapMMIO(pScrn)) return FALSE; - if (pVia->pVbe && pVia->vbeSR) + if (pVia->pVbe && pVia->vbeSR) { ViaVbeSaveRestore(pScrn, MODE_SAVE); - else + } else { VIASave(pScrn); + } vgaHWUnlock(hwp); @@ -2526,8 +2548,8 @@ static Bool VIACloseScreen(int scrnIndex, ScreenPtr pScreen) /* A soft reset Fixes 3D Hang after X restart */ - - hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); + if (pVia->Chipset != VIA_K8M890) + hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40); if (!pVia->IsSecondary) { /* Turn off all video activities */ diff --git a/unichrome/via_id.c b/unichrome/via_id.c index 053167b..867b851 100644 --- a/unichrome/via_id.c +++ b/unichrome/via_id.c @@ -184,6 +184,11 @@ static struct ViaCardIdStruct ViaCardId[] = { {"Fujitsu/Siemens Amilo L7320", VIA_VM800, 0x1734, 0x10CD, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, {"ASRock P4VM800", VIA_VM800, 0x1849, 0x3344, VIA_DEVICE_CRT}, {"Asustek P5V800-MX", VIA_VM800, 0x3344, 0x1122, VIA_DEVICE_CRT}, + /* K8M890 */ + {"ASUS A8V-VM", VIA_K8M890, 0x1043, 0x81B5, VIA_DEVICE_CRT}, + {"Shuttle FX22V1", VIA_K8M890, 0x1297, 0x3080, VIA_DEVICE_CRT}, + {"MSI K9VGM-V", VIA_K8M890, 0x1462, 0x7253, VIA_DEVICE_CRT}, + {"Averatec 226x", VIA_K8M890, 0x14FF, 0xA002, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, /* keep this */ {NULL, VIA_UNKNOWN, 0x0000, 0x0000, VIA_DEVICE_NONE} }; diff --git a/unichrome/via_id.h b/unichrome/via_id.h index bccaa71..33cb88f 100644 --- a/unichrome/via_id.h +++ b/unichrome/via_id.h @@ -34,6 +34,7 @@ enum VIACHIPTAGS { VIA_K8M800, VIA_PM800, VIA_VM800, + VIA_K8M890, VIA_LAST }; @@ -56,6 +57,7 @@ enum VIACHIPTAGS { #define PCI_CHIP_CLE3122 0x3122 /* CLE266 */ #define PCI_CHIP_VT3205 0x7205 /* KM400 */ #define PCI_CHIP_VT3314 0x3344 /* VM800 */ +#define PCI_CHIP_VT3336 0x3230 /* K8M890 */ /* * There is also quite some conflicting information on the diff --git a/unichrome/via_mode.c b/unichrome/via_mode.c index 94f0dca..2a4c2bc 100644 --- a/unichrome/via_mode.c +++ b/unichrome/via_mode.c @@ -794,6 +794,8 @@ ViaGetMemoryBandwidth(ScrnInfoPtr pScrn) return ViaBandwidthTable[VIA_BW_PM800].Bandwidth[pVia->MemClk]; case VIA_VM800: return ViaBandwidthTable[VIA_BW_VM800].Bandwidth[pVia->MemClk]; + case VIA_K8M890: + return ViaBandwidthTable[VIA_BW_K8M890].Bandwidth[pVia->MemClk]; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaBandwidthAllowed: Unknown Chipset.\n"); return VIA_BW_MIN; @@ -1713,7 +1715,7 @@ ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode) is removed -- copy from clock handling code below */ if ((pVia->Chipset == VIA_CLE266) && CLE266_REV_IS_AX(pVia->ChipRev)) ViaSetPrimaryDotclock(pScrn, 0x471C); /* CLE266Ax use 2x XCLK */ - else if ((pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) || (pVia->Chipset == VIA_VM800)) + else if ((pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) || (pVia->Chipset == VIA_VM800) || (pVia->Chipset == VIA_K8M890)) ViaSetPrimaryDotclock(pScrn, 0x529001); else ViaSetPrimaryDotclock(pScrn, 0x871C); @@ -1728,11 +1730,11 @@ ViaModePrimary(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pBIOSInfo->ClockExternal) { if ((pVia->Chipset == VIA_CLE266) && CLE266_REV_IS_AX(pVia->ChipRev)) ViaSetPrimaryDotclock(pScrn, 0x471C); /* CLE266Ax use 2x XCLK */ - else if ((pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) ||(pVia->Chipset == VIA_VM800)) + else if ((pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) ||(pVia->Chipset == VIA_VM800) || (pVia->Chipset == VIA_K8M890)) ViaSetPrimaryDotclock(pScrn, 0x529001); else ViaSetPrimaryDotclock(pScrn, 0x871C); - if ((pVia->Chipset != VIA_K8M800) && (pVia->Chipset != VIA_PM800) && (pVia->Chipset != VIA_VM800)) + if ((pVia->Chipset != VIA_K8M800) && (pVia->Chipset != VIA_PM800) && (pVia->Chipset != VIA_VM800) && (pVia->Chipset != VIA_K8M890)) ViaCrtcMask(hwp, 0x6B, 0x01, 0x01); } else { ViaSetPrimaryDotclock(pScrn, pBIOSInfo->Clock); diff --git a/unichrome/via_mode.h b/unichrome/via_mode.h index ea7bb87..b9af170 100644 --- a/unichrome/via_mode.h +++ b/unichrome/via_mode.h @@ -41,7 +41,8 @@ #define VIA_BW_K8M800 4 #define VIA_BW_PM800 5 #define VIA_BW_VM800 6 -#define VIA_BW_ALL 7 +#define VIA_BW_K8M890 7 +#define VIA_BW_ALL 8 /* * 393216000 is for SDR133 in via_refresh.h @@ -57,7 +58,8 @@ static struct { { VIA_BW_KM400A, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, VIA_BW_MIN } }, { VIA_BW_K8M800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, VIA_BW_MIN } }, { VIA_BW_PM800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, 922000000 } }, - { VIA_BW_VM800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, 922000000 } } + { VIA_BW_VM800, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, 922000000 } }, + { VIA_BW_K8M890, { VIA_BW_MIN, VIA_BW_MIN, VIA_BW_MIN, 394000000, 461000000, 461000000, 461000000, 922000000 } } }; /* diff --git a/unichrome/via_regs.h b/unichrome/via_regs.h index 2440451..6538388 100644 --- a/unichrome/via_regs.h +++ b/unichrome/via_regs.h @@ -42,7 +42,7 @@ #define VIA_MMIO_REGBASE 0x0 #define VIA_MMIO_VGABASE 0x8000 #define VIA_MMIO_BLTBASE 0x200000 -#define VIA_MMIO_BLTSIZE 0x10000 +#define VIA_MMIO_BLTSIZE 0x20000 /* defines for VIA 2D registers */ diff --git a/unichrome/via_swov.c b/unichrome/via_swov.c index b207f32..c0311f7 100644 --- a/unichrome/via_swov.c +++ b/unichrome/via_swov.c @@ -89,13 +89,12 @@ viaWaitHQVFlip(VIAPtr pVia) unsigned long proReg = 0; CARD32 volatile *pdwState; - if ((pVia->ChipId == PCI_CHIP_VT3259) && - !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; pdwState = (CARD32 volatile *)(pVia->VidMapBase + (HQV_CONTROL + proReg)); - if (pVia->ChipId == PCI_CHIP_VT3259) { + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) { while (*pdwState & (HQV_SUBPIC_FLIP | HQV_SW_FLIP)) ; } else { while (!(*pdwState & HQV_FLIP_STATUS)) ; @@ -126,8 +125,7 @@ viaWaitHQVDone(VIAPtr pVia) CARD32 volatile *pdwState; unsigned long proReg = 0; - if ((pVia->ChipId == PCI_CHIP_VT3259) && - !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; pdwState = (CARD32 volatile *)(pVia->VidMapBase + (HQV_CONTROL + proReg)); @@ -214,12 +212,14 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; HWDiff->dwHQVInitPatch = VID_HWDIFF_TRUE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; } else { HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; } break; case VIA_KM400: @@ -228,6 +228,7 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; break; case VIA_K8M800: HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; @@ -235,6 +236,7 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; break; case VIA_PM800: HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; @@ -242,6 +244,7 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE; HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_FALSE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; break; case VIA_VM800: HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; @@ -249,6 +252,15 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn) HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE; + break; + case VIA_K8M890: + HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE; + HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE; + HWDiff->dwSupportTwoColorKey = VID_HWDIFF_FALSE; + HWDiff->dwHQVInitPatch = VID_HWDIFF_FALSE; + HWDiff->dwHQVDisablePatch = VID_HWDIFF_TRUE; + HWDiff->dwNeedV1Prefetch = VID_HWDIFF_TRUE; break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -739,6 +751,7 @@ viaCalculateVideoColor(VIAPtr pVia, int hue, int saturation, int brightness, case PCI_CHIP_VT3204: case PCI_CHIP_VT3259: case PCI_CHIP_VT3314: + case PCI_CHIP_VT3336: model = 0; break; case PCI_CHIP_CLE3122: @@ -872,6 +885,7 @@ viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness, DBG_DD(ErrorF("000002C4 %08lx\n", col1)); DBG_DD(ErrorF("000002C8 %08lx\n", col2)); break; + case PCI_CHIP_VT3336: case PCI_CHIP_CLE3122: VIDOutD(V1_ColorSpaceReg_2, col2); VIDOutD(V1_ColorSpaceReg_1, col1); @@ -896,6 +910,9 @@ ViaInitVideoStatusFlag(VIAPtr pVia) case PCI_CHIP_VT3259: case PCI_CHIP_VT3314: return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE; + case PCI_CHIP_VT3336: + return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE | \ + VIDEO_ACTIVE | VIDEO_SHOW; case PCI_CHIP_CLE3122: return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE; default: @@ -927,14 +944,14 @@ ViaSetVidCtl(VIAPtr pVia, unsigned int videoFlag) case PCI_CHIP_VT3259: case PCI_CHIP_VT3314: return V3_ENABLE | V3_EXPIRE_NUM_3205; - + case PCI_CHIP_VT3336: + return V3_ENABLE | VIDEO_EXPIRE_NUM_VT3336; case PCI_CHIP_CLE3122: if (CLE266_REV_IS_CX(pVia->ChipRev)) return V3_ENABLE | V3_EXPIRE_NUM_F; else return V3_ENABLE | V3_EXPIRE_NUM; break; - default: DBG_DD(ErrorF("Unknown DeviceID\n")); break; @@ -976,8 +993,7 @@ AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc) { HQV_DST_STARTADDR0, HQV_DST_STARTADDR1, HQV_DST_STARTADDR2 }; unsigned long proReg = 0; - if ((pVia->ChipId == PCI_CHIP_VT3259) && - !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; isplanar = ((fourcc == FOURCC_YV12) || (fourcc == FOURCC_XVMC)); @@ -1263,6 +1279,9 @@ static void SetFIFO_V3_64or32or32(VIAPtr pVia) { switch (pVia->ChipId) { + case PCI_CHIP_VT3336: + SetFIFO_V3(pVia, 225, 200, 250); + break; case PCI_CHIP_VT3204: SetFIFO_V3(pVia, 100, 89, 89); break; @@ -1273,14 +1292,12 @@ SetFIFO_V3_64or32or32(VIAPtr pVia) case PCI_CHIP_VT3259: SetFIFO_V3(pVia, 32, 29, 29); break; - case PCI_CHIP_CLE3122: if (CLE266_REV_IS_CX(pVia->ChipRev)) SetFIFO_V3(pVia, 64, 56, 56); else SetFIFO_V3(pVia, 32, 16, 16); break; - default: break; } @@ -1290,6 +1307,9 @@ static void SetFIFO_V3_64or32or16(VIAPtr pVia) { switch (pVia->ChipId) { + case PCI_CHIP_VT3336: + SetFIFO_V3(pVia, 225, 200, 250); + break; case PCI_CHIP_VT3204: SetFIFO_V3(pVia, 100, 89, 89); break; @@ -1391,7 +1411,7 @@ SetColorKey(VIAPtr pVia, unsigned long videoFlag, CARD32 keyLow, CARD32 keyHigh, CARD32 compose) { keyLow &= 0x00FFFFFF; - if (pVia->ChipId == PCI_CHIP_VT3259) + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) keyLow |= 0x40000000; /*SaveVideoRegister(pVia, V_COLOR_KEY, keyLow); */ @@ -1423,7 +1443,7 @@ SetChromaKey(VIAPtr pVia, unsigned long videoFlag, chromaLow |= (VIDInD(V_CHROMAKEY_LOW) & ~CHROMA_KEY_LOW); chromaHigh |= (VIDInD(V_CHROMAKEY_HIGH) & ~CHROMA_KEY_HIGH); - if (pVia->ChipId == PCI_CHIP_VT3259) + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) chromaLow |= 0x40000000; SaveVideoRegister(pVia, V_CHROMAKEY_HIGH, chromaHigh); @@ -1465,8 +1485,7 @@ SetHQVFetch(VIAPtr pVia, CARD32 srcFetch, unsigned long srcHeight) { unsigned long proReg = 0; - if ((pVia->ChipId == PCI_CHIP_VT3259) && - !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; if (!pVia->HWDiff.dwHQVFetchByteUnit) { /* CLE_C0 */ @@ -1632,7 +1651,9 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, unsigned long dwOffset = 0, fetch = 0, tmp = 0; unsigned long proReg = 0; - if ((pVia->ChipId == PCI_CHIP_VT3259) && !(videoFlag & VIDEO_1_INUSE)) + DBG_DD(ErrorF("videoflag=%p\n",videoFlag)); + + if (pVia->ChipId == PCI_CHIP_VT3259 && !(videoFlag & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; compose = (VIDInD(V_COMPOSE_MODE) & @@ -1657,6 +1678,12 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, DBG_DD(ErrorF("===srcHeight= %ld \n", srcHeight)); vidCtl = ViaSetVidCtl(pVia, videoFlag); + + if(hwDiff->dwNeedV1Prefetch) { + DBG_DD(ErrorF("NEEDV1PREFETCH\n")); + vidCtl |= V1_PREFETCH_ON_3336; + } + viaOverlayGetV1V3Format(pVia, (videoFlag & VIDEO_1_INUSE) ? 1 : 3, videoFlag, &vidCtl, &hqvCtl); @@ -1688,7 +1715,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, pVia->swov.overlayRecordV1.dwOffset, pVia->swov.overlayRecordV1.dwUVoffset, srcPitch, oriSrcHeight); - if (pVia->ChipId == PCI_CHIP_VT3259) { + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) { SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y + proReg, YCbCr.dwY); SaveVideoRegister(pVia, HQV_SRC_STARTADDR_U + proReg, @@ -1726,7 +1753,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, pVia->swov.overlayRecordV1.dwHQVAddr[1] + hqvOffset, pVia->swov.overlayRecordV1.dwHQVAddr[2] + hqvOffset); - if (pVia->ChipId == PCI_CHIP_VT3259) + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) SaveVideoRegister(pVia, 0x1cc + proReg, dwOffset); SaveVideoRegister(pVia, HQV_SRC_STARTADDR_Y + proReg, startAddr); } else { @@ -1924,7 +1951,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, usleep(1); } - if (pVia->ChipId == PCI_CHIP_VT3259) + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) hqvCtl |= HQV_GEN_IRQ; VIDOutD(HQV_CONTROL + proReg, hqvCtl & ~HQV_SW_FLIP); @@ -1933,7 +1960,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, DBG_DD(ErrorF("HQV control wf5 - %08lx\n", *HQVCtrl)); DBG_DD(ErrorF(" Wait flips5")); - if (pVia->ChipId != PCI_CHIP_VT3259) { + if (pVia->ChipId != PCI_CHIP_VT3259 && pVia->ChipId != PCI_CHIP_VT3336) { for (i = 0; (i < 50) && !(*HQVCtrl & HQV_FLIP_STATUS); i++) { DBG_DD(ErrorF(" HQV wait %d %08lx\n", i, *HQVCtrl)); @@ -2042,7 +2069,7 @@ VIAVidUpdateOverlay(ScrnInfoPtr pScrn, LPDDUPDATEOVERLAY pUpdate) videoFlag = pVia->swov.gdwVideoFlagSW; } - if ((pVia->ChipId == PCI_CHIP_VT3259) && !(videoFlag & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(videoFlag & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; flags |= DDOVER_INTERLEAVED; @@ -2170,7 +2197,7 @@ ViaOverlayHide(ScrnInfoPtr pScrn) (pVia->swov.SrcFourCC == FOURCC_XVMC)) videoFlag = pVia->swov.gdwVideoFlagSW; - if ((pVia->ChipId == PCI_CHIP_VT3259) && !(videoFlag & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(videoFlag & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; ResetVidRegBuffer(pVia); diff --git a/unichrome/via_swov.h b/unichrome/via_swov.h index 10569a1..1dcb625 100644 --- a/unichrome/via_swov.h +++ b/unichrome/via_swov.h @@ -26,7 +26,7 @@ #ifndef _VIA_SWOV_H_ #define _VIA_SWOV_H_ 1 - /* #define XV_DEBUG 1 *//* write log msg to /var/log/XFree86.0.log */ +#define XV_DEBUG 1 /* write log msg to /var/log/XFree86.0.log */ #ifdef XV_DEBUG # define DBG_DD(x) (x) @@ -60,6 +60,7 @@ typedef struct __VIAHWDiff /*unsigned long dwUpdFlip; *//* Set HQV3D0[15] to flip video */ unsigned long dwHQVDisablePatch; /* Change Video Engine Clock setting for HQV disable bug */ /*unsigned long dwSUBFlip; *//* Set HQV3D0[15] to flip video for sub-picture blending */ + unsigned long dwNeedV1Prefetch; /*V1 pre-fetch function for K8*/ /*unsigned long dwNeedV3Prefetch; *//* V3 pre-fetch function for K8 */ /*unsigned long dwNeedV4Prefetch; *//* V4 pre-fetch function for K8 */ /*unsigned long dwUseSystemMemory; *//* Use system memory for DXVA compressed data buffers */ diff --git a/unichrome/via_vbe.c b/unichrome/via_vbe.c index 70fddfb..a286a7a 100644 --- a/unichrome/via_vbe.c +++ b/unichrome/via_vbe.c @@ -120,6 +120,7 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) VIAPtr pVia; VbeModeInfoData *data; int mode; + int refresh; pVia = VIAPTR(pScrn); @@ -136,7 +137,9 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) (int) data->data->XResolution, (int) data->data->YResolution, mode & ~(1 << 11), (float) data->block->RefreshRate/100.); + ViaVbeSetRefresh(pScrn, data->block->RefreshRate/100); + if (VBESetVBEMode(pVia->pVbe, mode, data->block) == FALSE) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBESetVBEMode failed"); if ((data->block || (data->mode & (1 << 11))) && diff --git a/unichrome/via_video.c b/unichrome/via_video.c index 62b8a88..f5de474 100644 --- a/unichrome/via_video.c +++ b/unichrome/via_video.c @@ -278,7 +278,7 @@ DecideOverlaySupport(ScrnInfoPtr pScrn) if (pVia->ChipId != PCI_CHIP_VT3205 && pVia->ChipId != PCI_CHIP_VT3204 && pVia->ChipId != PCI_CHIP_VT3259 && - pVia->ChipId != PCI_CHIP_VT3314) { + pVia->ChipId != PCI_CHIP_VT3314 && pVia->ChipId != PCI_CHIP_VT3336) { CARD32 bandwidth = (mode->HDisplay >> 4) * (mode->VDisplay >> 5) * pScrn->bitsPerPixel * mode->VRefresh; @@ -555,7 +555,9 @@ viaInitVideo(ScreenPtr pScreen) ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) || (pVia->Chipset == VIA_K8M800) || - (pVia->Chipset == VIA_PM800) || (pVia->Chipset == VIA_VM800)); + (pVia->Chipset == VIA_PM800) || + (pVia->Chipset == VIA_VM800) || + (pVia->Chipset == VIA_K8M890)); if ((pVia->drmVerMajor < 2) || ((pVia->drmVerMajor == 2) && (pVia->drmVerMinor < 9))) pVia->useDmaBlit = FALSE; @@ -571,7 +573,7 @@ viaInitVideo(ScreenPtr pScreen) if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) || (pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) || - (pVia->Chipset == VIA_VM800)) { + (pVia->Chipset == VIA_VM800) || (pVia->Chipset == VIA_K8M890)) { num_new = viaSetupAdaptors(pScreen, &newAdaptors); num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); } else { @@ -1055,8 +1057,7 @@ Flip(VIAPtr pVia, viaPortPrivPtr pPriv, int fourcc, { unsigned long proReg = 0; - if ((pVia->ChipId == PCI_CHIP_VT3259) && - !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) + if (pVia->ChipId == PCI_CHIP_VT3259 && !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) proReg = PRO_HQV1_OFFSET; switch (fourcc) { @@ -1078,7 +1079,7 @@ Flip(VIAPtr pVia, viaPortPrivPtr pPriv, int fourcc, while ((VIDInD(HQV_CONTROL + proReg) & HQV_SW_FLIP)) ; VIDOutD(HQV_SRC_STARTADDR_Y + proReg, pVia->swov.SWDevice.dwSWPhysicalAddr[DisplayBufferIndex]); - if (pVia->ChipId == PCI_CHIP_VT3259) { + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) { VIDOutD(HQV_SRC_STARTADDR_U + proReg, pVia->swov.SWDevice.dwSWCrPhysicalAddr[DisplayBufferIndex]); } else { @@ -1132,7 +1133,7 @@ viaDmaBlitImage(VIAPtr pVia, Bool nv12Conversion; bounceBuffer = ((unsigned long)src & 15); - nv12Conversion = ((pVia->ChipId == PCI_CHIP_VT3259) + nv12Conversion = ((pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) && (id == FOURCC_YV12)); switch (id) { @@ -1325,7 +1326,7 @@ viaPutImage(ScrnInfoPtr pScrn, } else { switch (id) { case FOURCC_YV12: - if (pVia->ChipId == PCI_CHIP_VT3259) { + if (pVia->ChipId == PCI_CHIP_VT3259 || pVia->ChipId == PCI_CHIP_VT3336) { nv12cp(pVia->swov.SWDevice. lpSWOverlaySurface[pVia->dwFrameNum & 1], buf, dstPitch, width, height, 0); diff --git a/unichrome/via_video.h b/unichrome/via_video.h index 6ca7da1..7a54e81 100644 --- a/unichrome/via_video.h +++ b/unichrome/via_video.h @@ -29,7 +29,7 @@ * I N C L U D E S */ - /*#define XV_DEBUG 1*//* write log msg to /var/log/XFree86.0.log */ +#define XV_DEBUG 1 /* write log msg to /var/log/XFree86.0.log */ #define COLOR_KEY 1 /* set color key value from driver layer */ #define HW_3123 diff --git a/unichrome/via_xvmc.c b/unichrome/via_xvmc.c index fa390d1..721c42b 100644 --- a/unichrome/via_xvmc.c +++ b/unichrome/via_xvmc.c @@ -330,7 +330,8 @@ ViaInitXVMC(ScreenPtr pScreen) pVia->XvMCEnabled = 0; if (!(pVia->Chipset == VIA_CLE266) && !(pVia->Chipset == VIA_K8M800) && - !(pVia->Chipset == VIA_PM800) && !(pVia->Chipset == VIA_VM800)) { + !(pVia->Chipset == VIA_PM800) && !(pVia->Chipset == VIA_VM800) && + !(pVia->Chipset == VIA_K8M890)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Not supported on this chipset.\n"); return; |