Cut a bunch of code by not trying to precompute the blit commands and instead
just do it per blit. No noticable performance difference (or behavior difference, in my tests), and a significant difference in sanity.
This commit is contained in:
@@ -160,26 +160,6 @@ sisAllocZStencilBuffer( sisContextPtr smesa )
|
||||
smesa->stencil.pitch = smesa->depth.pitch;
|
||||
smesa->stencil.bpp = smesa->depth.bpp;
|
||||
smesa->stencil.map = smesa->depth.map;
|
||||
|
||||
/* set pZClearPacket */
|
||||
memset( &smesa->zClearPacket, 0, sizeof(ENGPACKET) );
|
||||
|
||||
smesa->zClearPacket.dwSrcPitch = (cpp == 2) ? 0x80000000 : 0xf0000000;
|
||||
smesa->zClearPacket.dwDestBaseAddr = smesa->depth.offset;
|
||||
smesa->zClearPacket.wDestPitch = smesa->depth.pitch;
|
||||
smesa->zClearPacket.stdwDestPos.wY = 0;
|
||||
smesa->zClearPacket.stdwDestPos.wX = 0;
|
||||
|
||||
smesa->zClearPacket.wDestHeight = smesa->virtualY;
|
||||
smesa->zClearPacket.stdwDim.wWidth = smesa->depth.pitch / cpp;
|
||||
smesa->zClearPacket.stdwDim.wHeight = (GLshort)smesa->height;
|
||||
smesa->zClearPacket.stdwCmd.cRop = 0xf0;
|
||||
|
||||
if (smesa->blockWrite)
|
||||
smesa->zClearPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
|
||||
else
|
||||
smesa->zClearPacket.stdwCmd.cCmd0 = 0;
|
||||
smesa->zClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -208,25 +188,6 @@ sisAllocBackbuffer( sisContextPtr smesa )
|
||||
|
||||
smesa->back.map = addr;
|
||||
smesa->back.offset = addr - smesa->FbBase;
|
||||
|
||||
memset ( &smesa->cbClearPacket, 0, sizeof(ENGPACKET) );
|
||||
|
||||
smesa->cbClearPacket.dwSrcPitch = (cpp == 2) ? 0x80000000 : 0xf0000000;
|
||||
smesa->cbClearPacket.dwDestBaseAddr = smesa->back.offset;
|
||||
smesa->cbClearPacket.wDestPitch = smesa->back.pitch;
|
||||
smesa->cbClearPacket.stdwDestPos.wY = 0;
|
||||
smesa->cbClearPacket.stdwDestPos.wX = 0;
|
||||
|
||||
smesa->cbClearPacket.wDestHeight = smesa->virtualY;
|
||||
smesa->cbClearPacket.stdwDim.wWidth = (GLshort) smesa->back.pitch / cpp;
|
||||
smesa->cbClearPacket.stdwDim.wHeight = (GLshort) smesa->height;
|
||||
smesa->cbClearPacket.stdwCmd.cRop = 0xf0;
|
||||
|
||||
if (smesa->blockWrite)
|
||||
smesa->cbClearPacket.stdwCmd.cCmd0 = (GLbyte)(CMD0_PAT_FG_COLOR);
|
||||
else
|
||||
smesa->cbClearPacket.stdwCmd.cCmd0 = 0;
|
||||
smesa->cbClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -144,7 +144,7 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
|
||||
}
|
||||
|
||||
if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) {
|
||||
if (smesa->depth.offset != NULL)
|
||||
if (smesa->depth.offset != 0)
|
||||
sis_clear_z_stencil_buffer( ctx, mask, x1, y1, width1, height1 );
|
||||
mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
|
||||
}
|
||||
@@ -331,28 +331,6 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
|
||||
BUFFER_BIT_FRONT_LEFT);
|
||||
}
|
||||
|
||||
static void
|
||||
sis_bitblt_clear_cmd( sisContextPtr smesa, ENGPACKET * pkt )
|
||||
{
|
||||
GLint *lpdwDest, *lpdwSrc;
|
||||
int i;
|
||||
|
||||
lpdwSrc = (GLint *) pkt + 1;
|
||||
lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR) + 1;
|
||||
|
||||
mWait3DCmdQueue (10);
|
||||
|
||||
*lpdwDest++ = *lpdwSrc++;
|
||||
lpdwSrc++;
|
||||
lpdwDest++;
|
||||
for (i = 3; i < 8; i++) {
|
||||
*lpdwDest++ = *lpdwSrc++;
|
||||
}
|
||||
|
||||
MMIO(REG_CMD0, *(GLint *) & pkt->stdwCmd);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
||||
GLint width, GLint height )
|
||||
@@ -365,17 +343,18 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
||||
GLint xx, yy;
|
||||
GLint x0, y0, width0, height0;
|
||||
|
||||
ENGPACKET stEngPacket;
|
||||
|
||||
/* Clear back buffer */
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
smesa->cbClearPacket.stdwDestPos.wY = y;
|
||||
smesa->cbClearPacket.stdwDestPos.wX = x;
|
||||
smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width;
|
||||
smesa->cbClearPacket.stdwDim.wHeight = (GLshort) height;
|
||||
smesa->cbClearPacket.dwFgRopColor = smesa->clearColorPattern;
|
||||
|
||||
sis_bitblt_clear_cmd( smesa, &smesa->cbClearPacket );
|
||||
mWait3DCmdQueue (8);
|
||||
MMIO(REG_SRC_PITCH, (smesa->bytesPerPixel == 4) ?
|
||||
BLIT_DEPTH_32 : BLIT_DEPTH_16);
|
||||
MMIO(REG_DST_X_Y, (x << 16) | y);
|
||||
MMIO(REG_DST_ADDR, smesa->back.offset);
|
||||
MMIO(REG_DST_PITCH_HEIGHT, (smesa->virtualY << 16) | smesa->back.pitch);
|
||||
MMIO(REG_WIDTH_HEIGHT, (height << 16) | width);
|
||||
MMIO(REG_PATFG, smesa->clearColorPattern);
|
||||
MMIO(REG_BLIT_CMD, CMD_DIR_X_INC | CMD_DIR_Y_INC | CMD_ROP_PAT);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
|
||||
if ((mask & BUFFER_BIT_FRONT_LEFT) == 0)
|
||||
@@ -390,23 +369,6 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
||||
pExtents = smesa->driDrawable->pClipRects;
|
||||
count = smesa->driDrawable->numClipRects;
|
||||
|
||||
memset( &stEngPacket, 0, sizeof (ENGPACKET) );
|
||||
|
||||
stEngPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xc0000000;
|
||||
stEngPacket.dwDestBaseAddr = smesa->front.offset;
|
||||
stEngPacket.wDestPitch = smesa->front.pitch;
|
||||
/* TODO: set maximum value? */
|
||||
stEngPacket.wDestHeight = smesa->virtualY;
|
||||
stEngPacket.stdwCmd.cRop = 0xf0;
|
||||
stEngPacket.dwFgRopColor = smesa->clearColorPattern;
|
||||
|
||||
/* for SGRAM Block Write Enable */
|
||||
if (smesa->blockWrite)
|
||||
stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
|
||||
else
|
||||
stEngPacket.stdwCmd.cCmd0 = 0;
|
||||
stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
|
||||
|
||||
while (count--) {
|
||||
GLint x2 = pExtents->x1 - smesa->driDrawable->x;
|
||||
GLint y2 = pExtents->y1 - smesa->driDrawable->y;
|
||||
@@ -424,12 +386,18 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
||||
if (width <= 0 || height <= 0)
|
||||
continue;
|
||||
|
||||
stEngPacket.stdwDestPos.wY = y;
|
||||
stEngPacket.stdwDestPos.wX = x;
|
||||
stEngPacket.stdwDim.wWidth = (GLshort)width;
|
||||
stEngPacket.stdwDim.wHeight = (GLshort)height;
|
||||
int cmd;
|
||||
|
||||
sis_bitblt_clear_cmd( smesa, &stEngPacket );
|
||||
mWait3DCmdQueue (8);
|
||||
MMIO(REG_SRC_PITCH, (smesa->bytesPerPixel == 4) ?
|
||||
BLIT_DEPTH_32 : BLIT_DEPTH_16);
|
||||
MMIO(REG_DST_X_Y, (x << 16) | y);
|
||||
MMIO(REG_DST_ADDR, smesa->front.offset);
|
||||
MMIO(REG_DST_PITCH_HEIGHT, (smesa->virtualY << 16) | smesa->front.pitch);
|
||||
MMIO(REG_WIDTH_HEIGHT, (height << 16) | width);
|
||||
MMIO(REG_PATFG, smesa->clearColorPattern);
|
||||
MMIO(REG_BLIT_CMD, CMD_DIR_X_INC | CMD_DIR_Y_INC | CMD_ROP_PAT);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,14 +406,17 @@ sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask,
|
||||
GLint x, GLint y, GLint width, GLint height )
|
||||
{
|
||||
sisContextPtr smesa = SIS_CONTEXT(ctx);
|
||||
int cmd;
|
||||
|
||||
/* TODO: consider alignment of width, height? */
|
||||
smesa->zClearPacket.stdwDestPos.wY = y;
|
||||
smesa->zClearPacket.stdwDestPos.wX = x;
|
||||
smesa->zClearPacket.stdwDim.wWidth = (GLshort) width;
|
||||
smesa->zClearPacket.stdwDim.wHeight = (GLshort) height;
|
||||
smesa->zClearPacket.dwFgRopColor = smesa->clearZStencilPattern;
|
||||
|
||||
sis_bitblt_clear_cmd( smesa, &smesa->zClearPacket );
|
||||
mWait3DCmdQueue (8);
|
||||
MMIO(REG_SRC_PITCH, (smesa->zFormat == SiS_ZFORMAT_Z16) ?
|
||||
BLIT_DEPTH_16 : BLIT_DEPTH_32);
|
||||
MMIO(REG_DST_X_Y, (x << 16) | y);
|
||||
MMIO(REG_DST_ADDR, smesa->depth.offset);
|
||||
MMIO(REG_DST_PITCH_HEIGHT, (smesa->virtualY << 16) | smesa->depth.pitch);
|
||||
MMIO(REG_WIDTH_HEIGHT, (height << 16) | width);
|
||||
MMIO(REG_PATFG, smesa->clearZStencilPattern);
|
||||
MMIO(REG_BLIT_CMD, CMD_DIR_X_INC | CMD_DIR_Y_INC | CMD_ROP_PAT);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
|
||||
All Rights Reserved.
|
||||
|
||||
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, sub license, 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 NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL SILICON INTEGRATED SYSTEMS CORP 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.
|
||||
|
||||
**************************************************************************/
|
||||
/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Sung-Ching Lin <sclin@sis.com.tw>
|
||||
*/
|
||||
|
||||
#ifndef _sis_common_h_
|
||||
#define _sis_common_h_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
typedef struct _Box
|
||||
{
|
||||
short x1, y1, x2, y2;
|
||||
}
|
||||
BoxRec;
|
||||
#define NullBox ((BoxPtr)0)
|
||||
typedef struct _Box *BoxPtr;
|
||||
|
||||
/* BitBlt Commands */
|
||||
#define CMD0_DD_ENABLE 0x06
|
||||
#define CMD0_SRC_VIDEO 0x00
|
||||
#define CMD0_SRC_CPU 0x10
|
||||
#define CMD0_PAT_FG_COLOR 0x00
|
||||
#define CMD1_DIR_X_DEC 0x00
|
||||
#define CMD1_DIR_X_INC 0x01
|
||||
#define CMD1_DIR_Y_DEC 0x00
|
||||
#define CMD1_DIR_Y_INC 0x02
|
||||
#define REG_SRC_ADDR 0x8200
|
||||
#define REG_CMD0 0x823c
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLshort wSrcPitch;
|
||||
GLshort wDestPitch;
|
||||
}
|
||||
_PITCH;
|
||||
typedef struct
|
||||
{
|
||||
GLshort wWidth;
|
||||
GLshort wHeight;
|
||||
}
|
||||
_DIM;
|
||||
typedef struct
|
||||
{
|
||||
GLshort wY;
|
||||
GLshort wX;
|
||||
}
|
||||
_POS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLubyte cCmd0;
|
||||
GLubyte cRop;
|
||||
GLubyte cCmd1;
|
||||
GLubyte cReserved;
|
||||
}
|
||||
_CMD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLshort wStatus0;
|
||||
GLbyte cStatus0_GLbyte3;
|
||||
GLbyte cStatus0_GLbyte4;
|
||||
}
|
||||
_CMDQUESTATUS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GLint dwSrcBaseAddr;
|
||||
GLint dwSrcPitch;
|
||||
_POS stdwSrcPos;
|
||||
_POS stdwDestPos;
|
||||
GLint dwDestBaseAddr;
|
||||
GLshort wDestPitch;
|
||||
GLshort wDestHeight;
|
||||
_DIM stdwDim;
|
||||
GLint dwFgRopColor;
|
||||
GLint dwBgRopColor;
|
||||
GLint dwSrcHiCKey;
|
||||
GLint dwSrcLoCKey;
|
||||
GLint dwMaskA;
|
||||
GLint dwMaskB;
|
||||
GLint dwClipA;
|
||||
GLint dwClipB;
|
||||
_CMD stdwCmd;
|
||||
_CMDQUESTATUS stdwCmdQueStatus;
|
||||
}
|
||||
ENGPACKET, *LPENGPACKET;
|
||||
|
||||
/* Hardware Info */
|
||||
#include "sis_reg.h"
|
||||
|
||||
/* HW capability */
|
||||
#define SIS_MAX_TEXTURE_SIZE 2048
|
||||
#define SIS_MAX_TEXTURES 2
|
||||
|
||||
#define SIS_MAX_FRAME_LENGTH 3
|
||||
|
||||
GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
|
||||
|
||||
#endif
|
||||
@@ -282,10 +282,6 @@ sisCreateContext( const __GLcontextModes *glVisual,
|
||||
|
||||
driInitExtensions( ctx, card_extensions, GL_FALSE );
|
||||
|
||||
/* TODO */
|
||||
/* smesa->blockWrite = SGRAMbw = IsBlockWrite (); */
|
||||
smesa->blockWrite = GL_FALSE;
|
||||
|
||||
for (i = 0; i < SIS_MAX_TEXTURES; i++) {
|
||||
smesa->TexStates[i] = 0;
|
||||
smesa->PrevTexFormat[i] = 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#include "tnl/t_vertex.h"
|
||||
|
||||
#include "sis_screen.h"
|
||||
#include "sis_common2.h"
|
||||
#include "sis_reg.h"
|
||||
#include "sis_dri.h"
|
||||
|
||||
/* for GLboolean */
|
||||
@@ -115,7 +115,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define SUBPIXEL_X (-0.5F)
|
||||
#define SUBPIXEL_Y (-0.5F)
|
||||
|
||||
#define SIS_MAX_TEXTURE_SIZE 2048
|
||||
#define SIS_MAX_TEXTURES 2
|
||||
#define SIS_MAX_TEXTURE_LEVELS 11
|
||||
#define SIS_MAX_FRAME_LENGTH 3
|
||||
|
||||
typedef struct {
|
||||
GLubyte *Data; /* Pointer to texture in offscreen */
|
||||
@@ -322,9 +325,6 @@ struct sis_context
|
||||
|
||||
GLint drawableID;
|
||||
|
||||
/* SGRAM block write */
|
||||
GLboolean blockWrite;
|
||||
|
||||
GLint GlobalFlag;
|
||||
GLuint last_tcl_state;
|
||||
|
||||
@@ -346,7 +346,6 @@ struct sis_context
|
||||
/* Front/back/depth buffer info */
|
||||
GLuint width, height; /* size of buffers */
|
||||
GLint bottom; /* used for FLIP macro */
|
||||
ENGPACKET zClearPacket, cbClearPacket;
|
||||
/* XXX These don't belong here. They should be per-drawable state. */
|
||||
struct sis_renderbuffer front;
|
||||
struct sis_renderbuffer back;
|
||||
|
||||
@@ -227,7 +227,7 @@ sisUpdateBufferSize(sisContextPtr smesa)
|
||||
/* XXX Should get the base offset of the frontbuffer from the X Server */
|
||||
smesa->front.offset = smesa->driDrawable->x * smesa->bytesPerPixel +
|
||||
smesa->driDrawable->y * smesa->front.pitch;
|
||||
smesa->front.map = (char *) smesa->driScreen->pFB;
|
||||
smesa->front.map = (char *) smesa->driScreen->pFB + smesa->front.offset;
|
||||
|
||||
smesa->width = smesa->driDrawable->w;
|
||||
smesa->height = smesa->driDrawable->h;
|
||||
|
||||
@@ -39,6 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#include "macros.h"
|
||||
|
||||
static GLint convertFtToFogFt( GLfloat dwInValue );
|
||||
static GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
|
||||
|
||||
void
|
||||
sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
|
||||
@@ -114,7 +115,7 @@ sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
|
||||
}
|
||||
}
|
||||
|
||||
GLint
|
||||
static GLint
|
||||
doFPtoFixedNoRound( GLfloat dwInValue, int nFraction )
|
||||
{
|
||||
GLint dwMantissa;
|
||||
|
||||
@@ -39,6 +39,35 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
/*
|
||||
* Define All the Register Address of 6327
|
||||
*/
|
||||
#define REG_SRC_ADDR 0x8200
|
||||
#define REG_SRC_PITCH 0x8204
|
||||
# define BLIT_DEPTH_8 0x00000000
|
||||
# define BLIT_DEPTH_15 0x40000000
|
||||
# define BLIT_DEPTH_16 0x80000000
|
||||
# define BLIT_DEPTH_32 0xc0000000
|
||||
#define REG_SRC_X_Y 0x8208
|
||||
#define REG_DST_X_Y 0x820c
|
||||
#define REG_DST_ADDR 0x8210
|
||||
#define REG_DST_PITCH_HEIGHT 0x8214
|
||||
#define REG_WIDTH_HEIGHT 0x8218
|
||||
#define REG_PATFG 0x821c
|
||||
#define REG_PATBG 0x8220
|
||||
#define REG_SRCFG 0x8224
|
||||
#define REG_SRCBG 0x8228
|
||||
#define REG_MONOPAT0 0x822c
|
||||
#define REG_MONOPAT1 0x8230
|
||||
#define REG_CLIPLT 0x8234
|
||||
#define REG_CLIPRB 0x8238
|
||||
#define REG_BLIT_CMD 0x823c
|
||||
# define CMD_ROP_PAT 0x0000f000
|
||||
# define CMD_ROP_SRC 0x0000cc00
|
||||
# define CMD_DD_ENABLE 0x00000006
|
||||
# define CMD_SRC_VIDEO 0x00000000
|
||||
# define CMD_SRC_CPU 0x00000010
|
||||
# define CMD_DIR_X_DEC 0x00000000
|
||||
# define CMD_DIR_X_INC 0x00010000
|
||||
# define CMD_DIR_Y_DEC 0x00000000
|
||||
# define CMD_DIR_Y_INC 0x00020000
|
||||
|
||||
#define REG_CommandQueue 0x8240
|
||||
|
||||
|
||||
@@ -235,63 +235,30 @@ sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
|
||||
_mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
|
||||
}
|
||||
|
||||
__inline__ static void
|
||||
sis_bitblt_copy_cmd (sisContextPtr smesa, ENGPACKET * pkt)
|
||||
{
|
||||
GLint *lpdwDest, *lpdwSrc;
|
||||
int i;
|
||||
|
||||
lpdwSrc = (GLint *) pkt;
|
||||
lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR);
|
||||
|
||||
mWait3DCmdQueue (10);
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
*lpdwDest++ = *lpdwSrc++;
|
||||
|
||||
MMIO(REG_CMD0, *(GLint *)&pkt->stdwCmd);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
|
||||
static void sisCopyBuffer( __DRIdrawablePrivate *dPriv )
|
||||
{
|
||||
sisContextPtr smesa = (sisContextPtr)dPriv->driContextPriv->driverPrivate;
|
||||
int i;
|
||||
ENGPACKET stEngPacket;
|
||||
|
||||
memset(&stEngPacket, 0, sizeof(ENGPACKET));
|
||||
|
||||
while ((*smesa->FrameCountPtr) - MMIO_READ(0x8a2c) > SIS_MAX_FRAME_LENGTH)
|
||||
;
|
||||
|
||||
LOCK_HARDWARE();
|
||||
|
||||
stEngPacket.dwSrcBaseAddr = smesa->back.offset;
|
||||
stEngPacket.dwSrcPitch = smesa->back.pitch |
|
||||
((smesa->bytesPerPixel == 2) ? 0x80000000 : 0xc0000000);
|
||||
stEngPacket.dwDestBaseAddr = 0;
|
||||
stEngPacket.wDestPitch = smesa->front.pitch;
|
||||
/* TODO: set maximum value? */
|
||||
stEngPacket.wDestHeight = smesa->virtualY;
|
||||
|
||||
stEngPacket.stdwCmd.cRop = 0xcc;
|
||||
|
||||
if (smesa->blockWrite)
|
||||
stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
|
||||
else
|
||||
stEngPacket.stdwCmd.cCmd0 = 0;
|
||||
stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
|
||||
|
||||
for (i = 0; i < dPriv->numClipRects; i++) {
|
||||
drm_clip_rect_t *box = &dPriv->pClipRects[i];
|
||||
stEngPacket.stdwSrcPos.wY = box->y1 - dPriv->y;
|
||||
stEngPacket.stdwSrcPos.wX = box->x1 - dPriv->x;
|
||||
stEngPacket.stdwDestPos.wY = box->y1;
|
||||
stEngPacket.stdwDestPos.wX = box->x1;
|
||||
|
||||
stEngPacket.stdwDim.wWidth = (GLshort) box->x2 - box->x1;
|
||||
stEngPacket.stdwDim.wHeight = (GLshort) box->y2 - box->y1;
|
||||
sis_bitblt_copy_cmd( smesa, &stEngPacket );
|
||||
mWait3DCmdQueue(10);
|
||||
MMIO(REG_SRC_ADDR, smesa->back.offset);
|
||||
MMIO(REG_SRC_PITCH, smesa->back.pitch | ((smesa->bytesPerPixel == 4) ?
|
||||
BLIT_DEPTH_32 : BLIT_DEPTH_16));
|
||||
MMIO(REG_SRC_X_Y, ((box->x1 - dPriv->x) << 16) | (box->y1 - dPriv->y));
|
||||
MMIO(REG_DST_X_Y, (box->x1 << 16) | box->y1);
|
||||
MMIO(REG_DST_ADDR, smesa->front.offset);
|
||||
MMIO(REG_DST_PITCH_HEIGHT, (smesa->virtualY << 16) | smesa->front.pitch);
|
||||
MMIO(REG_WIDTH_HEIGHT, ((box->y2 - box->y1) << 16) | (box->x2 - box->x1));
|
||||
MMIO(REG_BLIT_CMD, CMD_DIR_X_INC | CMD_DIR_Y_INC | CMD_ROP_SRC);
|
||||
MMIO(REG_CommandQueue, -1);
|
||||
}
|
||||
|
||||
*(GLint *)(smesa->IOBase+0x8a2c) = *smesa->FrameCountPtr;
|
||||
|
||||
Reference in New Issue
Block a user