mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-04 16:50:13 +01:00
- Commit WIP of an integration of the Composite extension and a
DDX-independent Composite wrapper. It's quite incomplete. Notably, the
Render extension isn't wrapped properly or even completely wrapped
improperly.
- Rename COMPOSITE enum in smi driver to avoid conflict with new define.
- Fix REGION_INIT usage of Damage so that it doesn't crash on first use.
- Fix some apparent mismerges of XFIXES.
- Fix some whitespace from DAMAGE-XFIXES merge that appears different from
both xserver CVS and surrounding style.
This commit is contained in:
parent
854c1afa86
commit
6ff8c33f50
402 changed files with 4892 additions and 86785 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
|
||||
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
|
|
@ -45,8 +45,13 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
|
|||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDisp_PointParameterfARB, /* 2065 */
|
||||
__glXDisp_PointParameterfvARB, /* 2066 */
|
||||
#else
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#endif
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
|
|
@ -2104,6 +2109,7 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
|
|||
__glXDisp_CopyTexSubImage1D, /* 4121 */
|
||||
__glXDisp_CopyTexSubImage2D, /* 4122 */
|
||||
__glXDisp_CopyTexSubImage3D, /* 4123 */
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDisp_FogCoordfv, /* 4124 */
|
||||
__glXDisp_FogCoorddv, /* 4125 */
|
||||
__glXDisp_SecondaryColor3bv, /* 4126 */
|
||||
|
|
@ -2115,6 +2121,19 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
|
|||
__glXDisp_SecondaryColor3usv, /* 4132 */
|
||||
__glXDisp_SecondaryColor3uiv, /* 4133 */
|
||||
__glXDisp_BlendFuncSeparate, /* 4134 */
|
||||
#else
|
||||
__glXNoSuchRenderOpcode, /* 4124 */
|
||||
__glXNoSuchRenderOpcode, /* 4125 */
|
||||
__glXNoSuchRenderOpcode, /* 4126 */
|
||||
__glXNoSuchRenderOpcode, /* 4127 */
|
||||
__glXNoSuchRenderOpcode, /* 4128 */
|
||||
__glXNoSuchRenderOpcode, /* 4129 */
|
||||
__glXNoSuchRenderOpcode, /* 4130 */
|
||||
__glXNoSuchRenderOpcode, /* 4131 */
|
||||
__glXNoSuchRenderOpcode, /* 4132 */
|
||||
__glXNoSuchRenderOpcode, /* 4133 */
|
||||
__glXNoSuchRenderOpcode, /* 4134 */
|
||||
#endif
|
||||
__glXNoSuchRenderOpcode, /* 4135 */
|
||||
__glXNoSuchRenderOpcode, /* 4136 */
|
||||
__glXNoSuchRenderOpcode, /* 4137 */
|
||||
|
|
@ -2200,9 +2219,20 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
|
|||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode, /* 4219 */
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDisp_ActiveStencilFaceEXT, /* 4220 */
|
||||
# ifndef __DARWIN__
|
||||
__glXDisp_PointParameteri, /* 4221 */
|
||||
__glXDisp_PointParameteriv, /* 4222 */
|
||||
# else
|
||||
__glXDisp_PointParameteriNV, /* 4221 */
|
||||
__glXDisp_PointParameterivNV, /* 4222 */
|
||||
# endif
|
||||
#else
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#endif
|
||||
};
|
||||
__GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = {
|
||||
__glXDisp_AreTexturesResidentEXT, /* 11 */
|
||||
|
|
@ -2225,8 +2255,13 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
|
|||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDispSwap_PointParameterfARB, /* 2065 */
|
||||
__glXDispSwap_PointParameterfvARB, /* 2066 */
|
||||
#else
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#endif
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
|
|
@ -4284,6 +4319,7 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
|
|||
__glXDispSwap_CopyTexSubImage1D, /* 4121 */
|
||||
__glXDispSwap_CopyTexSubImage2D, /* 4122 */
|
||||
__glXDispSwap_CopyTexSubImage3D, /* 4123 */
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDispSwap_FogCoordfv, /* 4124 */
|
||||
__glXDispSwap_FogCoorddv, /* 4125 */
|
||||
__glXDispSwap_SecondaryColor3bv, /* 4126 */
|
||||
|
|
@ -4295,6 +4331,19 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
|
|||
__glXDispSwap_SecondaryColor3usv, /* 4132 */
|
||||
__glXDispSwap_SecondaryColor3uiv, /* 4133 */
|
||||
__glXDisp_BlendFuncSeparate, /* 4134 */
|
||||
#else
|
||||
__glXNoSuchRenderOpcode, /* 4124 */
|
||||
__glXNoSuchRenderOpcode, /* 4125 */
|
||||
__glXNoSuchRenderOpcode, /* 4126 */
|
||||
__glXNoSuchRenderOpcode, /* 4127 */
|
||||
__glXNoSuchRenderOpcode, /* 4128 */
|
||||
__glXNoSuchRenderOpcode, /* 4129 */
|
||||
__glXNoSuchRenderOpcode, /* 4130 */
|
||||
__glXNoSuchRenderOpcode, /* 4131 */
|
||||
__glXNoSuchRenderOpcode, /* 4132 */
|
||||
__glXNoSuchRenderOpcode, /* 4133 */
|
||||
__glXNoSuchRenderOpcode, /* 4134 */
|
||||
#endif
|
||||
__glXNoSuchRenderOpcode, /* 4135 */
|
||||
__glXNoSuchRenderOpcode, /* 4136 */
|
||||
__glXNoSuchRenderOpcode, /* 4137 */
|
||||
|
|
@ -4380,9 +4429,20 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
|
|||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode, /* 4219 */
|
||||
#ifndef MISSING_GL_EXTS
|
||||
__glXDispSwap_ActiveStencilFaceEXT, /* 4220 */
|
||||
# ifndef __DARWIN__
|
||||
__glXDispSwap_PointParameteri, /* 4221 */
|
||||
__glXDispSwap_PointParameteriv, /* 4222 */
|
||||
# else
|
||||
__glXDispSwap_PointParameteriNV, /* 4221 */
|
||||
__glXDispSwap_PointParameterivNV, /* 4222 */
|
||||
# endif
|
||||
#else
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
__glXNoSuchRenderOpcode,
|
||||
#endif
|
||||
};
|
||||
__GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = {
|
||||
__glXDispSwap_AreTexturesResidentEXT, /* 11 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
|
||||
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
|
||||
#ifndef _GLX_g_disptab_EXT_h_
|
||||
#define _GLX_g_disptab_EXT_h_
|
||||
|
|
@ -95,10 +95,17 @@ extern void __glXDispSwap_SecondaryColor3dv(GLbyte *);
|
|||
extern void __glXDisp_BlendFuncSeparate(GLbyte *);
|
||||
extern void __glXDispSwap_BlendFuncSeparate(GLbyte *);
|
||||
|
||||
#ifdef __DARWIN__
|
||||
extern void __glXDisp_PointParameteriNV(GLbyte *);
|
||||
extern void __glXDisp_PointParameterivNV(GLbyte *);
|
||||
extern void __glXDispSwap_PointParameteriNV(GLbyte *);
|
||||
extern void __glXDispSwap_PointParameterivNV(GLbyte *);
|
||||
#else
|
||||
extern void __glXDisp_PointParameteri(GLbyte *);
|
||||
extern void __glXDisp_PointParameteriv(GLbyte *);
|
||||
extern void __glXDispSwap_PointParameteri(GLbyte *);
|
||||
extern void __glXDispSwap_PointParameteriv(GLbyte *);
|
||||
#endif
|
||||
|
||||
extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5 2002/01/14 22:47:08 tsi Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
@ -1264,7 +1264,6 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
|
|||
|
||||
int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
GLsizei n;
|
||||
__GLXcontext *cx;
|
||||
int error;
|
||||
|
||||
|
|
@ -1273,7 +1272,6 @@ int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
|
|||
return error;
|
||||
}
|
||||
pc += __GLX_SINGLE_HDR_SIZE;
|
||||
n = *(GLsizei *)(pc + 0);
|
||||
|
||||
glDeleteTextures(
|
||||
*(GLsizei *)(pc + 0),
|
||||
|
|
@ -1717,7 +1715,6 @@ int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
|
|||
|
||||
int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
GLsizei n;
|
||||
__GLXcontext *cx;
|
||||
int error;
|
||||
|
||||
|
|
@ -1726,7 +1723,6 @@ int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
|
|||
return error;
|
||||
}
|
||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||
n = *(GLsizei *)(pc + 0);
|
||||
|
||||
glDeleteTexturesEXT(
|
||||
*(GLsizei *)(pc + 0),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.5 2002/01/14 22:47:08 tsi Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.4tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.7 2001/10/31 22:50:26 tsi Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _glxbuf_h_
|
||||
#define _glxbuf_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _GLX_error_h_
|
||||
#define _GLX_error_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _glxfb_h_
|
||||
#define _glxfb_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.7 2002/08/28 06:41:26 torrey Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _glxmem_h_
|
||||
#define _glxmem_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.4 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _glxpix_h_
|
||||
#define _glxpix_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */
|
||||
#ifndef _impsize_h_
|
||||
#define _impsize_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.5 2004/01/28 18:11:53 alanh Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
#ifndef _singlesize_h_
|
||||
#define _singlesize_h_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.5 2002/10/30 12:52:03 alanh Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.4 2002/01/14 22:47:08 tsi Exp $ */
|
||||
#ifndef __GLX_unpack_h__
|
||||
#define __GLX_unpack_h__
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
|
||||
/* $XFree86$ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _glx_ansic_h_
|
||||
#define _glx_ansic_h_
|
||||
|
||||
/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.7 2002/04/04 14:05:36 eich Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.5 2001/03/21 20:49:08 dawes Exp $ */
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.4 2000/02/23 04:46:54 martin Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
|
|
|
|||
537
composite/compalloc.c
Normal file
537
composite/compalloc.c
Normal file
|
|
@ -0,0 +1,537 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "compint.h"
|
||||
|
||||
void
|
||||
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
|
||||
{
|
||||
WindowPtr pWin = (WindowPtr) closure;
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
cs->damaged = TRUE;
|
||||
cw->damaged = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
compDestroyDamage (DamagePtr pDamage, void *closure)
|
||||
{
|
||||
WindowPtr pWin = (WindowPtr) closure;
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
cw->damage = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Redirect one window for one client
|
||||
*/
|
||||
int
|
||||
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
Bool wasMapped = pWin->mapped;
|
||||
|
||||
/*
|
||||
* Only one Manual update is allowed
|
||||
*/
|
||||
if (cw && update == CompositeRedirectManual)
|
||||
for (ccw = cw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
return BadAccess;
|
||||
|
||||
/*
|
||||
* Allocate per-client per-window structure
|
||||
* The client *could* allocate multiple, but while supported,
|
||||
* it is not expected to be common
|
||||
*/
|
||||
ccw = xalloc (sizeof (CompClientWindowRec));
|
||||
if (!ccw)
|
||||
return BadAlloc;
|
||||
ccw->id = FakeClientID (pClient->index);
|
||||
ccw->update = update;
|
||||
/*
|
||||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!cw)
|
||||
{
|
||||
cw = xalloc (sizeof (CompWindowRec));
|
||||
if (!cw)
|
||||
{
|
||||
xfree (ccw);
|
||||
return BadAlloc;
|
||||
}
|
||||
cw->damage = DamageCreate (compReportDamage,
|
||||
compDestroyDamage,
|
||||
DamageReportNonEmpty,
|
||||
FALSE,
|
||||
pWin->drawable.pScreen,
|
||||
pWin);
|
||||
if (!cw->damage)
|
||||
{
|
||||
xfree (ccw);
|
||||
xfree (cw);
|
||||
return BadAlloc;
|
||||
}
|
||||
if (wasMapped)
|
||||
UnmapWindow (pWin, FALSE);
|
||||
|
||||
REGION_NULL (pScreen, &cw->borderClip);
|
||||
cw->update = CompositeRedirectAutomatic;
|
||||
cw->clients = 0;
|
||||
cw->oldx = COMP_ORIGIN_INVALID;
|
||||
cw->oldy = COMP_ORIGIN_INVALID;
|
||||
cw->damageRegistered = FALSE;
|
||||
cw->damaged = FALSE;
|
||||
pWin->devPrivates[CompWindowPrivateIndex].ptr = cw;
|
||||
}
|
||||
ccw->next = cw->clients;
|
||||
cw->clients = ccw;
|
||||
if (!AddResource (ccw->id, CompositeClientWindowType, pWin))
|
||||
return BadAlloc;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
if (cw->damageRegistered)
|
||||
{
|
||||
DamageUnregister (&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = FALSE;
|
||||
}
|
||||
cw->update = CompositeRedirectManual;
|
||||
}
|
||||
|
||||
if (!compCheckRedirect (pWin))
|
||||
{
|
||||
FreeResource (ccw->id, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
if (wasMapped && !pWin->mapped)
|
||||
{
|
||||
Bool overrideRedirect = pWin->overrideRedirect;
|
||||
pWin->overrideRedirect = TRUE;
|
||||
MapWindow (pWin, pClient);
|
||||
pWin->overrideRedirect = overrideRedirect;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free one of the per-client per-window resources, clearing
|
||||
* redirect and the per-window pointer as appropriate
|
||||
*/
|
||||
void
|
||||
compFreeClientWindow (WindowPtr pWin, XID id)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
CompClientWindowPtr ccw, *prev;
|
||||
Bool wasMapped = pWin->mapped;
|
||||
|
||||
if (!cw)
|
||||
return;
|
||||
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
|
||||
{
|
||||
if (ccw->id == id)
|
||||
{
|
||||
*prev = ccw->next;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
cw->update = CompositeRedirectAutomatic;
|
||||
xfree (ccw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!cw->clients)
|
||||
{
|
||||
if (wasMapped)
|
||||
UnmapWindow (pWin, FALSE);
|
||||
|
||||
if (pWin->redirectDraw)
|
||||
compFreePixmap (pWin);
|
||||
|
||||
if (cw->damage)
|
||||
DamageDestroy (cw->damage);
|
||||
|
||||
REGION_UNINIT (pScreen, &cw->borderClip);
|
||||
|
||||
pWin->devPrivates[CompWindowPrivateIndex].ptr = 0;
|
||||
xfree (cw);
|
||||
}
|
||||
else if (cw->update == CompositeRedirectAutomatic &&
|
||||
!cw->damageRegistered && pWin->redirectDraw)
|
||||
{
|
||||
DamageRegister (&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = TRUE;
|
||||
DamageDamageRegion (&pWin->drawable, &pWin->borderSize);
|
||||
}
|
||||
if (wasMapped && !pWin->mapped)
|
||||
{
|
||||
Bool overrideRedirect = pWin->overrideRedirect;
|
||||
pWin->overrideRedirect = TRUE;
|
||||
MapWindow (pWin, clients[CLIENT_ID(id)]);
|
||||
pWin->overrideRedirect = overrideRedirect;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is easy, just free the appropriate resource.
|
||||
*/
|
||||
|
||||
int
|
||||
compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
if (!cw)
|
||||
return BadValue;
|
||||
|
||||
for (ccw = cw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
|
||||
{
|
||||
FreeResource (ccw->id, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Redirect all subwindows for one client
|
||||
*/
|
||||
|
||||
int
|
||||
compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
WindowPtr pChild;
|
||||
|
||||
/*
|
||||
* Only one Manual update is allowed
|
||||
*/
|
||||
if (csw && update == CompositeRedirectManual)
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
return BadAccess;
|
||||
/*
|
||||
* Allocate per-client per-window structure
|
||||
* The client *could* allocate multiple, but while supported,
|
||||
* it is not expected to be common
|
||||
*/
|
||||
ccw = xalloc (sizeof (CompClientWindowRec));
|
||||
if (!ccw)
|
||||
return BadAlloc;
|
||||
ccw->id = FakeClientID (pClient->index);
|
||||
ccw->update = update;
|
||||
/*
|
||||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!csw)
|
||||
{
|
||||
csw = xalloc (sizeof (CompSubwindowsRec));
|
||||
if (!csw)
|
||||
{
|
||||
xfree (ccw);
|
||||
return BadAlloc;
|
||||
}
|
||||
csw->update = CompositeRedirectAutomatic;
|
||||
csw->clients = 0;
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = csw;
|
||||
}
|
||||
/*
|
||||
* Redirect all existing windows
|
||||
*/
|
||||
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
|
||||
{
|
||||
int ret = compRedirectWindow (pClient, pChild, update);
|
||||
if (ret != Success)
|
||||
{
|
||||
for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
|
||||
(void) compUnredirectWindow (pClient, pChild, update);
|
||||
if (!csw->clients)
|
||||
{
|
||||
xfree (csw);
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
|
||||
}
|
||||
xfree (ccw);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Hook into subwindows list
|
||||
*/
|
||||
ccw->next = csw->clients;
|
||||
csw->clients = ccw;
|
||||
if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))
|
||||
return BadAlloc;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
csw->update = CompositeRedirectManual;
|
||||
/*
|
||||
* tell damage extension that damage events for this client are
|
||||
* critical output
|
||||
*/
|
||||
DamageExtSetCritical (pClient, TRUE);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free one of the per-client per-subwindows resources,
|
||||
* which frees one redirect per subwindow
|
||||
*/
|
||||
void
|
||||
compFreeClientSubwindows (WindowPtr pWin, XID id)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pWin);
|
||||
CompClientWindowPtr ccw, *prev;
|
||||
WindowPtr pChild;
|
||||
|
||||
if (!csw)
|
||||
return;
|
||||
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
|
||||
{
|
||||
if (ccw->id == id)
|
||||
{
|
||||
ClientPtr pClient = clients[CLIENT_ID(id)];
|
||||
|
||||
*prev = ccw->next;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
/*
|
||||
* tell damage extension that damage events for this client are
|
||||
* critical output
|
||||
*/
|
||||
DamageExtSetCritical (pClient, FALSE);
|
||||
csw->update = CompositeRedirectAutomatic;
|
||||
if (pWin->mapped)
|
||||
(*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unredirect all existing subwindows
|
||||
*/
|
||||
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
|
||||
(void) compUnredirectWindow (pClient, pChild, ccw->update);
|
||||
|
||||
xfree (ccw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if all of the per-client records are gone
|
||||
*/
|
||||
if (!csw->clients)
|
||||
{
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
|
||||
xfree (csw);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is easy, just free the appropriate resource.
|
||||
*/
|
||||
|
||||
int
|
||||
compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
if (!csw)
|
||||
return BadValue;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
|
||||
{
|
||||
FreeResource (ccw->id, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add redirection information for one subwindow (during reparent)
|
||||
*/
|
||||
|
||||
int
|
||||
compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pParent);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
if (!csw)
|
||||
return Success;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
{
|
||||
int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)],
|
||||
pWin, ccw->update);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove redirection information for one subwindow (during reparent)
|
||||
*/
|
||||
|
||||
int
|
||||
compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pParent);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
if (!csw)
|
||||
return Success;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
{
|
||||
int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)],
|
||||
pWin, ccw->update);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
Bool
|
||||
compAllocPixmap (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pPixmap;
|
||||
int bw = (int) pWin->borderWidth;
|
||||
int x, y, w, h;
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
x = pWin->drawable.x - bw;
|
||||
y = pWin->drawable.y - bw;
|
||||
w = pWin->drawable.width + (bw << 1);
|
||||
h = pWin->drawable.height + (bw << 1);
|
||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth);
|
||||
if (!pPixmap)
|
||||
return FALSE;
|
||||
pPixmap->screen_x = x;
|
||||
pPixmap->screen_y = y;
|
||||
pWin->redirectDraw = TRUE;
|
||||
compSetPixmap (pWin, pPixmap);
|
||||
cw->oldx = COMP_ORIGIN_INVALID;
|
||||
cw->oldy = COMP_ORIGIN_INVALID;
|
||||
cw->damageRegistered = FALSE;
|
||||
if (cw->update == CompositeRedirectAutomatic)
|
||||
{
|
||||
DamageRegister (&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
compFreePixmap (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pRedirectPixmap, pParentPixmap;
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
if (cw->damageRegistered)
|
||||
{
|
||||
DamageUnregister (&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = FALSE;
|
||||
}
|
||||
/*
|
||||
* Move the parent-constrained border clip region back into
|
||||
* the window so that ValidateTree will handle the unmap
|
||||
* case correctly. Unmap adds the window borderClip to the
|
||||
* parent exposed area; regions beyond the parent cause crashes
|
||||
*/
|
||||
REGION_COPY (pScreen, &pWin->borderClip, &cw->borderClip);
|
||||
pRedirectPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
|
||||
pWin->redirectDraw = FALSE;
|
||||
compSetPixmap (pWin, pParentPixmap);
|
||||
(*pScreen->DestroyPixmap) (pRedirectPixmap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure the pixmap is the right size and offset. Allocate a new
|
||||
* pixmap to change size, adjust origin to change offset, leaving the
|
||||
* old pixmap in cw->pOldPixmap so bits can be recovered
|
||||
*/
|
||||
Bool
|
||||
compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
|
||||
unsigned int w, unsigned int h, int bw)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin);
|
||||
PixmapPtr pNew;
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
int pix_x, pix_y;
|
||||
unsigned int pix_w, pix_h;
|
||||
|
||||
assert (cw && pWin->redirectDraw);
|
||||
pix_x = draw_x - bw;
|
||||
pix_y = draw_y - bw;
|
||||
pix_w = w + (bw << 1);
|
||||
pix_h = h + (bw << 1);
|
||||
cw->oldx = pOld->screen_x;
|
||||
cw->oldy = pOld->screen_y;
|
||||
if (pix_w != pOld->drawable.width ||
|
||||
pix_h != pOld->drawable.height)
|
||||
{
|
||||
GCPtr pGC;
|
||||
|
||||
pNew = (*pScreen->CreatePixmap) (pScreen, pix_w, pix_h, pWin->drawable.depth);
|
||||
if (!pNew)
|
||||
return FALSE;
|
||||
cw->pOldPixmap = pOld;
|
||||
compSetPixmap (pWin, pNew);
|
||||
/*
|
||||
* Copy new bits to align at same place on the screen. CopyWindow
|
||||
* calls will patch up any differences
|
||||
*/
|
||||
pGC = GetScratchGC (pNew->drawable.depth, pScreen);
|
||||
if (pGC)
|
||||
{
|
||||
ValidateGC(&pNew->drawable, pGC);
|
||||
(*pGC->ops->CopyArea) (&pOld->drawable,
|
||||
&pNew->drawable,
|
||||
pGC,
|
||||
pWin->drawable.x - draw_x,
|
||||
pWin->drawable.y - draw_y,
|
||||
pix_w, pix_h,
|
||||
0, 0);
|
||||
FreeScratchGC (pGC);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pNew = pOld;
|
||||
cw->pOldPixmap = 0;
|
||||
}
|
||||
pNew->screen_x = pix_x;
|
||||
pNew->screen_y = pix_y;
|
||||
return TRUE;
|
||||
}
|
||||
408
composite/compext.c
Normal file
408
composite/compext.c
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "compint.h"
|
||||
|
||||
static CARD8 CompositeReqCode;
|
||||
int CompositeClientPrivateIndex;
|
||||
RESTYPE CompositeClientWindowType;
|
||||
RESTYPE CompositeClientSubwindowsType;
|
||||
|
||||
typedef struct _CompositeClient {
|
||||
int major_version;
|
||||
int minor_version;
|
||||
} CompositeClientRec, *CompositeClientPtr;
|
||||
|
||||
#define GetCompositeClient(pClient) ((CompositeClientPtr) (pClient)->devPrivates[CompositeClientPrivateIndex].ptr)
|
||||
|
||||
static void
|
||||
CompositeClientCallback (CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
CompositeClientPtr pCompositeClient = GetCompositeClient (pClient);
|
||||
|
||||
pCompositeClient->major_version = 0;
|
||||
pCompositeClient->minor_version = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
CompositeResetProc (ExtensionEntry *extEntry)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
FreeCompositeClientWindow (pointer value, XID ccwid)
|
||||
{
|
||||
WindowPtr pWin = value;
|
||||
|
||||
compFreeClientWindow (pWin, ccwid);
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
FreeCompositeClientSubwindows (pointer value, XID ccwid)
|
||||
{
|
||||
WindowPtr pWin = value;
|
||||
|
||||
compFreeClientSubwindows (pWin, ccwid);
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeQueryVersion (ClientPtr client)
|
||||
{
|
||||
CompositeClientPtr pCompositeClient = GetCompositeClient (client);
|
||||
xCompositeQueryVersionReply rep;
|
||||
register int n;
|
||||
REQUEST(xCompositeQueryVersionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
if (stuff->majorVersion < COMPOSITE_MAJOR) {
|
||||
rep.majorVersion = stuff->majorVersion;
|
||||
rep.minorVersion = stuff->minorVersion;
|
||||
} else {
|
||||
rep.majorVersion = COMPOSITE_MAJOR;
|
||||
if (stuff->majorVersion == COMPOSITE_MAJOR &&
|
||||
stuff->minorVersion < COMPOSITE_MINOR)
|
||||
rep.minorVersion = stuff->minorVersion;
|
||||
else
|
||||
rep.minorVersion = COMPOSITE_MINOR;
|
||||
}
|
||||
pCompositeClient->major_version = rep.majorVersion;
|
||||
pCompositeClient->minor_version = rep.minorVersion;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.majorVersion, n);
|
||||
swapl(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeRedirectWindow (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
return compRedirectWindow (client, pWin, stuff->update);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeRedirectSubwindows (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
return compRedirectSubwindows (client, pWin, stuff->update);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeUnredirectWindow (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
return compUnredirectWindow (client, pWin, stuff->update);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeUnredirectSubwindows (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
return compUnredirectSubwindows (client, pWin, stuff->update);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
CompWindowPtr cw;
|
||||
RegionPtr pBorderClip, pRegion;
|
||||
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
|
||||
LEGAL_NEW_RESOURCE (stuff->region, client);
|
||||
|
||||
cw = GetCompWindow (pWin);
|
||||
if (cw)
|
||||
pBorderClip = &cw->borderClip;
|
||||
else
|
||||
pBorderClip = &pWin->borderClip;
|
||||
pRegion = XFixesRegionCopy (pBorderClip);
|
||||
if (!pRegion)
|
||||
return BadAlloc;
|
||||
REGION_TRANSLATE (pScreen, pRegion, -pWin->drawable.x, -pWin->drawable.y);
|
||||
|
||||
if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
|
||||
return BadAlloc;
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeNameWindowPixmap (ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
CompWindowPtr cw;
|
||||
PixmapPtr pPixmap;
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
|
||||
LEGAL_NEW_RESOURCE (stuff->pixmap, client);
|
||||
|
||||
cw = GetCompWindow (pWin);
|
||||
if (!cw)
|
||||
return BadMatch;
|
||||
|
||||
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
|
||||
if (!pPixmap)
|
||||
return BadMatch;
|
||||
|
||||
++pPixmap->refcnt;
|
||||
|
||||
if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
|
||||
return BadAlloc;
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
||||
ProcCompositeQueryVersion,
|
||||
ProcCompositeRedirectWindow,
|
||||
ProcCompositeRedirectSubwindows,
|
||||
ProcCompositeUnredirectWindow,
|
||||
ProcCompositeUnredirectSubwindows,
|
||||
ProcCompositeCreateRegionFromBorderClip,
|
||||
ProcCompositeNameWindowPixmap,
|
||||
};
|
||||
|
||||
static int
|
||||
ProcCompositeDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data < CompositeNumberRequests)
|
||||
return (*ProcCompositeVector[stuff->data]) (client);
|
||||
else
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeQueryVersion (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
||||
swapl(&stuff->majorVersion, n);
|
||||
swapl(&stuff->minorVersion, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeRedirectWindow (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
swapl (&stuff->window, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeRedirectSubwindows (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
swapl (&stuff->window, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeUnredirectWindow (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
swapl (&stuff->window, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeUnredirectSubwindows (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
swapl (&stuff->window, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeCreateRegionFromBorderClip (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
||||
swapl (&stuff->region, n);
|
||||
swapl (&stuff->window, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcCompositeNameWindowPixmap (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
swapl (&stuff->window, n);
|
||||
swapl (&stuff->pixmap, n);
|
||||
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
||||
}
|
||||
|
||||
int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
||||
SProcCompositeQueryVersion,
|
||||
SProcCompositeRedirectWindow,
|
||||
SProcCompositeRedirectSubwindows,
|
||||
SProcCompositeUnredirectWindow,
|
||||
SProcCompositeUnredirectSubwindows,
|
||||
SProcCompositeCreateRegionFromBorderClip,
|
||||
SProcCompositeNameWindowPixmap,
|
||||
};
|
||||
|
||||
static int
|
||||
SProcCompositeDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data < CompositeNumberRequests)
|
||||
return (*SProcCompositeVector[stuff->data]) (client);
|
||||
else
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
void
|
||||
CompositeExtensionInit (void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
int s;
|
||||
|
||||
CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
|
||||
if (!CompositeClientWindowType)
|
||||
return;
|
||||
|
||||
CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows);
|
||||
if (!CompositeClientSubwindowsType)
|
||||
return;
|
||||
|
||||
CompositeClientPrivateIndex = AllocateClientPrivateIndex ();
|
||||
if (!AllocateClientPrivate (CompositeClientPrivateIndex,
|
||||
sizeof (CompositeClientRec)))
|
||||
return;
|
||||
if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0))
|
||||
return;
|
||||
|
||||
extEntry = AddExtension (COMPOSITE_NAME, 0, 0,
|
||||
ProcCompositeDispatch, SProcCompositeDispatch,
|
||||
CompositeResetProc, StandardMinorOpcode);
|
||||
if (!extEntry)
|
||||
return;
|
||||
CompositeReqCode = (CARD8) extEntry->base;
|
||||
|
||||
|
||||
for (s = 0; s < screenInfo.numScreens; s++)
|
||||
if (!compScreenInit (screenInfo.screens[s]))
|
||||
return;
|
||||
miRegisterRedirectBorderClipProc (compSetRedirectBorderClip,
|
||||
compGetRedirectBorderClip);
|
||||
}
|
||||
371
composite/compinit.c
Normal file
371
composite/compinit.c
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "compint.h"
|
||||
|
||||
int CompScreenPrivateIndex;
|
||||
int CompWindowPrivateIndex;
|
||||
int CompSubwindowsPrivateIndex;
|
||||
int CompGeneration;
|
||||
|
||||
static Bool
|
||||
compCloseScreen (int index, ScreenPtr pScreen)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
Bool ret;
|
||||
|
||||
pScreen->CloseScreen = cs->CloseScreen;
|
||||
pScreen->BlockHandler = cs->BlockHandler;
|
||||
pScreen->ReparentWindow = cs->ReparentWindow;
|
||||
pScreen->MoveWindow = cs->MoveWindow;
|
||||
pScreen->ResizeWindow = cs->ResizeWindow;
|
||||
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
|
||||
|
||||
pScreen->ClipNotify = cs->ClipNotify;
|
||||
pScreen->PaintWindowBackground = cs->PaintWindowBackground;
|
||||
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
|
||||
pScreen->RealizeWindow = cs->RealizeWindow;
|
||||
pScreen->DestroyWindow = cs->DestroyWindow;
|
||||
pScreen->CreateWindow = cs->CreateWindow;
|
||||
pScreen->CopyWindow = cs->CopyWindow;
|
||||
pScreen->PositionWindow = cs->PositionWindow;
|
||||
xfree (cs);
|
||||
pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0;
|
||||
ret = (*pScreen->CloseScreen) (index, pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
compScreenUpdate (ScreenPtr pScreen)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
compCheckTree (pScreen);
|
||||
if (cs->damaged)
|
||||
{
|
||||
compWindowUpdate (WindowTable[pScreen->myNum]);
|
||||
cs->damaged = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
compBlockHandler (int i,
|
||||
pointer blockData,
|
||||
pointer pTimeout,
|
||||
pointer pReadmask)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
pScreen->BlockHandler = cs->BlockHandler;
|
||||
compScreenUpdate (pScreen);
|
||||
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
|
||||
cs->BlockHandler = pScreen->BlockHandler;
|
||||
pScreen->BlockHandler = compBlockHandler;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add alternate visuals -- always expose an ARGB32 and RGB24 visual
|
||||
*/
|
||||
|
||||
static DepthPtr
|
||||
compFindVisuallessDepth (ScreenPtr pScreen, int d)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
DepthPtr depth = &pScreen->allowedDepths[i];
|
||||
if (depth->depth == d)
|
||||
{
|
||||
/*
|
||||
* Make sure it doesn't have visuals already
|
||||
*/
|
||||
if (depth->numVids)
|
||||
return 0;
|
||||
/*
|
||||
* looks fine
|
||||
*/
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If there isn't one, then it's gonna be hard to have
|
||||
* an associated visual
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct _alternateVisual {
|
||||
int depth;
|
||||
CARD32 format;
|
||||
} CompAlternateVisual;
|
||||
|
||||
static CompAlternateVisual altVisuals[NUM_COMP_ALTERNATE_VISUALS] = {
|
||||
{ 24, PICT_r8g8b8 },
|
||||
{ 32, PICT_a8r8g8b8 },
|
||||
};
|
||||
|
||||
static Bool
|
||||
compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
|
||||
{
|
||||
VisualPtr visuals;
|
||||
DepthPtr depths[NUM_COMP_ALTERNATE_VISUALS];
|
||||
PictFormatPtr pPictFormats[NUM_COMP_ALTERNATE_VISUALS];
|
||||
int i;
|
||||
int numVisuals;
|
||||
VisualID *vids[NUM_COMP_ALTERNATE_VISUALS];
|
||||
XID *installedCmaps;
|
||||
ColormapPtr installedCmap;
|
||||
int numInstalledCmaps;
|
||||
int numAlternate = 0;
|
||||
int alt;
|
||||
|
||||
memset (cs->alternateVisuals, '\0', sizeof (cs->alternateVisuals));
|
||||
|
||||
for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
|
||||
{
|
||||
DepthPtr depth;
|
||||
PictFormatPtr pPictFormat;
|
||||
|
||||
depth = compFindVisuallessDepth (pScreen, altVisuals[alt].depth);
|
||||
if (!depth)
|
||||
continue;
|
||||
/*
|
||||
* Find the right picture format
|
||||
*/
|
||||
pPictFormat = PictureMatchFormat (pScreen, altVisuals[alt].depth,
|
||||
altVisuals[alt].format);
|
||||
if (!pPictFormat)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Ok, create a visual id for this format
|
||||
*/
|
||||
cs->alternateVisuals[numAlternate] = FakeClientID (0);
|
||||
/*
|
||||
* Allocate vid list for this depth
|
||||
*/
|
||||
vids[numAlternate] = xalloc (sizeof (VisualID));
|
||||
if (!vids[numAlternate])
|
||||
continue;
|
||||
depths[numAlternate] = depth;
|
||||
pPictFormats[numAlternate] = pPictFormat;
|
||||
numAlternate++;
|
||||
}
|
||||
|
||||
if (!numAlternate)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* Find the installed colormaps
|
||||
*/
|
||||
installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
|
||||
if (!installedCmaps)
|
||||
{
|
||||
for (alt = 0; alt < numAlternate; alt++)
|
||||
xfree (vids[alt]);
|
||||
return FALSE;
|
||||
}
|
||||
numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
|
||||
installedCmaps);
|
||||
|
||||
/*
|
||||
* realloc the visual array to fit the new one in place
|
||||
*/
|
||||
numVisuals = pScreen->numVisuals;
|
||||
visuals = xrealloc (pScreen->visuals,
|
||||
(numVisuals + numAlternate) * sizeof (VisualRec));
|
||||
if (!visuals)
|
||||
{
|
||||
for (alt = 0; alt < numAlternate; alt++)
|
||||
xfree (vids[alt]);
|
||||
xfree (installedCmaps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fix up any existing installed colormaps -- we'll assume that
|
||||
* the only ones created so far have been installed. If this
|
||||
* isn't true, we'll have to walk the resource database looking
|
||||
* for all colormaps.
|
||||
*/
|
||||
for (i = 0; i < numInstalledCmaps; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
|
||||
if (!installedCmap)
|
||||
continue;
|
||||
j = installedCmap->pVisual - pScreen->visuals;
|
||||
installedCmap->pVisual = &visuals[j];
|
||||
}
|
||||
|
||||
xfree (installedCmaps);
|
||||
|
||||
pScreen->visuals = visuals;
|
||||
pScreen->numVisuals = numVisuals + numAlternate;
|
||||
|
||||
for (alt = 0; alt < numAlternate; alt++)
|
||||
{
|
||||
DepthPtr depth = depths[alt];
|
||||
PictFormatPtr pPictFormat = pPictFormats[alt];
|
||||
VisualPtr visual = &visuals[numVisuals + alt];
|
||||
|
||||
/*
|
||||
* Initialize the visual
|
||||
*/
|
||||
visual->class = TrueColor;
|
||||
visual->bitsPerRGBValue = 8;
|
||||
|
||||
visual->vid = FakeClientID (0);
|
||||
visual->redMask = (((unsigned long) pPictFormat->direct.redMask) <<
|
||||
pPictFormat->direct.red);
|
||||
visual->greenMask = (((unsigned long) pPictFormat->direct.greenMask) <<
|
||||
pPictFormat->direct.green);
|
||||
visual->blueMask = (((unsigned long) pPictFormat->direct.blueMask) <<
|
||||
pPictFormat->direct.blue);
|
||||
visual->offsetRed = pPictFormat->direct.red;
|
||||
visual->offsetGreen = pPictFormat->direct.green;
|
||||
visual->offsetBlue = pPictFormat->direct.blue;
|
||||
visual->alphaMask = (((unsigned long) pPictFormat->direct.alphaMask) <<
|
||||
pPictFormat->direct.alpha);
|
||||
visual->offsetAlpha = pPictFormat->direct.alpha;
|
||||
/*
|
||||
* follow GLX and set nplanes to just the bits
|
||||
* used for the RGB value, not A
|
||||
*/
|
||||
visual->nplanes = Ones (visual->redMask |
|
||||
visual->greenMask |
|
||||
visual->blueMask);
|
||||
/*
|
||||
* find widest component
|
||||
*/
|
||||
visual->ColormapEntries = (1 << max (Ones (visual->redMask),
|
||||
max (Ones (visual->greenMask),
|
||||
Ones (visual->blueMask))));
|
||||
|
||||
/*
|
||||
* remember the visual ID to detect auto-update windows
|
||||
*/
|
||||
cs->alternateVisuals[alt] = visual->vid;
|
||||
|
||||
/*
|
||||
* Fix up the depth
|
||||
*/
|
||||
vids[alt][0] = visual->vid;
|
||||
depth->numVids = 1;
|
||||
depth->vids = vids[alt];
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
compScreenInit (ScreenPtr pScreen)
|
||||
{
|
||||
CompScreenPtr cs;
|
||||
|
||||
if (CompGeneration != serverGeneration)
|
||||
{
|
||||
CompScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
if (CompScreenPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompWindowPrivateIndex = AllocateWindowPrivateIndex ();
|
||||
if (CompWindowPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex ();
|
||||
if (CompSubwindowsPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompGeneration = serverGeneration;
|
||||
}
|
||||
if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0))
|
||||
return FALSE;
|
||||
|
||||
if (GetCompScreen (pScreen))
|
||||
return TRUE;
|
||||
cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
|
||||
if (!cs)
|
||||
return FALSE;
|
||||
|
||||
cs->damaged = FALSE;
|
||||
|
||||
if (!compAddAlternateVisuals (pScreen, cs))
|
||||
{
|
||||
xfree (cs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cs->PositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = compPositionWindow;
|
||||
|
||||
cs->CopyWindow = pScreen->CopyWindow;
|
||||
pScreen->CopyWindow = compCopyWindow;
|
||||
|
||||
cs->CreateWindow = pScreen->CreateWindow;
|
||||
pScreen->CreateWindow = compCreateWindow;
|
||||
|
||||
cs->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = compDestroyWindow;
|
||||
|
||||
cs->RealizeWindow = pScreen->RealizeWindow;
|
||||
pScreen->RealizeWindow = compRealizeWindow;
|
||||
|
||||
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
|
||||
pScreen->UnrealizeWindow = compUnrealizeWindow;
|
||||
|
||||
cs->PaintWindowBackground = pScreen->PaintWindowBackground;
|
||||
pScreen->PaintWindowBackground = compPaintWindowBackground;
|
||||
|
||||
cs->ClipNotify = pScreen->ClipNotify;
|
||||
pScreen->ClipNotify = compClipNotify;
|
||||
|
||||
cs->MoveWindow = pScreen->MoveWindow;
|
||||
pScreen->MoveWindow = compMoveWindow;
|
||||
|
||||
cs->ResizeWindow = pScreen->ResizeWindow;
|
||||
pScreen->ResizeWindow = compResizeWindow;
|
||||
|
||||
cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
|
||||
pScreen->ChangeBorderWidth = compChangeBorderWidth;
|
||||
|
||||
cs->ReparentWindow = pScreen->ReparentWindow;
|
||||
pScreen->ReparentWindow = compReparentWindow;
|
||||
|
||||
cs->BlockHandler = pScreen->BlockHandler;
|
||||
pScreen->BlockHandler = compBlockHandler;
|
||||
|
||||
cs->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = compCloseScreen;
|
||||
|
||||
miInitializeCompositeWrapper(pScreen);
|
||||
|
||||
pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs;
|
||||
return TRUE;
|
||||
}
|
||||
243
composite/compint.h
Normal file
243
composite/compint.h
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _COMPINT_H_
|
||||
#define _COMPINT_H_
|
||||
|
||||
#include "misc.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "os.h"
|
||||
#include "regionstr.h"
|
||||
#include "validate.h"
|
||||
#include "windowstr.h"
|
||||
#include "input.h"
|
||||
#include "resource.h"
|
||||
#include "colormapst.h"
|
||||
#include "cursorstr.h"
|
||||
#include "dixstruct.h"
|
||||
#include "gcstruct.h"
|
||||
#include "servermd.h"
|
||||
#include "dixevents.h"
|
||||
#include "globals.h"
|
||||
#include "picturestr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "mi.h"
|
||||
#include "damage.h"
|
||||
#include "damageextint.h"
|
||||
#include "xfixes.h"
|
||||
#include <X11/extensions/compositeproto.h>
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct _CompClientWindow {
|
||||
struct _CompClientWindow *next;
|
||||
XID id;
|
||||
int update;
|
||||
} CompClientWindowRec, *CompClientWindowPtr;
|
||||
|
||||
typedef struct _CompWindow {
|
||||
RegionRec borderClip;
|
||||
DamagePtr damage; /* for automatic update mode */
|
||||
Bool damageRegistered;
|
||||
Bool damaged;
|
||||
int update;
|
||||
CompClientWindowPtr clients;
|
||||
int oldx;
|
||||
int oldy;
|
||||
PixmapPtr pOldPixmap;
|
||||
int borderClipX, borderClipY;
|
||||
} CompWindowRec, *CompWindowPtr;
|
||||
|
||||
#define COMP_ORIGIN_INVALID 0x80000000
|
||||
|
||||
typedef struct _CompSubwindows {
|
||||
int update;
|
||||
CompClientWindowPtr clients;
|
||||
} CompSubwindowsRec, *CompSubwindowsPtr;
|
||||
|
||||
extern int CompPixmapPrivateIndex;
|
||||
|
||||
#define NUM_COMP_ALTERNATE_VISUALS 2
|
||||
|
||||
typedef struct _CompScreen {
|
||||
PositionWindowProcPtr PositionWindow;
|
||||
CopyWindowProcPtr CopyWindow;
|
||||
CreateWindowProcPtr CreateWindow;
|
||||
DestroyWindowProcPtr DestroyWindow;
|
||||
RealizeWindowProcPtr RealizeWindow;
|
||||
UnrealizeWindowProcPtr UnrealizeWindow;
|
||||
PaintWindowProcPtr PaintWindowBackground;
|
||||
ClipNotifyProcPtr ClipNotify;
|
||||
/*
|
||||
* Called from ConfigureWindow, these
|
||||
* three track changes to the offscreen storage
|
||||
* geometry
|
||||
*/
|
||||
MoveWindowProcPtr MoveWindow;
|
||||
ResizeWindowProcPtr ResizeWindow;
|
||||
ChangeBorderWidthProcPtr ChangeBorderWidth;
|
||||
/*
|
||||
* Reparenting has an effect on Subwindows redirect
|
||||
*/
|
||||
ReparentWindowProcPtr ReparentWindow;
|
||||
|
||||
ScreenBlockHandlerProcPtr BlockHandler;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
Bool damaged;
|
||||
XID alternateVisuals[NUM_COMP_ALTERNATE_VISUALS];
|
||||
} CompScreenRec, *CompScreenPtr;
|
||||
|
||||
#define HasCompRedirect(w) (wPixmap(w) != wPixmap(w->parent))
|
||||
#define wScreen(w) ((w)->drawable.pScreen)
|
||||
#define wPixmap(w) (*(wScreen(w)->GetWindowPixmap) (w))
|
||||
|
||||
extern int CompScreenPrivateIndex;
|
||||
extern int CompWindowPrivateIndex;
|
||||
extern int CompSubwindowsPrivateIndex;
|
||||
|
||||
#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr))
|
||||
#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr))
|
||||
#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr))
|
||||
|
||||
extern RESTYPE CompositeClientWindowType;
|
||||
extern RESTYPE CompositeClientSubwindowsType;
|
||||
|
||||
/*
|
||||
* compalloc.c
|
||||
*/
|
||||
|
||||
void
|
||||
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure);
|
||||
|
||||
Bool
|
||||
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
|
||||
|
||||
void
|
||||
compFreeClientWindow (WindowPtr pWin, XID id);
|
||||
|
||||
int
|
||||
compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
|
||||
|
||||
int
|
||||
compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
|
||||
|
||||
void
|
||||
compFreeClientSubwindows (WindowPtr pWin, XID id);
|
||||
|
||||
int
|
||||
compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
|
||||
|
||||
int
|
||||
compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
|
||||
|
||||
int
|
||||
compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compAllocPixmap (WindowPtr pWin);
|
||||
|
||||
void
|
||||
compFreePixmap (WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compReallocPixmap (WindowPtr pWin, int x, int y,
|
||||
unsigned int w, unsigned int h, int bw);
|
||||
|
||||
/*
|
||||
* compext.c
|
||||
*/
|
||||
|
||||
void
|
||||
CompositeExtensionInit (void);
|
||||
|
||||
/*
|
||||
* compinit.c
|
||||
*/
|
||||
|
||||
Bool
|
||||
compScreenInit (ScreenPtr pScreen);
|
||||
|
||||
/*
|
||||
* compwindow.c
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define compCheckTree(s)
|
||||
#else
|
||||
void
|
||||
compCheckTree (ScreenPtr pScreen);
|
||||
#endif
|
||||
|
||||
void
|
||||
compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
|
||||
|
||||
Bool
|
||||
compCheckRedirect (WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compPositionWindow (WindowPtr pWin, int x, int y);
|
||||
|
||||
Bool
|
||||
compRealizeWindow (WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compUnrealizeWindow (WindowPtr pWin);
|
||||
|
||||
void
|
||||
compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
|
||||
|
||||
void
|
||||
compClipNotify (WindowPtr pWin, int dx, int dy);
|
||||
|
||||
void
|
||||
compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
|
||||
|
||||
void
|
||||
compResizeWindow (WindowPtr pWin, int x, int y,
|
||||
unsigned int w, unsigned int h, WindowPtr pSib);
|
||||
|
||||
void
|
||||
compChangeBorderWidth (WindowPtr pWin, unsigned int border_width);
|
||||
|
||||
void
|
||||
compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
|
||||
|
||||
Bool
|
||||
compCreateWindow (WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compDestroyWindow (WindowPtr pWin);
|
||||
|
||||
void
|
||||
compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion);
|
||||
|
||||
RegionPtr
|
||||
compGetRedirectBorderClip (WindowPtr pWin);
|
||||
|
||||
void
|
||||
compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
|
||||
|
||||
void
|
||||
compWindowUpdate (WindowPtr pWin);
|
||||
|
||||
#endif /* _COMPINT_H_ */
|
||||
708
composite/compwindow.c
Normal file
708
composite/compwindow.c
Normal file
|
|
@ -0,0 +1,708 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "compint.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
static int
|
||||
compCheckWindow (WindowPtr pWin, pointer data)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
|
||||
PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
|
||||
|
||||
if (!pWin->parent)
|
||||
{
|
||||
assert (!pWin->redirectDraw);
|
||||
assert (pWinPixmap == pScreenPixmap);
|
||||
}
|
||||
else if (pWin->redirectDraw)
|
||||
{
|
||||
assert (pWinPixmap != pParentPixmap);
|
||||
assert (pWinPixmap != pScreenPixmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (pWinPixmap == pParentPixmap);
|
||||
}
|
||||
assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
|
||||
assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
|
||||
if (pParentPixmap)
|
||||
assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
|
||||
return WT_WALKCHILDREN;
|
||||
}
|
||||
|
||||
void
|
||||
compCheckTree (ScreenPtr pScreen)
|
||||
{
|
||||
WalkTree (pScreen, compCheckWindow, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct _compPixmapVisit {
|
||||
WindowPtr pWindow;
|
||||
PixmapPtr pPixmap;
|
||||
} CompPixmapVisitRec, *CompPixmapVisitPtr;
|
||||
|
||||
static int
|
||||
compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
||||
{
|
||||
CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
|
||||
ScreenPtr pScreen = pWindow->drawable.pScreen;
|
||||
|
||||
if (pWindow != pVisit->pWindow && pWindow->redirectDraw)
|
||||
return WT_DONTWALKCHILDREN;
|
||||
(*pScreen->SetWindowPixmap) (pWindow, pVisit->pPixmap);
|
||||
/*
|
||||
* Recompute winSize and borderSize. This is duplicate effort
|
||||
* when resizing pixmaps, but necessary when changing redirection.
|
||||
* Might be nice to fix this.
|
||||
*/
|
||||
SetWinSize (pWindow);
|
||||
SetBorderSize (pWindow);
|
||||
return WT_WALKCHILDREN;
|
||||
}
|
||||
|
||||
void
|
||||
compSetPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
|
||||
{
|
||||
CompPixmapVisitRec visitRec;
|
||||
|
||||
visitRec.pWindow = pWindow;
|
||||
visitRec.pPixmap = pPixmap;
|
||||
TraverseTree (pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
|
||||
compCheckTree (pWindow->drawable.pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
compCheckRedirect (WindowPtr pWin)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
Bool should = pWin->viewable && (cw != NULL);
|
||||
|
||||
if (should != pWin->redirectDraw)
|
||||
{
|
||||
if (should)
|
||||
return compAllocPixmap (pWin);
|
||||
else
|
||||
compFreePixmap (pWin);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
compPositionWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
pScreen->PositionWindow = cs->PositionWindow;
|
||||
/*
|
||||
* "Shouldn't need this as all possible places should be wrapped
|
||||
*
|
||||
compCheckRedirect (pWin);
|
||||
*/
|
||||
if (pWin->redirectDraw != (pWin->viewable && (GetCompWindow(pWin) != NULL)))
|
||||
abort ();
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
int bw = wBorderWidth (pWin);
|
||||
int nx = pWin->drawable.x - bw;
|
||||
int ny = pWin->drawable.y - bw;
|
||||
|
||||
if (pPixmap->screen_x != nx || pPixmap->screen_y != ny)
|
||||
{
|
||||
pPixmap->screen_x = nx;
|
||||
pPixmap->screen_y = ny;
|
||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(*pScreen->PositionWindow) (pWin, x, y))
|
||||
ret = FALSE;
|
||||
cs->PositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = compPositionWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
compRealizeWindow (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
pScreen->RealizeWindow = cs->RealizeWindow;
|
||||
compCheckRedirect (pWin);
|
||||
if (!(*pScreen->RealizeWindow) (pWin))
|
||||
ret = FALSE;
|
||||
cs->RealizeWindow = pScreen->RealizeWindow;
|
||||
pScreen->RealizeWindow = compRealizeWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
compUnrealizeWindow (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
|
||||
compCheckRedirect (pWin);
|
||||
if (!(*pScreen->UnrealizeWindow) (pWin))
|
||||
ret = FALSE;
|
||||
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
|
||||
pScreen->UnrealizeWindow = compUnrealizeWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pWin);
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
if (csw && csw->update == CompositeRedirectManual)
|
||||
return;
|
||||
pScreen->PaintWindowBackground = cs->PaintWindowBackground;
|
||||
(*pScreen->PaintWindowBackground) (pWin, pRegion, what);
|
||||
cs->PaintWindowBackground = pScreen->PaintWindowBackground;
|
||||
pScreen->PaintWindowBackground = compPaintWindowBackground;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called after the borderClip for the window has settled down
|
||||
* We use this to make sure our extra borderClip has the right origin
|
||||
*/
|
||||
|
||||
void
|
||||
compClipNotify (WindowPtr pWin, int dx, int dy)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
if (cw)
|
||||
{
|
||||
if (cw->borderClipX != pWin->drawable.x ||
|
||||
cw->borderClipY != pWin->drawable.y)
|
||||
{
|
||||
REGION_TRANSLATE (pScreen, &cw->borderClip,
|
||||
pWin->drawable.x - cw->borderClipX,
|
||||
pWin->drawable.y - cw->borderClipY);
|
||||
cw->borderClipX = pWin->drawable.x;
|
||||
cw->borderClipY = pWin->drawable.y;
|
||||
}
|
||||
}
|
||||
if (cs->ClipNotify)
|
||||
{
|
||||
pScreen->ClipNotify = cs->ClipNotify;
|
||||
(*pScreen->ClipNotify) (pWin, dx, dy);
|
||||
cs->ClipNotify = pScreen->ClipNotify;
|
||||
pScreen->ClipNotify = compClipNotify;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns TRUE if the window needs server-provided automatic redirect,
|
||||
* which is true if the child and parent aren't both regular or ARGB visuals
|
||||
*/
|
||||
|
||||
static Bool
|
||||
compIsAlternateVisual (ScreenPtr pScreen,
|
||||
XID visual)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_COMP_ALTERNATE_VISUALS; i++)
|
||||
if (cs->alternateVisuals[i] == visual)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
|
||||
{
|
||||
if (pParent)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
XID winVisual = wVisual (pWin);
|
||||
XID parentVisual = wVisual (pParent);
|
||||
|
||||
if (winVisual != parentVisual &&
|
||||
(compIsAlternateVisual (pScreen, winVisual) ||
|
||||
compIsAlternateVisual (pScreen, parentVisual)))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
compCheckTree (pScreen);
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
WindowPtr pParent;
|
||||
int draw_x, draw_y;
|
||||
unsigned int w, h, bw;
|
||||
|
||||
/* if this is a root window, can't be moved */
|
||||
if (!(pParent = pWin->parent))
|
||||
return;
|
||||
|
||||
bw = wBorderWidth (pWin);
|
||||
draw_x = pParent->drawable.x + x + (int)bw;
|
||||
draw_y = pParent->drawable.y + y + (int)bw;
|
||||
w = pWin->drawable.width;
|
||||
h = pWin->drawable.height;
|
||||
compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
|
||||
}
|
||||
compCheckTree (pScreen);
|
||||
|
||||
pScreen->MoveWindow = cs->MoveWindow;
|
||||
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
|
||||
cs->MoveWindow = pScreen->MoveWindow;
|
||||
pScreen->MoveWindow = compMoveWindow;
|
||||
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
||||
cw->pOldPixmap = NullPixmap;
|
||||
}
|
||||
}
|
||||
|
||||
compCheckTree (pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
compResizeWindow (WindowPtr pWin, int x, int y,
|
||||
unsigned int w, unsigned int h, WindowPtr pSib)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
compCheckTree (pScreen);
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
WindowPtr pParent;
|
||||
int draw_x, draw_y;
|
||||
unsigned int bw;
|
||||
|
||||
/* if this is a root window, can't be moved */
|
||||
if (!(pParent = pWin->parent))
|
||||
return;
|
||||
|
||||
bw = wBorderWidth (pWin);
|
||||
draw_x = pParent->drawable.x + x + (int)bw;
|
||||
draw_y = pParent->drawable.y + y + (int)bw;
|
||||
compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
|
||||
}
|
||||
compCheckTree (pScreen);
|
||||
|
||||
pScreen->ResizeWindow = cs->ResizeWindow;
|
||||
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
|
||||
cs->ResizeWindow = pScreen->ResizeWindow;
|
||||
pScreen->ResizeWindow = compResizeWindow;
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
||||
cw->pOldPixmap = NullPixmap;
|
||||
}
|
||||
}
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
compCheckTree (pScreen);
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
WindowPtr pParent;
|
||||
int draw_x, draw_y;
|
||||
unsigned int w, h;
|
||||
|
||||
/* if this is a root window, can't be moved */
|
||||
if (!(pParent = pWin->parent))
|
||||
return;
|
||||
|
||||
draw_x = pWin->drawable.x;
|
||||
draw_y = pWin->drawable.y;
|
||||
w = pWin->drawable.width;
|
||||
h = pWin->drawable.height;
|
||||
compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
|
||||
}
|
||||
compCheckTree (pScreen);
|
||||
|
||||
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
|
||||
(*pScreen->ChangeBorderWidth) (pWin, bw);
|
||||
cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
|
||||
pScreen->ChangeBorderWidth = compChangeBorderWidth;
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
||||
cw->pOldPixmap = NullPixmap;
|
||||
}
|
||||
}
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
|
||||
pScreen->ReparentWindow = cs->ReparentWindow;
|
||||
/*
|
||||
* Remove any implicit redirect due to synthesized visual
|
||||
*/
|
||||
if (compImplicitRedirect (pWin, pPriorParent))
|
||||
compUnredirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
|
||||
/*
|
||||
* Handle subwindows redirection
|
||||
*/
|
||||
compUnredirectOneSubwindow (pPriorParent, pWin);
|
||||
compRedirectOneSubwindow (pWin->parent, pWin);
|
||||
/*
|
||||
* Add any implict redirect due to synthesized visual
|
||||
*/
|
||||
if (compImplicitRedirect (pWin, pWin->parent))
|
||||
compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
|
||||
|
||||
/*
|
||||
* Allocate any necessary redirect pixmap
|
||||
* (this actually should never be true; pWin is always unmapped)
|
||||
*/
|
||||
compCheckRedirect (pWin);
|
||||
|
||||
/*
|
||||
* Reset pixmap pointers as appropriate
|
||||
*/
|
||||
if (pWin->parent && !pWin->redirectDraw)
|
||||
compSetPixmap (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
|
||||
/*
|
||||
* Call down to next function
|
||||
*/
|
||||
if (pScreen->ReparentWindow)
|
||||
(*pScreen->ReparentWindow) (pWin, pPriorParent);
|
||||
cs->ReparentWindow = pScreen->ReparentWindow;
|
||||
pScreen->ReparentWindow = compReparentWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
assert (cw->oldx != COMP_ORIGIN_INVALID);
|
||||
assert (cw->oldy != COMP_ORIGIN_INVALID);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
/*
|
||||
* Ok, the old bits are available in pOldPixmap and
|
||||
* need to be copied to pNewPixmap.
|
||||
*/
|
||||
RegionRec rgnDst;
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
GCPtr pGC;
|
||||
|
||||
dx = ptOldOrg.x - pWin->drawable.x;
|
||||
dy = ptOldOrg.y - pWin->drawable.y;
|
||||
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
|
||||
|
||||
REGION_NULL (pWin->drawable.pScreen, &rgnDst);
|
||||
|
||||
REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst,
|
||||
&pWin->borderClip, prgnSrc);
|
||||
|
||||
REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst,
|
||||
-pPixmap->screen_x, -pPixmap->screen_y);
|
||||
|
||||
dx = dx + pPixmap->screen_x - cw->oldx;
|
||||
dy = dy + pPixmap->screen_y - cw->oldy;
|
||||
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
||||
if (pGC)
|
||||
{
|
||||
BoxPtr pBox = REGION_RECTS (&rgnDst);
|
||||
int nBox = REGION_NUM_RECTS (&rgnDst);
|
||||
|
||||
ValidateGC(&pPixmap->drawable, pGC);
|
||||
while (nBox--)
|
||||
{
|
||||
(void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
|
||||
&pPixmap->drawable,
|
||||
pGC,
|
||||
pBox->x1 + dx, pBox->y1 + dy,
|
||||
pBox->x2 - pBox->x1,
|
||||
pBox->y2 - pBox->y1,
|
||||
pBox->x1, pBox->y1);
|
||||
pBox++;
|
||||
}
|
||||
FreeScratchGC (pGC);
|
||||
}
|
||||
return;
|
||||
}
|
||||
dx = pPixmap->screen_x - cw->oldx;
|
||||
dy = pPixmap->screen_y - cw->oldy;
|
||||
ptOldOrg.x += dx;
|
||||
ptOldOrg.y += dy;
|
||||
}
|
||||
|
||||
pScreen->CopyWindow = cs->CopyWindow;
|
||||
if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y)
|
||||
{
|
||||
if (dx || dy)
|
||||
REGION_TRANSLATE (pScreen, prgnSrc, dx, dy);
|
||||
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
|
||||
if (dx || dy)
|
||||
REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptOldOrg.x -= dx;
|
||||
ptOldOrg.y -= dy;
|
||||
REGION_TRANSLATE (prgnSrc, prgnSrc,
|
||||
pWin->drawable.x - ptOldOrg.x,
|
||||
pWin->drawable.y - ptOldOrg.y);
|
||||
DamageDamageRegion (&pWin->drawable, prgnSrc);
|
||||
}
|
||||
cs->CopyWindow = pScreen->CopyWindow;
|
||||
pScreen->CopyWindow = compCopyWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
compCreateWindow (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
Bool ret;
|
||||
|
||||
pScreen->CreateWindow = cs->CreateWindow;
|
||||
ret = (*pScreen->CreateWindow) (pWin);
|
||||
if (pWin->parent && ret)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
(*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
|
||||
if (csw)
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
compRedirectWindow (clients[CLIENT_ID(ccw->id)],
|
||||
pWin, ccw->update);
|
||||
if (compImplicitRedirect (pWin, pWin->parent))
|
||||
compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
|
||||
}
|
||||
cs->CreateWindow = pScreen->CreateWindow;
|
||||
pScreen->CreateWindow = compCreateWindow;
|
||||
compCheckTree (pWin->drawable.pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
compDestroyWindow (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen (pScreen);
|
||||
CompWindowPtr cw;
|
||||
CompSubwindowsPtr csw;
|
||||
Bool ret;
|
||||
|
||||
pScreen->DestroyWindow = cs->DestroyWindow;
|
||||
while ((cw = GetCompWindow (pWin)))
|
||||
FreeResource (cw->clients->id, RT_NONE);
|
||||
while ((csw = GetCompSubwindows (pWin)))
|
||||
FreeResource (csw->clients->id, RT_NONE);
|
||||
|
||||
if (pWin->redirectDraw)
|
||||
compFreePixmap (pWin);
|
||||
ret = (*pScreen->DestroyWindow) (pWin);
|
||||
cs->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = compDestroyWindow;
|
||||
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
RegionRec damage;
|
||||
|
||||
REGION_NULL (pScreen, &damage);
|
||||
/*
|
||||
* Align old border clip with new border clip
|
||||
*/
|
||||
REGION_TRANSLATE (pScreen, &cw->borderClip,
|
||||
pWin->drawable.x - cw->borderClipX,
|
||||
pWin->drawable.y - cw->borderClipY);
|
||||
/*
|
||||
* Compute newly visible portion of window for repaint
|
||||
*/
|
||||
REGION_SUBTRACT (pScreen, &damage, pRegion, &cw->borderClip);
|
||||
/*
|
||||
* Report that as damaged so it will be redrawn
|
||||
*/
|
||||
DamageDamageRegion (&pWin->drawable, &damage);
|
||||
REGION_UNINIT (pScreen, &damage);
|
||||
/*
|
||||
* Save the new border clip region
|
||||
*/
|
||||
REGION_COPY (pScreen, &cw->borderClip, pRegion);
|
||||
cw->borderClipX = pWin->drawable.x;
|
||||
cw->borderClipY = pWin->drawable.y;
|
||||
}
|
||||
|
||||
RegionPtr
|
||||
compGetRedirectBorderClip (WindowPtr pWin)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
|
||||
return &cw->borderClip;
|
||||
}
|
||||
|
||||
static VisualPtr
|
||||
compGetWindowVisual (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual (pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PictFormatPtr
|
||||
compWindowFormat (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
return PictureMatchVisual (pScreen, pWin->drawable.depth,
|
||||
compGetWindowVisual (pWin));
|
||||
}
|
||||
|
||||
static void
|
||||
compWindowUpdateAutomatic (WindowPtr pWin)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow (pWin);
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
WindowPtr pParent = pWin->parent;
|
||||
PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
PixmapPtr pDstPixmap = (*pScreen->GetWindowPixmap) (pParent);
|
||||
PictFormatPtr pSrcFormat = compWindowFormat (pWin);
|
||||
PictFormatPtr pDstFormat = compWindowFormat (pWin->parent);
|
||||
int error;
|
||||
RegionPtr pRegion = DamageRegion (cw->damage);
|
||||
PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable,
|
||||
pSrcFormat,
|
||||
0, 0,
|
||||
serverClient,
|
||||
&error);
|
||||
PicturePtr pDstPicture = CreatePicture (0, &pDstPixmap->drawable,
|
||||
pDstFormat,
|
||||
0, 0,
|
||||
serverClient,
|
||||
&error);
|
||||
|
||||
REGION_TRANSLATE (pScreen, pRegion,
|
||||
pSrcPixmap->screen_x, pSrcPixmap->screen_y);
|
||||
REGION_INTERSECT (pScreen, pRegion, pRegion, &cw->borderClip);
|
||||
REGION_TRANSLATE (pScreen, pRegion,
|
||||
-pSrcPixmap->screen_x, -pSrcPixmap->screen_y);
|
||||
|
||||
SetPictureClipRegion (pSrcPicture, 0, 0, pRegion);
|
||||
|
||||
CompositePicture (PictOpSrc,
|
||||
pSrcPicture,
|
||||
0,
|
||||
pDstPicture,
|
||||
0,
|
||||
0,
|
||||
0, 0,
|
||||
pSrcPixmap->screen_x - pDstPixmap->screen_x,
|
||||
pSrcPixmap->screen_y - pDstPixmap->screen_y,
|
||||
pSrcPixmap->drawable.width,
|
||||
pSrcPixmap->drawable.height);
|
||||
FreePicture (pSrcPicture, 0);
|
||||
FreePicture (pDstPicture, 0);
|
||||
DamageEmpty (cw->damage);
|
||||
}
|
||||
|
||||
void
|
||||
compWindowUpdate (WindowPtr pWin)
|
||||
{
|
||||
WindowPtr pChild;
|
||||
|
||||
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
|
||||
compWindowUpdate (pChild);
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
|
||||
if (cw->damaged)
|
||||
{
|
||||
compWindowUpdateAutomatic (pWin);
|
||||
cw->damaged = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg$ */
|
||||
/* $XdotOrg: xc/programs/Xserver/dix/colormap.c,v 1.2 2004/04/23 19:04:43 eich Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.11 2003/11/03 05:10:59 tsi Exp $ */
|
||||
/***********************************************************
|
||||
|
||||
|
|
@ -190,7 +190,15 @@ static void FindColorInRootCmap (
|
|||
#define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
|
||||
#define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
|
||||
#define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1)
|
||||
#define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask)
|
||||
#ifdef COMPOSITE
|
||||
#define NUMALPHA(vis) ((vis->alphaMask >> vis->offsetAlpha) + 1)
|
||||
#define ALPHAMASK(vis) (vis->alphaMask)
|
||||
#else
|
||||
#define NUMALPHA(vis) 0
|
||||
#define ALPHAMASK(vis) 0
|
||||
#endif
|
||||
|
||||
#define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask | ALPHAMASK(vis))
|
||||
|
||||
/* GetNextBitsOrBreak(bits, mask, base) --
|
||||
* (Suggestion: First read the macro, then read this explanation.
|
||||
|
|
@ -866,6 +874,9 @@ AllocColor (pmap, pred, pgreen, pblue, pPix, client)
|
|||
*pPix = (pixR << pVisual->offsetRed) |
|
||||
(pixG << pVisual->offsetGreen) |
|
||||
(pixB << pVisual->offsetBlue);
|
||||
#ifdef COMPOSITE
|
||||
*pPix |= pVisual->alphaMask;
|
||||
#endif
|
||||
*pred = pmap->red[pixR].co.local.red;
|
||||
*pgreen = pmap->green[pixG].co.local.green;
|
||||
*pblue = pmap->blue[pixB].co.local.blue;
|
||||
|
|
@ -956,6 +967,9 @@ AllocColor (pmap, pred, pgreen, pblue, pPix, client)
|
|||
return (BadAlloc);
|
||||
}
|
||||
*pPix = pixR | pixG | pixB;
|
||||
#ifdef COMPOSITE
|
||||
*pPix |= pVisual->alphaMask;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1928,6 +1942,10 @@ AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask)
|
|||
}
|
||||
pmap->numPixelsBlue[client] += npixB;
|
||||
pmap->freeBlue -= npixB;
|
||||
#ifdef COMPOSITE
|
||||
for (pDst = pixels; pDst < pixels + c; pDst++)
|
||||
*pDst |= pmap->pVisual->alphaMask;
|
||||
#endif
|
||||
|
||||
DEALLOCATE_LOCAL(ppixBlue);
|
||||
DEALLOCATE_LOCAL(ppixGreen);
|
||||
|
|
|
|||
12
dix/cursor.c
12
dix/cursor.c
|
|
@ -68,6 +68,10 @@ typedef struct _GlyphShare {
|
|||
|
||||
static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
|
||||
|
||||
#ifdef XFIXES
|
||||
static CARD32 cursorSerial;
|
||||
#endif
|
||||
|
||||
static void
|
||||
FreeCursorBits(CursorBitsPtr bits)
|
||||
{
|
||||
|
|
@ -189,6 +193,10 @@ AllocCursorARGB(psrcbits, pmaskbits, argb, cm,
|
|||
|
||||
pCurs->bits = bits;
|
||||
pCurs->refcnt = 1;
|
||||
#ifdef XFIXES
|
||||
pCurs->serialNumber = ++cursorSerial;
|
||||
pCurs->name = None;
|
||||
#endif
|
||||
|
||||
pCurs->foreRed = foreRed;
|
||||
pCurs->foreGreen = foreGreen;
|
||||
|
|
@ -379,6 +387,10 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
|
|||
CheckForEmptyMask(bits);
|
||||
pCurs->bits = bits;
|
||||
pCurs->refcnt = 1;
|
||||
#ifdef XFIXES
|
||||
pCurs->serialNumber = ++cursorSerial;
|
||||
pCurs->name = None;
|
||||
#endif
|
||||
|
||||
pCurs->foreRed = foreRed;
|
||||
pCurs->foreGreen = foreGreen;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.3 2004/06/21 13:40:25 ago Exp $ */
|
||||
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.4 2004/07/29 18:43:58 stukreit Exp $ */
|
||||
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
|
||||
/************************************************************
|
||||
|
||||
|
|
@ -1050,13 +1050,12 @@ ProcSetSelectionOwner(client)
|
|||
CurrentSelections[i].client = (pWin ? client : NullClient);
|
||||
if (SelectionCallback)
|
||||
{
|
||||
SelectionInfoRec info;
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.kind= SelectionSetOwner;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.kind= SelectionSetOwner;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
else
|
||||
|
|
@ -2130,7 +2129,9 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
|
|||
Mask plane = 0;
|
||||
char *pBuf;
|
||||
xGetImageReply xgi;
|
||||
#ifdef XCSECURITY
|
||||
RegionPtr pVisibleRegion = NULL;
|
||||
#endif
|
||||
|
||||
if ((format != XYPixmap) && (format != ZPixmap))
|
||||
{
|
||||
|
|
|
|||
52
dix/window.c
52
dix/window.c
|
|
@ -1,4 +1,4 @@
|
|||
/* $XdotOrg: xc/programs/Xserver/dix/window.c,v 1.3 2004/07/29 18:43:58 stukreit Exp $ */
|
||||
/* $XdotOrg: xc/programs/Xserver/dix/window.c,v 1.4 2004/07/29 23:43:39 kem Exp $ */
|
||||
/* $Xorg: window.c,v 1.4 2001/02/09 02:04:41 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
|
|
@ -291,6 +291,9 @@ SetWindowToDefaults(register WindowPtr pWin)
|
|||
pWin->srcBuffer = DBE_FRONT_BUFFER;
|
||||
pWin->dstBuffer = DBE_FRONT_BUFFER;
|
||||
#endif
|
||||
#ifdef COMPOSITE
|
||||
pWin->redirectDraw = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1661,6 +1664,19 @@ void
|
|||
SetWinSize (pWin)
|
||||
register WindowPtr pWin;
|
||||
{
|
||||
#ifdef COMPOSITE
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
box.x1 = pWin->drawable.x;
|
||||
box.y1 = pWin->drawable.y;
|
||||
box.x2 = pWin->drawable.x + pWin->drawable.width;
|
||||
box.y2 = pWin->drawable.y + pWin->drawable.height;
|
||||
REGION_RESET (pScreen, &pWin->winSize, &box);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
ClippedRegionFromBox(pWin->parent, &pWin->winSize,
|
||||
pWin->drawable.x, pWin->drawable.y,
|
||||
(int)pWin->drawable.width,
|
||||
|
|
@ -1691,6 +1707,19 @@ SetBorderSize (pWin)
|
|||
|
||||
if (HasBorder (pWin)) {
|
||||
bw = wBorderWidth (pWin);
|
||||
#ifdef COMPOSITE
|
||||
if (pWin->redirectDraw)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
box.x1 = pWin->drawable.x - bw;
|
||||
box.y1 = pWin->drawable.y - bw;
|
||||
box.x2 = pWin->drawable.x + pWin->drawable.width + bw;
|
||||
box.y2 = pWin->drawable.y + pWin->drawable.height + bw;
|
||||
REGION_RESET (pScreen, &pWin->borderSize, &box);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
|
||||
pWin->drawable.x - bw, pWin->drawable.y - bw,
|
||||
(int)(pWin->drawable.width + (bw<<1)),
|
||||
|
|
@ -3154,15 +3183,15 @@ HandleSaveSet(client)
|
|||
{
|
||||
pWin = SaveSetWindow(client->saveSet[j]);
|
||||
#ifdef XFIXES
|
||||
if (SaveSetToRoot(client->saveSet[j]))
|
||||
pParent = WindowTable[pWin->drawable.pScreen->myNum];
|
||||
else
|
||||
if (SaveSetToRoot(client->saveSet[j]))
|
||||
pParent = WindowTable[pWin->drawable.pScreen->myNum];
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pParent = pWin->parent;
|
||||
while (pParent && (wClient (pParent) == client))
|
||||
pParent = pParent->parent;
|
||||
}
|
||||
{
|
||||
pParent = pWin->parent;
|
||||
while (pParent && (wClient (pParent) == client))
|
||||
pParent = pParent->parent;
|
||||
}
|
||||
if (pParent)
|
||||
{
|
||||
if (pParent != pWin->parent)
|
||||
|
|
@ -3174,7 +3203,10 @@ HandleSaveSet(client)
|
|||
if(!pWin->realized && pWin->mapped)
|
||||
pWin->mapped = FALSE;
|
||||
}
|
||||
MapWindow(pWin, client);
|
||||
#ifdef XFIXES
|
||||
if (SaveSetRemap (client->saveSet[j]))
|
||||
#endif
|
||||
MapWindow(pWin, client);
|
||||
}
|
||||
}
|
||||
xfree(client->saveSet);
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
|
||||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.7 2001/05/23 08:56:08 alanh Exp $
|
||||
KDRIVE=.
|
||||
#include "Kdrive.tmpl"
|
||||
|
||||
#if BuildRender
|
||||
RENDERSRCS=kpict.c
|
||||
RENDEROBJS=kpict.o
|
||||
#endif
|
||||
|
||||
#if BuildXvExt
|
||||
XVSRCS=kxv.c
|
||||
XVOBJS=kxv.o
|
||||
#endif
|
||||
|
||||
#if XipaqServer
|
||||
DEFINES = -DXIPAQ
|
||||
#endif
|
||||
|
||||
SRCS = kaa.c kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \
|
||||
vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) $(XVSRCS)
|
||||
|
||||
OBJS = kaa.o kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \
|
||||
vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) $(XVOBJS)
|
||||
|
||||
INCLUDES = $(KDINCS)
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
NormalLibraryTarget(kdrive,$(OBJS))
|
||||
|
||||
SpecialCObjectRule(kdrive,,$(EXT_DEFINES))
|
||||
|
||||
InstallManPage(Xkdrive,$(MANDIR))
|
||||
DependTarget()
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $
|
||||
|
||||
#include <Server.tmpl>
|
||||
|
||||
#if BuildRender
|
||||
RENDERINCS=-I$(KDRIVE)/../../render
|
||||
#endif
|
||||
|
||||
#if BuildRandR
|
||||
RANDRINCS=-I$(KDRIVE)/../../randr
|
||||
#endif
|
||||
|
||||
KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
|
||||
-I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \
|
||||
-I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \
|
||||
-I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \
|
||||
-I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS)
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
if KDRIVEVESA
|
||||
VESA_SUBDIRS = vesa mach64 mga nvidia r128 smi chips pm2 via neomagic
|
||||
endif
|
||||
|
||||
if KDRIVEFBDEV
|
||||
FBDEV_SUBDIRS = fbdev
|
||||
endif
|
||||
|
||||
if XSDLSERVER
|
||||
XSDL_SUBDIRS=sdl
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
linux \
|
||||
$(XSDL_SUBDIRS) \
|
||||
$(FBDEV_SUBDIRS) \
|
||||
$(VESA_SUBDIRS) \
|
||||
ati \
|
||||
fake \
|
||||
i810
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $
|
||||
.\"
|
||||
.TH Xkdrive 1 __vendorversion__
|
||||
.SH NAME
|
||||
Xkdrive \- tiny X server
|
||||
.SH SYNOPSIS
|
||||
.B Xvesa
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xfbdev
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xigs
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xtrident
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xsis530
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xtrio
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
|
||||
.B Xitsy
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
.SH DESCRIPTION
|
||||
.B Xkdrive
|
||||
is a family of X servers designed to be particularly small. This
|
||||
manual page describes the common functionality of the
|
||||
.B Xkdrive
|
||||
servers; for information on a specific X server, please refer to the
|
||||
relevant manual page.
|
||||
.SH OPTIONS
|
||||
In addition to the standard options accepted by all X servers (see
|
||||
Xserver(1)), all the
|
||||
.B Xkdrive
|
||||
servers accept the following options:
|
||||
.TP 8
|
||||
.B -card \fIpcmcia\fP
|
||||
use pcmcia card as additional screen.
|
||||
.TP 8
|
||||
.B -dumb
|
||||
disable hardware acceleration.
|
||||
.TP 8
|
||||
.B -origin \fIX\fP,\fIY\fP
|
||||
Locates the next screen in the Xinerama virtual screen.
|
||||
.TP 8
|
||||
.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB
|
||||
use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values).
|
||||
.TP 8
|
||||
.B -softCursor
|
||||
disable the hardware cursor.
|
||||
.TP 8
|
||||
.B -videoTest
|
||||
start the server, pause momentarily, and exit.
|
||||
.TP 8
|
||||
.B -zaphod
|
||||
disable switching screens by moving the pointer across a screen boundary.
|
||||
.TP 8
|
||||
.B -2button
|
||||
enable emulation of a middle mouse button by chording.
|
||||
.TP 8
|
||||
.B -3button
|
||||
disable emulation of a middle mouse button by chording.
|
||||
.SH SEE ALSO
|
||||
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1).
|
||||
.SH AUTHORS
|
||||
The Xkdrive common core was written by Keith Packard,
|
||||
and is based on the Sample Implementation of X.
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
if DRI
|
||||
DRI_INCLUDES = -I$(top_srcdir)/dri \
|
||||
-I$(top_srcdir)/drm
|
||||
DRI_LIBS = $(top_builddir)/dri/libdri.a \
|
||||
$(top_builddir)/drm/libdrm.a
|
||||
DRI_SOURCES = ati_dri.c \
|
||||
ati_dri.h \
|
||||
ati_dripriv.h \
|
||||
r128_common.h \
|
||||
r128_sarea.h \
|
||||
radeon_common.h \
|
||||
radeon_sarea.h
|
||||
endif
|
||||
|
||||
if KDRIVEFBDEV
|
||||
FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
|
||||
FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
|
||||
endif
|
||||
|
||||
if KDRIVEVESA
|
||||
VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
|
||||
VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
|
||||
endif
|
||||
|
||||
INCLUDES = \
|
||||
@KDRIVE_INCS@ \
|
||||
$(DRI_INCLUDES) \
|
||||
$(FBDEV_INCLUDES) \
|
||||
$(VESA_INCLUDES) \
|
||||
@XSERVER_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = Xati
|
||||
|
||||
if TSLIB
|
||||
TSLIB_FLAG = -lts
|
||||
endif
|
||||
|
||||
noinst_LIBRARIES = libati.a
|
||||
|
||||
libati_a_SOURCES = \
|
||||
ati_cursor.c \
|
||||
ati_dma.c \
|
||||
ati_dma.h \
|
||||
ati_draw.c \
|
||||
ati_draw.h \
|
||||
ati_microcode.c \
|
||||
ati.c \
|
||||
ati.h \
|
||||
ati_reg.h \
|
||||
r128_composite.c \
|
||||
ati_video.c \
|
||||
radeon_composite.c \
|
||||
$(DRI_SOURCES)
|
||||
|
||||
Xati_SOURCES = \
|
||||
ati_stub.c
|
||||
|
||||
ATI_LIBS = \
|
||||
libati.a \
|
||||
$(FBDEV_LIBS) \
|
||||
$(VESA_LIBS) \
|
||||
$(DRI_LIBS) \
|
||||
@KDRIVE_LIBS@
|
||||
|
||||
Xati_LDADD = \
|
||||
$(ATI_LIBS) \
|
||||
@XSERVER_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
|
||||
Xati_DEPENDENCIES = $(ATI_LIBS) @KDRIVE_LIBS@
|
||||
|
|
@ -1,773 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "ati_reg.h"
|
||||
#if defined(USE_DRI) && defined(GLXEXT)
|
||||
#include "ati_sarea.h"
|
||||
#endif
|
||||
|
||||
static Bool ATIIsAGP(ATICardInfo *atic);
|
||||
|
||||
#define CAP_SERIESMASK 0xf
|
||||
#define CAP_R128 0x1 /* If it's a Rage 128 */
|
||||
#define CAP_R100 0x2 /* If it's an r100 series radeon. */
|
||||
#define CAP_R200 0x3 /* If it's an r200 series radeon. */
|
||||
#define CAP_R300 0x4 /* If it's an r300 series radeon. */
|
||||
|
||||
#define CAP_FEATURESMASK 0xf0
|
||||
#define CAP_NOAGP 0x10 /* If it's a PCI-only card. */
|
||||
|
||||
struct pci_id_entry ati_pci_ids[] = {
|
||||
{0x1002, 0x4136, 0x2, "ATI Radeon RS100"},
|
||||
{0x1002, 0x4137, 0x2, "ATI Radeon RS200"},
|
||||
{0x1002, 0x4237, 0x2, "ATI Radeon RS250"},
|
||||
{0x1002, 0x4144, 0x4, "ATI Radeon R300 AD"},
|
||||
{0x1002, 0x4145, 0x4, "ATI Radeon R300 AE"},
|
||||
{0x1002, 0x4146, 0x4, "ATI Radeon R300 AF"},
|
||||
{0x1002, 0x4147, 0x4, "ATI Radeon R300 AG"},
|
||||
{0x1002, 0x4148, 0x4, "ATI Radeon R350 AH"},
|
||||
{0x1002, 0x4149, 0x4, "ATI Radeon R350 AI"},
|
||||
{0x1002, 0x414a, 0x4, "ATI Radeon R350 AJ"},
|
||||
{0x1002, 0x414b, 0x4, "ATI Radeon R350 AK"},
|
||||
{0x1002, 0x4150, 0x4, "ATI Radeon RV350 AP"},
|
||||
{0x1002, 0x4151, 0x4, "ATI Radeon RV350 AQ"},
|
||||
{0x1002, 0x4152, 0x4, "ATI Radeon RV350 AR"},
|
||||
{0x1002, 0x4153, 0x4, "ATI Radeon RV350 AS"},
|
||||
{0x1002, 0x4154, 0x4, "ATI Radeon RV350 AT"},
|
||||
{0x1002, 0x4156, 0x4, "ATI Radeon RV350 AV"},
|
||||
{0x1002, 0x4242, 0x3, "ATI Radeon R200 BB"},
|
||||
{0x1002, 0x4243, 0x3, "ATI Radeon R200 BC"},
|
||||
{0x1002, 0x4336, 0x2, "ATI Radeon RS100"},
|
||||
{0x1002, 0x4337, 0x2, "ATI Radeon RS200"},
|
||||
{0x1002, 0x4437, 0x2, "ATI Radeon RS250"},
|
||||
{0x1002, 0x4964, 0x2, "ATI Radeon RV250 Id"},
|
||||
{0x1002, 0x4965, 0x2, "ATI Radeon RV250 Ie"},
|
||||
{0x1002, 0x4966, 0x2, "ATI Radeon RV250 If"},
|
||||
{0x1002, 0x4967, 0x2, "ATI Radeon R250 Ig"},
|
||||
{0x1002, 0x4c45, 0x11, "ATI Rage 128 LE"},
|
||||
{0x1002, 0x4c46, 0x1, "ATI Rage 128 LF"},
|
||||
{0x1002, 0x4c57, 0x2, "ATI Radeon Mobiliy M7 RV200 LW (7500)"},
|
||||
{0x1002, 0x4c58, 0x2, "ATI Radeon Mobiliy M7 RV200 LX (7500)"},
|
||||
{0x1002, 0x4c59, 0x2, "ATI Radeon Mobility M6 LY"},
|
||||
{0x1002, 0x4c5a, 0x2, "ATI Radeon Mobility M6 LZ"},
|
||||
{0x1002, 0x4c64, 0x3, "ATI Radeon RV250 Ld"},
|
||||
{0x1002, 0x4c65, 0x3, "ATI Radeon RV250 Le"},
|
||||
{0x1002, 0x4c66, 0x3, "ATI Radeon Mobility M9 RV250 Lf"},
|
||||
{0x1002, 0x4c67, 0x3, "ATI Radeon RV250 Lg"},
|
||||
{0x1002, 0x4d46, 0x1, "ATI Rage 128 MF"},
|
||||
{0x1002, 0x4d46, 0x1, "ATI Rage 128 ML"},
|
||||
{0x1002, 0x4e44, 0x4, "ATI Radeon R300 ND"},
|
||||
{0x1002, 0x4e45, 0x4, "ATI Radeon R300 NE"},
|
||||
{0x1002, 0x4e46, 0x4, "ATI Radeon R300 NF"},
|
||||
{0x1002, 0x4e47, 0x4, "ATI Radeon R300 NG"},
|
||||
{0x1002, 0x4e48, 0x4, "ATI Radeon R350 NH"},
|
||||
{0x1002, 0x4e49, 0x4, "ATI Radeon R350 NI"},
|
||||
{0x1002, 0x4e4a, 0x4, "ATI Radeon R350 NJ"},
|
||||
{0x1002, 0x4e4b, 0x4, "ATI Radeon R350 NK"},
|
||||
{0x1002, 0x4e50, 0x4, "ATI Radeon Mobility RV350 NP"},
|
||||
{0x1002, 0x4e51, 0x4, "ATI Radeon Mobility RV350 NQ"},
|
||||
{0x1002, 0x4e52, 0x4, "ATI Radeon Mobility RV350 NR"},
|
||||
{0x1002, 0x4e53, 0x4, "ATI Radeon Mobility RV350 NS"},
|
||||
{0x1002, 0x4e54, 0x4, "ATI Radeon Mobility RV350 NT"},
|
||||
{0x1002, 0x4e56, 0x4, "ATI Radeon Mobility RV350 NV"},
|
||||
{0x1002, 0x5041, 0x1, "ATI Rage 128 PA"},
|
||||
{0x1002, 0x5042, 0x1, "ATI Rage 128 PB"},
|
||||
{0x1002, 0x5043, 0x1, "ATI Rage 128 PC"},
|
||||
{0x1002, 0x5044, 0x11, "ATI Rage 128 PD"},
|
||||
{0x1002, 0x5045, 0x1, "ATI Rage 128 PE"},
|
||||
{0x1002, 0x5046, 0x1, "ATI Rage 128 PF"},
|
||||
{0x1002, 0x5047, 0x1, "ATI Rage 128 PG"},
|
||||
{0x1002, 0x5048, 0x1, "ATI Rage 128 PH"},
|
||||
{0x1002, 0x5049, 0x1, "ATI Rage 128 PI"},
|
||||
{0x1002, 0x504a, 0x1, "ATI Rage 128 PJ"},
|
||||
{0x1002, 0x504b, 0x1, "ATI Rage 128 PK"},
|
||||
{0x1002, 0x504c, 0x1, "ATI Rage 128 PL"},
|
||||
{0x1002, 0x504d, 0x1, "ATI Rage 128 PM"},
|
||||
{0x1002, 0x504e, 0x1, "ATI Rage 128 PN"},
|
||||
{0x1002, 0x504f, 0x1, "ATI Rage 128 PO"},
|
||||
{0x1002, 0x5050, 0x11, "ATI Rage 128 PP"},
|
||||
{0x1002, 0x5051, 0x1, "ATI Rage 128 PQ"},
|
||||
{0x1002, 0x5052, 0x11, "ATI Rage 128 PR"},
|
||||
{0x1002, 0x5053, 0x1, "ATI Rage 128 PS"},
|
||||
{0x1002, 0x5054, 0x1, "ATI Rage 128 PT"},
|
||||
{0x1002, 0x5055, 0x1, "ATI Rage 128 PU"},
|
||||
{0x1002, 0x5056, 0x1, "ATI Rage 128 PV"},
|
||||
{0x1002, 0x5057, 0x1, "ATI Rage 128 PW"},
|
||||
{0x1002, 0x5058, 0x1, "ATI Rage 128 PX"},
|
||||
{0x1002, 0x5144, 0x2, "ATI Radeon R100 QD"},
|
||||
{0x1002, 0x5145, 0x2, "ATI Radeon R100 QE"},
|
||||
{0x1002, 0x5146, 0x2, "ATI Radeon R100 QF"},
|
||||
{0x1002, 0x5147, 0x2, "ATI Radeon R100 QG"},
|
||||
{0x1002, 0x5148, 0x3, "ATI Radeon R200 QH"},
|
||||
{0x1002, 0x514c, 0x3, "ATI Radeon R200 QL"},
|
||||
{0x1002, 0x514d, 0x3, "ATI Radeon R200 QM"},
|
||||
{0x1002, 0x5157, 0x2, "ATI Radeon RV200 QW (7500)"},
|
||||
{0x1002, 0x5158, 0x2, "ATI Radeon RV200 QX (7500)"},
|
||||
{0x1002, 0x5159, 0x2, "ATI Radeon RV100 QY"},
|
||||
{0x1002, 0x515a, 0x2, "ATI Radeon RV100 QZ"},
|
||||
{0x1002, 0x5245, 0x11, "ATI Rage 128 RE"},
|
||||
{0x1002, 0x5246, 0x1, "ATI Rage 128 RF"},
|
||||
{0x1002, 0x5247, 0x1, "ATI Rage 128 RG"},
|
||||
{0x1002, 0x524b, 0x11, "ATI Rage 128 RK"},
|
||||
{0x1002, 0x524c, 0x1, "ATI Rage 128 RL"},
|
||||
{0x1002, 0x5345, 0x1, "ATI Rage 128 SE"},
|
||||
{0x1002, 0x5346, 0x1, "ATI Rage 128 SF"},
|
||||
{0x1002, 0x5347, 0x1, "ATI Rage 128 SG"},
|
||||
{0x1002, 0x5348, 0x1, "ATI Rage 128 SH"},
|
||||
{0x1002, 0x534b, 0x1, "ATI Rage 128 SK"},
|
||||
{0x1002, 0x534c, 0x1, "ATI Rage 128 SL"},
|
||||
{0x1002, 0x534d, 0x1, "ATI Rage 128 SM"},
|
||||
{0x1002, 0x534e, 0x1, "ATI Rage 128 SN"},
|
||||
{0x1002, 0x5446, 0x1, "ATI Rage 128 TF"},
|
||||
{0x1002, 0x544c, 0x1, "ATI Rage 128 TL"},
|
||||
{0x1002, 0x5452, 0x1, "ATI Rage 128 TR"},
|
||||
{0x1002, 0x5453, 0x1, "ATI Rage 128 TS"},
|
||||
{0x1002, 0x5454, 0x1, "ATI Rage 128 TT"},
|
||||
{0x1002, 0x5455, 0x1, "ATI Rage 128 TU"},
|
||||
{0x1002, 0x5834, 0x3, "ATI Radeon RS300"},
|
||||
{0x1002, 0x5835, 0x3, "ATI Radeon RS300 Mobility"},
|
||||
{0x1002, 0x5941, 0x3, "ATI Radeon RV280 (9200)"},
|
||||
{0x1002, 0x5961, 0x3, "ATI Radeon RV280 (9200 SE)"},
|
||||
{0x1002, 0x5964, 0x3, "ATI Radeon RV280 (9200 SE)"},
|
||||
{0x1002, 0x5c60, 0x3, "ATI Radeon RV280"},
|
||||
{0x1002, 0x5c61, 0x3, "ATI Radeon RV280 Mobility"},
|
||||
{0x1002, 0x5c62, 0x3, "ATI Radeon RV280"},
|
||||
{0x1002, 0x5c63, 0x3, "ATI Radeon RV280 Mobility"},
|
||||
{0x1002, 0x5c64, 0x3, "ATI Radeon RV280"},
|
||||
{0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static char *
|
||||
make_busid(KdCardAttr *attr)
|
||||
{
|
||||
char *busid;
|
||||
|
||||
busid = xalloc(20);
|
||||
if (busid == NULL)
|
||||
return NULL;
|
||||
snprintf(busid, 20, "pci:%04x:%02x:%02x.%d", attr->domain, attr->bus,
|
||||
attr->slot, attr->func);
|
||||
return busid;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATICardInit(KdCardInfo *card)
|
||||
{
|
||||
ATICardInfo *atic;
|
||||
int i;
|
||||
Bool initialized = FALSE;
|
||||
|
||||
atic = xcalloc(sizeof(ATICardInfo), 1);
|
||||
if (atic == NULL)
|
||||
return FALSE;
|
||||
|
||||
#ifdef KDRIVEFBDEV
|
||||
if (!initialized && fbdevInitialize(card, &atic->backend_priv.fbdev)) {
|
||||
atic->use_fbdev = TRUE;
|
||||
initialized = TRUE;
|
||||
atic->backend_funcs.cardfini = fbdevCardFini;
|
||||
atic->backend_funcs.scrfini = fbdevScreenFini;
|
||||
atic->backend_funcs.initScreen = fbdevInitScreen;
|
||||
atic->backend_funcs.finishInitScreen = fbdevFinishInitScreen;
|
||||
atic->backend_funcs.createRes = fbdevCreateResources;
|
||||
atic->backend_funcs.preserve = fbdevPreserve;
|
||||
atic->backend_funcs.restore = fbdevRestore;
|
||||
atic->backend_funcs.dpms = fbdevDPMS;
|
||||
atic->backend_funcs.enable = fbdevEnable;
|
||||
atic->backend_funcs.disable = fbdevDisable;
|
||||
atic->backend_funcs.getColors = fbdevGetColors;
|
||||
atic->backend_funcs.putColors = fbdevPutColors;
|
||||
#ifdef RANDR
|
||||
atic->backend_funcs.randrSetConfig = fbdevRandRSetConfig;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef KDRIVEVESA
|
||||
if (!initialized && vesaInitialize(card, &atic->backend_priv.vesa)) {
|
||||
atic->use_vesa = TRUE;
|
||||
initialized = TRUE;
|
||||
atic->backend_funcs.cardfini = vesaCardFini;
|
||||
atic->backend_funcs.scrfini = vesaScreenFini;
|
||||
atic->backend_funcs.initScreen = vesaInitScreen;
|
||||
atic->backend_funcs.finishInitScreen = vesaFinishInitScreen;
|
||||
atic->backend_funcs.createRes = vesaCreateResources;
|
||||
atic->backend_funcs.preserve = vesaPreserve;
|
||||
atic->backend_funcs.restore = vesaRestore;
|
||||
atic->backend_funcs.dpms = vesaDPMS;
|
||||
atic->backend_funcs.enable = vesaEnable;
|
||||
atic->backend_funcs.disable = vesaDisable;
|
||||
atic->backend_funcs.getColors = vesaGetColors;
|
||||
atic->backend_funcs.putColors = vesaPutColors;
|
||||
#ifdef RANDR
|
||||
atic->backend_funcs.randrSetConfig = vesaRandRSetConfig;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!initialized || !ATIMapReg(card, atic)) {
|
||||
xfree(atic);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
atic->busid = make_busid(&card->attr);
|
||||
if (atic->busid == NULL) {
|
||||
xfree(atic);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_DRI
|
||||
/* We demand identification by busid, not driver name */
|
||||
atic->drmFd = drmOpen(NULL, atic->busid);
|
||||
if (atic->drmFd < 0)
|
||||
ErrorF("Failed to open DRM, DRI disabled.\n");
|
||||
#endif /* USE_DRI */
|
||||
|
||||
card->driver = atic;
|
||||
|
||||
for (i = 0; ati_pci_ids[i].name != NULL; i++) {
|
||||
if (ati_pci_ids[i].device == card->attr.deviceID) {
|
||||
atic->pci_id = &ati_pci_ids[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((atic->pci_id->caps & CAP_SERIESMASK) != CAP_R128)
|
||||
atic->is_radeon = TRUE;
|
||||
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R100)
|
||||
atic->is_r100 = TRUE;
|
||||
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R200)
|
||||
atic->is_r200 = TRUE;
|
||||
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R300)
|
||||
atic->is_r300 = TRUE;
|
||||
|
||||
atic->is_agp = ATIIsAGP(atic);
|
||||
|
||||
ErrorF("Using ATI card: %s (%s) at %s\n", atic->pci_id->name,
|
||||
atic->is_agp ? "AGP" : "PCI", atic->busid);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATICardFini(KdCardInfo *card)
|
||||
{
|
||||
ATICardInfo *atic = (ATICardInfo *)card->driver;
|
||||
|
||||
ATIUnmapReg(card, atic);
|
||||
atic->backend_funcs.cardfini(card);
|
||||
}
|
||||
|
||||
/*
|
||||
* Once screen->off_screen_base is set, this function
|
||||
* allocates the remaining memory appropriately
|
||||
*/
|
||||
|
||||
static void
|
||||
ATISetOffscreen (KdScreenInfo *screen)
|
||||
{
|
||||
ATICardInfo(screen);
|
||||
#if defined(USE_DRI) && defined(GLXEXT)
|
||||
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
|
||||
int l;
|
||||
#endif
|
||||
int screen_size;
|
||||
char *mmio = atic->reg_base;
|
||||
|
||||
/* check (and adjust) pitch */
|
||||
if (mmio)
|
||||
{
|
||||
int byteStride = screen->fb[0].byteStride;
|
||||
int bitStride;
|
||||
int pixelStride;
|
||||
int bpp = screen->fb[0].bitsPerPixel;
|
||||
|
||||
/*
|
||||
* Ensure frame buffer is correctly aligned
|
||||
*/
|
||||
if (byteStride & 0x3f)
|
||||
{
|
||||
byteStride = (byteStride + 0x3f) & ~0x3f;
|
||||
bitStride = byteStride * 8;
|
||||
pixelStride = bitStride / bpp;
|
||||
|
||||
screen->fb[0].byteStride = byteStride;
|
||||
screen->fb[0].pixelStride = pixelStride;
|
||||
}
|
||||
}
|
||||
|
||||
screen_size = screen->fb[0].byteStride * screen->height;
|
||||
|
||||
screen->off_screen_base = screen_size;
|
||||
|
||||
#if defined(USE_DRI) && defined(GLXEXT)
|
||||
/* Reserve a static area for the back buffer the same size as the
|
||||
* visible screen. XXX: This would be better initialized in ati_dri.c
|
||||
* when GLX is set up, but the offscreen memory manager's allocations
|
||||
* don't last through VT switches, while the kernel's understanding of
|
||||
* offscreen locations does.
|
||||
*/
|
||||
atis->frontOffset = 0;
|
||||
atis->frontPitch = screen->fb[0].byteStride;
|
||||
|
||||
if (screen->off_screen_base + screen_size <= screen->memory_size) {
|
||||
atis->backOffset = screen->off_screen_base;
|
||||
atis->backPitch = screen->fb[0].byteStride;
|
||||
screen->off_screen_base += screen_size;
|
||||
}
|
||||
|
||||
/* Reserve the depth span for Rage 128 */
|
||||
if (!atic->is_radeon && screen->off_screen_base +
|
||||
screen->fb[0].byteStride <= screen->memory_size) {
|
||||
atis->spanOffset = screen->off_screen_base;
|
||||
screen->off_screen_base += screen->fb[0].byteStride;
|
||||
}
|
||||
|
||||
/* Reserve the static depth buffer, which happens to be the same
|
||||
* bitsPerPixel as the screen.
|
||||
*/
|
||||
if (screen->off_screen_base + screen_size <= screen->memory_size) {
|
||||
atis->depthOffset = screen->off_screen_base;
|
||||
atis->depthPitch = screen->fb[0].byteStride;
|
||||
screen->off_screen_base += screen_size;
|
||||
}
|
||||
|
||||
/* Reserve approx. half of remaining offscreen memory for local
|
||||
* textures. Round down to a whole number of texture regions.
|
||||
*/
|
||||
atis->textureSize = (screen->memory_size - screen->off_screen_base) / 2;
|
||||
l = ATILog2(atis->textureSize / ATI_NR_TEX_REGIONS);
|
||||
if (l < ATI_LOG_TEX_GRANULARITY)
|
||||
l = ATI_LOG_TEX_GRANULARITY;
|
||||
atis->textureSize = (atis->textureSize >> l) << l;
|
||||
if (atis->textureSize >= 512 * 1024) {
|
||||
atis->textureOffset = screen->off_screen_base;
|
||||
screen->off_screen_base += atis->textureSize;
|
||||
} else {
|
||||
/* Minimum texture size is for 2 256x256x32bpp textures */
|
||||
atis->textureSize = 0;
|
||||
}
|
||||
#endif /* USE_DRI && GLXEXT */
|
||||
}
|
||||
|
||||
static void
|
||||
ATISetPitch (KdScreenInfo *screen)
|
||||
{
|
||||
ATICardInfo(screen);
|
||||
#if defined(USE_DRI) && defined(GLXEXT)
|
||||
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
|
||||
int l;
|
||||
#endif
|
||||
char *mmio = atic->reg_base;
|
||||
|
||||
/* check (and adjust) pitch for radeon */
|
||||
if (mmio)
|
||||
{
|
||||
int byteStride = screen->fb[0].byteStride;
|
||||
int bitStride;
|
||||
int pixelStride;
|
||||
int bpp = screen->fb[0].bitsPerPixel;
|
||||
CARD32 crtc_pitch;
|
||||
CARD32 crtc2_pitch;
|
||||
#if 0
|
||||
CARD32 crtc_ext_cntl;
|
||||
CARD32 dac_cntl;
|
||||
#endif
|
||||
bitStride = byteStride * 8;
|
||||
pixelStride = bitStride / bpp;
|
||||
|
||||
crtc_pitch = (pixelStride >> 3);
|
||||
crtc_pitch |= crtc_pitch << 16;
|
||||
crtc2_pitch = (pixelStride >> 3);
|
||||
crtc2_pitch |= crtc2_pitch << 16;
|
||||
#if 0
|
||||
crtc_ext_cntl = MMIO_IN32 (mmio, ATI_REG_CRTC_EXT_CNTL);
|
||||
dac_cntl = MMIO_IN32 (mmio, ATI_REG_DAC_CNTL);
|
||||
/* Turn off the screen */
|
||||
MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
|
||||
crtc_ext_cntl |
|
||||
ATI_CRTC_VSYNC_DIS |
|
||||
ATI_CRTC_HSYNC_DIS |
|
||||
ATI_CRTC_DISPLAY_DIS);
|
||||
MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
|
||||
dac_cntl |
|
||||
ATI_DAC_RANGE_CNTL |
|
||||
ATI_DAC_BLANKING);
|
||||
#endif
|
||||
MMIO_OUT32 (mmio, ATI_REG_CRTC_PITCH, crtc_pitch);
|
||||
MMIO_OUT32 (mmio, ATI_REG_CRTC2_PITCH, crtc2_pitch);
|
||||
#if 0
|
||||
/* Turn the screen back on */
|
||||
MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
|
||||
crtc_ext_cntl);
|
||||
MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
|
||||
dac_cntl);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIScreenInit(KdScreenInfo *screen)
|
||||
{
|
||||
ATIScreenInfo *atis;
|
||||
ATICardInfo(screen);
|
||||
Bool success = FALSE;
|
||||
|
||||
atis = xcalloc(sizeof(ATIScreenInfo), 1);
|
||||
if (atis == NULL)
|
||||
return FALSE;
|
||||
|
||||
atis->atic = atic;
|
||||
atis->screen = screen;
|
||||
screen->driver = atis;
|
||||
|
||||
if (screen->fb[0].depth == 0)
|
||||
screen->fb[0].depth = 16;
|
||||
#ifdef KDRIVEFBDEV
|
||||
if (atic->use_fbdev) {
|
||||
success = fbdevScreenInitialize(screen,
|
||||
&atis->backend_priv.fbdev);
|
||||
}
|
||||
#endif
|
||||
#ifdef KDRIVEVESA
|
||||
if (atic->use_vesa) {
|
||||
success = vesaScreenInitialize(screen,
|
||||
&atis->backend_priv.vesa);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!success) {
|
||||
screen->driver = NULL;
|
||||
xfree(atis);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ATISetOffscreen (screen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef RANDR
|
||||
static Bool
|
||||
ATIRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation randr,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
ATICardInfo *atic = screen->card->driver;
|
||||
Bool ret;
|
||||
|
||||
ATIDrawDisable (pScreen);
|
||||
ret = atic->backend_funcs.randrSetConfig(pScreen, randr, rate, pSize);
|
||||
ATISetOffscreen (screen);
|
||||
ATISetPitch (screen);
|
||||
/*
|
||||
* Set frame buffer mapping
|
||||
*/
|
||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||
pScreen->width,
|
||||
pScreen->height,
|
||||
screen->fb[0].depth,
|
||||
screen->fb[0].bitsPerPixel,
|
||||
screen->fb[0].byteStride,
|
||||
screen->fb[0].frameBuffer);
|
||||
|
||||
ATIDrawEnable (pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIRandRInit (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
pScrPriv->rrSetConfig = ATIRandRSetConfig;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
ATIScreenFini(KdScreenInfo *screen)
|
||||
{
|
||||
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
|
||||
ATICardInfo *atic = screen->card->driver;
|
||||
|
||||
#ifdef XV
|
||||
ATIFiniVideo(screen->pScreen);
|
||||
#endif
|
||||
|
||||
atic->backend_funcs.scrfini(screen);
|
||||
xfree(atis);
|
||||
screen->driver = 0;
|
||||
}
|
||||
|
||||
Bool
|
||||
ATIMapReg(KdCardInfo *card, ATICardInfo *atic)
|
||||
{
|
||||
atic->reg_base = (CARD8 *)KdMapDevice(ATI_REG_BASE(card),
|
||||
ATI_REG_SIZE(card));
|
||||
|
||||
if (atic->reg_base == NULL)
|
||||
return FALSE;
|
||||
|
||||
KdSetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
|
||||
KD_MAPPED_MODE_REGISTERS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic)
|
||||
{
|
||||
if (atic->reg_base) {
|
||||
KdResetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
|
||||
KD_MAPPED_MODE_REGISTERS);
|
||||
KdUnmapDevice((void *)atic->reg_base, ATI_REG_SIZE(card));
|
||||
atic->reg_base = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIInitScreen(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
#ifdef XV
|
||||
ATIInitVideo(pScreen);
|
||||
#endif
|
||||
return atic->backend_funcs.initScreen(pScreen);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIFinishInitScreen(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
if (!atic->backend_funcs.finishInitScreen(pScreen))
|
||||
return FALSE;
|
||||
#ifdef RANDR
|
||||
if (!ATIRandRInit (pScreen))
|
||||
return FALSE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATICreateResources(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
return atic->backend_funcs.createRes(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIPreserve(KdCardInfo *card)
|
||||
{
|
||||
ATICardInfo *atic = card->driver;
|
||||
char *mmio = atic->reg_base;
|
||||
|
||||
atic->backend_funcs.preserve(card);
|
||||
if (atic->is_radeon && mmio)
|
||||
{
|
||||
atic->crtc_pitch = MMIO_IN32(mmio, ATI_REG_CRTC_PITCH);
|
||||
atic->crtc2_pitch = MMIO_IN32(mmio, ATI_REG_CRTC2_PITCH);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ATIRestore(KdCardInfo *card)
|
||||
{
|
||||
ATICardInfo *atic = card->driver;
|
||||
char *mmio = atic->reg_base;
|
||||
|
||||
if (mmio)
|
||||
{
|
||||
MMIO_OUT32(mmio, ATI_REG_CRTC_PITCH, atic->crtc_pitch);
|
||||
MMIO_OUT32(mmio, ATI_REG_CRTC2_PITCH, atic->crtc2_pitch);
|
||||
}
|
||||
ATIUnmapReg(card, atic);
|
||||
|
||||
atic->backend_funcs.restore(card);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIDPMS(ScreenPtr pScreen, int mode)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
return atic->backend_funcs.dpms(pScreen, mode);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIEnable(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
if (!atic->backend_funcs.enable(pScreen))
|
||||
return FALSE;
|
||||
|
||||
if ((atic->reg_base == NULL) && !ATIMapReg(pScreenPriv->screen->card,
|
||||
atic))
|
||||
return FALSE;
|
||||
|
||||
ATISetOffscreen (pScreenPriv->screen);
|
||||
|
||||
ATISetPitch (pScreenPriv->screen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATIDisable(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
#if defined(USE_DRI) && defined(GLXEXT)
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
#endif /* USE_DRI && GLXEXT */
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
ATIUnmapReg(pScreenPriv->card, atic);
|
||||
|
||||
atic->backend_funcs.disable(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
atic->backend_funcs.getColors(pScreen, fb, n, pdefs);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
atic->backend_funcs.putColors(pScreen, fb, n, pdefs);
|
||||
}
|
||||
|
||||
/* Compute log base 2 of val. */
|
||||
int
|
||||
ATILog2(int val)
|
||||
{
|
||||
int bits;
|
||||
|
||||
for (bits = 0; val != 0; val >>= 1, ++bits)
|
||||
;
|
||||
return bits - 1;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIIsAGP(ATICardInfo *atic)
|
||||
{
|
||||
char *mmio = atic->reg_base;
|
||||
CARD32 agp_command;
|
||||
Bool is_agp = FALSE;
|
||||
|
||||
if (mmio == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (atic->is_radeon) {
|
||||
/* XXX: Apparently this doesn't work. Maybe it needs to be done
|
||||
* through the PCI config aperture then.
|
||||
*/
|
||||
agp_command = MMIO_IN32(mmio, RADEON_REG_AGP_COMMAND);
|
||||
MMIO_OUT32(mmio, RADEON_REG_AGP_COMMAND, agp_command |
|
||||
RADEON_AGP_ENABLE);
|
||||
if (MMIO_IN32(mmio, RADEON_REG_AGP_COMMAND) & RADEON_AGP_ENABLE)
|
||||
is_agp = TRUE;
|
||||
MMIO_OUT32(mmio, RADEON_REG_AGP_COMMAND, agp_command);
|
||||
} else {
|
||||
/* Don't know any way to detect R128 AGP automatically, so
|
||||
* assume AGP for all cards not marked as PCI-only by XFree86.
|
||||
*/
|
||||
if ((atic->pci_id->caps & CAP_FEATURESMASK) != CAP_NOAGP)
|
||||
is_agp = TRUE;
|
||||
}
|
||||
|
||||
return is_agp;
|
||||
}
|
||||
|
||||
/* This function is required to work around a hardware bug in some (all?)
|
||||
* revisions of the R300. This workaround should be called after every
|
||||
* CLOCK_CNTL_INDEX register access. If not, register reads afterward
|
||||
* may not be correct.
|
||||
*/
|
||||
void R300CGWorkaround(ATIScreenInfo *atis) {
|
||||
ATICardInfo *atic = atis->atic;
|
||||
char *mmio = atic->reg_base;
|
||||
CARD32 save;
|
||||
|
||||
save = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
|
||||
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save & ~(0x3f |
|
||||
ATI_PLL_WR_EN));
|
||||
MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
|
||||
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save);
|
||||
}
|
||||
|
||||
KdCardFuncs ATIFuncs = {
|
||||
ATICardInit, /* cardinit */
|
||||
ATIScreenInit, /* scrinit */
|
||||
ATIInitScreen, /* initScreen */
|
||||
ATIFinishInitScreen, /* finishInitScreen */
|
||||
ATICreateResources, /* createRes */
|
||||
ATIPreserve, /* preserve */
|
||||
ATIEnable, /* enable */
|
||||
ATIDPMS, /* dpms */
|
||||
ATIDisable, /* disable */
|
||||
ATIRestore, /* restore */
|
||||
ATIScreenFini, /* scrfini */
|
||||
ATICardFini, /* cardfini */
|
||||
|
||||
ATICursorInit, /* initCursor */
|
||||
ATICursorEnable, /* enableCursor */
|
||||
ATICursorDisable, /* disableCursor */
|
||||
ATICursorFini, /* finiCursor */
|
||||
ATIRecolorCursor, /* recolorCursor */
|
||||
|
||||
ATIDrawInit, /* initAccel */
|
||||
ATIDrawEnable, /* enableAccel */
|
||||
ATIDrawSync, /* syncAccel */
|
||||
ATIDrawDisable, /* disableAccel */
|
||||
ATIDrawFini, /* finiAccel */
|
||||
|
||||
ATIGetColors, /* getColors */
|
||||
ATIPutColors, /* putColors */
|
||||
};
|
||||
|
|
@ -1,401 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef _ATI_H_
|
||||
#define _ATI_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef KDRIVEFBDEV
|
||||
#include <fbdev.h>
|
||||
#endif
|
||||
#ifdef KDRIVEVESA
|
||||
#include <vesa.h>
|
||||
#endif
|
||||
|
||||
#include "kxv.h"
|
||||
|
||||
#ifdef XF86DRI
|
||||
#define USE_DRI
|
||||
#include "libdrm.h"
|
||||
#include "dri.h"
|
||||
#ifdef GLXEXT
|
||||
#include "GL/glxint.h"
|
||||
#include "GL/glxtokens.h"
|
||||
#include "ati_dripriv.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ATI_REG_BASE(c) ((c)->attr.address[1])
|
||||
#define ATI_REG_SIZE(c) (0x4000)
|
||||
|
||||
#ifdef __powerpc__
|
||||
|
||||
static __inline__ void
|
||||
MMIO_OUT32(__volatile__ void *base, const unsigned long offset,
|
||||
const unsigned int val)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"stwbrx %1,%2,%3\n\t"
|
||||
"eieio"
|
||||
: "=m" (*((volatile unsigned char *)base+offset))
|
||||
: "r" (val), "b" (base), "r" (offset));
|
||||
}
|
||||
|
||||
static __inline__ CARD32
|
||||
MMIO_IN32(__volatile__ void *base, const unsigned long offset)
|
||||
{
|
||||
register unsigned int val;
|
||||
__asm__ __volatile__(
|
||||
"lwbrx %0,%1,%2\n\t"
|
||||
"eieio"
|
||||
: "=r" (val)
|
||||
: "b" (base), "r" (offset),
|
||||
"m" (*((volatile unsigned char *)base+offset)));
|
||||
return val;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v))
|
||||
#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a)))
|
||||
|
||||
#endif
|
||||
|
||||
#define MMIO_OUT8(mmio, a, v) (*(VOL8 *)((mmio) + (a)) = (v))
|
||||
#define MMIO_IN8(mmio, a, v) (*(VOL8 *)((mmio) + (a)))
|
||||
|
||||
#define INPLL(mmio, addr) \
|
||||
(MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, addr), \
|
||||
MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_DATA))
|
||||
|
||||
#define OUTPLL(mmio, addr, val) do { \
|
||||
MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, (addr) | ATI_PLL_WR_EN); \
|
||||
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_DATA, val); \
|
||||
} while (0)
|
||||
|
||||
typedef volatile CARD8 VOL8;
|
||||
typedef volatile CARD16 VOL16;
|
||||
typedef volatile CARD32 VOL32;
|
||||
|
||||
struct pci_id_entry {
|
||||
CARD16 vendor;
|
||||
CARD16 device;
|
||||
CARD8 caps;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct backend_funcs {
|
||||
void (*cardfini)(KdCardInfo *);
|
||||
void (*scrfini)(KdScreenInfo *);
|
||||
Bool (*initScreen)(ScreenPtr);
|
||||
Bool (*finishInitScreen)(ScreenPtr pScreen);
|
||||
Bool (*createRes)(ScreenPtr);
|
||||
void (*preserve)(KdCardInfo *);
|
||||
void (*restore)(KdCardInfo *);
|
||||
Bool (*dpms)(ScreenPtr, int);
|
||||
Bool (*enable)(ScreenPtr);
|
||||
void (*disable)(ScreenPtr);
|
||||
void (*getColors)(ScreenPtr, int, int, xColorItem *);
|
||||
void (*putColors)(ScreenPtr, int, int, xColorItem *);
|
||||
#ifdef RANDR
|
||||
Bool (*randrSetConfig) (ScreenPtr, Rotation, int, RRScreenSizePtr);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _ATICardInfo {
|
||||
union {
|
||||
#ifdef KDRIVEFBDEV
|
||||
FbdevPriv fbdev;
|
||||
#endif
|
||||
#ifdef KDRIVEVESA
|
||||
VesaCardPrivRec vesa;
|
||||
#endif
|
||||
} backend_priv;
|
||||
struct backend_funcs backend_funcs;
|
||||
|
||||
struct pci_id_entry *pci_id;
|
||||
CARD8 *reg_base;
|
||||
Bool is_radeon;
|
||||
Bool is_r100;
|
||||
Bool is_r200;
|
||||
Bool is_r300;
|
||||
Bool is_agp;
|
||||
char *busid;
|
||||
CARD32 crtc_pitch;
|
||||
CARD32 crtc2_pitch;
|
||||
#ifdef USE_DRI
|
||||
int drmFd;
|
||||
#endif /* USE_DRI */
|
||||
Bool use_fbdev, use_vesa;
|
||||
} ATICardInfo;
|
||||
|
||||
#define getATICardInfo(kd) ((ATICardInfo *) ((kd)->card->driver))
|
||||
#define ATICardInfo(kd) ATICardInfo *atic = getATICardInfo(kd)
|
||||
|
||||
typedef struct _ATICursor {
|
||||
int width, height;
|
||||
int xhot, yhot;
|
||||
|
||||
Bool has_cursor;
|
||||
CursorPtr pCursor;
|
||||
Pixel source, mask;
|
||||
KdOffscreenArea *area;
|
||||
} ATICursor;
|
||||
|
||||
typedef struct _ATIPortPriv {
|
||||
int brightness;
|
||||
int saturation;
|
||||
RegionRec clip;
|
||||
Bool videoOn;
|
||||
Time offTime;
|
||||
Time freeTime;
|
||||
CARD32 size;
|
||||
KdOffscreenArea *off_screen;
|
||||
DrawablePtr pDraw;
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
CARD32 src_offset;
|
||||
CARD32 src_pitch;
|
||||
CARD8 *src_addr;
|
||||
|
||||
int id;
|
||||
int src_x1, src_y1, src_x2, src_y2;
|
||||
int dst_x1, dst_y1, dst_x2, dst_y2;
|
||||
int src_w, src_h, dst_w, dst_h;
|
||||
} ATIPortPrivRec, *ATIPortPrivPtr;
|
||||
|
||||
typedef struct _dmaBuf {
|
||||
int size;
|
||||
int used;
|
||||
void *address;
|
||||
#ifdef USE_DRI
|
||||
drmBufPtr drmBuf;
|
||||
#endif
|
||||
} dmaBuf;
|
||||
|
||||
typedef struct _ATIScreenInfo {
|
||||
union {
|
||||
#ifdef KDRIVEFBDEV
|
||||
FbdevScrPriv fbdev;
|
||||
#endif
|
||||
#ifdef KDRIVEVESA
|
||||
VesaScreenPrivRec vesa;
|
||||
#endif
|
||||
} backend_priv;
|
||||
KaaScreenInfoRec kaa;
|
||||
|
||||
ATICardInfo *atic;
|
||||
KdScreenInfo *screen;
|
||||
|
||||
int scratch_offset;
|
||||
int scratch_next;
|
||||
int scratch_size;
|
||||
KdOffscreenArea *scratch_area;
|
||||
|
||||
ATICursor cursor;
|
||||
|
||||
KdVideoAdaptorPtr pAdaptor;
|
||||
int num_texture_ports;
|
||||
|
||||
Bool using_pio; /* If we use decode DMA packets to MMIO. */
|
||||
Bool using_pseudo; /* If we use MMIO to submit DMA packets. */
|
||||
Bool using_dma; /* If we use non-DRI DMA to submit packets. */
|
||||
Bool using_dri; /* If we use the DRM for DMA. */
|
||||
Bool using_agp; /* If we are using AGP or not for DMA. */
|
||||
|
||||
KdOffscreenArea *dma_space; /* For "DMA" from framebuffer. */
|
||||
void *agp_addr; /* Mapped AGP aperture */
|
||||
int agp_size;
|
||||
int agp_key; /* Key of AGP memory for DMA */
|
||||
CARD32 *ring_addr; /* Beginning of ring buffer. */
|
||||
int ring_write; /* Index of write ptr in ring. */
|
||||
int ring_read; /* Index of read ptr in ring. */
|
||||
int ring_len;
|
||||
|
||||
|
||||
dmaBuf *indirectBuffer;
|
||||
int indirectStart;
|
||||
|
||||
int mmio_avail;
|
||||
int cce_pri_size;
|
||||
int cce_pri_avail;
|
||||
|
||||
#ifdef USE_DRI
|
||||
Bool dma_started;
|
||||
|
||||
drmSize registerSize;
|
||||
drmHandle registerHandle;
|
||||
drmHandle fbHandle;
|
||||
|
||||
drmSize gartSize;
|
||||
drmHandle agpMemHandle; /* Handle from drmAgpAlloc */
|
||||
unsigned long gartOffset;
|
||||
unsigned char *AGP; /* Map */
|
||||
int agpMode;
|
||||
drmSize pciSize;
|
||||
drmHandle pciMemHandle;
|
||||
|
||||
/* ring buffer data */
|
||||
unsigned long ringStart; /* Offset into AGP space */
|
||||
drmHandle ringHandle; /* Handle from drmAddMap */
|
||||
drmSize ringMapSize; /* Size of map */
|
||||
int ringSize; /* Size of ring (MB) */
|
||||
unsigned char *ring; /* Map */
|
||||
|
||||
unsigned long ringReadOffset; /* Offset into AGP space */
|
||||
drmHandle ringReadPtrHandle; /* Handle from drmAddMap */
|
||||
drmSize ringReadMapSize; /* Size of map */
|
||||
unsigned char *ringReadPtr; /* Map */
|
||||
|
||||
/* vertex/indirect buffer data */
|
||||
unsigned long bufStart; /* Offset into AGP space */
|
||||
drmHandle bufHandle; /* Handle from drmAddMap */
|
||||
drmSize bufMapSize; /* Size of map */
|
||||
int bufSize; /* Size of buffers (MB) */
|
||||
unsigned char *buf; /* Map */
|
||||
int bufNumBufs; /* Number of buffers */
|
||||
drmBufMapPtr buffers; /* Buffer map */
|
||||
|
||||
/* AGP Texture data */
|
||||
unsigned long gartTexStart; /* Offset into AGP space */
|
||||
drmHandle gartTexHandle; /* Handle from drmAddMap */
|
||||
drmSize gartTexMapSize; /* Size of map */
|
||||
int gartTexSize; /* Size of AGP tex space (MB) */
|
||||
unsigned char *gartTex; /* Map */
|
||||
int log2GARTTexGran;
|
||||
|
||||
int DMAusecTimeout; /* CCE timeout in usecs */
|
||||
|
||||
/* DRI screen private data */
|
||||
int frontOffset;
|
||||
int frontPitch;
|
||||
int backOffset;
|
||||
int backPitch;
|
||||
int depthOffset;
|
||||
int depthPitch;
|
||||
int spanOffset;
|
||||
int textureOffset;
|
||||
int textureSize;
|
||||
int log2TexGran;
|
||||
|
||||
int irqEnabled;
|
||||
|
||||
int serverContext;
|
||||
|
||||
DRIInfoPtr pDRIInfo;
|
||||
#ifdef GLXEXT
|
||||
int numVisualConfigs;
|
||||
__GLXvisualConfig *pVisualConfigs;
|
||||
ATIConfigPrivPtr pVisualConfigsPriv;
|
||||
#endif /* GLXEXT */
|
||||
#endif /* USE_DRI */
|
||||
} ATIScreenInfo;
|
||||
|
||||
#define getATIScreenInfo(kd) ((ATIScreenInfo *) ((kd)->screen->driver))
|
||||
#define ATIScreenInfo(kd) ATIScreenInfo *atis = getATIScreenInfo(kd)
|
||||
|
||||
/* ati.c */
|
||||
Bool
|
||||
ATIMapReg(KdCardInfo *card, ATICardInfo *atic);
|
||||
|
||||
void
|
||||
ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic);
|
||||
|
||||
void
|
||||
R300CGWorkaround(ATIScreenInfo *atis);
|
||||
|
||||
/* ati_draw.c */
|
||||
void
|
||||
ATIDrawSetup(ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
ATIDrawInit(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDrawEnable(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDrawSync(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDrawDisable(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDrawFini(ScreenPtr pScreen);
|
||||
|
||||
/* ati_dri.c */
|
||||
#ifdef USE_DRI
|
||||
Bool
|
||||
ATIDRIScreenInit(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDRICloseScreen(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDRIDMAStart(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDRIDMAStop(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard);
|
||||
|
||||
drmBufPtr
|
||||
ATIDRIGetBuffer(ATIScreenInfo *atis);
|
||||
|
||||
#endif /* USE_DRI */
|
||||
|
||||
/* ati_cursor.c */
|
||||
Bool
|
||||
ATICursorInit(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATICursorEnable(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATICursorDisable(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATICursorFini(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef);
|
||||
|
||||
int
|
||||
ATILog2(int val);
|
||||
|
||||
/* ati_video.c */
|
||||
Bool
|
||||
ATIInitVideo(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIFiniVideo(ScreenPtr pScreen);
|
||||
|
||||
extern KdCardFuncs ATIFuncs;
|
||||
|
||||
#endif /* _ATI_H_ */
|
||||
|
|
@ -1,560 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2004 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "ati_reg.h"
|
||||
#include "cursorstr.h"
|
||||
#include "ati_draw.h"
|
||||
|
||||
static void
|
||||
ATIMoveCursor(ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CARD16 xoff, yoff;
|
||||
CARD8 *mmio = atic->reg_base;
|
||||
int stride = atic->is_radeon ? 256 : 16;
|
||||
|
||||
if (!pCurPriv->has_cursor)
|
||||
return;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
x -= pCurPriv->xhot;
|
||||
xoff = 0;
|
||||
if (x < 0) {
|
||||
xoff = -x;
|
||||
x = 0;
|
||||
}
|
||||
y -= pCurPriv->yhot;
|
||||
yoff = 0;
|
||||
if (y < 0) {
|
||||
yoff = -y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_OFF, ATI_CUR_LOCK |
|
||||
(xoff << 16) | yoff);
|
||||
MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_POSN, ATI_CUR_LOCK |
|
||||
(x << 16) | y);
|
||||
MMIO_OUT32(mmio, ATI_REG_CUR_OFFSET, (pCurPriv->area->offset + yoff *
|
||||
stride));
|
||||
}
|
||||
|
||||
static void
|
||||
ClassicAllocCursorColors(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
|
||||
KdAllocateCursorPixels(pScreen, 0, pCursor, &pCurPriv->source,
|
||||
&pCurPriv->mask);
|
||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
||||
case 4:
|
||||
pCurPriv->source |= pCurPriv->source << 4;
|
||||
pCurPriv->mask |= pCurPriv->mask << 4;
|
||||
/* FALLTHROUGH */
|
||||
case 8:
|
||||
pCurPriv->source |= pCurPriv->source << 8;
|
||||
pCurPriv->mask |= pCurPriv->mask << 8;
|
||||
/* FALLTHROUGH */
|
||||
case 16:
|
||||
pCurPriv->source |= pCurPriv->source << 16;
|
||||
pCurPriv->mask |= pCurPriv->mask << 16;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ClassicSetCursorColors(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CARD8 *mmio = atic->reg_base;
|
||||
|
||||
MMIO_OUT32(mmio, ATI_REG_CUR_CLR0, pCurPriv->mask);
|
||||
MMIO_OUT32(mmio, ATI_REG_CUR_CLR1, pCurPriv->source);
|
||||
}
|
||||
|
||||
static void
|
||||
ClassicRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
|
||||
if (!pCurPriv->has_cursor || !pCursor)
|
||||
return;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pdef) {
|
||||
while (ndef != 0) {
|
||||
if (pdef->pixel == pCurPriv->source ||
|
||||
pdef->pixel == pCurPriv->mask)
|
||||
break;
|
||||
ndef--;
|
||||
}
|
||||
|
||||
if (ndef == 0)
|
||||
return;
|
||||
}
|
||||
ClassicAllocCursorColors(pScreen);
|
||||
ClassicSetCursorColors(pScreen);
|
||||
}
|
||||
|
||||
#define InvertBits32(v) do { \
|
||||
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
|
||||
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
|
||||
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
ClassicLoadCursor(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
CursorBitsPtr bits = pCursor->bits;
|
||||
int h;
|
||||
CARD32 *ram, *msk, *mskLine, *src, *srcLine;
|
||||
int i;
|
||||
int lwsrc;
|
||||
CARD32 tmp;
|
||||
CARD8 *mmio = atic->reg_base;
|
||||
|
||||
ClassicAllocCursorColors(pScreen);
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
pCurPriv->xhot = pCursor->bits->xhot;
|
||||
pCurPriv->yhot = pCursor->bits->yhot;
|
||||
|
||||
/* Stick new image into cursor memory */
|
||||
ram = (CARD32 *)(pScreenPriv->screen->memory_base +
|
||||
pCurPriv->area->offset);
|
||||
mskLine = (CARD32 *)bits->mask;
|
||||
srcLine = (CARD32 *)bits->source;
|
||||
|
||||
h = bits->height;
|
||||
if (h > ATI_CURSOR_HEIGHT)
|
||||
h = ATI_CURSOR_HEIGHT;
|
||||
|
||||
lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
|
||||
|
||||
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
|
||||
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp & ~ATI_CRTC_CUR_EN);
|
||||
|
||||
for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
|
||||
CARD32 m1, m2, s1, s2;
|
||||
|
||||
msk = mskLine;
|
||||
src = srcLine;
|
||||
mskLine += lwsrc;
|
||||
srcLine += lwsrc;
|
||||
|
||||
if (i < h && 0 < lwsrc) {
|
||||
m1 = ~*msk++;
|
||||
s1 = *src++;
|
||||
InvertBits32(m1);
|
||||
InvertBits32(s1);
|
||||
} else {
|
||||
m1 = 0xffffffff;
|
||||
s1 = 0x0;
|
||||
}
|
||||
if (i < h && 1 < lwsrc) {
|
||||
m2 = ~*msk++;
|
||||
s2 = *src++;
|
||||
InvertBits32(m2);
|
||||
InvertBits32(s2);
|
||||
} else {
|
||||
m2 = 0xffffffff;
|
||||
s2 = 0x0;
|
||||
}
|
||||
|
||||
*ram++ = m1;
|
||||
*ram++ = m2;
|
||||
*ram++ = s1;
|
||||
*ram++ = s2;
|
||||
}
|
||||
|
||||
/* Not sure why this is necessary, but it prevents some cursor
|
||||
* corruption. Not even all of it.
|
||||
*/
|
||||
for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
|
||||
*ram++ = 0xffffffff;
|
||||
*ram++ = 0xffffffff;
|
||||
*ram++ = 0x0;
|
||||
*ram++ = 0x0;
|
||||
}
|
||||
|
||||
/* Enable the cursor */
|
||||
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
|
||||
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp | ATI_CRTC_CUR_EN);
|
||||
|
||||
/* Set new color */
|
||||
ClassicSetCursorColors(pScreen);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
RadeonLoadCursor(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
CursorBitsPtr bits = pCursor->bits;
|
||||
int h, w;
|
||||
int x, y;
|
||||
CARD32 *ram, *msk, *mskLine, *src, *srcLine;
|
||||
int lwsrc;
|
||||
CARD32 tmp;
|
||||
CARD8 *mmio = atic->reg_base;
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
pCurPriv->xhot = pCursor->bits->xhot;
|
||||
pCurPriv->yhot = pCursor->bits->yhot;
|
||||
|
||||
w = bits->width;
|
||||
if (w > ATI_CURSOR_WIDTH)
|
||||
w = ATI_CURSOR_WIDTH;
|
||||
|
||||
h = bits->height;
|
||||
if (h > ATI_CURSOR_HEIGHT)
|
||||
h = ATI_CURSOR_HEIGHT;
|
||||
|
||||
tmp = MMIO_IN32(mmio, 0x7c);
|
||||
tmp = 0x00010f80;
|
||||
MMIO_OUT32 (mmio, 0x7c, tmp);
|
||||
|
||||
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
|
||||
tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
|
||||
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
|
||||
|
||||
/* Stick new image into cursor memory */
|
||||
ram = (CARD32 *)(pScreenPriv->screen->memory_base +
|
||||
pCurPriv->area->offset);
|
||||
if (pCursor->bits->argb)
|
||||
{
|
||||
srcLine = pCursor->bits->argb;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
src = srcLine;
|
||||
srcLine += pCursor->bits->width;
|
||||
for (x = 0; x < w; x++)
|
||||
*ram++ = *src++;
|
||||
for (; x < ATI_CURSOR_WIDTH; x++)
|
||||
*ram++ = 0;
|
||||
}
|
||||
for (; y < ATI_CURSOR_HEIGHT; y++)
|
||||
for (x = 0; x < ATI_CURSOR_WIDTH; x++)
|
||||
*ram++ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CARD32 colors[4];
|
||||
|
||||
colors[0] = 0;
|
||||
colors[1] = 0;
|
||||
colors[2] = (((pCursor->backRed >> 8) << 16) |
|
||||
((pCursor->backGreen >> 8) << 8) |
|
||||
((pCursor->backBlue >> 8) << 0) |
|
||||
0xff000000);
|
||||
colors[3] = (((pCursor->foreRed >> 8) << 16) |
|
||||
((pCursor->foreGreen >> 8) << 8) |
|
||||
((pCursor->foreBlue >> 8) << 0) |
|
||||
0xff000000);
|
||||
|
||||
mskLine = (CARD32 *)bits->mask;
|
||||
srcLine = (CARD32 *)bits->source;
|
||||
|
||||
/* words per line */
|
||||
lwsrc = BitmapBytePad(bits->width) / 4;
|
||||
|
||||
for (y = 0; y < ATI_CURSOR_HEIGHT; y++)
|
||||
{
|
||||
CARD32 m, s;
|
||||
|
||||
msk = mskLine;
|
||||
src = srcLine;
|
||||
mskLine += lwsrc;
|
||||
srcLine += lwsrc;
|
||||
|
||||
for (x = 0; x < ATI_CURSOR_WIDTH / 32; x++)
|
||||
{
|
||||
int k;
|
||||
if (y < h && x < lwsrc)
|
||||
{
|
||||
m = *msk++;
|
||||
s = *src++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m = 0x0;
|
||||
s = 0x0;
|
||||
}
|
||||
|
||||
for (k = 0; k < 32; k++)
|
||||
{
|
||||
CARD32 bits = (s & 1) | ((m & 1) << 1);
|
||||
*ram++ = colors[bits];
|
||||
s >>= 1;
|
||||
m >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable the cursor */
|
||||
tmp &= ~(ATI_CRTC_ICON_EN);
|
||||
tmp |= ATI_CRTC_ARGB_EN;
|
||||
tmp |= ATI_CRTC_CUR_EN;
|
||||
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIUnloadCursor(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD8 *mmio = atic->reg_base;
|
||||
CARD32 tmp;
|
||||
|
||||
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
|
||||
tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
|
||||
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return TRUE;
|
||||
|
||||
/* miRecolorCursor does this */
|
||||
if (pCursor && pCurPriv->pCursor == pCursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
miPointerPosition(&x, &y);
|
||||
if (atic->is_radeon)
|
||||
RadeonLoadCursor (pScreen);
|
||||
else
|
||||
ClassicLoadCursor(pScreen);
|
||||
/* Move to new position */
|
||||
ATIMoveCursor(pScreen, x, y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pCursor)
|
||||
{
|
||||
if (atic->is_radeon)
|
||||
RadeonLoadCursor (pScreen);
|
||||
else
|
||||
ClassicLoadCursor(pScreen);
|
||||
/* Move to new position */
|
||||
ATIMoveCursor(pScreen, x, y);
|
||||
}
|
||||
else
|
||||
ATIUnloadCursor(pScreen);
|
||||
}
|
||||
|
||||
miPointerSpriteFuncRec ATIPointerSpriteFuncs = {
|
||||
ATIRealizeCursor,
|
||||
ATIUnrealizeCursor,
|
||||
ATISetCursor,
|
||||
ATIMoveCursor,
|
||||
};
|
||||
|
||||
static void
|
||||
ATIQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight,
|
||||
ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
switch (class)
|
||||
{
|
||||
case CursorShape:
|
||||
if (*pwidth > pCurPriv->width)
|
||||
*pwidth = pCurPriv->width;
|
||||
if (*pheight > pCurPriv->height)
|
||||
*pheight = pCurPriv->height;
|
||||
if (*pwidth > pScreen->width)
|
||||
*pwidth = pScreen->width;
|
||||
if (*pheight > pScreen->height)
|
||||
*pheight = pScreen->height;
|
||||
break;
|
||||
default:
|
||||
fbQueryBestSize(class, pwidth, pheight, pScreen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ATICursorSave(ScreenPtr pScreen, KdOffscreenArea *area)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
pCurPriv->area = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ATICursorEnable(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
if (!pCurPriv->has_cursor)
|
||||
return;
|
||||
|
||||
if (pCurPriv->area == NULL) {
|
||||
if (atic->is_radeon)
|
||||
pCurPriv->area = KdOffscreenAlloc(pScreen,
|
||||
ATI_CURSOR_HEIGHT * ATI_CURSOR_WIDTH * 4,
|
||||
128, TRUE, ATICursorSave, atis);
|
||||
else
|
||||
pCurPriv->area = KdOffscreenAlloc(pScreen,
|
||||
ATI_CURSOR_HEIGHT * ATI_CURSOR_PITCH * 2,
|
||||
32, TRUE, ATICursorSave, atis);
|
||||
}
|
||||
if (pCurPriv->area == NULL)
|
||||
FatalError("Couldn't allocate offscreen memory for cursor.\n");
|
||||
|
||||
if (pCurPriv->pCursor) {
|
||||
int x, y;
|
||||
|
||||
miPointerPosition(&x, &y);
|
||||
if (atic->is_radeon)
|
||||
RadeonLoadCursor(pScreen);
|
||||
else
|
||||
ClassicLoadCursor(pScreen);
|
||||
/* Move to new position */
|
||||
ATIMoveCursor(pScreen, x, y);
|
||||
}
|
||||
else
|
||||
ATIUnloadCursor(pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
ATICursorDisable(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
if (!pScreenPriv->enabled || !pCurPriv->has_cursor)
|
||||
return;
|
||||
|
||||
if (pCurPriv->pCursor)
|
||||
ATIUnloadCursor(pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
ATICursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
pCurPriv->has_cursor = FALSE;
|
||||
|
||||
if (atic->reg_base == NULL)
|
||||
return FALSE;
|
||||
|
||||
pCurPriv->width = ATI_CURSOR_WIDTH;
|
||||
pCurPriv->height= ATI_CURSOR_HEIGHT;
|
||||
pScreen->QueryBestSize = ATIQueryBestSize;
|
||||
miPointerInitialize(pScreen, &ATIPointerSpriteFuncs,
|
||||
&kdPointerScreenFuncs, FALSE);
|
||||
pCurPriv->has_cursor = TRUE;
|
||||
pCurPriv->pCursor = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ATIRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
if (!atic->is_radeon)
|
||||
ClassicRecolorCursor (pScreen, ndef, pdef);
|
||||
}
|
||||
|
||||
void
|
||||
ATICursorFini(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICursor *pCurPriv = &atis->cursor;
|
||||
|
||||
pCurPriv->has_cursor = FALSE;
|
||||
pCurPriv->pCursor = NULL;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2004 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef _ATI_DMA_H_
|
||||
#define _ATI_DMA_H_
|
||||
|
||||
#define DMA_PACKET0(reg, count) \
|
||||
(ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2))
|
||||
#define DMA_PACKET1(reg1, reg2) \
|
||||
(ATI_CCE_PACKET1 | \
|
||||
(((reg2) >> 2) << ATI_CCE_PACKET1_REG_2_SHIFT) | ((reg1) >> 2))
|
||||
#define DMA_PACKET3(type, count) \
|
||||
((type) | (((count) - 1) << 16))
|
||||
|
||||
#if 0 /* CCE non-debug */
|
||||
|
||||
#define RING_LOCALS CARD32 *__head; int __count
|
||||
#define BEGIN_DMA(n) \
|
||||
do { \
|
||||
if ((atis->indirectBuffer->used + 4*(n)) > \
|
||||
atis->indirectBuffer->size) { \
|
||||
ATIFlushIndirect(atis, 1); \
|
||||
} \
|
||||
__head = (CARD32 *)((char *)atis->indirectBuffer->address + \
|
||||
atis->indirectBuffer->used); \
|
||||
__count = 0; \
|
||||
} while (0)
|
||||
#define END_DMA() do { \
|
||||
atis->indirectBuffer->used += __count * 4; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define RING_LOCALS CARD32 *__head; int __count; int __total
|
||||
#define BEGIN_DMA(n) \
|
||||
do { \
|
||||
if ((atis->indirectBuffer->used + 4*(n)) > \
|
||||
atis->indirectBuffer->size) { \
|
||||
ATIFlushIndirect(atis, 1); \
|
||||
} \
|
||||
__head = (CARD32 *)((char *)atis->indirectBuffer->address + \
|
||||
atis->indirectBuffer->used); \
|
||||
__count = 0; \
|
||||
__total = n; \
|
||||
} while (0)
|
||||
#define END_DMA() do { \
|
||||
if (__count != __total) \
|
||||
ErrorF("count != total (%d vs %d) at %s:%d\n", __count, \
|
||||
__total, __FILE__, __LINE__); \
|
||||
atis->indirectBuffer->used += __count * 4; \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#define OUT_RING(x) do { \
|
||||
__head[__count++] = (x); \
|
||||
} while (0)
|
||||
|
||||
#define OUT_REG(reg, val) \
|
||||
do { \
|
||||
OUT_RING(DMA_PACKET0(reg, 1)); \
|
||||
OUT_RING(val); \
|
||||
} while (0)
|
||||
|
||||
dmaBuf *
|
||||
ATIGetDMABuffer(ATIScreenInfo *atis);
|
||||
|
||||
void
|
||||
ATIFlushIndirect(ATIScreenInfo *atis, Bool discard);
|
||||
|
||||
void
|
||||
ATIDMASetup(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ATIDMATeardown(ScreenPtr pScreen);
|
||||
|
||||
#endif /* _ATI_DMA_H_ */
|
||||
|
|
@ -1,835 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "ati_reg.h"
|
||||
#include "ati_dma.h"
|
||||
#include "ati_draw.h"
|
||||
|
||||
CARD8 ATISolidRop[16] = {
|
||||
/* GXclear */ 0x00, /* 0 */
|
||||
/* GXand */ 0xa0, /* src AND dst */
|
||||
/* GXandReverse */ 0x50, /* src AND NOT dst */
|
||||
/* GXcopy */ 0xf0, /* src */
|
||||
/* GXandInverted*/ 0x0a, /* NOT src AND dst */
|
||||
/* GXnoop */ 0xaa, /* dst */
|
||||
/* GXxor */ 0x5a, /* src XOR dst */
|
||||
/* GXor */ 0xfa, /* src OR dst */
|
||||
/* GXnor */ 0x05, /* NOT src AND NOT dst */
|
||||
/* GXequiv */ 0xa5, /* NOT src XOR dst */
|
||||
/* GXinvert */ 0x55, /* NOT dst */
|
||||
/* GXorReverse */ 0xf5, /* src OR NOT dst */
|
||||
/* GXcopyInverted*/ 0x0f, /* NOT src */
|
||||
/* GXorInverted */ 0xaf, /* NOT src OR dst */
|
||||
/* GXnand */ 0x5f, /* NOT src OR NOT dst */
|
||||
/* GXset */ 0xff, /* 1 */
|
||||
};
|
||||
|
||||
CARD8 ATIBltRop[16] = {
|
||||
/* GXclear */ 0x00, /* 0 */
|
||||
/* GXand */ 0x88, /* src AND dst */
|
||||
/* GXandReverse */ 0x44, /* src AND NOT dst */
|
||||
/* GXcopy */ 0xcc, /* src */
|
||||
/* GXandInverted*/ 0x22, /* NOT src AND dst */
|
||||
/* GXnoop */ 0xaa, /* dst */
|
||||
/* GXxor */ 0x66, /* src XOR dst */
|
||||
/* GXor */ 0xee, /* src OR dst */
|
||||
/* GXnor */ 0x11, /* NOT src AND NOT dst */
|
||||
/* GXequiv */ 0x99, /* NOT src XOR dst */
|
||||
/* GXinvert */ 0x55, /* NOT dst */
|
||||
/* GXorReverse */ 0xdd, /* src OR NOT dst */
|
||||
/* GXcopyInverted*/ 0x33, /* NOT src */
|
||||
/* GXorInverted */ 0xbb, /* NOT src OR dst */
|
||||
/* GXnand */ 0x77, /* NOT src OR NOT dst */
|
||||
/* GXset */ 0xff, /* 1 */
|
||||
};
|
||||
|
||||
int copydx, copydy;
|
||||
ATIScreenInfo *accel_atis;
|
||||
/* If is_24bpp is set, then we are using the accelerator in 8-bit mode due
|
||||
* to it being broken for 24bpp, so coordinates have to be multiplied by 3.
|
||||
*/
|
||||
Bool is_24bpp;
|
||||
CARD32 settings, color, src_pitch_offset, dst_pitch_offset;
|
||||
|
||||
#define DRAW_USING_PACKET3 0
|
||||
|
||||
void
|
||||
ATIDrawSetup(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
RING_LOCALS;
|
||||
|
||||
/* XXX: this shouldn't be necessary, but fixes some R128 composite
|
||||
* issues.
|
||||
*/
|
||||
/*if (!atic->is_radeon) {
|
||||
char *mmio = atic->reg_base;
|
||||
ATIWaitIdle(atis);
|
||||
MMIO_OUT32(mmio, R128_REG_PC_GUI_MODE,
|
||||
R128_PC_BYPASS_EN);
|
||||
}*/
|
||||
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
|
||||
END_DMA();
|
||||
|
||||
if (!atic->is_radeon) {
|
||||
/* Setup for R128 Composite */
|
||||
BEGIN_DMA(12);
|
||||
OUT_REG(R128_REG_SCALE_3D_CNTL,
|
||||
R128_SCALE_3D_TEXMAP_SHADE |
|
||||
R128_SCALE_PIX_REPLICATE |
|
||||
R128_TEX_CACHE_SPLIT |
|
||||
R128_TEX_MAP_ALPHA_IN_TEXTURE |
|
||||
R128_TEX_CACHE_LINE_SIZE_4QW);
|
||||
OUT_REG(R128_REG_SETUP_CNTL,
|
||||
R128_COLOR_SOLID_COLOR |
|
||||
R128_PRIM_TYPE_TRI |
|
||||
R128_TEXTURE_ST_MULT_W |
|
||||
R128_STARTING_VERTEX_1 |
|
||||
R128_ENDING_VERTEX_3 |
|
||||
R128_SUB_PIX_4BITS);
|
||||
OUT_REG(R128_REG_PM4_VC_FPU_SETUP,
|
||||
R128_FRONT_DIR_CCW |
|
||||
R128_BACKFACE_CULL |
|
||||
R128_FRONTFACE_SOLID |
|
||||
R128_FPU_COLOR_SOLID |
|
||||
R128_FPU_SUB_PIX_4BITS |
|
||||
R128_FPU_MODE_3D |
|
||||
R128_TRAP_BITS_DISABLE |
|
||||
R128_XFACTOR_2 |
|
||||
R128_YFACTOR_2 |
|
||||
R128_FLAT_SHADE_VERTEX_OGL |
|
||||
R128_FPU_ROUND_TRUNCATE |
|
||||
R128_WM_SEL_8DW);
|
||||
OUT_REG(R128_REG_PLANE_3D_MASK_C, 0xffffffff);
|
||||
OUT_REG(R128_REG_CONSTANT_COLOR_C, 0xff000000);
|
||||
OUT_REG(R128_REG_WINDOW_XY_OFFSET, 0x00000000);
|
||||
END_DMA();
|
||||
} else {
|
||||
/* Setup for R100/R200 Composite */
|
||||
BEGIN_DMA(8);
|
||||
OUT_REG(RADEON_REG_RE_TOP_LEFT, 0);
|
||||
OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff);
|
||||
OUT_REG(RADEON_REG_RB3D_PLANEMASK, 0xffffffff);
|
||||
OUT_REG(RADEON_REG_SE_CNTL,
|
||||
RADEON_FFACE_CULL_CCW |
|
||||
RADEON_FFACE_SOLID |
|
||||
RADEON_VTX_PIX_CENTER_OGL);
|
||||
END_DMA();
|
||||
|
||||
if (atic->is_r100) {
|
||||
BEGIN_DMA(4);
|
||||
OUT_REG(RADEON_REG_SE_CNTL_STATUS, RADEON_TCL_BYPASS);
|
||||
OUT_REG(RADEON_REG_SE_COORD_FMT,
|
||||
RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
|
||||
RADEON_VTX_ST0_NONPARAMETRIC |
|
||||
RADEON_VTX_ST1_NONPARAMETRIC |
|
||||
RADEON_TEX1_W_ROUTING_USE_W0);
|
||||
END_DMA();
|
||||
} else {
|
||||
BEGIN_DMA(12);
|
||||
OUT_REG(R200_REG_RE_CNTL, 0);
|
||||
OUT_REG(R200_REG_SE_VTE_CNTL, R200_VTX_XY_FMT);
|
||||
OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY);
|
||||
OUT_REG(R200_REG_SE_VTX_FMT_1,
|
||||
(2 << R200_VTX_TEX0_COMP_CNT_SHIFT) |
|
||||
(2 << R200_VTX_TEX1_COMP_CNT_SHIFT));
|
||||
OUT_REG(R200_REG_SE_VAP_CNTL, 0);
|
||||
OUT_REG(R200_REG_RE_AUX_SCISSOR_CNTL, 0);
|
||||
END_DMA();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RadeonSwitchTo2D(ATIScreenInfo *atis)
|
||||
{
|
||||
RING_LOCALS;
|
||||
|
||||
BEGIN_DMA(4);
|
||||
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
|
||||
RADEON_RB2D_DC_FLUSH);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
void
|
||||
RadeonSwitchTo3D(ATIScreenInfo *atis)
|
||||
{
|
||||
RING_LOCALS;
|
||||
|
||||
BEGIN_DMA(4);
|
||||
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
|
||||
RADEON_RB2D_DC_FLUSH);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we
|
||||
* require src and dest datatypes to be equal.
|
||||
*/
|
||||
static Bool
|
||||
ATIGetDatatypeBpp(int bpp, CARD32 *type)
|
||||
{
|
||||
switch (bpp) {
|
||||
case 8:
|
||||
*type = R128_DATATYPE_CI8;
|
||||
return TRUE;
|
||||
case 16:
|
||||
*type = R128_DATATYPE_RGB565;
|
||||
return TRUE;
|
||||
case 24:
|
||||
*type = R128_DATATYPE_CI8;
|
||||
return TRUE;
|
||||
case 32:
|
||||
*type = R128_DATATYPE_ARGB8888;
|
||||
return TRUE;
|
||||
default:
|
||||
ATI_FALLBACK(("Unsupported bpp: %d\n", bpp));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
|
||||
int offset, int pitch)
|
||||
{
|
||||
ATICardInfo *atic = atis->atic;
|
||||
|
||||
/* On the R128, depending on the bpp the screen can be set up so that it
|
||||
* doesn't meet the offscreenPitch requirement but can still be
|
||||
* accelerated, so we check the specific pitch requirement of alignment
|
||||
* to 8 pixels.
|
||||
*/
|
||||
if (atic->is_radeon) {
|
||||
if (pitch % atis->kaa.offscreenPitch != 0)
|
||||
ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
|
||||
*pitch_offset = ((pitch >> 6) << 22) | (offset >> 10);
|
||||
|
||||
} else {
|
||||
if (pitch % bpp != 0)
|
||||
ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
|
||||
*pitch_offset = ((pitch / bpp) << 21) | (offset >> 5);
|
||||
}
|
||||
|
||||
if (offset % atis->kaa.offscreenByteAlign != 0)
|
||||
ATI_FALLBACK(("Bad offset 0x%08x\n", offset));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset)
|
||||
{
|
||||
KdScreenPriv(pPix->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 pitch, offset;
|
||||
int bpp;
|
||||
|
||||
bpp = pPix->drawable.bitsPerPixel;
|
||||
if (bpp == 24)
|
||||
bpp = 8;
|
||||
|
||||
offset = ((CARD8 *)pPix->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
pitch = pPix->devKind;
|
||||
|
||||
return ATIGetOffsetPitch(atis, bpp, pitch_offset, offset, pitch);
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
|
||||
{
|
||||
KdScreenPriv(pPix->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD32 datatype;
|
||||
RING_LOCALS;
|
||||
|
||||
is_24bpp = (pPix->drawable.bitsPerPixel == 24);
|
||||
accel_atis = atis;
|
||||
|
||||
if (is_24bpp) {
|
||||
/* Solid fills in fake-24bpp mode only work if the pixel color
|
||||
* and planemask are all the same byte.
|
||||
*/
|
||||
if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) &
|
||||
0xffff)))
|
||||
ATI_FALLBACK(("Can't do solid color 0x%08x in 24bpp\n",
|
||||
fg));
|
||||
if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
|
||||
0xffff)))
|
||||
ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n",
|
||||
pm));
|
||||
}
|
||||
|
||||
if (!ATIGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype))
|
||||
return FALSE;
|
||||
if (!ATIGetPixmapOffsetPitch(pPix, &dst_pitch_offset))
|
||||
return FALSE;
|
||||
|
||||
if (atic->is_radeon)
|
||||
RadeonSwitchTo2D(atis);
|
||||
|
||||
settings =
|
||||
ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_SOLID_COLOR |
|
||||
(datatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATISolidRop[alu] << 16) |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS;
|
||||
color = fg;
|
||||
|
||||
#if DRAW_USING_PACKET3
|
||||
BEGIN_DMA(6);
|
||||
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
|
||||
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
|
||||
ATI_DST_Y_TOP_TO_BOTTOM);
|
||||
END_DMA();
|
||||
#else
|
||||
BEGIN_DMA(12);
|
||||
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
|
||||
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
|
||||
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
|
||||
OUT_REG(ATI_REG_DP_BRUSH_FRGD_CLR, fg);
|
||||
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
|
||||
ATI_DST_Y_TOP_TO_BOTTOM);
|
||||
END_DMA();
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATISolid(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
RING_LOCALS;
|
||||
|
||||
if (is_24bpp) {
|
||||
x1 *= 3;
|
||||
x2 *= 3;
|
||||
}
|
||||
#if DRAW_USING_PACKET3
|
||||
BEGIN_DMA(6);
|
||||
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_PAINT_MULTI, 5));
|
||||
OUT_RING(settings);
|
||||
OUT_RING(dst_pitch_offset);
|
||||
OUT_RING(color);
|
||||
OUT_RING((x1 << 16) | y1);
|
||||
OUT_RING(((x2 - x1) << 16) | (y2 - y1));
|
||||
END_DMA();
|
||||
#else
|
||||
BEGIN_DMA(3);
|
||||
OUT_RING(DMA_PACKET0(ATI_REG_DST_Y_X, 2));
|
||||
OUT_RING((y1 << 16) | x1);
|
||||
OUT_RING(((y2 - y1) << 16) | (x2 - x1));
|
||||
END_DMA();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ATIDoneSolid(void)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD32 datatype;
|
||||
RING_LOCALS;
|
||||
|
||||
copydx = dx;
|
||||
copydy = dy;
|
||||
is_24bpp = pDst->drawable.bitsPerPixel == 24;
|
||||
accel_atis = atis;
|
||||
|
||||
if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
|
||||
0xffff))))
|
||||
ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n", pm));
|
||||
|
||||
if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
|
||||
return FALSE;
|
||||
if (!ATIGetPixmapOffsetPitch(pSrc, &src_pitch_offset))
|
||||
return FALSE;
|
||||
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
|
||||
return FALSE;
|
||||
|
||||
if (atic->is_radeon)
|
||||
RadeonSwitchTo2D(atis);
|
||||
|
||||
settings =
|
||||
ATI_GMC_SRC_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_NONE |
|
||||
(datatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATIBltRop[alu] << 16) |
|
||||
ATI_DP_SRC_SOURCE_MEMORY |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS;
|
||||
|
||||
#if DRAW_USING_PACKET3
|
||||
BEGIN_DMA(6);
|
||||
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
|
||||
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(ATI_REG_DP_CNTL,
|
||||
(dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
|
||||
(dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
|
||||
END_DMA();
|
||||
|
||||
#else
|
||||
BEGIN_DMA(12);
|
||||
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
|
||||
OUT_REG(ATI_REG_SRC_PITCH_OFFSET, src_pitch_offset);
|
||||
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
|
||||
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
|
||||
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(ATI_REG_DP_CNTL,
|
||||
(dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
|
||||
(dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
|
||||
END_DMA();
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATICopy(int srcX, int srcY, int dstX, int dstY, int w, int h)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
RING_LOCALS;
|
||||
|
||||
if (is_24bpp) {
|
||||
srcX *= 3;
|
||||
dstX *= 3;
|
||||
w *= 3;
|
||||
}
|
||||
|
||||
#if !DRAW_USING_PACKET3
|
||||
if (copydx < 0) {
|
||||
srcX += w - 1;
|
||||
dstX += w - 1;
|
||||
}
|
||||
|
||||
if (copydy < 0) {
|
||||
srcY += h - 1;
|
||||
dstY += h - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DRAW_USING_PACKET3
|
||||
BEGIN_DMA(7);
|
||||
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_BITBLT_MULTI, 6));
|
||||
OUT_RING(settings);
|
||||
OUT_RING(src_pitch_offset);
|
||||
OUT_RING(dst_pitch_offset);
|
||||
OUT_RING((srcX << 16) | srcY);
|
||||
OUT_RING((dstX << 16) | dstY);
|
||||
OUT_RING((w << 16) | h);
|
||||
END_DMA();
|
||||
#else
|
||||
BEGIN_DMA(4);
|
||||
OUT_RING(DMA_PACKET0(ATI_REG_SRC_Y_X, 3));
|
||||
OUT_RING((srcY << 16) | srcX);
|
||||
OUT_RING((dstY << 16) | dstX);
|
||||
OUT_RING((h << 16) | w);
|
||||
END_DMA();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ATIDoneCopy(void)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool
|
||||
ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch)
|
||||
{
|
||||
ScreenPtr pScreen = pDst->drawable.pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
int width, height, bpp, i, dwords;
|
||||
int dst_pitch, dst_offset;
|
||||
CARD32 dst_pitch_offset, datatype;
|
||||
Bool success;
|
||||
RING_LOCALS;
|
||||
|
||||
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
dst_pitch = pDst->devKind;
|
||||
width = pDst->drawable.width;
|
||||
height = pDst->drawable.height;
|
||||
bpp = pDst->drawable.bitsPerPixel;
|
||||
|
||||
success = ATIGetDatatypeBpp(bpp, &datatype);
|
||||
|
||||
if (bpp == 24) {
|
||||
is_24bpp = TRUE;
|
||||
bpp = 8;
|
||||
} else
|
||||
is_24bpp = FALSE;
|
||||
|
||||
if (!ATIGetOffsetPitch(atis, bpp, &dst_pitch_offset, dst_offset,
|
||||
dst_pitch))
|
||||
return FALSE;
|
||||
|
||||
if (src_pitch != (width * bpp / 8))
|
||||
return FALSE;
|
||||
|
||||
/* No PACKET3 packets when in PIO mode. */
|
||||
if (atis->using_pio)
|
||||
return FALSE;
|
||||
|
||||
/* XXX: Hostdata uploads aren't working yet. */
|
||||
return FALSE;
|
||||
|
||||
dwords = (width * height * (bpp / 8) + 3) / 4;
|
||||
|
||||
/* Flush pixel cache so nothing being written to the destination
|
||||
* previously gets mixed up with the hostdata blit.
|
||||
*/
|
||||
if (atic->is_radeon) {
|
||||
BEGIN_DMA(4);
|
||||
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
|
||||
RADEON_RB2D_DC_FLUSH);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_2D_IDLECLEAN |
|
||||
RADEON_WAIT_3D_IDLECLEAN |
|
||||
RADEON_WAIT_HOST_IDLECLEAN);
|
||||
END_DMA();
|
||||
} else {
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(R128_REG_PC_GUI_CTLSTAT,
|
||||
R128_PC_FLUSH_GUI | R128_PC_RI_GUI);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
BEGIN_DMA(8);
|
||||
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_HOSTDATA_BLT, 7 + dwords));
|
||||
OUT_RING(ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_NONE |
|
||||
(datatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATISolidRop[GXcopy] << 16) |
|
||||
ATI_DP_SRC_SOURCE_HOST_DATA |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS |
|
||||
ATI_GMC_WR_MSK_DIS);
|
||||
OUT_RING(dst_pitch_offset);
|
||||
OUT_RING(0xffffffff);
|
||||
OUT_RING(0xffffffff);
|
||||
OUT_RING((0 << 16) | 0);
|
||||
OUT_RING((height << 16) | width);
|
||||
OUT_RING(dwords);
|
||||
END_DMA();
|
||||
|
||||
for (i = 0; i < dwords; i++) {
|
||||
BEGIN_DMA(1);
|
||||
OUT_RING(((CARD32 *)src)[i]);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
if (atic->is_radeon) {
|
||||
BEGIN_DMA(4);
|
||||
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
|
||||
RADEON_RB2D_DC_FLUSH);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_2D_IDLECLEAN |
|
||||
RADEON_WAIT_HOST_IDLECLEAN);
|
||||
END_DMA();
|
||||
} else {
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
KdMarkSync(pScreen);
|
||||
|
||||
ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pSrc->drawable.pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
int dst_pitch, src_pitch, w, i, size, bytes;
|
||||
unsigned char *dst, *src;
|
||||
RING_LOCALS;
|
||||
|
||||
/* Align width to log 2, useful for R128 composite. This should be a
|
||||
* KAA flag we check for (and supported in kaa.c in general) since many
|
||||
* older bits of hardware are going to want POT pitches.
|
||||
*/
|
||||
w = pSrc->drawable.width;
|
||||
if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT)
|
||||
w = 1 << (ATILog2(w - 1) + 1);
|
||||
dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 +
|
||||
atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1);
|
||||
|
||||
size = dst_pitch * pSrc->drawable.height;
|
||||
if (size > atis->scratch_area->size)
|
||||
ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n",
|
||||
pSrc->drawable.width, pSrc->drawable.height));
|
||||
|
||||
atis->scratch_next = (atis->scratch_next +
|
||||
atis->kaa.offscreenByteAlign - 1) &
|
||||
~(atis->kaa.offscreenByteAlign - 1);
|
||||
if (atis->scratch_next + size > atis->scratch_area->offset +
|
||||
atis->scratch_area->size) {
|
||||
/* Only sync when we've used all of the scratch area. */
|
||||
KdCheckSync(pSrc->drawable.pScreen);
|
||||
atis->scratch_next = atis->scratch_area->offset;
|
||||
}
|
||||
memcpy(pDst, pSrc, sizeof(*pDst));
|
||||
pDst->devKind = dst_pitch;
|
||||
pDst->devPrivate.ptr = pScreenPriv->screen->memory_base +
|
||||
atis->scratch_next;
|
||||
atis->scratch_next += size;
|
||||
|
||||
src = pSrc->devPrivate.ptr;
|
||||
src_pitch = pSrc->devKind;
|
||||
dst = pDst->devPrivate.ptr;
|
||||
bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
|
||||
|
||||
i = pSrc->drawable.height;
|
||||
while (i--) {
|
||||
memcpy(dst, src, bytes);
|
||||
dst += dst_pitch;
|
||||
src += src_pitch;
|
||||
}
|
||||
|
||||
/* Flush the pixel cache */
|
||||
if (atic->is_radeon) {
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
|
||||
RADEON_RB2D_DC_FLUSH_ALL);
|
||||
END_DMA();
|
||||
} else {
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_ALL);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATIBlockHandler(pointer blockData, OSTimePtr timeout, pointer readmask)
|
||||
{
|
||||
ScreenPtr pScreen = (ScreenPtr) blockData;
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
|
||||
/* When the server is going to sleep, make sure that all DMA data has
|
||||
* been flushed.
|
||||
*/
|
||||
ATIFlushIndirect(atis, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIWakeupHandler(pointer blockData, int result, pointer readmask)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
ATIDrawInit(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
|
||||
pScreenPriv->screen->fb[0].bitsPerPixel);
|
||||
|
||||
#ifdef USE_DRI
|
||||
atis->using_dri = ATIDRIScreenInit(pScreen);
|
||||
#endif /* USE_DRI */
|
||||
|
||||
memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec));
|
||||
atis->kaa.PrepareSolid = ATIPrepareSolid;
|
||||
atis->kaa.Solid = ATISolid;
|
||||
atis->kaa.DoneSolid = ATIDoneSolid;
|
||||
atis->kaa.PrepareCopy = ATIPrepareCopy;
|
||||
atis->kaa.Copy = ATICopy;
|
||||
atis->kaa.DoneCopy = ATIDoneCopy;
|
||||
/* Other acceleration will be hooked in in DrawEnable depending on
|
||||
* what type of DMA gets initialized.
|
||||
*/
|
||||
|
||||
atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
|
||||
if (atic->is_radeon) {
|
||||
atis->kaa.offscreenByteAlign = 1024;
|
||||
atis->kaa.offscreenPitch = 64;
|
||||
} else {
|
||||
/* Rage 128 compositing wants power-of-two pitches. */
|
||||
atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT;
|
||||
atis->kaa.offscreenByteAlign = 32;
|
||||
/* Pitch alignment is in sets of 8 pixels, and we need to cover
|
||||
* 32bpp, so 32 bytes.
|
||||
*/
|
||||
atis->kaa.offscreenPitch = 32;
|
||||
}
|
||||
|
||||
if (!kaaDrawInit(pScreen, &atis->kaa))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ATIScratchSave(ScreenPtr pScreen, KdOffscreenArea *area)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
|
||||
atis->scratch_area = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ATIDrawEnable(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
|
||||
ATIDMASetup(pScreen);
|
||||
ATIDrawSetup(pScreen);
|
||||
|
||||
atis->kaa.PrepareBlend = NULL;
|
||||
atis->kaa.Blend = NULL;
|
||||
atis->kaa.DoneBlend = NULL;
|
||||
atis->kaa.CheckComposite = NULL;
|
||||
atis->kaa.PrepareComposite = NULL;
|
||||
atis->kaa.Composite = NULL;
|
||||
atis->kaa.DoneComposite = NULL;
|
||||
/* XXX: The R128 Blend code has several issues, according to
|
||||
* rendercheck. Source coordinates are sometimes wrong it appears, and
|
||||
* in some cases the blending results are wrong.
|
||||
*/
|
||||
if (0 && !atic->is_radeon) {
|
||||
atis->kaa.PrepareBlend = R128PrepareBlend;
|
||||
atis->kaa.Blend = R128Blend;
|
||||
atis->kaa.DoneBlend = R128DoneBlend;
|
||||
}
|
||||
|
||||
/* We can't dispatch 3d commands in PIO mode. */
|
||||
if (!atis->using_pio) {
|
||||
if (!atic->is_radeon) {
|
||||
atis->kaa.CheckComposite = R128CheckComposite;
|
||||
atis->kaa.PrepareComposite = R128PrepareComposite;
|
||||
atis->kaa.Composite = R128Composite;
|
||||
atis->kaa.DoneComposite = R128DoneComposite;
|
||||
} else if (atic->is_r100) {
|
||||
atis->kaa.CheckComposite = R100CheckComposite;
|
||||
atis->kaa.PrepareComposite = R100PrepareComposite;
|
||||
atis->kaa.Composite = RadeonComposite;
|
||||
atis->kaa.DoneComposite = RadeonDoneComposite;
|
||||
} else if (0 && atic->is_r200) { /* XXX */
|
||||
atis->kaa.CheckComposite = R200CheckComposite;
|
||||
atis->kaa.PrepareComposite = R200PrepareComposite;
|
||||
atis->kaa.Composite = RadeonComposite;
|
||||
atis->kaa.DoneComposite = RadeonDoneComposite;
|
||||
}
|
||||
}
|
||||
|
||||
atis->kaa.UploadToScreen = ATIUploadToScreen;
|
||||
|
||||
/* Reserve a scratch area. It'll be used for storing glyph data during
|
||||
* Composite operations, because glyphs aren't in real pixmaps and thus
|
||||
* can't be migrated.
|
||||
*/
|
||||
atis->scratch_area = KdOffscreenAlloc(pScreen, 131072,
|
||||
atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis);
|
||||
if (atis->scratch_area != NULL) {
|
||||
atis->scratch_next = atis->scratch_area->offset;
|
||||
atis->kaa.UploadToScratch = ATIUploadToScratch;
|
||||
} else
|
||||
atis->kaa.UploadToScratch = NULL;
|
||||
|
||||
RegisterBlockAndWakeupHandlers (ATIBlockHandler, ATIWakeupHandler,
|
||||
pScreen);
|
||||
|
||||
KdMarkSync(pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
ATIDrawDisable(ScreenPtr pScreen)
|
||||
{
|
||||
RemoveBlockAndWakeupHandlers (ATIBlockHandler, ATIWakeupHandler,
|
||||
pScreen);
|
||||
|
||||
ATIDMATeardown(pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
ATIDrawFini(ScreenPtr pScreen)
|
||||
{
|
||||
#ifdef USE_DRI
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
if (atis->using_dri) {
|
||||
ATIDRICloseScreen(pScreen);
|
||||
atis->using_dri = FALSE;
|
||||
}
|
||||
#endif /* USE_DRI */
|
||||
|
||||
kaaDrawFini(pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
ATIDrawSync(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
|
||||
ATIWaitIdle(atis);
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2004 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef _ATI_DRAW_H_
|
||||
#define _ATI_DRAW_H_
|
||||
|
||||
Bool
|
||||
ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
|
||||
int offset, int pitch);
|
||||
|
||||
Bool
|
||||
ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset);
|
||||
|
||||
Bool
|
||||
R128PrepareBlend(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture,
|
||||
PixmapPtr pSrc, PixmapPtr pDst);
|
||||
|
||||
void
|
||||
R128Blend(int srcX, int srcY, int dstX, int dstY, int width, int height);
|
||||
|
||||
void
|
||||
R128DoneBlend(void);
|
||||
|
||||
Bool
|
||||
R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture);
|
||||
|
||||
Bool
|
||||
R128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
|
||||
|
||||
void
|
||||
R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
|
||||
int w, int h);
|
||||
|
||||
void
|
||||
R128DoneComposite(void);
|
||||
|
||||
Bool
|
||||
R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture);
|
||||
|
||||
Bool
|
||||
R100PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
|
||||
|
||||
Bool
|
||||
R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture);
|
||||
|
||||
Bool
|
||||
R200PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
|
||||
|
||||
void
|
||||
RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX,
|
||||
int dstY, int w, int h);
|
||||
|
||||
void
|
||||
RadeonDoneComposite(void);
|
||||
|
||||
void
|
||||
RadeonSwitchTo2D(ATIScreenInfo *atis);
|
||||
|
||||
void
|
||||
RadeonSwitchTo3D(ATIScreenInfo *atis);
|
||||
|
||||
void
|
||||
ATIWaitIdle(ATIScreenInfo *atis);
|
||||
|
||||
#if 0
|
||||
#define ATI_FALLBACK(x) \
|
||||
do { \
|
||||
ErrorF("%s: ", __FUNCTION__); \
|
||||
ErrorF x; \
|
||||
return FALSE; \
|
||||
} while (0)
|
||||
#else
|
||||
#define ATI_FALLBACK(x) return FALSE
|
||||
#endif
|
||||
|
||||
#endif /* _ATI_DRAW_H_ */
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef USE_DMA
|
||||
#define TAG(x) x##DMA
|
||||
#define LOCALS RING_LOCALS; \
|
||||
(void)atic
|
||||
#define BEGIN(x) BEGIN_RING(x * 2)
|
||||
#define OUT_REG(reg, val) OUT_RING_REG(reg, val)
|
||||
#define END() ADVANCE_RING()
|
||||
#else
|
||||
#define TAG(x) x##MMIO
|
||||
#define LOCALS char *mmio = atic->reg_base; \
|
||||
(void)atis
|
||||
#define BEGIN(x) ATIWaitAvailMMIO(x)
|
||||
#define OUT_REG(reg, val) MMIO_OUT32((mmio), (reg), (val))
|
||||
#define END()
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
TAG(ATISetup)(PixmapPtr pDst, PixmapPtr pSrc)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
int dst_offset, dst_pitch;
|
||||
int bpp = pDst->drawable.bitsPerPixel;
|
||||
LOCALS;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
dst_pitch = pDst->devKind;
|
||||
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
if ((dst_pitch & (atis->kaa.offscreenPitch - 1)) != 0)
|
||||
ATI_FALLBACK(("Bad dst pitch 0x%x\n", dst_pitch));
|
||||
if ((dst_offset & (atis->kaa.offscreenByteAlign - 1)) != 0)
|
||||
ATI_FALLBACK(("Bad dst offset 0x%x\n", dst_offset));
|
||||
|
||||
if (pSrc != NULL) {
|
||||
src_pitch = pSrc->devKind;
|
||||
src_offset = ((CARD8 *)pSrc->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
if ((src_pitch & (atis->kaa.offscreenPitch - 1)) != 0)
|
||||
ATI_FALLBACK(("Bad src pitch 0x%x\n", src_pitch));
|
||||
if ((src_offset & (atis->kaa.offscreenByteAlign - 1)) != 0)
|
||||
ATI_FALLBACK(("Bad src offset 0x%x\n", src_offset));
|
||||
}
|
||||
|
||||
#ifdef USE_DMA
|
||||
if (atic->is_radeon && !atic->is_r200)
|
||||
RadeonSwitchTo2D();
|
||||
#endif
|
||||
BEGIN((pSrc != NULL) ? 3 : 2);
|
||||
if (atic->is_radeon) {
|
||||
OUT_REG(RADEON_REG_DST_PITCH_OFFSET,
|
||||
((dst_pitch >> 6) << 22) | (dst_offset >> 10));
|
||||
if (pSrc != NULL) {
|
||||
OUT_REG(RADEON_REG_SRC_PITCH_OFFSET,
|
||||
((src_pitch >> 6) << 22) | (src_offset >> 10));
|
||||
}
|
||||
} else {
|
||||
if (is_24bpp) {
|
||||
dst_pitch *= 3;
|
||||
src_pitch *= 3;
|
||||
}
|
||||
/* R128 pitch is in units of 8 pixels, offset in 32 bytes */
|
||||
OUT_REG(RADEON_REG_DST_PITCH_OFFSET,
|
||||
((dst_pitch/bpp) << 21) | (dst_offset >> 5));
|
||||
if (pSrc != NULL) {
|
||||
OUT_REG(RADEON_REG_SRC_PITCH_OFFSET,
|
||||
((src_pitch/bpp) << 21) | (src_offset >> 5));
|
||||
}
|
||||
}
|
||||
OUT_REG(RADEON_REG_DEFAULT_SC_BOTTOM_RIGHT,
|
||||
(RADEON_DEFAULT_SC_RIGHT_MAX | RADEON_DEFAULT_SC_BOTTOM_MAX));
|
||||
END();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
TAG(ATIPrepareSolid)(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
|
||||
{
|
||||
KdScreenPriv(pPixmap->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD32 datatype;
|
||||
LOCALS;
|
||||
|
||||
if (is_24bpp) {
|
||||
/* Solid fills in fake-24bpp mode only work if the pixel color
|
||||
* and planemask are all the same byte.
|
||||
*/
|
||||
if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) &
|
||||
0xffff)))
|
||||
ATI_FALLBACK(("Can't do solid color %d in 24bpp\n"));
|
||||
if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
|
||||
0xffff)))
|
||||
ATI_FALLBACK(("Can't do planemask %d in 24bpp\n"));
|
||||
}
|
||||
|
||||
if (!ATIGetDatatypeBpp(pPixmap->drawable.bitsPerPixel, &datatype))
|
||||
return FALSE;
|
||||
if (!TAG(ATISetup)(pPixmap, NULL))
|
||||
return FALSE;
|
||||
|
||||
BEGIN(4);
|
||||
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
|
||||
(datatype << 8) |
|
||||
RADEON_GMC_CLR_CMP_CNTL_DIS |
|
||||
RADEON_GMC_AUX_CLIP_DIS |
|
||||
RADEON_GMC_BRUSH_SOLID_COLOR |
|
||||
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
RADEON_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATISolidRop[alu] << 16));
|
||||
OUT_REG(RADEON_REG_DP_BRUSH_FRGD_CLR, fg);
|
||||
OUT_REG(RADEON_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(RADEON_REG_DP_CNTL, RADEON_DST_X_LEFT_TO_RIGHT |
|
||||
RADEON_DST_Y_TOP_TO_BOTTOM);
|
||||
END();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
TAG(ATISolid)(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
ATICardInfo *atic = atis->atic;
|
||||
LOCALS;
|
||||
|
||||
if (is_24bpp) {
|
||||
x1 *= 3;
|
||||
x2 *= 3;
|
||||
}
|
||||
BEGIN(2);
|
||||
OUT_REG(RADEON_REG_DST_Y_X, (y1 << 16) | x1);
|
||||
OUT_REG(RADEON_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1));
|
||||
END();
|
||||
}
|
||||
|
||||
static Bool
|
||||
TAG(ATIPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD32 datatype;
|
||||
LOCALS;
|
||||
|
||||
copydx = dx;
|
||||
copydy = dy;
|
||||
|
||||
if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
|
||||
0xffff))))
|
||||
ATI_FALLBACK(("Can't do planemask %d in 24bpp\n"));
|
||||
|
||||
if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
|
||||
return FALSE;
|
||||
if (!TAG(ATISetup)(pDst, pSrc))
|
||||
return FALSE;
|
||||
|
||||
BEGIN(3);
|
||||
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
|
||||
(datatype << 8) |
|
||||
RADEON_GMC_CLR_CMP_CNTL_DIS |
|
||||
RADEON_GMC_AUX_CLIP_DIS |
|
||||
RADEON_GMC_BRUSH_SOLID_COLOR |
|
||||
RADEON_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATIBltRop[alu] << 16) |
|
||||
RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
|
||||
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
RADEON_DP_SRC_SOURCE_MEMORY);
|
||||
OUT_REG(RADEON_REG_DP_WRITE_MASK, pm);
|
||||
OUT_REG(RADEON_REG_DP_CNTL,
|
||||
(dx >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) |
|
||||
(dy >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0));
|
||||
END();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
TAG(ATICopy)(int srcX, int srcY, int dstX, int dstY, int w, int h)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
ATICardInfo *atic = atis->atic;
|
||||
LOCALS;
|
||||
|
||||
if (is_24bpp) {
|
||||
srcX *= 3;
|
||||
dstX *= 3;
|
||||
w *= 3;
|
||||
}
|
||||
|
||||
if (copydx < 0) {
|
||||
srcX += w - 1;
|
||||
dstX += w - 1;
|
||||
}
|
||||
|
||||
if (copydy < 0) {
|
||||
srcY += h - 1;
|
||||
dstY += h - 1;
|
||||
}
|
||||
|
||||
BEGIN(3);
|
||||
OUT_REG(RADEON_REG_SRC_Y_X, (srcY << 16) | srcX);
|
||||
OUT_REG(RADEON_REG_DST_Y_X, (dstY << 16) | dstX);
|
||||
OUT_REG(RADEON_REG_DST_HEIGHT_WIDTH, (h << 16) | w);
|
||||
END();
|
||||
}
|
||||
|
||||
#undef TAG
|
||||
#undef LOCALS
|
||||
#undef BEGIN
|
||||
#undef OUT_REG
|
||||
#undef END
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef _ATI_DRI_H_
|
||||
#define _ATI_DRI_H_
|
||||
|
||||
typedef struct {
|
||||
/* DRI screen private data */
|
||||
int deviceID; /* PCI device ID */
|
||||
int width; /* Width in pixels of display */
|
||||
int height; /* Height in scanlines of display */
|
||||
int depth; /* Depth of display (8, 15, 16, 24) */
|
||||
int bpp; /* Bit depth of display (8, 16, 24, 32) */
|
||||
|
||||
int IsPCI; /* Current card is a PCI card */
|
||||
int AGPMode;
|
||||
|
||||
int frontOffset; /* Start of front buffer */
|
||||
int frontPitch;
|
||||
int backOffset; /* Start of shared back buffer */
|
||||
int backPitch;
|
||||
int depthOffset; /* Start of shared depth buffer */
|
||||
int depthPitch;
|
||||
int spanOffset; /* Start of scratch spanline */
|
||||
int textureOffset; /* Start of texture data in frame buffer */
|
||||
int textureSize;
|
||||
int log2TexGran;
|
||||
|
||||
/* MMIO register data */
|
||||
drmHandle registerHandle;
|
||||
drmSize registerSize;
|
||||
|
||||
/* CCE AGP Texture data */
|
||||
drmHandle gartTexHandle;
|
||||
drmSize gartTexMapSize;
|
||||
int log2AGPTexGran;
|
||||
int gartTexOffset;
|
||||
unsigned int sarea_priv_offset;
|
||||
} R128DRIRec, *R128DRIPtr;
|
||||
|
||||
typedef struct {
|
||||
/* DRI screen private data */
|
||||
int deviceID; /* PCI device ID */
|
||||
int width; /* Width in pixels of display */
|
||||
int height; /* Height in scanlines of display */
|
||||
int depth; /* Depth of display (8, 15, 16, 24) */
|
||||
int bpp; /* Bit depth of display (8, 16, 24, 32) */
|
||||
|
||||
int IsPCI; /* Current card is a PCI card */
|
||||
int AGPMode;
|
||||
|
||||
int frontOffset; /* Start of front buffer */
|
||||
int frontPitch;
|
||||
int backOffset; /* Start of shared back buffer */
|
||||
int backPitch;
|
||||
int depthOffset; /* Start of shared depth buffer */
|
||||
int depthPitch;
|
||||
int textureOffset; /* Start of texture data in frame buffer */
|
||||
int textureSize;
|
||||
int log2TexGran;
|
||||
|
||||
/* MMIO register data */
|
||||
drmHandle registerHandle;
|
||||
drmSize registerSize;
|
||||
|
||||
/* CP in-memory status information */
|
||||
drmHandle statusHandle;
|
||||
drmSize statusSize;
|
||||
|
||||
/* CP GART Texture data */
|
||||
drmHandle gartTexHandle;
|
||||
drmSize gartTexMapSize;
|
||||
int log2GARTTexGran;
|
||||
int gartTexOffset;
|
||||
unsigned int sarea_priv_offset;
|
||||
} RADEONDRIRec, *RADEONDRIPtr;
|
||||
|
||||
#endif /* _ATI_DRI_H_ */
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
|
||||
* Precision Insight, Inc., Cedar Park, Texas, and
|
||||
* VA Linux Systems Inc., Fremont, California.
|
||||
*
|
||||
* 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 on 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
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
|
||||
* SYSTEMS AND/OR THEIR SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Rickard E. Faith <faith@valinux.com>
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ATI_DRIPRIV_H_
|
||||
#define _ATI_DRIPRIV_H_
|
||||
|
||||
#ifdef GLXEXT
|
||||
#include "GL/glxint.h"
|
||||
|
||||
extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
|
||||
void **configprivs);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* Nothing here yet */
|
||||
int dummy;
|
||||
} ATIConfigPrivRec, *ATIConfigPrivPtr;
|
||||
|
||||
typedef struct {
|
||||
/* Nothing here yet */
|
||||
int dummy;
|
||||
} ATIDRIContextRec, *ATIDRIContextPtr;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,857 +0,0 @@
|
|||
/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*-
|
||||
* radeon_cp.c -- CP support for Radeon -*- linux-c -*-
|
||||
*
|
||||
* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
|
||||
* 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, 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
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
/* CCE microcode (from ATI) */
|
||||
|
||||
#include "ati.h"
|
||||
|
||||
CARD32 r128_cce_microcode[] = {
|
||||
0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0,
|
||||
1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0,
|
||||
599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1,
|
||||
11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11,
|
||||
262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28,
|
||||
1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9,
|
||||
30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656,
|
||||
1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1,
|
||||
15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071,
|
||||
12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2,
|
||||
46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1,
|
||||
459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1,
|
||||
18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1,
|
||||
15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2,
|
||||
268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1,
|
||||
15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82,
|
||||
1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729,
|
||||
3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008,
|
||||
1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0,
|
||||
15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1,
|
||||
180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1,
|
||||
114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0,
|
||||
33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370,
|
||||
1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1,
|
||||
14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793,
|
||||
1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1,
|
||||
198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1,
|
||||
114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1,
|
||||
1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1,
|
||||
1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894,
|
||||
16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14,
|
||||
174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1,
|
||||
33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1,
|
||||
33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1,
|
||||
409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
CARD32 radeon_cp_microcode[][2] = {
|
||||
{ 0x21007000, 0000000000 },
|
||||
{ 0x20007000, 0000000000 },
|
||||
{ 0x000000b4, 0x00000004 },
|
||||
{ 0x000000b8, 0x00000004 },
|
||||
{ 0x6f5b4d4c, 0000000000 },
|
||||
{ 0x4c4c427f, 0000000000 },
|
||||
{ 0x5b568a92, 0000000000 },
|
||||
{ 0x4ca09c6d, 0000000000 },
|
||||
{ 0xad4c4c4c, 0000000000 },
|
||||
{ 0x4ce1af3d, 0000000000 },
|
||||
{ 0xd8afafaf, 0000000000 },
|
||||
{ 0xd64c4cdc, 0000000000 },
|
||||
{ 0x4cd10d10, 0000000000 },
|
||||
{ 0x000f0000, 0x00000016 },
|
||||
{ 0x362f242d, 0000000000 },
|
||||
{ 0x00000012, 0x00000004 },
|
||||
{ 0x000f0000, 0x00000016 },
|
||||
{ 0x362f282d, 0000000000 },
|
||||
{ 0x000380e7, 0x00000002 },
|
||||
{ 0x04002c97, 0x00000002 },
|
||||
{ 0x000f0001, 0x00000016 },
|
||||
{ 0x333a3730, 0000000000 },
|
||||
{ 0x000077ef, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000021, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000021, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000021, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00000017, 0x00000004 },
|
||||
{ 0x0003802b, 0x00000002 },
|
||||
{ 0x040067e0, 0x00000002 },
|
||||
{ 0x00000017, 0x00000004 },
|
||||
{ 0x000077e0, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x000037e1, 0x00000002 },
|
||||
{ 0x040067e1, 0x00000006 },
|
||||
{ 0x000077e0, 0x00000002 },
|
||||
{ 0x000077e1, 0x00000002 },
|
||||
{ 0x000077e1, 0x00000006 },
|
||||
{ 0xffffffff, 0000000000 },
|
||||
{ 0x10000000, 0000000000 },
|
||||
{ 0x0003802b, 0x00000002 },
|
||||
{ 0x040067e0, 0x00000006 },
|
||||
{ 0x00007675, 0x00000002 },
|
||||
{ 0x00007676, 0x00000002 },
|
||||
{ 0x00007677, 0x00000002 },
|
||||
{ 0x00007678, 0x00000006 },
|
||||
{ 0x0003802c, 0x00000002 },
|
||||
{ 0x04002676, 0x00000002 },
|
||||
{ 0x00007677, 0x00000002 },
|
||||
{ 0x00007678, 0x00000006 },
|
||||
{ 0x0000002f, 0x00000018 },
|
||||
{ 0x0000002f, 0x00000018 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x00000030, 0x00000018 },
|
||||
{ 0x00000030, 0x00000018 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x01605000, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x00098000, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x64c0603e, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00080000, 0x00000016 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0x0400251d, 0x00000002 },
|
||||
{ 0x00007580, 0x00000002 },
|
||||
{ 0x00067581, 0x00000002 },
|
||||
{ 0x04002580, 0x00000002 },
|
||||
{ 0x00067581, 0x00000002 },
|
||||
{ 0x00000049, 0x00000004 },
|
||||
{ 0x00005000, 0000000000 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x0000750e, 0x00000002 },
|
||||
{ 0x00019000, 0x00000002 },
|
||||
{ 0x00011055, 0x00000014 },
|
||||
{ 0x00000055, 0x00000012 },
|
||||
{ 0x0400250f, 0x00000002 },
|
||||
{ 0x0000504f, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00007565, 0x00000002 },
|
||||
{ 0x00007566, 0x00000002 },
|
||||
{ 0x00000058, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x01e655b4, 0x00000002 },
|
||||
{ 0x4401b0e4, 0x00000002 },
|
||||
{ 0x01c110e4, 0x00000002 },
|
||||
{ 0x26667066, 0x00000018 },
|
||||
{ 0x040c2565, 0x00000002 },
|
||||
{ 0x00000066, 0x00000018 },
|
||||
{ 0x04002564, 0x00000002 },
|
||||
{ 0x00007566, 0x00000002 },
|
||||
{ 0x0000005d, 0x00000004 },
|
||||
{ 0x00401069, 0x00000008 },
|
||||
{ 0x00101000, 0x00000002 },
|
||||
{ 0x000d80ff, 0x00000002 },
|
||||
{ 0x0080006c, 0x00000008 },
|
||||
{ 0x000f9000, 0x00000002 },
|
||||
{ 0x000e00ff, 0x00000002 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x0000008f, 0x00000018 },
|
||||
{ 0x0000005b, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00007576, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x00009000, 0x00000002 },
|
||||
{ 0x00041000, 0x00000002 },
|
||||
{ 0x0c00350e, 0x00000002 },
|
||||
{ 0x00049000, 0x00000002 },
|
||||
{ 0x00051000, 0x00000002 },
|
||||
{ 0x01e785f8, 0x00000002 },
|
||||
{ 0x00200000, 0x00000002 },
|
||||
{ 0x0060007e, 0x0000000c },
|
||||
{ 0x00007563, 0x00000002 },
|
||||
{ 0x006075f0, 0x00000021 },
|
||||
{ 0x20007073, 0x00000004 },
|
||||
{ 0x00005073, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00007576, 0x00000002 },
|
||||
{ 0x00007577, 0x00000002 },
|
||||
{ 0x0000750e, 0x00000002 },
|
||||
{ 0x0000750f, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00600083, 0x0000000c },
|
||||
{ 0x006075f0, 0x00000021 },
|
||||
{ 0x000075f8, 0x00000002 },
|
||||
{ 0x00000083, 0x00000004 },
|
||||
{ 0x000a750e, 0x00000002 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x0020750f, 0x00000002 },
|
||||
{ 0x00600086, 0x00000004 },
|
||||
{ 0x00007570, 0x00000002 },
|
||||
{ 0x00007571, 0x00000002 },
|
||||
{ 0x00007572, 0x00000006 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00007568, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000095, 0x0000000c },
|
||||
{ 0x00058000, 0x00000002 },
|
||||
{ 0x0c607562, 0x00000002 },
|
||||
{ 0x00000097, 0x00000004 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x00600096, 0x00000004 },
|
||||
{ 0x400070e5, 0000000000 },
|
||||
{ 0x000380e6, 0x00000002 },
|
||||
{ 0x040025c5, 0x00000002 },
|
||||
{ 0x000380e5, 0x00000002 },
|
||||
{ 0x000000a8, 0x0000001c },
|
||||
{ 0x000650aa, 0x00000018 },
|
||||
{ 0x040025bb, 0x00000002 },
|
||||
{ 0x000610ab, 0x00000018 },
|
||||
{ 0x040075bc, 0000000000 },
|
||||
{ 0x000075bb, 0x00000002 },
|
||||
{ 0x000075bc, 0000000000 },
|
||||
{ 0x00090000, 0x00000006 },
|
||||
{ 0x00090000, 0x00000002 },
|
||||
{ 0x000d8002, 0x00000006 },
|
||||
{ 0x00007832, 0x00000002 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x000380e7, 0x00000002 },
|
||||
{ 0x04002c97, 0x00000002 },
|
||||
{ 0x00007820, 0x00000002 },
|
||||
{ 0x00007821, 0x00000002 },
|
||||
{ 0x00007800, 0000000000 },
|
||||
{ 0x01200000, 0x00000002 },
|
||||
{ 0x20077000, 0x00000002 },
|
||||
{ 0x01200000, 0x00000002 },
|
||||
{ 0x20007000, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x0120751b, 0x00000002 },
|
||||
{ 0x8040750a, 0x00000002 },
|
||||
{ 0x8040750b, 0x00000002 },
|
||||
{ 0x00110000, 0x00000002 },
|
||||
{ 0x000380e5, 0x00000002 },
|
||||
{ 0x000000c6, 0x0000001c },
|
||||
{ 0x000610ab, 0x00000018 },
|
||||
{ 0x844075bd, 0x00000002 },
|
||||
{ 0x000610aa, 0x00000018 },
|
||||
{ 0x840075bb, 0x00000002 },
|
||||
{ 0x000610ab, 0x00000018 },
|
||||
{ 0x844075bc, 0x00000002 },
|
||||
{ 0x000000c9, 0x00000004 },
|
||||
{ 0x804075bd, 0x00000002 },
|
||||
{ 0x800075bb, 0x00000002 },
|
||||
{ 0x804075bc, 0x00000002 },
|
||||
{ 0x00108000, 0x00000002 },
|
||||
{ 0x01400000, 0x00000002 },
|
||||
{ 0x006000cd, 0x0000000c },
|
||||
{ 0x20c07000, 0x00000020 },
|
||||
{ 0x000000cf, 0x00000012 },
|
||||
{ 0x00800000, 0x00000006 },
|
||||
{ 0x0080751d, 0x00000006 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0x0000775c, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00661000, 0x00000002 },
|
||||
{ 0x0460275d, 0x00000020 },
|
||||
{ 0x00004000, 0000000000 },
|
||||
{ 0x01e00830, 0x00000002 },
|
||||
{ 0x21007000, 0000000000 },
|
||||
{ 0x6464614d, 0000000000 },
|
||||
{ 0x69687420, 0000000000 },
|
||||
{ 0x00000073, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x000380d0, 0x00000002 },
|
||||
{ 0x040025e0, 0x00000002 },
|
||||
{ 0x000075e1, 0000000000 },
|
||||
{ 0x00000001, 0000000000 },
|
||||
{ 0x000380e0, 0x00000002 },
|
||||
{ 0x04002394, 0x00000002 },
|
||||
{ 0x00005000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0x00000008, 0000000000 },
|
||||
{ 0x00000004, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
};
|
||||
|
||||
CARD32 r200_cp_microcode[][2] = {
|
||||
{ 0x21007000, 0000000000 },
|
||||
{ 0x20007000, 0000000000 },
|
||||
{ 0x000000ab, 0x00000004 },
|
||||
{ 0x000000af, 0x00000004 },
|
||||
{ 0x66544a49, 0000000000 },
|
||||
{ 0x49494174, 0000000000 },
|
||||
{ 0x54517d83, 0000000000 },
|
||||
{ 0x498d8b64, 0000000000 },
|
||||
{ 0x49494949, 0000000000 },
|
||||
{ 0x49da493c, 0000000000 },
|
||||
{ 0x49989898, 0000000000 },
|
||||
{ 0xd34949d5, 0000000000 },
|
||||
{ 0x9dc90e11, 0000000000 },
|
||||
{ 0xce9b9b9b, 0000000000 },
|
||||
{ 0x000f0000, 0x00000016 },
|
||||
{ 0x352e232c, 0000000000 },
|
||||
{ 0x00000013, 0x00000004 },
|
||||
{ 0x000f0000, 0x00000016 },
|
||||
{ 0x352e272c, 0000000000 },
|
||||
{ 0x000f0001, 0x00000016 },
|
||||
{ 0x3239362f, 0000000000 },
|
||||
{ 0x000077ef, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000020, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000020, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000020, 0x0000001a },
|
||||
{ 0x00004000, 0x0000001e },
|
||||
{ 0x00000016, 0x00000004 },
|
||||
{ 0x0003802a, 0x00000002 },
|
||||
{ 0x040067e0, 0x00000002 },
|
||||
{ 0x00000016, 0x00000004 },
|
||||
{ 0x000077e0, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x000037e1, 0x00000002 },
|
||||
{ 0x040067e1, 0x00000006 },
|
||||
{ 0x000077e0, 0x00000002 },
|
||||
{ 0x000077e1, 0x00000002 },
|
||||
{ 0x000077e1, 0x00000006 },
|
||||
{ 0xffffffff, 0000000000 },
|
||||
{ 0x10000000, 0000000000 },
|
||||
{ 0x0003802a, 0x00000002 },
|
||||
{ 0x040067e0, 0x00000006 },
|
||||
{ 0x00007675, 0x00000002 },
|
||||
{ 0x00007676, 0x00000002 },
|
||||
{ 0x00007677, 0x00000002 },
|
||||
{ 0x00007678, 0x00000006 },
|
||||
{ 0x0003802b, 0x00000002 },
|
||||
{ 0x04002676, 0x00000002 },
|
||||
{ 0x00007677, 0x00000002 },
|
||||
{ 0x00007678, 0x00000006 },
|
||||
{ 0x0000002e, 0x00000018 },
|
||||
{ 0x0000002e, 0x00000018 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x0000002f, 0x00000018 },
|
||||
{ 0x0000002f, 0x00000018 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x01605000, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x00098000, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x64c0603d, 0x00000004 },
|
||||
{ 0x00080000, 0x00000016 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0x0400251d, 0x00000002 },
|
||||
{ 0x00007580, 0x00000002 },
|
||||
{ 0x00067581, 0x00000002 },
|
||||
{ 0x04002580, 0x00000002 },
|
||||
{ 0x00067581, 0x00000002 },
|
||||
{ 0x00000046, 0x00000004 },
|
||||
{ 0x00005000, 0000000000 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x0000750e, 0x00000002 },
|
||||
{ 0x00019000, 0x00000002 },
|
||||
{ 0x00011055, 0x00000014 },
|
||||
{ 0x00000055, 0x00000012 },
|
||||
{ 0x0400250f, 0x00000002 },
|
||||
{ 0x0000504a, 0x00000004 },
|
||||
{ 0x00007565, 0x00000002 },
|
||||
{ 0x00007566, 0x00000002 },
|
||||
{ 0x00000051, 0x00000004 },
|
||||
{ 0x01e655b4, 0x00000002 },
|
||||
{ 0x4401b0dc, 0x00000002 },
|
||||
{ 0x01c110dc, 0x00000002 },
|
||||
{ 0x2666705d, 0x00000018 },
|
||||
{ 0x040c2565, 0x00000002 },
|
||||
{ 0x0000005d, 0x00000018 },
|
||||
{ 0x04002564, 0x00000002 },
|
||||
{ 0x00007566, 0x00000002 },
|
||||
{ 0x00000054, 0x00000004 },
|
||||
{ 0x00401060, 0x00000008 },
|
||||
{ 0x00101000, 0x00000002 },
|
||||
{ 0x000d80ff, 0x00000002 },
|
||||
{ 0x00800063, 0x00000008 },
|
||||
{ 0x000f9000, 0x00000002 },
|
||||
{ 0x000e00ff, 0x00000002 },
|
||||
{ 0000000000, 0x00000006 },
|
||||
{ 0x00000080, 0x00000018 },
|
||||
{ 0x00000054, 0x00000004 },
|
||||
{ 0x00007576, 0x00000002 },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x00009000, 0x00000002 },
|
||||
{ 0x00041000, 0x00000002 },
|
||||
{ 0x0c00350e, 0x00000002 },
|
||||
{ 0x00049000, 0x00000002 },
|
||||
{ 0x00051000, 0x00000002 },
|
||||
{ 0x01e785f8, 0x00000002 },
|
||||
{ 0x00200000, 0x00000002 },
|
||||
{ 0x00600073, 0x0000000c },
|
||||
{ 0x00007563, 0x00000002 },
|
||||
{ 0x006075f0, 0x00000021 },
|
||||
{ 0x20007068, 0x00000004 },
|
||||
{ 0x00005068, 0x00000004 },
|
||||
{ 0x00007576, 0x00000002 },
|
||||
{ 0x00007577, 0x00000002 },
|
||||
{ 0x0000750e, 0x00000002 },
|
||||
{ 0x0000750f, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00600076, 0x0000000c },
|
||||
{ 0x006075f0, 0x00000021 },
|
||||
{ 0x000075f8, 0x00000002 },
|
||||
{ 0x00000076, 0x00000004 },
|
||||
{ 0x000a750e, 0x00000002 },
|
||||
{ 0x0020750f, 0x00000002 },
|
||||
{ 0x00600079, 0x00000004 },
|
||||
{ 0x00007570, 0x00000002 },
|
||||
{ 0x00007571, 0x00000002 },
|
||||
{ 0x00007572, 0x00000006 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00007568, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x00000084, 0x0000000c },
|
||||
{ 0x00058000, 0x00000002 },
|
||||
{ 0x0c607562, 0x00000002 },
|
||||
{ 0x00000086, 0x00000004 },
|
||||
{ 0x00600085, 0x00000004 },
|
||||
{ 0x400070dd, 0000000000 },
|
||||
{ 0x000380dd, 0x00000002 },
|
||||
{ 0x00000093, 0x0000001c },
|
||||
{ 0x00065095, 0x00000018 },
|
||||
{ 0x040025bb, 0x00000002 },
|
||||
{ 0x00061096, 0x00000018 },
|
||||
{ 0x040075bc, 0000000000 },
|
||||
{ 0x000075bb, 0x00000002 },
|
||||
{ 0x000075bc, 0000000000 },
|
||||
{ 0x00090000, 0x00000006 },
|
||||
{ 0x00090000, 0x00000002 },
|
||||
{ 0x000d8002, 0x00000006 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x00007821, 0x00000002 },
|
||||
{ 0x00007800, 0000000000 },
|
||||
{ 0x00007821, 0x00000002 },
|
||||
{ 0x00007800, 0000000000 },
|
||||
{ 0x01665000, 0x00000002 },
|
||||
{ 0x000a0000, 0x00000002 },
|
||||
{ 0x000671cc, 0x00000002 },
|
||||
{ 0x0286f1cd, 0x00000002 },
|
||||
{ 0x000000a3, 0x00000010 },
|
||||
{ 0x21007000, 0000000000 },
|
||||
{ 0x000000aa, 0x0000001c },
|
||||
{ 0x00065000, 0x00000002 },
|
||||
{ 0x000a0000, 0x00000002 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x000b0000, 0x00000002 },
|
||||
{ 0x38067000, 0x00000002 },
|
||||
{ 0x000a00a6, 0x00000004 },
|
||||
{ 0x20007000, 0000000000 },
|
||||
{ 0x01200000, 0x00000002 },
|
||||
{ 0x20077000, 0x00000002 },
|
||||
{ 0x01200000, 0x00000002 },
|
||||
{ 0x20007000, 0000000000 },
|
||||
{ 0x00061000, 0x00000002 },
|
||||
{ 0x0120751b, 0x00000002 },
|
||||
{ 0x8040750a, 0x00000002 },
|
||||
{ 0x8040750b, 0x00000002 },
|
||||
{ 0x00110000, 0x00000002 },
|
||||
{ 0x000380dd, 0x00000002 },
|
||||
{ 0x000000bd, 0x0000001c },
|
||||
{ 0x00061096, 0x00000018 },
|
||||
{ 0x844075bd, 0x00000002 },
|
||||
{ 0x00061095, 0x00000018 },
|
||||
{ 0x840075bb, 0x00000002 },
|
||||
{ 0x00061096, 0x00000018 },
|
||||
{ 0x844075bc, 0x00000002 },
|
||||
{ 0x000000c0, 0x00000004 },
|
||||
{ 0x804075bd, 0x00000002 },
|
||||
{ 0x800075bb, 0x00000002 },
|
||||
{ 0x804075bc, 0x00000002 },
|
||||
{ 0x00108000, 0x00000002 },
|
||||
{ 0x01400000, 0x00000002 },
|
||||
{ 0x006000c4, 0x0000000c },
|
||||
{ 0x20c07000, 0x00000020 },
|
||||
{ 0x000000c6, 0x00000012 },
|
||||
{ 0x00800000, 0x00000006 },
|
||||
{ 0x0080751d, 0x00000006 },
|
||||
{ 0x000025bb, 0x00000002 },
|
||||
{ 0x000040c0, 0x00000004 },
|
||||
{ 0x0000775c, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00661000, 0x00000002 },
|
||||
{ 0x0460275d, 0x00000020 },
|
||||
{ 0x00004000, 0000000000 },
|
||||
{ 0x00007999, 0x00000002 },
|
||||
{ 0x00a05000, 0x00000002 },
|
||||
{ 0x00661000, 0x00000002 },
|
||||
{ 0x0460299b, 0x00000020 },
|
||||
{ 0x00004000, 0000000000 },
|
||||
{ 0x01e00830, 0x00000002 },
|
||||
{ 0x21007000, 0000000000 },
|
||||
{ 0x00005000, 0x00000002 },
|
||||
{ 0x00038042, 0x00000002 },
|
||||
{ 0x040025e0, 0x00000002 },
|
||||
{ 0x000075e1, 0000000000 },
|
||||
{ 0x00000001, 0000000000 },
|
||||
{ 0x000380d9, 0x00000002 },
|
||||
{ 0x04007394, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
};
|
||||
|
||||
/* Microcode from http://volodya-project.sourceforge.net/ */
|
||||
|
||||
CARD32 r300_cp_microcode[][2] = {
|
||||
{ 0x4200e000, 0000000000 },
|
||||
{ 0x4000e000, 0000000000 },
|
||||
{ 0x000000af, 0x00000008 },
|
||||
{ 0x000000b3, 0x00000008 },
|
||||
{ 0x6c5a504f, 0000000000 },
|
||||
{ 0x4f4f497a, 0000000000 },
|
||||
{ 0x5a578288, 0000000000 },
|
||||
{ 0x4f91906a, 0000000000 },
|
||||
{ 0x4f4f4f4f, 0000000000 },
|
||||
{ 0x4fe24f44, 0000000000 },
|
||||
{ 0x4f9c9c9c, 0000000000 },
|
||||
{ 0xdc4f4fde, 0000000000 },
|
||||
{ 0xa1cd4f4f, 0000000000 },
|
||||
{ 0xd29d9d9d, 0000000000 },
|
||||
{ 0x4f0f9fd7, 0000000000 },
|
||||
{ 0x000ca000, 0x00000004 },
|
||||
{ 0x000d0012, 0x00000038 },
|
||||
{ 0x0000e8b4, 0x00000004 },
|
||||
{ 0x000d0014, 0x00000038 },
|
||||
{ 0x0000e8b6, 0x00000004 },
|
||||
{ 0x000d0016, 0x00000038 },
|
||||
{ 0x0000e854, 0x00000004 },
|
||||
{ 0x000d0018, 0x00000038 },
|
||||
{ 0x0000e855, 0x00000004 },
|
||||
{ 0x000d001a, 0x00000038 },
|
||||
{ 0x0000e856, 0x00000004 },
|
||||
{ 0x000d001c, 0x00000038 },
|
||||
{ 0x0000e857, 0x00000004 },
|
||||
{ 0x000d001e, 0x00000038 },
|
||||
{ 0x0000e824, 0x00000004 },
|
||||
{ 0x000d0020, 0x00000038 },
|
||||
{ 0x0000e825, 0x00000004 },
|
||||
{ 0x000d0022, 0x00000038 },
|
||||
{ 0x0000e830, 0x00000004 },
|
||||
{ 0x000d0024, 0x00000038 },
|
||||
{ 0x0000f0c0, 0x00000004 },
|
||||
{ 0x000d0026, 0x00000038 },
|
||||
{ 0x0000f0c1, 0x00000004 },
|
||||
{ 0x000d0028, 0x00000038 },
|
||||
{ 0x0000f041, 0x00000004 },
|
||||
{ 0x000d002a, 0x00000038 },
|
||||
{ 0x0000f184, 0x00000004 },
|
||||
{ 0x000d002c, 0x00000038 },
|
||||
{ 0x0000f185, 0x00000004 },
|
||||
{ 0x000d002e, 0x00000038 },
|
||||
{ 0x0000f186, 0x00000004 },
|
||||
{ 0x000d0030, 0x00000038 },
|
||||
{ 0x0000f187, 0x00000004 },
|
||||
{ 0x000d0032, 0x00000038 },
|
||||
{ 0x0000f180, 0x00000004 },
|
||||
{ 0x000d0034, 0x00000038 },
|
||||
{ 0x0000f393, 0x00000004 },
|
||||
{ 0x000d0036, 0x00000038 },
|
||||
{ 0x0000f38a, 0x00000004 },
|
||||
{ 0x000d0038, 0x00000038 },
|
||||
{ 0x0000f38e, 0x00000004 },
|
||||
{ 0x0000e821, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x00000043, 0x00000018 },
|
||||
{ 0x00cce800, 0x00000004 },
|
||||
{ 0x001b0001, 0x00000004 },
|
||||
{ 0x08004800, 0x00000004 },
|
||||
{ 0x001b0001, 0x00000004 },
|
||||
{ 0x08004800, 0x00000004 },
|
||||
{ 0x001b0001, 0x00000004 },
|
||||
{ 0x08004800, 0x00000004 },
|
||||
{ 0x0000003a, 0x00000008 },
|
||||
{ 0x0000a000, 0000000000 },
|
||||
{ 0x02c0a000, 0x00000004 },
|
||||
{ 0x000ca000, 0x00000004 },
|
||||
{ 0x00130000, 0x00000004 },
|
||||
{ 0x000c2000, 0x00000004 },
|
||||
{ 0xc980c045, 0x00000008 },
|
||||
{ 0x2000451d, 0x00000004 },
|
||||
{ 0x0000e580, 0x00000004 },
|
||||
{ 0x000ce581, 0x00000004 },
|
||||
{ 0x08004580, 0x00000004 },
|
||||
{ 0x000ce581, 0x00000004 },
|
||||
{ 0x0000004c, 0x00000008 },
|
||||
{ 0x0000a000, 0000000000 },
|
||||
{ 0x000c2000, 0x00000004 },
|
||||
{ 0x0000e50e, 0x00000004 },
|
||||
{ 0x00032000, 0x00000004 },
|
||||
{ 0x00022056, 0x00000028 },
|
||||
{ 0x00000056, 0x00000024 },
|
||||
{ 0x0800450f, 0x00000004 },
|
||||
{ 0x0000a050, 0x00000008 },
|
||||
{ 0x0000e565, 0x00000004 },
|
||||
{ 0x0000e566, 0x00000004 },
|
||||
{ 0x00000057, 0x00000008 },
|
||||
{ 0x03cca5b4, 0x00000004 },
|
||||
{ 0x05432000, 0x00000004 },
|
||||
{ 0x00022000, 0x00000004 },
|
||||
{ 0x4ccce063, 0x00000030 },
|
||||
{ 0x08274565, 0x00000004 },
|
||||
{ 0x00000063, 0x00000030 },
|
||||
{ 0x08004564, 0x00000004 },
|
||||
{ 0x0000e566, 0x00000004 },
|
||||
{ 0x0000005a, 0x00000008 },
|
||||
{ 0x00802066, 0x00000010 },
|
||||
{ 0x00202000, 0x00000004 },
|
||||
{ 0x001b00ff, 0x00000004 },
|
||||
{ 0x01000069, 0x00000010 },
|
||||
{ 0x001f2000, 0x00000004 },
|
||||
{ 0x001c00ff, 0x00000004 },
|
||||
{ 0000000000, 0x0000000c },
|
||||
{ 0x00000085, 0x00000030 },
|
||||
{ 0x0000005a, 0x00000008 },
|
||||
{ 0x0000e576, 0x00000004 },
|
||||
{ 0x000ca000, 0x00000004 },
|
||||
{ 0x00012000, 0x00000004 },
|
||||
{ 0x00082000, 0x00000004 },
|
||||
{ 0x1800650e, 0x00000004 },
|
||||
{ 0x00092000, 0x00000004 },
|
||||
{ 0x000a2000, 0x00000004 },
|
||||
{ 0x000f0000, 0x00000004 },
|
||||
{ 0x00400000, 0x00000004 },
|
||||
{ 0x00000079, 0x00000018 },
|
||||
{ 0x0000e563, 0x00000004 },
|
||||
{ 0x00c0e5f9, 0x000000c2 },
|
||||
{ 0x0000006e, 0x00000008 },
|
||||
{ 0x0000a06e, 0x00000008 },
|
||||
{ 0x0000e576, 0x00000004 },
|
||||
{ 0x0000e577, 0x00000004 },
|
||||
{ 0x0000e50e, 0x00000004 },
|
||||
{ 0x0000e50f, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x0000007c, 0x00000018 },
|
||||
{ 0x00c0e5f9, 0x000000c2 },
|
||||
{ 0x0000007c, 0x00000008 },
|
||||
{ 0x0014e50e, 0x00000004 },
|
||||
{ 0x0040e50f, 0x00000004 },
|
||||
{ 0x00c0007f, 0x00000008 },
|
||||
{ 0x0000e570, 0x00000004 },
|
||||
{ 0x0000e571, 0x00000004 },
|
||||
{ 0x0000e572, 0x0000000c },
|
||||
{ 0x0000a000, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x0000e568, 0x00000004 },
|
||||
{ 0x000c2000, 0x00000004 },
|
||||
{ 0x00000089, 0x00000018 },
|
||||
{ 0x000b0000, 0x00000004 },
|
||||
{ 0x18c0e562, 0x00000004 },
|
||||
{ 0x0000008b, 0x00000008 },
|
||||
{ 0x00c0008a, 0x00000008 },
|
||||
{ 0x000700e4, 0x00000004 },
|
||||
{ 0x00000097, 0x00000038 },
|
||||
{ 0x000ca099, 0x00000030 },
|
||||
{ 0x080045bb, 0x00000004 },
|
||||
{ 0x000c209a, 0x00000030 },
|
||||
{ 0x0800e5bc, 0000000000 },
|
||||
{ 0x0000e5bb, 0x00000004 },
|
||||
{ 0x0000e5bc, 0000000000 },
|
||||
{ 0x00120000, 0x0000000c },
|
||||
{ 0x00120000, 0x00000004 },
|
||||
{ 0x001b0002, 0x0000000c },
|
||||
{ 0x0000a000, 0x00000004 },
|
||||
{ 0x0000e821, 0x00000004 },
|
||||
{ 0x0000e800, 0000000000 },
|
||||
{ 0x0000e821, 0x00000004 },
|
||||
{ 0x0000e82e, 0000000000 },
|
||||
{ 0x02cca000, 0x00000004 },
|
||||
{ 0x00140000, 0x00000004 },
|
||||
{ 0x000ce1cc, 0x00000004 },
|
||||
{ 0x050de1cd, 0x00000004 },
|
||||
{ 0x000000a7, 0x00000020 },
|
||||
{ 0x4200e000, 0000000000 },
|
||||
{ 0x000000ae, 0x00000038 },
|
||||
{ 0x000ca000, 0x00000004 },
|
||||
{ 0x00140000, 0x00000004 },
|
||||
{ 0x000c2000, 0x00000004 },
|
||||
{ 0x00160000, 0x00000004 },
|
||||
{ 0x700ce000, 0x00000004 },
|
||||
{ 0x001400aa, 0x00000008 },
|
||||
{ 0x4000e000, 0000000000 },
|
||||
{ 0x02400000, 0x00000004 },
|
||||
{ 0x400ee000, 0x00000004 },
|
||||
{ 0x02400000, 0x00000004 },
|
||||
{ 0x4000e000, 0000000000 },
|
||||
{ 0x000c2000, 0x00000004 },
|
||||
{ 0x0240e51b, 0x00000004 },
|
||||
{ 0x0080e50a, 0x00000005 },
|
||||
{ 0x0080e50b, 0x00000005 },
|
||||
{ 0x00220000, 0x00000004 },
|
||||
{ 0x000700e4, 0x00000004 },
|
||||
{ 0x000000c1, 0x00000038 },
|
||||
{ 0x000c209a, 0x00000030 },
|
||||
{ 0x0880e5bd, 0x00000005 },
|
||||
{ 0x000c2099, 0x00000030 },
|
||||
{ 0x0800e5bb, 0x00000005 },
|
||||
{ 0x000c209a, 0x00000030 },
|
||||
{ 0x0880e5bc, 0x00000005 },
|
||||
{ 0x000000c4, 0x00000008 },
|
||||
{ 0x0080e5bd, 0x00000005 },
|
||||
{ 0x0000e5bb, 0x00000005 },
|
||||
{ 0x0080e5bc, 0x00000005 },
|
||||
{ 0x00210000, 0x00000004 },
|
||||
{ 0x02800000, 0x00000004 },
|
||||
{ 0x00c000c8, 0x00000018 },
|
||||
{ 0x4180e000, 0x00000040 },
|
||||
{ 0x000000ca, 0x00000024 },
|
||||
{ 0x01000000, 0x0000000c },
|
||||
{ 0x0100e51d, 0x0000000c },
|
||||
{ 0x000045bb, 0x00000004 },
|
||||
{ 0x000080c4, 0x00000008 },
|
||||
{ 0x0000f3ce, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x00cc2000, 0x00000004 },
|
||||
{ 0x08c053cf, 0x00000040 },
|
||||
{ 0x00008000, 0000000000 },
|
||||
{ 0x0000f3d2, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x00cc2000, 0x00000004 },
|
||||
{ 0x08c053d3, 0x00000040 },
|
||||
{ 0x00008000, 0000000000 },
|
||||
{ 0x0000f39d, 0x00000004 },
|
||||
{ 0x0140a000, 0x00000004 },
|
||||
{ 0x00cc2000, 0x00000004 },
|
||||
{ 0x08c0539e, 0x00000040 },
|
||||
{ 0x00008000, 0000000000 },
|
||||
{ 0x03c00830, 0x00000004 },
|
||||
{ 0x4200e000, 0000000000 },
|
||||
{ 0x0000a000, 0x00000004 },
|
||||
{ 0x200045e0, 0x00000004 },
|
||||
{ 0x0000e5e1, 0000000000 },
|
||||
{ 0x00000001, 0000000000 },
|
||||
{ 0x000700e1, 0x00000004 },
|
||||
{ 0x0800e394, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
{ 0000000000, 0000000000 },
|
||||
};
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,42 +0,0 @@
|
|||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef _ATI_SAREA_H_
|
||||
#define _ATI_SAREA_H_
|
||||
|
||||
/* There are 2 heaps (local/AGP). Each region within a heap is a
|
||||
* minimum of 64k, and there are at most 64 of them per heap.
|
||||
*/
|
||||
#define ATI_CARD_HEAP 0
|
||||
#define ATI_GART_HEAP 1
|
||||
#define ATI_NR_TEX_HEAPS 2
|
||||
#define ATI_NR_TEX_REGIONS 64
|
||||
#define ATI_LOG_TEX_GRANULARITY 16
|
||||
|
||||
#include "r128_sarea.h"
|
||||
#include "radeon_sarea.h"
|
||||
|
||||
#endif /* _ATI_SAREA_H_ */
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "klinux.h"
|
||||
|
||||
extern struct pci_id_entry ati_pci_ids[];
|
||||
|
||||
void
|
||||
InitCard(char *name)
|
||||
{
|
||||
struct pci_id_entry *id;
|
||||
KdCardAttr attr;
|
||||
|
||||
for (id = ati_pci_ids; id->name != NULL; id++) {
|
||||
int j = 0;
|
||||
while (LinuxFindPci(id->vendor, id->device, j++, &attr))
|
||||
KdCardInfoAdd(&ATIFuncs, &attr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput(pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput(int argc, char **argv)
|
||||
{
|
||||
KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg();
|
||||
#ifdef KDRIVEVESA
|
||||
vesaUseMsg();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument(int argc, char **argv, int i)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef KDRIVEVESA
|
||||
if (!(ret = vesaProcessArgument (argc, argv, i)))
|
||||
#endif
|
||||
ret = KdProcessArgument(argc, argv, i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,950 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Based on mach64video.c by Keith Packard.
|
||||
*/
|
||||
/* $RCSId$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "ati_dma.h"
|
||||
#include "ati_draw.h"
|
||||
#include "ati_reg.h"
|
||||
#include "kaa.h"
|
||||
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include "fourcc.h"
|
||||
|
||||
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
|
||||
|
||||
static Atom xvBrightness, xvSaturation;
|
||||
|
||||
extern CARD8 ATIBltRop[16];
|
||||
|
||||
#define IMAGE_MAX_WIDTH 2048
|
||||
#define IMAGE_MAX_HEIGHT 2048
|
||||
|
||||
static void
|
||||
ATIStopVideo(KdScreenInfo *screen, pointer data, Bool exit)
|
||||
{
|
||||
ScreenPtr pScreen = screen->pScreen;
|
||||
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
|
||||
|
||||
REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
|
||||
|
||||
if (pPortPriv->off_screen) {
|
||||
KdOffscreenFree (pScreen, pPortPriv->off_screen);
|
||||
pPortPriv->off_screen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ATISetPortAttribute(KdScreenInfo *screen, Atom attribute, int value,
|
||||
pointer data)
|
||||
{
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
static int
|
||||
ATIGetPortAttribute(KdScreenInfo *screen, Atom attribute, int *value,
|
||||
pointer data)
|
||||
{
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
static void
|
||||
ATIQueryBestSize(KdScreenInfo *screen, Bool motion, short vid_w, short vid_h,
|
||||
short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h,
|
||||
pointer data)
|
||||
{
|
||||
*p_w = drw_w;
|
||||
*p_h = drw_h;
|
||||
}
|
||||
|
||||
/* ATIClipVideo -
|
||||
|
||||
Takes the dst box in standard X BoxRec form (top and left
|
||||
edges inclusive, bottom and right exclusive). The new dst
|
||||
box is returned. The source boundaries are given (x1, y1
|
||||
inclusive, x2, y2 exclusive) and returned are the new source
|
||||
boundaries in 16.16 fixed point.
|
||||
*/
|
||||
|
||||
static void
|
||||
ATIClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2,
|
||||
BoxPtr extents, INT32 width, INT32 height)
|
||||
{
|
||||
INT32 vscale, hscale, delta;
|
||||
int diff;
|
||||
|
||||
hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
|
||||
vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
|
||||
|
||||
*x1 <<= 16; *x2 <<= 16;
|
||||
*y1 <<= 16; *y2 <<= 16;
|
||||
|
||||
diff = extents->x1 - dst->x1;
|
||||
if (diff > 0) {
|
||||
dst->x1 = extents->x1;
|
||||
*x1 += diff * hscale;
|
||||
}
|
||||
diff = dst->x2 - extents->x2;
|
||||
if (diff > 0) {
|
||||
dst->x2 = extents->x2;
|
||||
*x2 -= diff * hscale;
|
||||
}
|
||||
diff = extents->y1 - dst->y1;
|
||||
if (diff > 0) {
|
||||
dst->y1 = extents->y1;
|
||||
*y1 += diff * vscale;
|
||||
}
|
||||
diff = dst->y2 - extents->y2;
|
||||
if (diff > 0) {
|
||||
dst->y2 = extents->y2;
|
||||
*y2 -= diff * vscale;
|
||||
}
|
||||
|
||||
if (*x1 < 0) {
|
||||
diff = (- *x1 + hscale - 1)/ hscale;
|
||||
dst->x1 += diff;
|
||||
*x1 += diff * hscale;
|
||||
}
|
||||
delta = *x2 - (width << 16);
|
||||
if (delta > 0) {
|
||||
diff = (delta + hscale - 1)/ hscale;
|
||||
dst->x2 -= diff;
|
||||
*x2 -= diff * hscale;
|
||||
}
|
||||
if (*y1 < 0) {
|
||||
diff = (- *y1 + vscale - 1)/ vscale;
|
||||
dst->y1 += diff;
|
||||
*y1 += diff * vscale;
|
||||
}
|
||||
delta = *y2 - (height << 16);
|
||||
if (delta > 0) {
|
||||
diff = (delta + vscale - 1)/ vscale;
|
||||
dst->y2 -= diff;
|
||||
*y2 -= diff * vscale;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
|
||||
{
|
||||
ScreenPtr pScreen = screen->pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 dstDatatype, srcDatatype;
|
||||
CARD32 dst_offset, dst_pitch;
|
||||
int dstxoff, dstyoff;
|
||||
PixmapPtr pPixmap = pPortPriv->pPixmap;
|
||||
int bpp = pPixmap->drawable.bitsPerPixel;
|
||||
RING_LOCALS;
|
||||
|
||||
BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
|
||||
int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
|
||||
|
||||
if (pPortPriv->id == FOURCC_UYVY)
|
||||
srcDatatype = R128_DATATYPE_YVYU_422;
|
||||
else
|
||||
srcDatatype = R128_DATATYPE_VYUY_422;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 16:
|
||||
if (pPixmap->drawable.depth == 15)
|
||||
dstDatatype = R128_DATATYPE_ARGB1555;
|
||||
else
|
||||
dstDatatype = R128_DATATYPE_RGB565;
|
||||
break;
|
||||
case 32:
|
||||
dstDatatype = R128_DATATYPE_ARGB8888;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
dst_pitch = pPixmap->devKind;
|
||||
#ifdef COMPOSITE
|
||||
dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
|
||||
dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
|
||||
#else
|
||||
dstxoff = 0;
|
||||
dstyoff = 0;
|
||||
#endif
|
||||
|
||||
BEGIN_DMA(18);
|
||||
OUT_REG(ATI_REG_DST_PITCH_OFFSET,
|
||||
((dst_pitch / bpp) << 21) | (dst_offset >> 5));
|
||||
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
|
||||
ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_NONE |
|
||||
(dstDatatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATIBltRop[GXcopy] << 16) |
|
||||
R128_GMC_3D_FCN_EN |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS);
|
||||
OUT_REG(ATI_REG_DP_CNTL,
|
||||
ATI_DST_X_LEFT_TO_RIGHT | ATI_DST_Y_TOP_TO_BOTTOM );
|
||||
OUT_REG(R128_REG_SCALE_3D_CNTL,
|
||||
R128_SCALE_3D_SCALE |
|
||||
R128_SBLEND_ONE |
|
||||
R128_DBLEND_ZERO);
|
||||
OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_CACHE_FLUSH);
|
||||
OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
|
||||
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_PITCH, 5));
|
||||
OUT_RING(pPortPriv->src_pitch / 16);
|
||||
OUT_RING((pPortPriv->src_w << 16) / pPortPriv->dst_w);
|
||||
OUT_RING((pPortPriv->src_h << 16) / pPortPriv->dst_h);
|
||||
OUT_RING(0x0);
|
||||
OUT_RING(0x0);
|
||||
|
||||
END_DMA();
|
||||
|
||||
while (nBox--) {
|
||||
int srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
|
||||
|
||||
dstX = pBox->x1 + dstxoff;
|
||||
dstY = pBox->y1 + dstyoff;
|
||||
dstw = pBox->x2 - pBox->x1;
|
||||
dsth = pBox->y2 - pBox->y1;
|
||||
srcX = (pBox->x1 - pPortPriv->dst_x1) *
|
||||
pPortPriv->src_w / pPortPriv->dst_w;
|
||||
srcY = (pBox->y1 - pPortPriv->dst_y1) *
|
||||
pPortPriv->src_h / pPortPriv->dst_h;
|
||||
srcw = pPortPriv->src_w - srcX;
|
||||
srch = pPortPriv->src_h - srcY;
|
||||
|
||||
BEGIN_DMA(6);
|
||||
/* R128_REG_SCALE_SRC_HEIGHT_WIDTH,
|
||||
* R128_REG_SCALE_OFFSET_0
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_SRC_HEIGHT_WIDTH, 2));
|
||||
OUT_RING((srch << 16) | srcw);
|
||||
OUT_RING(pPortPriv->src_offset + srcY * pPortPriv->src_pitch +
|
||||
srcX * 2);
|
||||
/* R128_REG_SCALE_DST_X_Y
|
||||
* R128_REG_SCALE_DST_HEIGHT_WIDTH
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_DST_X_Y, 2));
|
||||
OUT_RING((dstX << 16) | dstY);
|
||||
OUT_RING((dsth << 16) | dstw);
|
||||
END_DMA();
|
||||
pBox++;
|
||||
}
|
||||
#ifdef DAMAGEEXT
|
||||
/* XXX: Shouldn't this be in kxv.c instead? */
|
||||
DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
|
||||
#endif
|
||||
KdMarkSync(pScreen);
|
||||
}
|
||||
|
||||
union intfloat {
|
||||
float f;
|
||||
CARD32 i;
|
||||
};
|
||||
|
||||
struct blend_vertex {
|
||||
union intfloat x, y;
|
||||
union intfloat s0, t0;
|
||||
};
|
||||
|
||||
#define VTX_DWORD_COUNT 4
|
||||
|
||||
#define VTX_OUT(vtx) \
|
||||
do { \
|
||||
OUT_RING(vtx.x.i); \
|
||||
OUT_RING(vtx.y.i); \
|
||||
OUT_RING(vtx.s0.i); \
|
||||
OUT_RING(vtx.t0.i); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
|
||||
{
|
||||
ScreenPtr pScreen = screen->pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
struct blend_vertex vtx[4];
|
||||
PixmapPtr pPixmap = pPortPriv->pPixmap;
|
||||
CARD32 txformat;
|
||||
CARD32 dst_offset, dst_pitch, dst_format;
|
||||
int dstxoff, dstyoff, pixel_shift;
|
||||
RING_LOCALS;
|
||||
|
||||
BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
|
||||
int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
|
||||
|
||||
switch (pPixmap->drawable.bitsPerPixel)
|
||||
{
|
||||
case 16:
|
||||
if (pPixmap->drawable.depth == 15)
|
||||
dst_format = RADEON_COLOR_FORMAT_ARGB1555;
|
||||
else
|
||||
dst_format = RADEON_COLOR_FORMAT_RGB565;
|
||||
pixel_shift = 1;
|
||||
break;
|
||||
case 32:
|
||||
dst_format = RADEON_COLOR_FORMAT_ARGB8888;
|
||||
pixel_shift = 2;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
dst_pitch = pPixmap->devKind;
|
||||
|
||||
#ifdef COMPOSITE
|
||||
dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
|
||||
dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
|
||||
#else
|
||||
dstxoff = 0;
|
||||
dstyoff = 0;
|
||||
#endif
|
||||
|
||||
if (pPortPriv->id == FOURCC_UYVY)
|
||||
txformat = RADEON_TXFORMAT_YVYU422;
|
||||
else
|
||||
txformat = RADEON_TXFORMAT_VYUY422;
|
||||
|
||||
txformat |= RADEON_TXFORMAT_NON_POWER2;
|
||||
|
||||
/* RADEON_REG_PP_TXFILTER_0,
|
||||
* RADEON_REG_PP_TXFORMAT_0,
|
||||
* RADEON_REG_PP_TXOFFSET_0
|
||||
*/
|
||||
BEGIN_DMA(4);
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 3));
|
||||
OUT_RING(RADEON_YUV_TO_RGB);
|
||||
OUT_RING(txformat);
|
||||
OUT_RING(pPortPriv->src_offset);
|
||||
END_DMA();
|
||||
|
||||
/* RADEON_REG_PP_TEX_SIZE_0,
|
||||
* RADEON_REG_PP_TEX_PITCH_0
|
||||
*/
|
||||
BEGIN_DMA(3);
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2));
|
||||
OUT_RING((pPixmap->drawable.width - 1) |
|
||||
((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
|
||||
OUT_RING(pPortPriv->src_pitch - 32);
|
||||
END_DMA();
|
||||
|
||||
BEGIN_DMA(14);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
|
||||
|
||||
/* RADEON_REG_PP_CNTL,
|
||||
* RADEON_REG_RB3D_CNTL,
|
||||
* RADEON_REG_RB3D_COLOROFFSET
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
|
||||
OUT_RING(RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
|
||||
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
|
||||
OUT_RING(dst_offset);
|
||||
|
||||
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
|
||||
|
||||
OUT_REG(RADEON_REG_PP_TXCBLEND_0,
|
||||
RADEON_COLOR_ARG_A_ZERO |
|
||||
RADEON_COLOR_ARG_B_ZERO |
|
||||
RADEON_COLOR_ARG_C_T0_COLOR |
|
||||
RADEON_BLEND_CTL_ADD |
|
||||
RADEON_CLAMP_TX);
|
||||
OUT_REG(RADEON_REG_PP_TXABLEND_0,
|
||||
RADEON_ALPHA_ARG_A_ZERO |
|
||||
RADEON_ALPHA_ARG_B_ZERO |
|
||||
RADEON_ALPHA_ARG_C_T0_ALPHA |
|
||||
RADEON_BLEND_CTL_ADD |
|
||||
RADEON_CLAMP_TX);
|
||||
|
||||
OUT_REG(RADEON_REG_RB3D_BLENDCNTL,
|
||||
RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO);
|
||||
|
||||
END_DMA();
|
||||
|
||||
while (nBox--) {
|
||||
float srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
|
||||
|
||||
dstX = pBox->x1 + dstxoff;
|
||||
dstY = pBox->y1 + dstyoff;
|
||||
dstw = pBox->x2 - pBox->x1;
|
||||
dsth = pBox->y2 - pBox->y1;
|
||||
srcX = (pBox->x1 - pPortPriv->dst_x1) *
|
||||
pPortPriv->src_w / pPortPriv->dst_w;
|
||||
srcY = (pBox->y1 - pPortPriv->dst_y1) *
|
||||
pPortPriv->src_h / pPortPriv->dst_h;
|
||||
srcw = pPortPriv->src_w * (dstw / pPortPriv->dst_w);
|
||||
srch = pPortPriv->src_h * (dsth / pPortPriv->dst_h);
|
||||
|
||||
vtx[0].x.f = dstX;
|
||||
vtx[0].y.f = dstY;
|
||||
vtx[0].s0.f = srcX;
|
||||
vtx[0].t0.f = srcY;
|
||||
|
||||
vtx[1].x.f = dstX;
|
||||
vtx[1].y.f = dstY + dsth;
|
||||
vtx[1].s0.f = srcX;
|
||||
vtx[1].t0.f = srcY + srch;
|
||||
|
||||
vtx[2].x.f = dstX + dstw;
|
||||
vtx[2].y.f = dstY + dsth;
|
||||
vtx[2].s0.f = srcX + srcw;
|
||||
vtx[2].t0.f = srcY + srch;
|
||||
|
||||
vtx[3].x.f = dstX + dstw;
|
||||
vtx[3].y.f = dstY;
|
||||
vtx[3].s0.f = srcX + srcw;
|
||||
vtx[3].t0.f = srcY;
|
||||
|
||||
if (atic->is_r100) {
|
||||
BEGIN_DMA(4 * VTX_DWORD_COUNT + 3);
|
||||
OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
|
||||
4 * VTX_DWORD_COUNT + 2));
|
||||
OUT_RING(RADEON_CP_VC_FRMT_XY |
|
||||
RADEON_CP_VC_FRMT_ST0);
|
||||
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
|
||||
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
|
||||
RADEON_CP_VC_CNTL_MAOS_ENABLE |
|
||||
RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
|
||||
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
|
||||
} else {
|
||||
BEGIN_DMA(4 * VTX_DWORD_COUNT + 2);
|
||||
OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
|
||||
4 * VTX_DWORD_COUNT + 1));
|
||||
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
|
||||
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
|
||||
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
|
||||
}
|
||||
|
||||
VTX_OUT(vtx[0]);
|
||||
VTX_OUT(vtx[1]);
|
||||
VTX_OUT(vtx[2]);
|
||||
VTX_OUT(vtx[3]);
|
||||
|
||||
END_DMA();
|
||||
|
||||
pBox++;
|
||||
}
|
||||
#ifdef DAMAGEEXT
|
||||
/* XXX: Shouldn't this be in kxv.c instead? */
|
||||
DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
|
||||
#endif
|
||||
KdMarkSync(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
ATIVideoSave(ScreenPtr pScreen, KdOffscreenArea *area)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATIPortPrivPtr pPortPriv = atis->pAdaptor->pPortPrivates[0].ptr;
|
||||
|
||||
if (pPortPriv->off_screen == area)
|
||||
pPortPriv->off_screen = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ATIPutImage(KdScreenInfo *screen, DrawablePtr pDraw,
|
||||
short src_x, short src_y,
|
||||
short drw_x, short drw_y,
|
||||
short src_w, short src_h,
|
||||
short drw_w, short drw_h,
|
||||
int id,
|
||||
unsigned char *buf,
|
||||
short width,
|
||||
short height,
|
||||
Bool sync,
|
||||
RegionPtr clipBoxes,
|
||||
pointer data)
|
||||
{
|
||||
ScreenPtr pScreen = screen->pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
|
||||
char *mmio = atic->reg_base;
|
||||
INT32 x1, x2, y1, y2;
|
||||
int randr = RR_Rotate_0 /* XXX */;
|
||||
int srcPitch, srcPitch2, dstPitch;
|
||||
int top, left, npixels, nlines, size;
|
||||
BoxRec dstBox;
|
||||
int dst_width = width, dst_height = height;
|
||||
int rot_x1, rot_y1, rot_x2, rot_y2;
|
||||
int dst_x1, dst_y1, dst_x2, dst_y2;
|
||||
int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
|
||||
|
||||
/* Clip */
|
||||
x1 = src_x;
|
||||
x2 = src_x + src_w;
|
||||
y1 = src_y;
|
||||
y2 = src_y + src_h;
|
||||
|
||||
dstBox.x1 = drw_x;
|
||||
dstBox.x2 = drw_x + drw_w;
|
||||
dstBox.y1 = drw_y;
|
||||
dstBox.y2 = drw_y + drw_h;
|
||||
|
||||
ATIClipVideo(&dstBox, &x1, &x2, &y1, &y2,
|
||||
REGION_EXTENTS(pScreen, clipBoxes), width, height);
|
||||
|
||||
src_w = (x2 - x1) >> 16;
|
||||
src_h = (y2 - y1) >> 16;
|
||||
drw_w = dstBox.x2 - dstBox.x1;
|
||||
drw_h = dstBox.y2 - dstBox.y1;
|
||||
|
||||
if ((x1 >= x2) || (y1 >= y2))
|
||||
return Success;
|
||||
|
||||
if (mmio == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
if (randr & (RR_Rotate_0|RR_Rotate_180)) {
|
||||
dst_width = width;
|
||||
dst_height = height;
|
||||
rot_src_w = src_w;
|
||||
rot_src_h = src_h;
|
||||
rot_drw_w = drw_w;
|
||||
rot_drw_h = drw_h;
|
||||
} else {
|
||||
dst_width = height;
|
||||
dst_height = width;
|
||||
rot_src_w = src_h;
|
||||
rot_src_h = src_w;
|
||||
rot_drw_w = drw_h;
|
||||
rot_drw_h = drw_w;
|
||||
}
|
||||
|
||||
switch (randr & RR_Rotate_All) {
|
||||
case RR_Rotate_0:
|
||||
default:
|
||||
dst_x1 = dstBox.x1;
|
||||
dst_y1 = dstBox.y1;
|
||||
dst_x2 = dstBox.x2;
|
||||
dst_y2 = dstBox.y2;
|
||||
rot_x1 = x1;
|
||||
rot_y1 = y1;
|
||||
rot_x2 = x2;
|
||||
rot_y2 = y2;
|
||||
break;
|
||||
case RR_Rotate_90:
|
||||
dst_x1 = dstBox.y1;
|
||||
dst_y1 = screen->height - dstBox.x2;
|
||||
dst_x2 = dstBox.y2;
|
||||
dst_y2 = screen->height - dstBox.x1;
|
||||
rot_x1 = y1;
|
||||
rot_y1 = (src_w << 16) - x2;
|
||||
rot_x2 = y2;
|
||||
rot_y2 = (src_w << 16) - x1;
|
||||
break;
|
||||
case RR_Rotate_180:
|
||||
dst_x1 = screen->width - dstBox.x2;
|
||||
dst_y1 = screen->height - dstBox.y2;
|
||||
dst_x2 = screen->width - dstBox.x1;
|
||||
dst_y2 = screen->height - dstBox.y1;
|
||||
rot_x1 = (src_w << 16) - x2;
|
||||
rot_y1 = (src_h << 16) - y2;
|
||||
rot_x2 = (src_w << 16) - x1;
|
||||
rot_y2 = (src_h << 16) - y1;
|
||||
break;
|
||||
case RR_Rotate_270:
|
||||
dst_x1 = screen->width - dstBox.y2;
|
||||
dst_y1 = dstBox.x1;
|
||||
dst_x2 = screen->width - dstBox.y1;
|
||||
dst_y2 = dstBox.x2;
|
||||
rot_x1 = (src_h << 16) - y2;
|
||||
rot_y1 = x1;
|
||||
rot_x2 = (src_h << 16) - y1;
|
||||
rot_y2 = x2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(id) {
|
||||
case FOURCC_YV12:
|
||||
case FOURCC_I420:
|
||||
dstPitch = ((dst_width << 1) + 15) & ~15;
|
||||
srcPitch = (width + 3) & ~3;
|
||||
srcPitch2 = ((width >> 1) + 3) & ~3;
|
||||
size = dstPitch * dst_height;
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
case FOURCC_YUY2:
|
||||
default:
|
||||
dstPitch = ((dst_width << 1) + 15) & ~15;
|
||||
srcPitch = (width << 1);
|
||||
srcPitch2 = 0;
|
||||
size = dstPitch * dst_height;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pPortPriv->off_screen != NULL && size != pPortPriv->size) {
|
||||
KdOffscreenFree(screen->pScreen, pPortPriv->off_screen);
|
||||
pPortPriv->off_screen = 0;
|
||||
}
|
||||
|
||||
if (pPortPriv->off_screen == NULL) {
|
||||
pPortPriv->off_screen = KdOffscreenAlloc(screen->pScreen,
|
||||
size * 2, 64, TRUE, ATIVideoSave, pPortPriv);
|
||||
if (pPortPriv->off_screen == NULL)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
pPortPriv->pPixmap =
|
||||
(*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
|
||||
else
|
||||
pPortPriv->pPixmap = (PixmapPtr)pDraw;
|
||||
|
||||
/* Migrate the pixmap to offscreen if necessary. */
|
||||
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
|
||||
kaaMoveInPixmap(pPortPriv->pPixmap);
|
||||
|
||||
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
pPortPriv->src_offset = pPortPriv->off_screen->offset;
|
||||
pPortPriv->src_addr = (CARD8 *)(pScreenPriv->screen->memory_base +
|
||||
pPortPriv->src_offset);
|
||||
pPortPriv->src_pitch = dstPitch;
|
||||
pPortPriv->size = size;
|
||||
pPortPriv->pDraw = pDraw;
|
||||
|
||||
/* copy data */
|
||||
top = rot_y1 >> 16;
|
||||
left = (rot_x1 >> 16) & ~1;
|
||||
npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
|
||||
|
||||
/* Since we're probably overwriting the area that might still be used
|
||||
* for the last PutImage request, wait for idle.
|
||||
*/
|
||||
ATIWaitIdle(atis);
|
||||
|
||||
switch(id) {
|
||||
case FOURCC_YV12:
|
||||
case FOURCC_I420:
|
||||
top &= ~1;
|
||||
nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
||||
KdXVCopyPlanarData(screen, buf, pPortPriv->src_addr, randr,
|
||||
srcPitch, srcPitch2, dstPitch, rot_src_w, rot_src_h,
|
||||
height, top, left, nlines, npixels, id);
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
case FOURCC_YUY2:
|
||||
default:
|
||||
nlines = ((rot_y2 + 0xffff) >> 16) - top;
|
||||
KdXVCopyPackedData(screen, buf, pPortPriv->src_addr, randr,
|
||||
srcPitch, dstPitch, rot_src_w, rot_src_h, top, left,
|
||||
nlines, npixels);
|
||||
break;
|
||||
}
|
||||
|
||||
/* update cliplist */
|
||||
if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes)) {
|
||||
REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
|
||||
}
|
||||
|
||||
pPortPriv->id = id;
|
||||
pPortPriv->src_x1 = rot_x1;
|
||||
pPortPriv->src_y1 = rot_y1;
|
||||
pPortPriv->src_x2 = rot_x2;
|
||||
pPortPriv->src_y2 = rot_y2;
|
||||
pPortPriv->src_w = rot_src_w;
|
||||
pPortPriv->src_h = rot_src_h;
|
||||
pPortPriv->dst_x1 = dst_x1;
|
||||
pPortPriv->dst_y1 = dst_y1;
|
||||
pPortPriv->dst_x2 = dst_x2;
|
||||
pPortPriv->dst_y2 = dst_y2;
|
||||
pPortPriv->dst_w = rot_drw_w;
|
||||
pPortPriv->dst_h = rot_drw_h;
|
||||
|
||||
if (atic->is_radeon)
|
||||
RadeonDisplayVideo(screen, pPortPriv);
|
||||
else
|
||||
R128DisplayVideo(screen, pPortPriv);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
ATIReputImage(KdScreenInfo *screen, DrawablePtr pDraw, short drw_x, short drw_y,
|
||||
RegionPtr clipBoxes, pointer data)
|
||||
{
|
||||
ScreenPtr pScreen = screen->pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
ATICardInfo(pScreenPriv);
|
||||
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
|
||||
BoxPtr pOldExtents = REGION_EXTENTS(screen->pScreen, &pPortPriv->clip);
|
||||
BoxPtr pNewExtents = REGION_EXTENTS(screen->pScreen, clipBoxes);
|
||||
|
||||
if (pOldExtents->x1 != pNewExtents->x1 ||
|
||||
pOldExtents->x2 != pNewExtents->x2 ||
|
||||
pOldExtents->y1 != pNewExtents->y1 ||
|
||||
pOldExtents->y2 != pNewExtents->y2)
|
||||
return BadMatch;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
pPortPriv->pPixmap =
|
||||
(*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
|
||||
else
|
||||
pPortPriv->pPixmap = (PixmapPtr)pDraw;
|
||||
|
||||
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
|
||||
kaaMoveInPixmap(pPortPriv->pPixmap);
|
||||
|
||||
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
|
||||
ErrorF("err\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
/* update cliplist */
|
||||
if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes))
|
||||
REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
|
||||
|
||||
/* XXX: What do the drw_x and drw_y here mean for us? */
|
||||
|
||||
if (atic->is_radeon)
|
||||
RadeonDisplayVideo(screen, pPortPriv);
|
||||
else
|
||||
R128DisplayVideo(screen, pPortPriv);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
ATIQueryImageAttributes(KdScreenInfo *screen, int id, unsigned short *w,
|
||||
unsigned short *h, int *pitches, int *offsets)
|
||||
{
|
||||
int size, tmp;
|
||||
|
||||
if (*w > IMAGE_MAX_WIDTH)
|
||||
*w = IMAGE_MAX_WIDTH;
|
||||
if (*h > IMAGE_MAX_HEIGHT)
|
||||
*h = IMAGE_MAX_HEIGHT;
|
||||
|
||||
*w = (*w + 1) & ~1;
|
||||
if (offsets)
|
||||
offsets[0] = 0;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case FOURCC_YV12:
|
||||
case FOURCC_I420:
|
||||
*h = (*h + 1) & ~1;
|
||||
size = (*w + 3) & ~3;
|
||||
if (pitches)
|
||||
pitches[0] = size;
|
||||
size *= *h;
|
||||
if (offsets)
|
||||
offsets[1] = size;
|
||||
tmp = ((*w >> 1) + 3) & ~3;
|
||||
if (pitches)
|
||||
pitches[1] = pitches[2] = tmp;
|
||||
tmp *= (*h >> 1);
|
||||
size += tmp;
|
||||
if (offsets)
|
||||
offsets[2] = size;
|
||||
size += tmp;
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
case FOURCC_YUY2:
|
||||
default:
|
||||
size = *w << 1;
|
||||
if (pitches)
|
||||
pitches[0] = size;
|
||||
size *= *h;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
/* client libraries expect an encoding */
|
||||
static KdVideoEncodingRec DummyEncoding[1] =
|
||||
{
|
||||
{
|
||||
0,
|
||||
"XV_IMAGE",
|
||||
IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
|
||||
{1, 1}
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_FORMATS 3
|
||||
|
||||
static KdVideoFormatRec Formats[NUM_FORMATS] =
|
||||
{
|
||||
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
|
||||
};
|
||||
|
||||
#define NUM_ATTRIBUTES 0
|
||||
|
||||
static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
|
||||
{
|
||||
};
|
||||
|
||||
#define NUM_IMAGES 4
|
||||
|
||||
static KdImageRec Images[NUM_IMAGES] =
|
||||
{
|
||||
XVIMAGE_YUY2,
|
||||
XVIMAGE_YV12,
|
||||
XVIMAGE_I420,
|
||||
XVIMAGE_UYVY
|
||||
};
|
||||
|
||||
static KdVideoAdaptorPtr
|
||||
ATISetupImageVideo(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
KdVideoAdaptorPtr adapt;
|
||||
ATIPortPrivPtr pPortPriv;
|
||||
int i;
|
||||
|
||||
atis->num_texture_ports = 16;
|
||||
|
||||
adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + atis->num_texture_ports *
|
||||
(sizeof(ATIPortPrivRec) + sizeof(DevUnion)));
|
||||
if (adapt == NULL)
|
||||
return NULL;
|
||||
|
||||
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
|
||||
adapt->flags = VIDEO_CLIP_TO_VIEWPORT;
|
||||
adapt->name = "ATI Texture Video";
|
||||
adapt->nEncodings = 1;
|
||||
adapt->pEncodings = DummyEncoding;
|
||||
adapt->nFormats = NUM_FORMATS;
|
||||
adapt->pFormats = Formats;
|
||||
adapt->nPorts = atis->num_texture_ports;
|
||||
adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
|
||||
|
||||
pPortPriv =
|
||||
(ATIPortPrivPtr)(&adapt->pPortPrivates[atis->num_texture_ports]);
|
||||
|
||||
for (i = 0; i < atis->num_texture_ports; i++)
|
||||
adapt->pPortPrivates[i].ptr = &pPortPriv[i];
|
||||
|
||||
adapt->nAttributes = NUM_ATTRIBUTES;
|
||||
adapt->pAttributes = Attributes;
|
||||
adapt->pImages = Images;
|
||||
adapt->nImages = NUM_IMAGES;
|
||||
adapt->PutVideo = NULL;
|
||||
adapt->PutStill = NULL;
|
||||
adapt->GetVideo = NULL;
|
||||
adapt->GetStill = NULL;
|
||||
adapt->StopVideo = ATIStopVideo;
|
||||
adapt->SetPortAttribute = ATISetPortAttribute;
|
||||
adapt->GetPortAttribute = ATIGetPortAttribute;
|
||||
adapt->QueryBestSize = ATIQueryBestSize;
|
||||
adapt->PutImage = ATIPutImage;
|
||||
adapt->ReputImage = ATIReputImage;
|
||||
adapt->QueryImageAttributes = ATIQueryImageAttributes;
|
||||
|
||||
/* gotta uninit this someplace */
|
||||
REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
|
||||
|
||||
atis->pAdaptor = adapt;
|
||||
|
||||
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
|
||||
xvSaturation = MAKE_ATOM("XV_SATURATION");
|
||||
|
||||
return adapt;
|
||||
}
|
||||
|
||||
Bool ATIInitVideo(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
|
||||
KdVideoAdaptorPtr newAdaptor = NULL;
|
||||
int num_adaptors;
|
||||
|
||||
atis->pAdaptor = NULL;
|
||||
|
||||
if (atic->reg_base == NULL)
|
||||
return FALSE;
|
||||
if (atic->is_r200 || atic->is_r300)
|
||||
return FALSE;
|
||||
|
||||
num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
|
||||
|
||||
newAdaptor = ATISetupImageVideo(pScreen);
|
||||
|
||||
if (newAdaptor) {
|
||||
if (!num_adaptors) {
|
||||
num_adaptors = 1;
|
||||
adaptors = &newAdaptor;
|
||||
} else {
|
||||
newAdaptors = xalloc((num_adaptors + 1) *
|
||||
sizeof(KdVideoAdaptorPtr *));
|
||||
if (newAdaptors) {
|
||||
memcpy(newAdaptors, adaptors, num_adaptors *
|
||||
sizeof(KdVideoAdaptorPtr));
|
||||
newAdaptors[num_adaptors] = newAdaptor;
|
||||
adaptors = newAdaptors;
|
||||
num_adaptors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num_adaptors)
|
||||
KdXVScreenInit(pScreen, adaptors, num_adaptors);
|
||||
|
||||
if (newAdaptors)
|
||||
xfree(newAdaptors);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ATIFiniVideo(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
KdVideoAdaptorPtr adapt = atis->pAdaptor;
|
||||
ATIPortPrivPtr pPortPriv;
|
||||
int i;
|
||||
|
||||
if (!adapt)
|
||||
return;
|
||||
|
||||
for (i = 0; i < atis->num_texture_ports; i++) {
|
||||
pPortPriv = (ATIPortPrivPtr)(&adapt->pPortPrivates[i].ptr);
|
||||
REGION_UNINIT(pScreen, &pPortPriv->clip);
|
||||
}
|
||||
xfree(adapt);
|
||||
atis->pAdaptor = NULL;
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt, Anders Carlsson
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef USE_DMA
|
||||
#define TAG(x) x##DMA
|
||||
#define LOCALS RING_LOCALS; \
|
||||
(void)atic
|
||||
#define BEGIN(x) BEGIN_RING(x * 2)
|
||||
#define OUT_REG(reg, val) OUT_RING_REG(reg, val)
|
||||
#define END() ADVANCE_RING()
|
||||
#else
|
||||
#define TAG(x) x##MMIO
|
||||
#define LOCALS char *mmio = atic->reg_base
|
||||
#define BEGIN(x) ATIWaitAvailMMIO(x)
|
||||
#define OUT_REG(reg, val) MMIO_OUT32(mmio, (reg), (val))
|
||||
#define END()
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
TAG(R128PrepareBlend)(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture,
|
||||
PixmapPtr pSrc, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
ATICardInfo(pScreenPriv);
|
||||
CARD32 dstDatatype, srcDatatype;
|
||||
LOCALS;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
if (!TAG(ATISetup)(pDst, pSrc))
|
||||
return FALSE;
|
||||
|
||||
src_bpp = pSrc->drawable.bitsPerPixel;
|
||||
is_repeat = pSrcPicture->repeat;
|
||||
|
||||
if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
|
||||
ATI_FALLBACK(("Unsupported op 0x%x\n", op));
|
||||
if (pSrcPicture->repeat && (pSrc->drawable.width != 1 ||
|
||||
pSrc->drawable.height != 1))
|
||||
ATI_FALLBACK(("repeat unsupported\n"));
|
||||
if (pSrcPicture->transform != NULL)
|
||||
ATI_FALLBACK(("transform unsupported\n"));
|
||||
if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype))
|
||||
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
|
||||
pDstPicture->format));
|
||||
if (!R128GetDatatypePict(pSrcPicture->format, &srcDatatype))
|
||||
ATI_FALLBACK(("Unsupported src format 0x%x\n",
|
||||
pSrcPicture->format));
|
||||
|
||||
BEGIN(11);
|
||||
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
|
||||
(dstDatatype << 8) |
|
||||
RADEON_GMC_SRC_DATATYPE_COLOR |
|
||||
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
RADEON_GMC_CLR_CMP_CNTL_DIS |
|
||||
RADEON_GMC_AUX_CLIP_DIS |
|
||||
(ATIBltRop[3] << 16) |
|
||||
RADEON_GMC_3D_FCN_EN);
|
||||
OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_ALPHA_EN | R128_TEX_CACHE_FLUSH);
|
||||
OUT_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C, 0);
|
||||
OUT_REG(R128_REG_SCALE_3D_CNTL,
|
||||
R128_SCALE_3D_SCALE |
|
||||
R128BlendOp[op] |
|
||||
R128_TEX_MAP_ALPHA_IN_TEXTURE);
|
||||
OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
|
||||
OUT_REG(R128_REG_SCALE_PITCH, src_pitch / src_bpp);
|
||||
/* 4.16 fixed point scaling factor? */
|
||||
if (is_repeat) {
|
||||
OUT_REG(R128_REG_SCALE_X_INC, 0);
|
||||
OUT_REG(R128_REG_SCALE_Y_INC, 0);
|
||||
} else {
|
||||
OUT_REG(R128_REG_SCALE_X_INC, 65536);
|
||||
OUT_REG(R128_REG_SCALE_Y_INC, 65536);
|
||||
}
|
||||
OUT_REG(R128_REG_SCALE_HACC, 0x00000000);
|
||||
OUT_REG(R128_REG_SCALE_VACC, 0x00000000);
|
||||
OUT_REG(RADEON_REG_DP_CNTL,
|
||||
RADEON_DST_X_LEFT_TO_RIGHT | RADEON_DST_Y_TOP_TO_BOTTOM );
|
||||
END();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
TAG(R128Blend)(int srcX, int srcY, int dstX, int dstY, int width, int height)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
ATICardInfo *atic = atis->atic;
|
||||
LOCALS;
|
||||
|
||||
if (is_repeat) {
|
||||
srcX = 0;
|
||||
srcY = 0;
|
||||
}
|
||||
|
||||
BEGIN(4);
|
||||
OUT_REG(R128_REG_SCALE_OFFSET_0, src_offset + srcY * src_pitch + srcX *
|
||||
(src_bpp >> 3));
|
||||
OUT_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH, (height << 16) | width);
|
||||
OUT_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY);
|
||||
OUT_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH, (height << 16) | width);
|
||||
END();
|
||||
}
|
||||
|
||||
static void
|
||||
TAG(R128DoneBlend)(void)
|
||||
{
|
||||
}
|
||||
|
||||
#undef TAG
|
||||
#undef LOCALS
|
||||
#undef BEGIN
|
||||
#undef OUT_REG
|
||||
#undef END
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite
|
||||
* Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* 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, 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
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
*
|
||||
* Converted to common header format:
|
||||
* Jens Owen <jens@tungstengraphics.com>
|
||||
*
|
||||
* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h,v 1.2 2002/12/16 16:19:10 dawes Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _R128_COMMON_H_
|
||||
#define _R128_COMMON_H_
|
||||
|
||||
#include "X11/Xmd.h"
|
||||
|
||||
/*
|
||||
* WARNING: If you change any of these defines, make sure to change
|
||||
* the kernel include file as well (r128_drm.h)
|
||||
*/
|
||||
|
||||
/* Driver specific DRM command indices
|
||||
* NOTE: these are not OS specific, but they are driver specific
|
||||
*/
|
||||
#define DRM_R128_INIT 0x00
|
||||
#define DRM_R128_CCE_START 0x01
|
||||
#define DRM_R128_CCE_STOP 0x02
|
||||
#define DRM_R128_CCE_RESET 0x03
|
||||
#define DRM_R128_CCE_IDLE 0x04
|
||||
#define DRM_R128_UNDEFINED1 0x05
|
||||
#define DRM_R128_RESET 0x06
|
||||
#define DRM_R128_SWAP 0x07
|
||||
#define DRM_R128_CLEAR 0x08
|
||||
#define DRM_R128_VERTEX 0x09
|
||||
#define DRM_R128_INDICES 0x0a
|
||||
#define DRM_R128_BLIT 0x0b
|
||||
#define DRM_R128_DEPTH 0x0c
|
||||
#define DRM_R128_STIPPLE 0x0d
|
||||
#define DRM_R128_UNDEFINED2 0x0e
|
||||
#define DRM_R128_INDIRECT 0x0f
|
||||
#define DRM_R128_FULLSCREEN 0x10
|
||||
#define DRM_R128_CLEAR2 0x11
|
||||
#define DRM_R128_GETPARAM 0x12
|
||||
#define DRM_R128_FLIP 0x13
|
||||
|
||||
#define DRM_R128_FRONT_BUFFER 0x1
|
||||
#define DRM_R128_BACK_BUFFER 0x2
|
||||
#define DRM_R128_DEPTH_BUFFER 0x4
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
DRM_R128_INIT_CCE = 0x01,
|
||||
DRM_R128_CLEANUP_CCE = 0x02
|
||||
} func;
|
||||
unsigned long sarea_priv_offset;
|
||||
int is_pci;
|
||||
int cce_mode;
|
||||
int cce_secure; /* FIXME: Deprecated, we should remove this */
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
unsigned int span_offset;
|
||||
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long ring_offset;
|
||||
unsigned long ring_rptr_offset;
|
||||
unsigned long buffers_offset;
|
||||
unsigned long agp_textures_offset;
|
||||
} drmR128Init;
|
||||
|
||||
typedef struct {
|
||||
int flush;
|
||||
int idle;
|
||||
} drmR128CCEStop;
|
||||
|
||||
typedef struct {
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard;
|
||||
} drmR128Indirect;
|
||||
|
||||
typedef struct {
|
||||
int idx;
|
||||
int pitch;
|
||||
int offset;
|
||||
int format;
|
||||
unsigned short x, y;
|
||||
unsigned short width, height;
|
||||
} drmR128Blit;
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
DRM_R128_WRITE_SPAN = 0x01,
|
||||
DRM_R128_WRITE_PIXELS = 0x02,
|
||||
DRM_R128_READ_SPAN = 0x03,
|
||||
DRM_R128_READ_PIXELS = 0x04
|
||||
} func;
|
||||
int n;
|
||||
int *x;
|
||||
int *y;
|
||||
unsigned int *buffer;
|
||||
unsigned char *mask;
|
||||
} drmR128Depth;
|
||||
|
||||
typedef struct {
|
||||
int prim;
|
||||
int idx; /* Index of vertex buffer */
|
||||
int count; /* Number of vertices in buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drmR128Vertex;
|
||||
|
||||
typedef struct {
|
||||
unsigned int *mask;
|
||||
} drmR128Stipple;
|
||||
|
||||
typedef struct {
|
||||
unsigned int flags;
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask;
|
||||
} drmR128Clear;
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
DRM_R128_INIT_FULLSCREEN = 0x01,
|
||||
DRM_R128_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drmR128Fullscreen;
|
||||
|
||||
typedef struct drm_r128_getparam {
|
||||
int param;
|
||||
int *value;
|
||||
} drmR128GetParam;
|
||||
|
||||
#define R128_PARAM_IRQ_NR 1
|
||||
|
||||
#endif
|
||||
|
|
@ -1,623 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2003 Eric Anholt, Anders Carlsson
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#include "ati.h"
|
||||
#include "ati_reg.h"
|
||||
#include "ati_dma.h"
|
||||
#include "ati_draw.h"
|
||||
|
||||
extern ATIScreenInfo *accel_atis;
|
||||
extern CARD8 ATIBltRop[16];
|
||||
|
||||
static int src_pitch;
|
||||
static int src_offset;
|
||||
static int src_bpp;
|
||||
static int widths[2] = {1,1};
|
||||
static int heights[2] = {1,1};
|
||||
static Bool is_repeat;
|
||||
static Bool is_transform[2];
|
||||
static PictTransform *transform[2];
|
||||
|
||||
struct blendinfo {
|
||||
Bool dst_alpha;
|
||||
Bool src_alpha;
|
||||
CARD32 blendctl;
|
||||
};
|
||||
|
||||
static struct blendinfo R128BlendOp[] = {
|
||||
/* Clear */
|
||||
{0, 0, R128_SBLEND_ZERO | R128_DBLEND_ZERO},
|
||||
/* Src */
|
||||
{0, 0, R128_SBLEND_ONE | R128_DBLEND_ZERO},
|
||||
/* Dst */
|
||||
{0, 0, R128_SBLEND_ZERO | R128_DBLEND_ONE},
|
||||
/* Over */
|
||||
{0, 1, R128_SBLEND_ONE | R128_DBLEND_INV_SRC_ALPHA},
|
||||
/* OverReverse */
|
||||
{1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ONE},
|
||||
/* In */
|
||||
{1, 0, R128_SBLEND_DST_ALPHA | R128_DBLEND_ZERO},
|
||||
/* InReverse */
|
||||
{0, 1, R128_SBLEND_ZERO | R128_DBLEND_SRC_ALPHA},
|
||||
/* Out */
|
||||
{1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ZERO},
|
||||
/* OutReverse */
|
||||
{0, 1, R128_SBLEND_ZERO | R128_DBLEND_INV_SRC_ALPHA},
|
||||
/* Atop */
|
||||
{1, 1, R128_SBLEND_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
|
||||
/* AtopReverse */
|
||||
{1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_SRC_ALPHA},
|
||||
/* Xor */
|
||||
{1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
|
||||
/* Add */
|
||||
{0, 0, R128_SBLEND_ONE | R128_DBLEND_ONE},
|
||||
};
|
||||
|
||||
static Bool
|
||||
R128GetDatatypePict(CARD32 format, CARD32 *type)
|
||||
{
|
||||
switch (format) {
|
||||
case PICT_a1r5g5b5:
|
||||
*type = R128_DATATYPE_ARGB1555;
|
||||
return TRUE;
|
||||
case PICT_r5g6b5:
|
||||
*type = R128_DATATYPE_RGB565;
|
||||
return TRUE;
|
||||
case PICT_a8r8g8b8:
|
||||
*type = R128_DATATYPE_ARGB8888;
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Bool
|
||||
R128PrepareBlend(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture,
|
||||
PixmapPtr pSrc, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 dstDatatype, srcDatatype;
|
||||
RING_LOCALS;
|
||||
CARD32 xinc, yinc, dst_pitch_offset;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
src_offset = (CARD8 *)pSrc->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base;
|
||||
src_pitch = pSrc->devKind;
|
||||
src_bpp = pSrc->drawable.bitsPerPixel;
|
||||
is_repeat = pSrcPicture->repeat;
|
||||
|
||||
if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
|
||||
ATI_FALLBACK(("Unsupported op 0x%x\n", op));
|
||||
if (pSrcPicture->repeat && (pSrc->drawable.width != 1 ||
|
||||
pSrc->drawable.height != 1))
|
||||
ATI_FALLBACK(("repeat unsupported\n"));
|
||||
if (pSrcPicture->transform != NULL)
|
||||
ATI_FALLBACK(("transform unsupported\n"));
|
||||
if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype))
|
||||
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
|
||||
pDstPicture->format));
|
||||
if (!R128GetDatatypePict(pSrcPicture->format, &srcDatatype))
|
||||
ATI_FALLBACK(("Unsupported src format 0x%x\n",
|
||||
pSrcPicture->format));
|
||||
if (src_pitch % src_bpp != 0)
|
||||
ATI_FALLBACK(("Bad src pitch 0x%x\n", src_pitch));
|
||||
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
|
||||
return FALSE;
|
||||
|
||||
if (is_repeat) {
|
||||
xinc = 0;
|
||||
yinc = 0;
|
||||
} else {
|
||||
xinc = 65536;
|
||||
yinc = 65536;
|
||||
}
|
||||
|
||||
BEGIN_DMA(18);
|
||||
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
|
||||
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
|
||||
ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_SOLID_COLOR |
|
||||
(dstDatatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATIBltRop[GXcopy] << 16) |
|
||||
ATI_DP_SRC_SOURCE_MEMORY |
|
||||
R128_GMC_3D_FCN_EN |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS);
|
||||
OUT_REG(ATI_REG_DP_CNTL,
|
||||
ATI_DST_X_LEFT_TO_RIGHT | ATI_DST_Y_TOP_TO_BOTTOM );
|
||||
OUT_REG(R128_REG_SCALE_3D_CNTL,
|
||||
R128_SCALE_3D_SCALE |
|
||||
R128_SCALE_PIX_REPLICATE |
|
||||
R128BlendOp[op].blendctl |
|
||||
R128_TEX_MAP_ALPHA_IN_TEXTURE);
|
||||
OUT_REG(R128_REG_TEX_CNTL_C, R128_ALPHA_ENABLE | R128_TEX_CACHE_FLUSH);
|
||||
OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
|
||||
|
||||
/* R128_REG_SCALE_PITCH,
|
||||
* R128_REG_SCALE_X_INC,
|
||||
* R128_REG_SCALE_Y_INC,
|
||||
* R128_REG_SCALE_HACC
|
||||
* R128_REG_SCALE_VACC */
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_PITCH, 5));
|
||||
OUT_RING(src_pitch / src_bpp);
|
||||
OUT_RING(xinc);
|
||||
OUT_RING(yinc);
|
||||
OUT_RING(0x0);
|
||||
OUT_RING(0x0);
|
||||
END_DMA();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
R128Blend(int srcX, int srcY, int dstX, int dstY, int width, int height)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
RING_LOCALS;
|
||||
|
||||
if (is_repeat) {
|
||||
srcX = 0;
|
||||
srcY = 0;
|
||||
}
|
||||
|
||||
BEGIN_DMA(6);
|
||||
/* R128_REG_SCALE_SRC_HEIGHT_WIDTH,
|
||||
* R128_REG_SCALE_OFFSET_0
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_SRC_HEIGHT_WIDTH, 2));
|
||||
OUT_RING((height << 16) | width);
|
||||
OUT_RING(src_offset + srcY * src_pitch + srcX * (src_bpp >> 3));
|
||||
/* R128_REG_SCALE_DST_X_Y
|
||||
* R128_REG_SCALE_DST_HEIGHT_WIDTH
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SCALE_DST_X_Y, 2));
|
||||
OUT_RING((dstX << 16) | dstY);
|
||||
OUT_RING((height << 16) | width);
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
void
|
||||
R128DoneBlend(void)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool
|
||||
R128CheckCompositeTexture(PicturePtr pPict)
|
||||
{
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
|
||||
if (w > (1 << 10) || h > (1 << 10))
|
||||
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
|
||||
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
|
||||
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
|
||||
|
||||
switch (pPict->format) {
|
||||
case PICT_a8:
|
||||
case PICT_a1r5g5b5:
|
||||
case PICT_a4r4g4b4:
|
||||
case PICT_r5g6b5:
|
||||
case PICT_a8r8g8b8:
|
||||
break;
|
||||
default:
|
||||
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
|
||||
pPict->format));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture)
|
||||
{
|
||||
CARD32 dstDatatype;
|
||||
|
||||
if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
|
||||
ATI_FALLBACK(("Unsupported op 0x%x\n", op));
|
||||
if (pDstPicture->format == PICT_a8) {
|
||||
if (R128BlendOp[op].src_alpha || R128BlendOp[op].dst_alpha ||
|
||||
pMaskPicture != NULL)
|
||||
ATI_FALLBACK(("alpha blending unsupported with "
|
||||
"A8 dst?\n"));
|
||||
} else if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) {
|
||||
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
|
||||
pDstPicture->format));
|
||||
}
|
||||
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
|
||||
R128BlendOp[op].src_alpha)
|
||||
ATI_FALLBACK(("Component alpha not supported with source alpha "
|
||||
"blending.\n"));
|
||||
|
||||
if (!R128CheckCompositeTexture(pSrcPicture))
|
||||
return FALSE;
|
||||
if (pMaskPicture != NULL && !R128CheckCompositeTexture(pMaskPicture))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, CARD32 *txsize,
|
||||
CARD32 *tex_cntl_c)
|
||||
{
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
int bytepp, shift, l2w, l2h, l2p;
|
||||
int pitch;
|
||||
|
||||
pitch = pPix->devKind;
|
||||
if ((pitch & (pitch - 1)) != 0)
|
||||
ATI_FALLBACK(("NPOT pitch 0x%x unsupported\n", pitch));
|
||||
|
||||
switch (pPict->format) {
|
||||
case PICT_a8:
|
||||
/* DATATYPE_RGB8 appears to expand the value into the alpha
|
||||
* channel like we want. We then blank out the R,G,B channels
|
||||
* as necessary using the combiners.
|
||||
*/
|
||||
*tex_cntl_c = R128_DATATYPE_RGB8 << R128_TEX_DATATYPE_SHIFT;
|
||||
break;
|
||||
case PICT_a1r5g5b5:
|
||||
*tex_cntl_c = R128_DATATYPE_ARGB1555 << R128_TEX_DATATYPE_SHIFT;
|
||||
break;
|
||||
case PICT_a4r4g4b4:
|
||||
*tex_cntl_c = R128_DATATYPE_ARGB4444 << R128_TEX_DATATYPE_SHIFT;
|
||||
break;
|
||||
case PICT_r5g6b5:
|
||||
*tex_cntl_c = R128_DATATYPE_RGB565 << R128_TEX_DATATYPE_SHIFT;
|
||||
break;
|
||||
case PICT_a8r8g8b8:
|
||||
*tex_cntl_c = R128_DATATYPE_ARGB8888 << R128_TEX_DATATYPE_SHIFT;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
bytepp = PICT_FORMAT_BPP(pPict->format) / 8;
|
||||
|
||||
*tex_cntl_c |= R128_MIP_MAP_DISABLE;
|
||||
|
||||
if (unit == 0)
|
||||
shift = 0;
|
||||
else {
|
||||
shift = 16;
|
||||
*tex_cntl_c |= R128_SEC_SELECT_SEC_ST;
|
||||
}
|
||||
|
||||
/* ATILog2 returns -1 for value of 0 */
|
||||
l2w = ATILog2(w - 1) + 1;
|
||||
l2h = ATILog2(h - 1) + 1;
|
||||
l2p = ATILog2(pPix->devKind / bytepp);
|
||||
|
||||
if (pPict->repeat && w == 1 && h == 1)
|
||||
l2p = 0;
|
||||
else if (pPict->repeat && l2p != l2w)
|
||||
ATI_FALLBACK(("Repeat not supported for pitch != width\n"));
|
||||
l2w = l2p;
|
||||
|
||||
widths[unit] = 1 << l2w;
|
||||
heights[unit] = 1 << l2h;
|
||||
*txsize |= l2p << (R128_TEX_PITCH_SHIFT + shift);
|
||||
*txsize |= ((l2w > l2h) ? l2w : l2h) << (R128_TEX_SIZE_SHIFT + shift);
|
||||
*txsize |= l2h << (R128_TEX_HEIGHT_SHIFT + shift);
|
||||
|
||||
if (pPict->transform != 0) {
|
||||
is_transform[unit] = TRUE;
|
||||
transform[unit] = pPict->transform;
|
||||
} else {
|
||||
is_transform[unit] = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 txsize = 0, prim_tex_cntl_c, sec_tex_cntl_c = 0, dstDatatype;
|
||||
CARD32 dst_pitch_offset, color_factor, in_color_factor, alpha_comb;
|
||||
int i;
|
||||
RING_LOCALS;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
if (pDstPicture->format == PICT_a8)
|
||||
dstDatatype = R128_DATATYPE_Y8;
|
||||
else
|
||||
R128GetDatatypePict(pDstPicture->format, &dstDatatype);
|
||||
|
||||
if (!R128TextureSetup(pSrcPicture, pSrc, 0, &txsize, &prim_tex_cntl_c))
|
||||
return FALSE;
|
||||
if (pMask != NULL && !R128TextureSetup(pMaskPicture, pMask, 1, &txsize,
|
||||
&sec_tex_cntl_c))
|
||||
return FALSE;
|
||||
else if (pMask == NULL)
|
||||
is_transform[1] = FALSE;
|
||||
|
||||
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
|
||||
return FALSE;
|
||||
|
||||
BEGIN_DMA(12);
|
||||
OUT_REG(R128_REG_SCALE_3D_CNTL,
|
||||
R128_SCALE_3D_TEXMAP_SHADE |
|
||||
R128_SCALE_PIX_REPLICATE |
|
||||
R128_TEX_CACHE_SPLIT |
|
||||
R128_TEX_MAP_ALPHA_IN_TEXTURE |
|
||||
R128_TEX_CACHE_LINE_SIZE_4QW);
|
||||
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
|
||||
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
|
||||
ATI_GMC_DST_PITCH_OFFSET_CNTL |
|
||||
ATI_GMC_BRUSH_SOLID_COLOR |
|
||||
(dstDatatype << 8) |
|
||||
ATI_GMC_SRC_DATATYPE_COLOR |
|
||||
(ATIBltRop[GXcopy] << 16) |
|
||||
ATI_DP_SRC_SOURCE_MEMORY |
|
||||
R128_GMC_3D_FCN_EN |
|
||||
ATI_GMC_CLR_CMP_CNTL_DIS |
|
||||
R128_GMC_AUX_CLIP_DIS |
|
||||
ATI_GMC_WR_MSK_DIS);
|
||||
OUT_REG(R128_REG_MISC_3D_STATE_CNTL,
|
||||
R128_MISC_SCALE_3D_TEXMAP_SHADE |
|
||||
R128_MISC_SCALE_PIX_REPLICATE |
|
||||
R128_ALPHA_COMB_ADD_CLAMP |
|
||||
R128BlendOp[op].blendctl);
|
||||
OUT_REG(R128_REG_TEX_CNTL_C,
|
||||
R128_TEXMAP_ENABLE |
|
||||
((pMask != NULL) ? R128_SEC_TEXMAP_ENABLE : 0) |
|
||||
R128_ALPHA_ENABLE |
|
||||
R128_TEX_CACHE_FLUSH);
|
||||
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
|
||||
END_DMA();
|
||||
|
||||
/* IN operator: Without a mask, only the first texture unit is enabled.
|
||||
* With a mask, we put the source in the first unit and have it pass
|
||||
* through as input to the 2nd. The 2nd unit takes the incoming source
|
||||
* pixel and modulates it with either the alpha or each of the channels
|
||||
* in the mask, depending on componentAlpha.
|
||||
*/
|
||||
BEGIN_DMA(15);
|
||||
/* R128_REG_PRIM_TEX_CNTL_C,
|
||||
* R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C,
|
||||
* R128_REG_TEX_SIZE_PITCH_C,
|
||||
* R128_REG_PRIM_TEX_0_OFFSET_C - R128_REG_PRIM_TEX_10_OFFSET_C
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_PRIM_TEX_CNTL_C, 14));
|
||||
OUT_RING(prim_tex_cntl_c);
|
||||
|
||||
/* If this is the only stage and the dest is a8, route the alpha result
|
||||
* to the color (red channel, in particular), too. Otherwise, be sure
|
||||
* to zero out color channels of an a8 source.
|
||||
*/
|
||||
if (pMaskPicture == NULL && pDstPicture->format == PICT_a8)
|
||||
color_factor = R128_COLOR_FACTOR_ALPHA;
|
||||
else if (pSrcPicture->format == PICT_a8)
|
||||
color_factor = R128_COLOR_FACTOR_CONST_COLOR;
|
||||
else
|
||||
color_factor = R128_COLOR_FACTOR_TEX;
|
||||
|
||||
if (PICT_FORMAT_A(pSrcPicture->format) == 0)
|
||||
alpha_comb = R128_COMB_ALPHA_COPY_INP;
|
||||
else
|
||||
alpha_comb = R128_COMB_ALPHA_DIS;
|
||||
|
||||
OUT_RING(R128_COMB_COPY |
|
||||
color_factor |
|
||||
R128_INPUT_FACTOR_INT_COLOR |
|
||||
alpha_comb |
|
||||
R128_ALPHA_FACTOR_TEX_ALPHA |
|
||||
R128_INP_FACTOR_A_CONST_ALPHA);
|
||||
OUT_RING(txsize);
|
||||
/* We could save some output by only writing the offset register that
|
||||
* will actually be used. On the other hand, this is easy.
|
||||
*/
|
||||
for (i = 0; i <= 10; i++)
|
||||
OUT_RING(((CARD8 *)pSrc->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base));
|
||||
END_DMA();
|
||||
|
||||
if (pMask != NULL) {
|
||||
BEGIN_DMA(14);
|
||||
/* R128_REG_SEC_TEX_CNTL_C,
|
||||
* R128_REG_SEC_TEXTURE_COMBINE_CNTL_C,
|
||||
* R128_REG_SEC_TEX_0_OFFSET_C - R128_REG_SEC_TEX_10_OFFSET_C
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(R128_REG_SEC_TEX_CNTL_C, 13));
|
||||
OUT_RING(sec_tex_cntl_c);
|
||||
|
||||
if (pDstPicture->format == PICT_a8) {
|
||||
color_factor = R128_COLOR_FACTOR_ALPHA;
|
||||
in_color_factor = R128_INPUT_FACTOR_PREV_ALPHA;
|
||||
} else if (pMaskPicture->componentAlpha) {
|
||||
color_factor = R128_COLOR_FACTOR_TEX;
|
||||
in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
|
||||
} else {
|
||||
color_factor = R128_COLOR_FACTOR_ALPHA;
|
||||
in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
|
||||
}
|
||||
|
||||
OUT_RING(R128_COMB_MODULATE |
|
||||
color_factor |
|
||||
in_color_factor |
|
||||
R128_COMB_ALPHA_MODULATE |
|
||||
R128_ALPHA_FACTOR_TEX_ALPHA |
|
||||
R128_INP_FACTOR_A_PREV_ALPHA);
|
||||
for (i = 0; i <= 10; i++)
|
||||
OUT_RING(((CARD8 *)pMask->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base));
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
union intfloat {
|
||||
float f;
|
||||
CARD32 i;
|
||||
};
|
||||
|
||||
struct blend_vertex {
|
||||
union intfloat x, y, z, w;
|
||||
union intfloat s0, t0;
|
||||
union intfloat s1, t1;
|
||||
};
|
||||
|
||||
#define VTX_RING_COUNT 8
|
||||
|
||||
#define VTX_OUT(vtx) \
|
||||
do { \
|
||||
OUT_RING(vtx.x.i); \
|
||||
OUT_RING(vtx.y.i); \
|
||||
OUT_RING(vtx.z.i); \
|
||||
OUT_RING(vtx.w.i); \
|
||||
OUT_RING(vtx.s0.i); \
|
||||
OUT_RING(vtx.t0.i); \
|
||||
OUT_RING(vtx.s1.i); \
|
||||
OUT_RING(vtx.t1.i); \
|
||||
} while (0)
|
||||
|
||||
void
|
||||
R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
|
||||
int w, int h)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
struct blend_vertex vtx[4];
|
||||
int i;
|
||||
int srcXend, srcYend, maskXend, maskYend;
|
||||
RING_LOCALS;
|
||||
|
||||
/*ErrorF("R128Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
|
||||
srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
|
||||
|
||||
if (is_transform[0]) {
|
||||
PictVector v;
|
||||
|
||||
v.vector[0] = IntToxFixed(srcX);
|
||||
v.vector[1] = IntToxFixed(srcY);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[0], &v);
|
||||
srcX = xFixedToInt(v.vector[0]);
|
||||
srcY = xFixedToInt(v.vector[1]);
|
||||
v.vector[0] = IntToxFixed(srcX + w);
|
||||
v.vector[1] = IntToxFixed(srcY + h);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[0], &v);
|
||||
srcXend = xFixedToInt(v.vector[0]);
|
||||
srcYend = xFixedToInt(v.vector[1]);
|
||||
} else {
|
||||
srcXend = srcX + w;
|
||||
srcYend = srcY + h;
|
||||
}
|
||||
if (is_transform[1]) {
|
||||
PictVector v;
|
||||
|
||||
v.vector[0] = IntToxFixed(maskX);
|
||||
v.vector[1] = IntToxFixed(maskY);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[1], &v);
|
||||
maskX = xFixedToInt(v.vector[0]);
|
||||
maskY = xFixedToInt(v.vector[1]);
|
||||
v.vector[0] = IntToxFixed(maskX + w);
|
||||
v.vector[1] = IntToxFixed(maskY + h);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[1], &v);
|
||||
maskXend = xFixedToInt(v.vector[0]);
|
||||
maskYend = xFixedToInt(v.vector[1]);
|
||||
} else {
|
||||
maskXend = maskX + w;
|
||||
maskYend = maskY + h;
|
||||
}
|
||||
vtx[0].x.f = dstX;
|
||||
vtx[0].y.f = dstY;
|
||||
vtx[0].z.f = 0.0;
|
||||
vtx[0].w.f = 1.0;
|
||||
vtx[0].s0.f = srcX;
|
||||
vtx[0].t0.f = srcY;
|
||||
vtx[0].s1.f = maskX;
|
||||
vtx[0].t1.f = maskY;
|
||||
|
||||
vtx[1].x.f = dstX;
|
||||
vtx[1].y.f = dstY + h;
|
||||
vtx[1].z.f = 0.0;
|
||||
vtx[1].w.f = 1.0;
|
||||
vtx[1].s0.f = srcX;
|
||||
vtx[1].t0.f = srcYend;
|
||||
vtx[1].s1.f = maskX;
|
||||
vtx[1].t1.f = maskYend;
|
||||
|
||||
vtx[2].x.f = dstX + w;
|
||||
vtx[2].y.f = dstY + h;
|
||||
vtx[2].z.f = 0.0;
|
||||
vtx[2].w.f = 1.0;
|
||||
vtx[2].s0.f = srcXend;
|
||||
vtx[2].t0.f = srcYend;
|
||||
vtx[2].s1.f = maskXend;
|
||||
vtx[2].t1.f = maskYend;
|
||||
|
||||
vtx[3].x.f = dstX + w;
|
||||
vtx[3].y.f = dstY;
|
||||
vtx[3].z.f = 0.0;
|
||||
vtx[3].w.f = 1.0;
|
||||
vtx[3].s0.f = srcXend;
|
||||
vtx[3].t0.f = srcY;
|
||||
vtx[3].s1.f = maskXend;
|
||||
vtx[3].t1.f = maskY;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
vtx[i].x.f += 0.0;
|
||||
vtx[i].y.f += 0.125;
|
||||
vtx[i].s0.f /= widths[0];
|
||||
vtx[i].t0.f /= heights[0];
|
||||
vtx[i].s1.f /= widths[1];
|
||||
vtx[i].t1.f /= heights[1];
|
||||
}
|
||||
|
||||
BEGIN_DMA(3 + 4 * VTX_RING_COUNT);
|
||||
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM,
|
||||
2 + 4 * VTX_RING_COUNT));
|
||||
OUT_RING(R128_CCE_VC_FRMT_RHW |
|
||||
R128_CCE_VC_FRMT_S_T |
|
||||
R128_CCE_VC_FRMT_S2_T2);
|
||||
OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN |
|
||||
R128_CCE_VC_CNTL_PRIM_WALK_RING |
|
||||
(4 << R128_CCE_VC_CNTL_NUM_SHIFT));
|
||||
|
||||
VTX_OUT(vtx[0]);
|
||||
VTX_OUT(vtx[1]);
|
||||
VTX_OUT(vtx[2]);
|
||||
VTX_OUT(vtx[3]);
|
||||
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
void
|
||||
R128DoneComposite(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.7 2002/02/16 21:26:35 herrb Exp $ */
|
||||
/*
|
||||
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
|
||||
* Precision Insight, Inc., Cedar Park, Texas, and
|
||||
* VA Linux Systems Inc., Fremont, California.
|
||||
*
|
||||
* 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 on 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
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
|
||||
* SYSTEMS AND/OR THEIR SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _R128_SAREA_H_
|
||||
#define _R128_SAREA_H_
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the kernel file (r128_drm.h)
|
||||
*/
|
||||
#ifndef __R128_SAREA_DEFINES__
|
||||
#define __R128_SAREA_DEFINES__
|
||||
|
||||
/* What needs to be changed for the current vertex buffer?
|
||||
*/
|
||||
#define R128_UPLOAD_CONTEXT 0x001
|
||||
#define R128_UPLOAD_SETUP 0x002
|
||||
#define R128_UPLOAD_TEX0 0x004
|
||||
#define R128_UPLOAD_TEX1 0x008
|
||||
#define R128_UPLOAD_TEX0IMAGES 0x010
|
||||
#define R128_UPLOAD_TEX1IMAGES 0x020
|
||||
#define R128_UPLOAD_CORE 0x040
|
||||
#define R128_UPLOAD_MASKS 0x080
|
||||
#define R128_UPLOAD_WINDOW 0x100
|
||||
#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */
|
||||
#define R128_REQUIRE_QUIESCENCE 0x400
|
||||
#define R128_UPLOAD_ALL 0x7ff
|
||||
|
||||
#define R128_FRONT 0x1
|
||||
#define R128_BACK 0x2
|
||||
#define R128_DEPTH 0x4
|
||||
|
||||
/* Primitive types
|
||||
*/
|
||||
#define R128_POINTS 0x1
|
||||
#define R128_LINES 0x2
|
||||
#define R128_LINE_STRIP 0x3
|
||||
#define R128_TRIANGLES 0x4
|
||||
#define R128_TRIANGLE_FAN 0x5
|
||||
#define R128_TRIANGLE_STRIP 0x6
|
||||
|
||||
/* Vertex/indirect buffer size
|
||||
*/
|
||||
#define R128_BUFFER_SIZE 16384
|
||||
|
||||
/* Byte offsets for indirect buffer data
|
||||
*/
|
||||
#define R128_INDEX_PRIM_OFFSET 20
|
||||
#define R128_HOSTDATA_BLIT_OFFSET 32
|
||||
|
||||
/* Keep these small for testing
|
||||
*/
|
||||
#define R128_NR_SAREA_CLIPRECTS 12
|
||||
|
||||
#define R128_NR_CONTEXT_REGS 12
|
||||
|
||||
#define R128_MAX_TEXTURE_LEVELS 11
|
||||
#define R128_MAX_TEXTURE_UNITS 2
|
||||
|
||||
#endif /* __R128_SAREA_DEFINES__ */
|
||||
|
||||
typedef struct {
|
||||
/* Context state - can be written in one large chunk */
|
||||
unsigned int dst_pitch_offset_c;
|
||||
unsigned int dp_gui_master_cntl_c;
|
||||
unsigned int sc_top_left_c;
|
||||
unsigned int sc_bottom_right_c;
|
||||
unsigned int z_offset_c;
|
||||
unsigned int z_pitch_c;
|
||||
unsigned int z_sten_cntl_c;
|
||||
unsigned int tex_cntl_c;
|
||||
unsigned int misc_3d_state_cntl_reg;
|
||||
unsigned int texture_clr_cmp_clr_c;
|
||||
unsigned int texture_clr_cmp_msk_c;
|
||||
unsigned int fog_color_c;
|
||||
|
||||
/* Texture state */
|
||||
unsigned int tex_size_pitch_c;
|
||||
unsigned int constant_color_c;
|
||||
|
||||
/* Setup state */
|
||||
unsigned int pm4_vc_fpu_setup;
|
||||
unsigned int setup_cntl;
|
||||
|
||||
/* Mask state */
|
||||
unsigned int dp_write_mask;
|
||||
unsigned int sten_ref_mask_c;
|
||||
unsigned int plane_3d_mask_c;
|
||||
|
||||
/* Window state */
|
||||
unsigned int window_xy_offset;
|
||||
|
||||
/* Core state */
|
||||
unsigned int scale_3d_cntl;
|
||||
} r128_context_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int tex_cntl;
|
||||
unsigned int tex_combine_cntl;
|
||||
unsigned int tex_size_pitch;
|
||||
unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS];
|
||||
unsigned int tex_border_color;
|
||||
} r128_texture_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* The channel for communication of state information to the kernel
|
||||
* on firing a vertex buffer.
|
||||
*/
|
||||
r128_context_regs_t ContextState;
|
||||
r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS];
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
unsigned int vc_format;
|
||||
|
||||
#ifdef XF86DRI
|
||||
/* The current cliprects, or a subset thereof.
|
||||
*/
|
||||
XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
#endif
|
||||
|
||||
/* Counters for throttling of rendering clients.
|
||||
*/
|
||||
unsigned int last_frame;
|
||||
unsigned int last_dispatch;
|
||||
|
||||
/* Maintain an LRU of contiguous regions of texture space. If you
|
||||
* think you own a region of texture memory, and it has an age
|
||||
* different to the one you set, then you are mistaken and it has
|
||||
* been stolen by another client. If global texAge hasn't changed,
|
||||
* there is no need to walk the list.
|
||||
*
|
||||
* These regions can be used as a proxy for the fine-grained texture
|
||||
* information of other clients - by maintaining them in the same
|
||||
* lru which is used to age their own textures, clients have an
|
||||
* approximate lru for the whole of global texture space, and can
|
||||
* make informed decisions as to which areas to kick out. There is
|
||||
* no need to choose whether to kick out your own texture or someone
|
||||
* else's - simply eject them all in LRU order.
|
||||
*/
|
||||
/* Last elt is sentinal */
|
||||
drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1];
|
||||
/* last time texture was uploaded */
|
||||
unsigned int texAge[ATI_NR_TEX_HEAPS];
|
||||
|
||||
int ctxOwner; /* last context to upload state */
|
||||
int pfAllowPageFlip; /* set by the 2d driver, read by the client */
|
||||
int pfCurrentPage; /* set by kernel, read by others */
|
||||
} R128SAREAPriv, *R128SAREAPrivPtr;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,461 +0,0 @@
|
|||
/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
|
||||
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* 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, 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
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*
|
||||
* Converted to common header format:
|
||||
* Jens Owen <jens@tungstengraphics.com>
|
||||
*
|
||||
* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h,v 1.2 2003/04/07 01:22:09 martin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RADEON_COMMON_H_
|
||||
#define _RADEON_COMMON_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change
|
||||
* the kernel include file as well (radeon_drm.h)
|
||||
*/
|
||||
|
||||
/* Driver specific DRM command indices
|
||||
* NOTE: these are not OS specific, but they are driver specific
|
||||
*/
|
||||
#define DRM_RADEON_CP_INIT 0x00
|
||||
#define DRM_RADEON_CP_START 0x01
|
||||
#define DRM_RADEON_CP_STOP 0x02
|
||||
#define DRM_RADEON_CP_RESET 0x03
|
||||
#define DRM_RADEON_CP_IDLE 0x04
|
||||
#define DRM_RADEON_RESET 0x05
|
||||
#define DRM_RADEON_FULLSCREEN 0x06
|
||||
#define DRM_RADEON_SWAP 0x07
|
||||
#define DRM_RADEON_CLEAR 0x08
|
||||
#define DRM_RADEON_VERTEX 0x09
|
||||
#define DRM_RADEON_INDICES 0x0a
|
||||
#define DRM_RADEON_STIPPLE 0x0c
|
||||
#define DRM_RADEON_INDIRECT 0x0d
|
||||
#define DRM_RADEON_TEXTURE 0x0e
|
||||
#define DRM_RADEON_VERTEX2 0x0f
|
||||
#define DRM_RADEON_CMDBUF 0x10
|
||||
#define DRM_RADEON_GETPARAM 0x11
|
||||
#define DRM_RADEON_FLIP 0x12
|
||||
#define DRM_RADEON_ALLOC 0x13
|
||||
#define DRM_RADEON_FREE 0x14
|
||||
#define DRM_RADEON_INIT_HEAP 0x15
|
||||
#define DRM_RADEON_IRQ_EMIT 0x16
|
||||
#define DRM_RADEON_IRQ_WAIT 0x17
|
||||
#define DRM_RADEON_CP_RESUME 0x18
|
||||
#define DRM_RADEON_SETPARAM 0x19
|
||||
#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39
|
||||
|
||||
|
||||
#define RADEON_FRONT 0x1
|
||||
#define RADEON_BACK 0x2
|
||||
#define RADEON_DEPTH 0x4
|
||||
#define RADEON_STENCIL 0x8
|
||||
|
||||
#define RADEON_CLEAR_X1 0
|
||||
#define RADEON_CLEAR_Y1 1
|
||||
#define RADEON_CLEAR_X2 2
|
||||
#define RADEON_CLEAR_Y2 3
|
||||
#define RADEON_CLEAR_DEPTH 4
|
||||
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
DRM_RADEON_INIT_CP = 0x01,
|
||||
DRM_RADEON_CLEANUP_CP = 0x02,
|
||||
DRM_RADEON_INIT_R200_CP = 0x03
|
||||
} func;
|
||||
unsigned long sarea_priv_offset;
|
||||
int is_pci;
|
||||
int cp_mode;
|
||||
int gart_size;
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long ring_offset;
|
||||
unsigned long ring_rptr_offset;
|
||||
unsigned long buffers_offset;
|
||||
unsigned long gart_textures_offset;
|
||||
} drmRadeonInit;
|
||||
|
||||
typedef struct {
|
||||
int flush;
|
||||
int idle;
|
||||
} drmRadeonCPStop;
|
||||
|
||||
typedef struct {
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard;
|
||||
} drmRadeonIndirect;
|
||||
|
||||
typedef union drmRadeonClearR {
|
||||
float f[5];
|
||||
unsigned int ui[5];
|
||||
} drmRadeonClearRect;
|
||||
|
||||
typedef struct drmRadeonClearT {
|
||||
unsigned int flags;
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask; /* misnamed field: should be stencil */
|
||||
drmRadeonClearRect *depth_boxes;
|
||||
} drmRadeonClearType;
|
||||
|
||||
typedef struct drmRadeonFullscreenT {
|
||||
enum {
|
||||
RADEON_INIT_FULLSCREEN = 0x01,
|
||||
RADEON_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drmRadeonFullscreenType;
|
||||
|
||||
typedef struct {
|
||||
unsigned int *mask;
|
||||
} drmRadeonStipple;
|
||||
|
||||
typedef struct {
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
const void *data;
|
||||
} drmRadeonTexImage;
|
||||
|
||||
typedef struct {
|
||||
unsigned int offset;
|
||||
int pitch;
|
||||
int format;
|
||||
int width; /* Texture image coordinates */
|
||||
int height;
|
||||
drmRadeonTexImage *image;
|
||||
} drmRadeonTexture;
|
||||
|
||||
|
||||
#define RADEON_MAX_TEXTURE_UNITS 3
|
||||
|
||||
/* Layout matches drm_radeon_state_t in linux drm_radeon.h.
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
unsigned int pp_misc; /* 0x1c14 */
|
||||
unsigned int pp_fog_color;
|
||||
unsigned int re_solid_color;
|
||||
unsigned int rb3d_blendcntl;
|
||||
unsigned int rb3d_depthoffset;
|
||||
unsigned int rb3d_depthpitch;
|
||||
unsigned int rb3d_zstencilcntl;
|
||||
unsigned int pp_cntl; /* 0x1c38 */
|
||||
unsigned int rb3d_cntl;
|
||||
unsigned int rb3d_coloroffset;
|
||||
unsigned int re_width_height;
|
||||
unsigned int rb3d_colorpitch;
|
||||
} context;
|
||||
struct {
|
||||
unsigned int se_cntl;
|
||||
} setup1;
|
||||
struct {
|
||||
unsigned int se_coord_fmt; /* 0x1c50 */
|
||||
} vertex;
|
||||
struct {
|
||||
unsigned int re_line_pattern; /* 0x1cd0 */
|
||||
unsigned int re_line_state;
|
||||
unsigned int se_line_width; /* 0x1db8 */
|
||||
} line;
|
||||
struct {
|
||||
unsigned int pp_lum_matrix; /* 0x1d00 */
|
||||
unsigned int pp_rot_matrix_0; /* 0x1d58 */
|
||||
unsigned int pp_rot_matrix_1;
|
||||
} bumpmap;
|
||||
struct {
|
||||
unsigned int rb3d_stencilrefmask; /* 0x1d7c */
|
||||
unsigned int rb3d_ropcntl;
|
||||
unsigned int rb3d_planemask;
|
||||
} mask;
|
||||
struct {
|
||||
unsigned int se_vport_xscale; /* 0x1d98 */
|
||||
unsigned int se_vport_xoffset;
|
||||
unsigned int se_vport_yscale;
|
||||
unsigned int se_vport_yoffset;
|
||||
unsigned int se_vport_zscale;
|
||||
unsigned int se_vport_zoffset;
|
||||
} viewport;
|
||||
struct {
|
||||
unsigned int se_cntl_status; /* 0x2140 */
|
||||
} setup2;
|
||||
struct {
|
||||
unsigned int re_top_left; /*ignored*/ /* 0x26c0 */
|
||||
unsigned int re_misc;
|
||||
} misc;
|
||||
struct {
|
||||
unsigned int pp_txfilter;
|
||||
unsigned int pp_txformat;
|
||||
unsigned int pp_txoffset;
|
||||
unsigned int pp_txcblend;
|
||||
unsigned int pp_txablend;
|
||||
unsigned int pp_tfactor;
|
||||
unsigned int pp_border_color;
|
||||
} texture[RADEON_MAX_TEXTURE_UNITS];
|
||||
struct {
|
||||
unsigned int se_zbias_factor;
|
||||
unsigned int se_zbias_constant;
|
||||
} zbias;
|
||||
unsigned int dirty;
|
||||
} drmRadeonState;
|
||||
|
||||
/* 1.1 vertex ioctl. Used in compatibility modes.
|
||||
*/
|
||||
typedef struct {
|
||||
int prim;
|
||||
int idx; /* Index of vertex buffer */
|
||||
int count; /* Number of vertices in buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drmRadeonVertex;
|
||||
|
||||
typedef struct {
|
||||
unsigned int start;
|
||||
unsigned int finish;
|
||||
unsigned int prim:8;
|
||||
unsigned int stateidx:8;
|
||||
unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
|
||||
unsigned int vc_format;
|
||||
} drmRadeonPrim;
|
||||
|
||||
typedef struct {
|
||||
int idx; /* Index of vertex buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
int nr_states;
|
||||
drmRadeonState *state;
|
||||
int nr_prims;
|
||||
drmRadeonPrim *prim;
|
||||
} drmRadeonVertex2;
|
||||
|
||||
#define RADEON_MAX_STATES 16
|
||||
#define RADEON_MAX_PRIMS 64
|
||||
|
||||
/* Command buffer. Replace with true dma stream?
|
||||
*/
|
||||
typedef struct {
|
||||
int bufsz;
|
||||
char *buf;
|
||||
int nbox;
|
||||
drmClipRect *boxes;
|
||||
} drmRadeonCmdBuffer;
|
||||
|
||||
/* New style per-packet identifiers for use in cmd_buffer ioctl with
|
||||
* the RADEON_EMIT_PACKET command. Comments relate new packets to old
|
||||
* state bits and the packet size:
|
||||
*/
|
||||
#define RADEON_EMIT_PP_MISC 0 /* context/7 */
|
||||
#define RADEON_EMIT_PP_CNTL 1 /* context/3 */
|
||||
#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
|
||||
#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
|
||||
#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
|
||||
#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
|
||||
#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
|
||||
#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
|
||||
#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
|
||||
#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
|
||||
#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
|
||||
#define RADEON_EMIT_RE_MISC 11 /* misc/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
|
||||
#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
|
||||
#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
|
||||
#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
|
||||
#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
|
||||
#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */
|
||||
#define R200_EMIT_TFACTOR_0 30 /* tf/6 */
|
||||
#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */
|
||||
#define R200_EMIT_VAP_CTL 32 /* vap/1 */
|
||||
#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
|
||||
#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
|
||||
#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
|
||||
#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
|
||||
#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
|
||||
#define R200_EMIT_VTE_CNTL 48 /* vte/1 */
|
||||
#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
|
||||
#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
|
||||
#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
|
||||
#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
|
||||
#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
|
||||
#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
|
||||
#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
|
||||
#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
|
||||
#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
|
||||
#define R200_EMIT_PP_CUBIC_FACES_0 61
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_0 62
|
||||
#define R200_EMIT_PP_CUBIC_FACES_1 63
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_1 64
|
||||
#define R200_EMIT_PP_CUBIC_FACES_2 65
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_2 66
|
||||
#define R200_EMIT_PP_CUBIC_FACES_3 67
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_3 68
|
||||
#define R200_EMIT_PP_CUBIC_FACES_4 69
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_4 70
|
||||
#define R200_EMIT_PP_CUBIC_FACES_5 71
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_5 72
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_0 73
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_1 74
|
||||
#define RADEON_EMIT_PP_TEX_SIZE_2 75
|
||||
#define RADEON_MAX_STATE_PACKETS 76
|
||||
|
||||
|
||||
/* Commands understood by cmd_buffer ioctl. More can be added but
|
||||
* obviously these can't be removed or changed:
|
||||
*/
|
||||
#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
|
||||
#define RADEON_CMD_SCALARS 2 /* emit scalar data */
|
||||
#define RADEON_CMD_VECTORS 3 /* emit vector data */
|
||||
#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
|
||||
#define RADEON_CMD_PACKET3 5 /* emit hw packet */
|
||||
#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
|
||||
#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */
|
||||
#define RADEON_CMD_WAIT 8 /* synchronization */
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
struct {
|
||||
unsigned char cmd_type, pad0, pad1, pad2;
|
||||
} header;
|
||||
struct {
|
||||
unsigned char cmd_type, packet_id, pad0, pad1;
|
||||
} packet;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} scalars;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} vectors;
|
||||
struct {
|
||||
unsigned char cmd_type, buf_idx, pad0, pad1;
|
||||
} dma;
|
||||
struct {
|
||||
unsigned char cmd_type, flags, pad0, pad1;
|
||||
} wait;
|
||||
} drmRadeonCmdHeader;
|
||||
|
||||
|
||||
#define RADEON_WAIT_2D 0x1
|
||||
#define RADEON_WAIT_3D 0x2
|
||||
|
||||
|
||||
typedef struct drm_radeon_getparam {
|
||||
int param;
|
||||
int *value;
|
||||
} drmRadeonGetParam;
|
||||
|
||||
#define RADEON_PARAM_GART_BUFFER_OFFSET 1
|
||||
#define RADEON_PARAM_LAST_FRAME 2
|
||||
#define RADEON_PARAM_LAST_DISPATCH 3
|
||||
#define RADEON_PARAM_LAST_CLEAR 4
|
||||
#define RADEON_PARAM_IRQ_NR 5
|
||||
#define RADEON_PARAM_GART_BASE 6
|
||||
|
||||
|
||||
#define RADEON_MEM_REGION_GART 1
|
||||
#define RADEON_MEM_REGION_FB 2
|
||||
|
||||
typedef struct drm_radeon_mem_alloc {
|
||||
int region;
|
||||
int alignment;
|
||||
int size;
|
||||
int *region_offset; /* offset from start of fb or GART */
|
||||
} drmRadeonMemAlloc;
|
||||
|
||||
typedef struct drm_radeon_mem_free {
|
||||
int region;
|
||||
int region_offset;
|
||||
} drmRadeonMemFree;
|
||||
|
||||
typedef struct drm_radeon_mem_init_heap {
|
||||
int region;
|
||||
int size;
|
||||
int start;
|
||||
} drmRadeonMemInitHeap;
|
||||
|
||||
/* 1.6: Userspace can request & wait on irq's:
|
||||
*/
|
||||
typedef struct drm_radeon_irq_emit {
|
||||
int *irq_seq;
|
||||
} drmRadeonIrqEmit;
|
||||
|
||||
typedef struct drm_radeon_irq_wait {
|
||||
int irq_seq;
|
||||
} drmRadeonIrqWait;
|
||||
|
||||
|
||||
/* 1.10: Clients tell the DRM where they think the framebuffer is located in
|
||||
* the card's address space, via a new generic ioctl to set parameters
|
||||
*/
|
||||
|
||||
typedef struct drm_radeon_set_param {
|
||||
unsigned int param;
|
||||
int64_t value;
|
||||
} drmRadeonSetParam;
|
||||
|
||||
#define RADEON_SETPARAM_FB_LOCATION 1
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,712 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2003 Eric Anholt
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Eric Anholt not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Eric Anholt makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "ati.h"
|
||||
#include "ati_reg.h"
|
||||
#include "ati_dma.h"
|
||||
#include "ati_draw.h"
|
||||
|
||||
extern ATIScreenInfo *accel_atis;
|
||||
static Bool is_transform[2];
|
||||
static PictTransform *transform[2];
|
||||
|
||||
struct blendinfo {
|
||||
Bool dst_alpha;
|
||||
Bool src_alpha;
|
||||
CARD32 blend_cntl;
|
||||
};
|
||||
|
||||
static struct blendinfo RadeonBlendOp[] = {
|
||||
/* Clear */
|
||||
{0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ZERO},
|
||||
/* Src */
|
||||
{0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO},
|
||||
/* Dst */
|
||||
{0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ONE},
|
||||
/* Over */
|
||||
{0, 1, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_INV_SRC_ALPHA},
|
||||
/* OverReverse */
|
||||
{1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ONE},
|
||||
/* In */
|
||||
{1, 0, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
|
||||
/* InReverse */
|
||||
{0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_SRC_ALPHA},
|
||||
/* Out */
|
||||
{1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
|
||||
/* OutReverse */
|
||||
{0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_INV_SRC_ALPHA},
|
||||
/* Atop */
|
||||
{1, 1, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
|
||||
/* AtopReverse */
|
||||
{1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_SRC_ALPHA},
|
||||
/* Xor */
|
||||
{1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
|
||||
/* Add */
|
||||
{0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ONE},
|
||||
};
|
||||
|
||||
struct formatinfo {
|
||||
int fmt;
|
||||
Bool byte_swap;
|
||||
CARD32 card_fmt;
|
||||
};
|
||||
|
||||
/* Note on texture formats:
|
||||
* TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I)
|
||||
*/
|
||||
static struct formatinfo R100TexFormats[] = {
|
||||
{PICT_a8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888},
|
||||
{PICT_a8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888},
|
||||
{PICT_r5g6b5, 0, RADEON_TXFORMAT_RGB565},
|
||||
{PICT_a1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555},
|
||||
{PICT_a8, 0, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP},
|
||||
};
|
||||
|
||||
static struct formatinfo R200TexFormats[] = {
|
||||
{PICT_a8r8g8b8, 0, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x8r8g8b8, 0, R200_TXFORMAT_ARGB8888},
|
||||
{PICT_a8r8g8b8, 1, R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x8r8g8b8, 1, R200_TXFORMAT_RGBA8888},
|
||||
{PICT_r5g6b5, 0, R200_TXFORMAT_RGB565},
|
||||
{PICT_a1r5g5b5, 0, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP},
|
||||
{PICT_x1r5g5b5, 0, R200_TXFORMAT_ARGB1555},
|
||||
{PICT_a8, 0, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP},
|
||||
};
|
||||
|
||||
/* Common Radeon setup code */
|
||||
|
||||
static Bool
|
||||
RadeonGetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
|
||||
{
|
||||
switch (pDstPicture->format) {
|
||||
case PICT_a8r8g8b8:
|
||||
case PICT_x8r8g8b8:
|
||||
*dst_format = RADEON_COLOR_FORMAT_ARGB8888;
|
||||
break;
|
||||
case PICT_r5g6b5:
|
||||
*dst_format = RADEON_COLOR_FORMAT_RGB565;
|
||||
break;
|
||||
case PICT_a1r5g5b5:
|
||||
case PICT_x1r5g5b5:
|
||||
*dst_format = RADEON_COLOR_FORMAT_ARGB1555;
|
||||
break;
|
||||
case PICT_a8:
|
||||
*dst_format = RADEON_COLOR_FORMAT_RGB8;
|
||||
break;
|
||||
default:
|
||||
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
|
||||
pDstPicture->format));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* R100-specific code */
|
||||
|
||||
static Bool
|
||||
R100CheckCompositeTexture(PicturePtr pPict, int unit)
|
||||
{
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
int i;
|
||||
|
||||
if ((w > 0x7ff) || (h > 0x7ff))
|
||||
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
|
||||
|
||||
for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
|
||||
{
|
||||
if (R100TexFormats[i].fmt == pPict->format)
|
||||
break;
|
||||
}
|
||||
if (i == sizeof(R100TexFormats) / sizeof(R100TexFormats[0]))
|
||||
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
|
||||
pPict->format));
|
||||
|
||||
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
|
||||
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
KdScreenPriv(pPix->drawable.pScreen);
|
||||
CARD32 txformat, txoffset, txpitch;
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
int i;
|
||||
RING_LOCALS;
|
||||
|
||||
txpitch = pPix->devKind;
|
||||
txoffset = ((CARD8 *)pPix->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
|
||||
for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
|
||||
{
|
||||
if (R100TexFormats[i].fmt == pPict->format)
|
||||
break;
|
||||
}
|
||||
txformat = R100TexFormats[i].card_fmt;
|
||||
if (R100TexFormats[i].byte_swap)
|
||||
txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP;
|
||||
|
||||
if (pPict->repeat) {
|
||||
txformat |= ATILog2(w) << RADEON_TXFORMAT_WIDTH_SHIFT;
|
||||
txformat |= ATILog2(h) << RADEON_TXFORMAT_HEIGHT_SHIFT;
|
||||
} else
|
||||
txformat |= RADEON_TXFORMAT_NON_POWER2;
|
||||
txformat |= unit << 24; /* RADEON_TXFORMAT_ST_ROUTE_STQX */
|
||||
|
||||
|
||||
if ((txoffset & 0x1f) != 0)
|
||||
ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
|
||||
if ((txpitch & 0x1f) != 0)
|
||||
ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
|
||||
|
||||
/* RADEON_REG_PP_TXFILTER_0,
|
||||
* RADEON_REG_PP_TXFORMAT_0,
|
||||
* RADEON_REG_PP_TXOFFSET_0
|
||||
*/
|
||||
BEGIN_DMA(4);
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0 + 0x18 * unit, 3));
|
||||
OUT_RING(0);
|
||||
OUT_RING(txformat);
|
||||
OUT_RING(txoffset);
|
||||
END_DMA();
|
||||
|
||||
/* RADEON_REG_PP_TEX_SIZE_0,
|
||||
* RADEON_REG_PP_TEX_PITCH_0
|
||||
*/
|
||||
BEGIN_DMA(3);
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0 + 0x8 * unit, 2));
|
||||
OUT_RING((pPix->drawable.width - 1) |
|
||||
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
|
||||
OUT_RING(txpitch - 32);
|
||||
END_DMA();
|
||||
|
||||
if (pPict->transform != 0) {
|
||||
is_transform[unit] = TRUE;
|
||||
transform[unit] = pPict->transform;
|
||||
} else {
|
||||
is_transform[unit] = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture)
|
||||
{
|
||||
CARD32 tmp1;
|
||||
|
||||
/* Check for unsupported compositing operations. */
|
||||
if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
|
||||
ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
|
||||
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
|
||||
RadeonBlendOp[op].src_alpha)
|
||||
ATI_FALLBACK(("Component alpha not supported with source "
|
||||
"alpha blending.\n"));
|
||||
if (pDstPicture->pDrawable->width >= (1 << 11) ||
|
||||
pDstPicture->pDrawable->height >= (1 << 11))
|
||||
ATI_FALLBACK(("Dest w/h too large (%d,%d).\n",
|
||||
pDstPicture->pDrawable->width,
|
||||
pDstPicture->pDrawable->height));
|
||||
|
||||
if (!R100CheckCompositeTexture(pSrcPicture, 0))
|
||||
return FALSE;
|
||||
if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1))
|
||||
return FALSE;
|
||||
|
||||
if (!RadeonGetDestFormat(pDstPicture, &tmp1))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R100PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 dst_format, dst_offset, dst_pitch;
|
||||
CARD32 pp_cntl, blendcntl, cblend, ablend;
|
||||
int pixel_shift;
|
||||
RING_LOCALS;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
RadeonGetDestFormat(pDstPicture, &dst_format);
|
||||
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
|
||||
|
||||
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
dst_pitch = pDst->devKind;
|
||||
if ((dst_offset & 0x0f) != 0)
|
||||
ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
|
||||
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
|
||||
ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
|
||||
|
||||
if (!R100TextureSetup(pSrcPicture, pSrc, 0))
|
||||
return FALSE;
|
||||
pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
|
||||
|
||||
if (pMask != NULL) {
|
||||
if (!R100TextureSetup(pMaskPicture, pMask, 1))
|
||||
return FALSE;
|
||||
pp_cntl |= RADEON_TEX_1_ENABLE;
|
||||
} else {
|
||||
is_transform[1] = FALSE;
|
||||
}
|
||||
|
||||
BEGIN_DMA(14);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
|
||||
|
||||
/* RADEON_REG_PP_CNTL,
|
||||
* RADEON_REG_RB3D_CNTL,
|
||||
* RADEON_REG_RB3D_COLOROFFSET
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
|
||||
OUT_RING(pp_cntl);
|
||||
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
|
||||
OUT_RING(dst_offset);
|
||||
|
||||
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
|
||||
|
||||
/* IN operator: Multiply src by mask components or mask alpha.
|
||||
* BLEND_CTL_ADD is A * B + C.
|
||||
* If a picture is a8, we have to explicitly zero its color values.
|
||||
* If the destination is a8, we have to route the alpha to red, I think.
|
||||
*/
|
||||
cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
|
||||
RADEON_COLOR_ARG_C_ZERO;
|
||||
ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
|
||||
RADEON_ALPHA_ARG_C_ZERO;
|
||||
|
||||
if (pDstPicture->format == PICT_a8)
|
||||
cblend |= RADEON_COLOR_ARG_A_T0_ALPHA;
|
||||
else if (pSrcPicture->format == PICT_a8)
|
||||
cblend |= RADEON_COLOR_ARG_A_ZERO;
|
||||
else
|
||||
cblend |= RADEON_COLOR_ARG_A_T0_COLOR;
|
||||
ablend |= RADEON_ALPHA_ARG_A_T0_ALPHA;
|
||||
|
||||
if (pMask) {
|
||||
if (pMaskPicture->componentAlpha &&
|
||||
pDstPicture->format != PICT_a8)
|
||||
cblend |= RADEON_COLOR_ARG_B_T1_COLOR;
|
||||
else
|
||||
cblend |= RADEON_COLOR_ARG_B_T1_ALPHA;
|
||||
ablend |= RADEON_ALPHA_ARG_B_T1_ALPHA;
|
||||
} else {
|
||||
cblend |= RADEON_COLOR_ARG_B_ZERO | RADEON_COMP_ARG_B;
|
||||
ablend |= RADEON_ALPHA_ARG_B_ZERO | RADEON_COMP_ARG_B;
|
||||
}
|
||||
|
||||
OUT_REG(RADEON_REG_PP_TXCBLEND_0, cblend);
|
||||
OUT_REG(RADEON_REG_PP_TXABLEND_0, ablend);
|
||||
|
||||
/* Op operator. */
|
||||
blendcntl = RadeonBlendOp[op].blend_cntl;
|
||||
if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
|
||||
RadeonBlendOp[op].dst_alpha) {
|
||||
if ((blendcntl & RADEON_SBLEND_MASK) ==
|
||||
RADEON_SBLEND_GL_DST_ALPHA)
|
||||
blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
|
||||
RADEON_SBLEND_GL_ONE;
|
||||
else if ((blendcntl & RADEON_SBLEND_MASK) ==
|
||||
RADEON_SBLEND_GL_INV_DST_ALPHA)
|
||||
blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
|
||||
RADEON_SBLEND_GL_ZERO;
|
||||
}
|
||||
OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
|
||||
END_DMA();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
R200CheckCompositeTexture(PicturePtr pPict, int unit)
|
||||
{
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
int i;
|
||||
|
||||
if ((w > 0x7ff) || (h > 0x7ff))
|
||||
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
|
||||
|
||||
for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
|
||||
{
|
||||
if (R200TexFormats[i].fmt == pPict->format)
|
||||
break;
|
||||
}
|
||||
if (i == sizeof(R200TexFormats) / sizeof(R200TexFormats[0]))
|
||||
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
|
||||
pPict->format));
|
||||
|
||||
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
|
||||
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
static Bool
|
||||
R200TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
KdScreenPriv(pPix->drawable.pScreen);
|
||||
CARD32 txformat, txoffset, txpitch;
|
||||
int w = pPict->pDrawable->width;
|
||||
int h = pPict->pDrawable->height;
|
||||
int i;
|
||||
RING_LOCALS;
|
||||
|
||||
txpitch = pPix->devKind;
|
||||
txoffset = ((CARD8 *)pPix->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
|
||||
for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
|
||||
{
|
||||
if (R200TexFormats[i].fmt == pPict->format)
|
||||
break;
|
||||
}
|
||||
txformat = R200TexFormats[i].card_fmt;
|
||||
if (R100TexFormats[i].byte_swap)
|
||||
txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP;
|
||||
|
||||
if (pPict->repeat) {
|
||||
txformat |= ATILog2(w) << R200_TXFORMAT_WIDTH_SHIFT;
|
||||
txformat |= ATILog2(h) << R200_TXFORMAT_HEIGHT_SHIFT;
|
||||
} else
|
||||
txformat |= R200_TXFORMAT_NON_POWER2;
|
||||
txformat |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT;
|
||||
|
||||
if ((txoffset & 0x1f) != 0)
|
||||
ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
|
||||
if ((txpitch & 0x1f) != 0)
|
||||
ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
|
||||
|
||||
/* R200_REG_PP_TXFILTER_0,
|
||||
* R200_REG_PP_TXFORMAT_0,
|
||||
* R200_REG_PP_TXFORMAT_X_0,
|
||||
* R200_REG_PP_TXSIZE_0,
|
||||
* R200_REG_PP_TXPITCH_0
|
||||
*/
|
||||
BEGIN_DMA(6);
|
||||
OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0 + 0x20 * unit, 5));
|
||||
OUT_RING(0);
|
||||
OUT_RING(txformat);
|
||||
OUT_RING(0);
|
||||
OUT_RING((pPix->drawable.width - 1) |
|
||||
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); /* XXX */
|
||||
OUT_RING(txpitch - 32); /* XXX */
|
||||
END_DMA();
|
||||
|
||||
BEGIN_DMA(2);
|
||||
OUT_REG(R200_PP_TXOFFSET_0 + 0x18 * unit, txoffset);
|
||||
END_DMA();
|
||||
|
||||
if (pPict->transform != 0) {
|
||||
is_transform[unit] = TRUE;
|
||||
transform[unit] = pPict->transform;
|
||||
} else {
|
||||
is_transform[unit] = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture)
|
||||
{
|
||||
CARD32 tmp1;
|
||||
|
||||
/* Check for unsupported compositing operations. */
|
||||
if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
|
||||
ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
|
||||
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
|
||||
RadeonBlendOp[op].src_alpha)
|
||||
ATI_FALLBACK(("Component alpha not supported with source "
|
||||
"alpha blending.\n"));
|
||||
|
||||
if (!R200CheckCompositeTexture(pSrcPicture, 0))
|
||||
return FALSE;
|
||||
if (pMaskPicture != NULL && !R200CheckCompositeTexture(pMaskPicture, 1))
|
||||
return FALSE;
|
||||
|
||||
if (!RadeonGetDestFormat(pDstPicture, &tmp1))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
R200PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
|
||||
{
|
||||
KdScreenPriv(pDst->drawable.pScreen);
|
||||
ATIScreenInfo(pScreenPriv);
|
||||
CARD32 dst_format, dst_offset, dst_pitch;
|
||||
CARD32 pp_cntl, blendcntl, cblend, ablend;
|
||||
int pixel_shift;
|
||||
RING_LOCALS;
|
||||
|
||||
RadeonGetDestFormat(pDstPicture, &dst_format);
|
||||
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
|
||||
|
||||
accel_atis = atis;
|
||||
|
||||
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
|
||||
pScreenPriv->screen->memory_base);
|
||||
dst_pitch = pDst->devKind;
|
||||
if ((dst_offset & 0x0f) != 0)
|
||||
ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
|
||||
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
|
||||
ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
|
||||
|
||||
if (!R200TextureSetup(pSrcPicture, pSrc, 0))
|
||||
return FALSE;
|
||||
pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
|
||||
|
||||
if (pMask != NULL) {
|
||||
if (!R200TextureSetup(pMaskPicture, pMask, 1))
|
||||
return FALSE;
|
||||
pp_cntl |= RADEON_TEX_1_ENABLE;
|
||||
} else {
|
||||
is_transform[1] = FALSE;
|
||||
}
|
||||
|
||||
BEGIN_DMA(34);
|
||||
OUT_REG(ATI_REG_WAIT_UNTIL,
|
||||
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
|
||||
|
||||
/* RADEON_REG_PP_CNTL,
|
||||
* RADEON_REG_RB3D_CNTL,
|
||||
* RADEON_REG_RB3D_COLOROFFSET
|
||||
*/
|
||||
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
|
||||
OUT_RING(pp_cntl);
|
||||
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
|
||||
OUT_RING(dst_offset);
|
||||
|
||||
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
|
||||
|
||||
/* IN operator: Multiply src by mask components or mask alpha.
|
||||
* BLEND_CTL_ADD is A * B + C.
|
||||
* If a picture is a8, we have to explicitly zero its color values.
|
||||
* If the destination is a8, we have to route the alpha to red, I think.
|
||||
*/
|
||||
cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO;
|
||||
ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO;
|
||||
|
||||
if (pDstPicture->format == PICT_a8)
|
||||
cblend |= R200_TXC_ARG_A_R0_ALPHA;
|
||||
else if (pSrcPicture->format == PICT_a8)
|
||||
cblend |= R200_TXC_ARG_A_ZERO;
|
||||
else
|
||||
cblend |= R200_TXC_ARG_A_R0_COLOR;
|
||||
ablend |= R200_TXA_ARG_B_R0_ALPHA;
|
||||
|
||||
if (pMask) {
|
||||
if (pMaskPicture->componentAlpha &&
|
||||
pDstPicture->format != PICT_a8)
|
||||
cblend |= R200_TXC_ARG_B_R1_COLOR;
|
||||
else
|
||||
cblend |= R200_TXC_ARG_B_R1_ALPHA;
|
||||
ablend |= R200_TXA_ARG_B_R1_ALPHA;
|
||||
} else {
|
||||
cblend |= R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B;
|
||||
ablend |= R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B;
|
||||
}
|
||||
|
||||
OUT_REG(R200_REG_PP_TXCBLEND_0, cblend);
|
||||
OUT_REG(R200_REG_PP_TXABLEND_0, ablend);
|
||||
OUT_REG(R200_REG_PP_TXCBLEND2_0, 0);
|
||||
OUT_REG(R200_REG_PP_TXABLEND2_0, 0);
|
||||
|
||||
/* Op operator. */
|
||||
blendcntl = RadeonBlendOp[op].blend_cntl;
|
||||
if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
|
||||
RadeonBlendOp[op].dst_alpha) {
|
||||
blendcntl &= ~RADEON_SBLEND_MASK;
|
||||
if ((blendcntl & RADEON_SBLEND_MASK) ==
|
||||
RADEON_SBLEND_GL_DST_ALPHA)
|
||||
blendcntl |= RADEON_SBLEND_GL_ONE;
|
||||
else if ((blendcntl & RADEON_SBLEND_MASK) ==
|
||||
RADEON_SBLEND_GL_INV_DST_ALPHA)
|
||||
blendcntl |= RADEON_SBLEND_GL_ZERO;
|
||||
}
|
||||
OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
|
||||
END_DMA();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
union intfloat {
|
||||
float f;
|
||||
CARD32 i;
|
||||
};
|
||||
|
||||
struct blend_vertex {
|
||||
union intfloat x, y;
|
||||
union intfloat s0, t0;
|
||||
union intfloat s1, t1;
|
||||
};
|
||||
|
||||
#define VTX_DWORD_COUNT 6
|
||||
|
||||
#define VTX_OUT(vtx) \
|
||||
do { \
|
||||
OUT_RING(vtx.x.i); \
|
||||
OUT_RING(vtx.y.i); \
|
||||
OUT_RING(vtx.s0.i); \
|
||||
OUT_RING(vtx.t0.i); \
|
||||
OUT_RING(vtx.s1.i); \
|
||||
OUT_RING(vtx.t1.i); \
|
||||
} while (0)
|
||||
|
||||
void
|
||||
RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
|
||||
int w, int h)
|
||||
{
|
||||
ATIScreenInfo *atis = accel_atis;
|
||||
ATICardInfo *atic = atis->atic;
|
||||
struct blend_vertex vtx[4];
|
||||
int srcXend, srcYend, maskXend, maskYend;
|
||||
RING_LOCALS;
|
||||
|
||||
/*ErrorF("RadeonComposite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
|
||||
srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
|
||||
|
||||
if (is_transform[0]) {
|
||||
PictVector v;
|
||||
|
||||
v.vector[0] = IntToxFixed(srcX);
|
||||
v.vector[1] = IntToxFixed(srcY);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[0], &v);
|
||||
srcX = xFixedToInt(v.vector[0]);
|
||||
srcY = xFixedToInt(v.vector[1]);
|
||||
v.vector[0] = IntToxFixed(srcX + w);
|
||||
v.vector[1] = IntToxFixed(srcY + h);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[0], &v);
|
||||
srcXend = xFixedToInt(v.vector[0]);
|
||||
srcYend = xFixedToInt(v.vector[1]);
|
||||
} else {
|
||||
srcXend = srcX + w;
|
||||
srcYend = srcY + h;
|
||||
}
|
||||
if (is_transform[1]) {
|
||||
PictVector v;
|
||||
|
||||
v.vector[0] = IntToxFixed(maskX);
|
||||
v.vector[1] = IntToxFixed(maskY);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[1], &v);
|
||||
maskX = xFixedToInt(v.vector[0]);
|
||||
maskY = xFixedToInt(v.vector[1]);
|
||||
v.vector[0] = IntToxFixed(maskX + w);
|
||||
v.vector[1] = IntToxFixed(maskY + h);
|
||||
v.vector[3] = xFixed1;
|
||||
PictureTransformPoint(transform[1], &v);
|
||||
maskXend = xFixedToInt(v.vector[0]);
|
||||
maskYend = xFixedToInt(v.vector[1]);
|
||||
} else {
|
||||
maskXend = maskX + w;
|
||||
maskYend = maskY + h;
|
||||
}
|
||||
|
||||
vtx[0].x.f = dstX;
|
||||
vtx[0].y.f = dstY;
|
||||
vtx[0].s0.f = srcX;
|
||||
vtx[0].t0.f = srcY;
|
||||
vtx[0].s1.f = maskX;
|
||||
vtx[0].t1.f = maskY;
|
||||
|
||||
vtx[1].x.f = dstX;
|
||||
vtx[1].y.f = dstY + h;
|
||||
vtx[1].s0.f = srcX;
|
||||
vtx[1].t0.f = srcYend;
|
||||
vtx[1].s1.f = maskX;
|
||||
vtx[1].t1.f = maskYend;
|
||||
|
||||
vtx[2].x.f = dstX + w;
|
||||
vtx[2].y.f = dstY + h;
|
||||
vtx[2].s0.f = srcXend;
|
||||
vtx[2].t0.f = srcYend;
|
||||
vtx[2].s1.f = maskXend;
|
||||
vtx[2].t1.f = maskYend;
|
||||
|
||||
vtx[3].x.f = dstX + w;
|
||||
vtx[3].y.f = dstY;
|
||||
vtx[3].s0.f = srcXend;
|
||||
vtx[3].t0.f = srcY;
|
||||
vtx[3].s1.f = maskXend;
|
||||
vtx[3].t1.f = maskY;
|
||||
|
||||
if (atic->is_r100) {
|
||||
BEGIN_DMA(4 * VTX_DWORD_COUNT + 3);
|
||||
OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
|
||||
4 * VTX_DWORD_COUNT + 2));
|
||||
OUT_RING(RADEON_CP_VC_FRMT_XY |
|
||||
RADEON_CP_VC_FRMT_ST0 |
|
||||
RADEON_CP_VC_FRMT_ST1);
|
||||
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
|
||||
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
|
||||
RADEON_CP_VC_CNTL_MAOS_ENABLE |
|
||||
RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
|
||||
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
|
||||
} else {
|
||||
BEGIN_DMA(4 * VTX_DWORD_COUNT + 2);
|
||||
OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
|
||||
4 * VTX_DWORD_COUNT + 1));
|
||||
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
|
||||
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
|
||||
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
|
||||
}
|
||||
|
||||
VTX_OUT(vtx[0]);
|
||||
VTX_OUT(vtx[1]);
|
||||
VTX_OUT(vtx[2]);
|
||||
VTX_OUT(vtx[3]);
|
||||
|
||||
END_DMA();
|
||||
}
|
||||
|
||||
void
|
||||
RadeonDoneComposite(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.5 2002/10/30 12:52:14 alanh Exp $ */
|
||||
/*
|
||||
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
|
||||
* VA Linux Systems Inc., Fremont, California.
|
||||
*
|
||||
* 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 on 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
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
|
||||
* THEIR SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@xfree86.org>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RADEON_SAREA_H_
|
||||
#define _RADEON_SAREA_H_
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the kernel file (radeon_drm.h)
|
||||
*/
|
||||
#ifndef __RADEON_SAREA_DEFINES__
|
||||
#define __RADEON_SAREA_DEFINES__
|
||||
|
||||
/* What needs to be changed for the current vertex buffer? */
|
||||
#define RADEON_UPLOAD_CONTEXT 0x00000001
|
||||
#define RADEON_UPLOAD_VERTFMT 0x00000002
|
||||
#define RADEON_UPLOAD_LINE 0x00000004
|
||||
#define RADEON_UPLOAD_BUMPMAP 0x00000008
|
||||
#define RADEON_UPLOAD_MASKS 0x00000010
|
||||
#define RADEON_UPLOAD_VIEWPORT 0x00000020
|
||||
#define RADEON_UPLOAD_SETUP 0x00000040
|
||||
#define RADEON_UPLOAD_TCL 0x00000080
|
||||
#define RADEON_UPLOAD_MISC 0x00000100
|
||||
#define RADEON_UPLOAD_TEX0 0x00000200
|
||||
#define RADEON_UPLOAD_TEX1 0x00000400
|
||||
#define RADEON_UPLOAD_TEX2 0x00000800
|
||||
#define RADEON_UPLOAD_TEX0IMAGES 0x00001000
|
||||
#define RADEON_UPLOAD_TEX1IMAGES 0x00002000
|
||||
#define RADEON_UPLOAD_TEX2IMAGES 0x00004000
|
||||
#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
|
||||
#define RADEON_REQUIRE_QUIESCENCE 0x00010000
|
||||
#define RADEON_UPLOAD_ZBIAS 0x00020000
|
||||
#define RADEON_UPLOAD_ALL 0x0002ffff
|
||||
#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff
|
||||
|
||||
#define RADEON_FRONT 0x1
|
||||
#define RADEON_BACK 0x2
|
||||
#define RADEON_DEPTH 0x4
|
||||
#define RADEON_STENCIL 0x8
|
||||
|
||||
/* Primitive types */
|
||||
#define RADEON_POINTS 0x1
|
||||
#define RADEON_LINES 0x2
|
||||
#define RADEON_LINE_STRIP 0x3
|
||||
#define RADEON_TRIANGLES 0x4
|
||||
#define RADEON_TRIANGLE_FAN 0x5
|
||||
#define RADEON_TRIANGLE_STRIP 0x6
|
||||
#define RADEON_3VTX_POINTS 0x9
|
||||
#define RADEON_3VTX_LINES 0xa
|
||||
|
||||
/* Vertex/indirect buffer size */
|
||||
#define RADEON_BUFFER_SIZE 65536
|
||||
|
||||
/* Byte offsets for indirect buffer data */
|
||||
#define RADEON_INDEX_PRIM_OFFSET 20
|
||||
#define RADEON_HOSTDATA_BLIT_OFFSET 32
|
||||
|
||||
#define RADEON_SCRATCH_REG_OFFSET 32
|
||||
|
||||
/* Keep these small for testing */
|
||||
#define RADEON_NR_SAREA_CLIPRECTS 12
|
||||
|
||||
#define RADEON_MAX_TEXTURE_LEVELS 12
|
||||
#define RADEON_MAX_TEXTURE_UNITS 3
|
||||
|
||||
/* Blits have strict offset rules. All blit offset must be aligned on
|
||||
* a 1K-byte boundary.
|
||||
*/
|
||||
#define RADEON_OFFSET_SHIFT 10
|
||||
#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
|
||||
#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
|
||||
|
||||
#endif /* __RADEON_SAREA_DEFINES__ */
|
||||
|
||||
typedef struct {
|
||||
unsigned int red;
|
||||
unsigned int green;
|
||||
unsigned int blue;
|
||||
unsigned int alpha;
|
||||
} radeon_color_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* Context state */
|
||||
unsigned int pp_misc;
|
||||
unsigned int pp_fog_color;
|
||||
unsigned int re_solid_color;
|
||||
unsigned int rb3d_blendcntl;
|
||||
unsigned int rb3d_depthoffset;
|
||||
unsigned int rb3d_depthpitch;
|
||||
unsigned int rb3d_zstencilcntl;
|
||||
|
||||
unsigned int pp_cntl;
|
||||
unsigned int rb3d_cntl;
|
||||
unsigned int rb3d_coloroffset;
|
||||
unsigned int re_width_height;
|
||||
unsigned int rb3d_colorpitch;
|
||||
unsigned int se_cntl;
|
||||
|
||||
/* Vertex format state */
|
||||
unsigned int se_coord_fmt;
|
||||
|
||||
/* Line state */
|
||||
unsigned int re_line_pattern;
|
||||
unsigned int re_line_state;
|
||||
|
||||
unsigned int se_line_width;
|
||||
|
||||
/* Bumpmap state */
|
||||
unsigned int pp_lum_matrix;
|
||||
|
||||
unsigned int pp_rot_matrix_0;
|
||||
unsigned int pp_rot_matrix_1;
|
||||
|
||||
/* Mask state */
|
||||
unsigned int rb3d_stencilrefmask;
|
||||
unsigned int rb3d_ropcntl;
|
||||
unsigned int rb3d_planemask;
|
||||
|
||||
/* Viewport state */
|
||||
unsigned int se_vport_xscale;
|
||||
unsigned int se_vport_xoffset;
|
||||
unsigned int se_vport_yscale;
|
||||
unsigned int se_vport_yoffset;
|
||||
unsigned int se_vport_zscale;
|
||||
unsigned int se_vport_zoffset;
|
||||
|
||||
/* Setup state */
|
||||
unsigned int se_cntl_status;
|
||||
|
||||
/* Misc state */
|
||||
unsigned int re_top_left;
|
||||
unsigned int re_misc;
|
||||
} radeon_context_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit */
|
||||
typedef struct {
|
||||
unsigned int pp_txfilter;
|
||||
unsigned int pp_txformat;
|
||||
unsigned int pp_txoffset;
|
||||
unsigned int pp_txcblend;
|
||||
unsigned int pp_txablend;
|
||||
unsigned int pp_tfactor;
|
||||
unsigned int pp_border_color;
|
||||
} radeon_texture_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* The channel for communication of state information to the kernel
|
||||
* on firing a vertex buffer.
|
||||
*/
|
||||
radeon_context_regs_t ContextState;
|
||||
radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS];
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
unsigned int vc_format;
|
||||
|
||||
/* The current cliprects, or a subset thereof */
|
||||
XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
|
||||
/* Counters for throttling of rendering clients */
|
||||
unsigned int last_frame;
|
||||
unsigned int last_dispatch;
|
||||
unsigned int last_clear;
|
||||
|
||||
/* Maintain an LRU of contiguous regions of texture space. If you
|
||||
* think you own a region of texture memory, and it has an age
|
||||
* different to the one you set, then you are mistaken and it has
|
||||
* been stolen by another client. If global texAge hasn't changed,
|
||||
* there is no need to walk the list.
|
||||
*
|
||||
* These regions can be used as a proxy for the fine-grained texture
|
||||
* information of other clients - by maintaining them in the same
|
||||
* lru which is used to age their own textures, clients have an
|
||||
* approximate lru for the whole of global texture space, and can
|
||||
* make informed decisions as to which areas to kick out. There is
|
||||
* no need to choose whether to kick out your own texture or someone
|
||||
* else's - simply eject them all in LRU order.
|
||||
*/
|
||||
/* Last elt is sentinal */
|
||||
drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1];
|
||||
/* last time texture was uploaded */
|
||||
unsigned int texAge[ATI_NR_TEX_HEAPS];
|
||||
|
||||
int ctxOwner; /* last context to upload state */
|
||||
int pfAllowPageFlip; /* set by the 2d driver, read by the client */
|
||||
int pfCurrentPage; /* set by kernel, read by others */
|
||||
int crtc2_base; /* for pageflipping with CloneMode */
|
||||
} RADEONSAREAPriv, *RADEONSAREAPrivPtr;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
INCLUDES = \
|
||||
@KDRIVE_INCS@ \
|
||||
-I$(top_srcdir)/hw/kdrive/vesa \
|
||||
@XSERVER_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = Xchips
|
||||
|
||||
if TSLIB
|
||||
TSLIB_FLAG = -lts
|
||||
endif
|
||||
|
||||
noinst_LIBRARIES = libchips.a
|
||||
|
||||
libchips_a_SOURCES = \
|
||||
chipsdraw.c \
|
||||
chips.c \
|
||||
chips.h
|
||||
|
||||
Xchips_SOURCES = \
|
||||
chipsstub.c
|
||||
|
||||
CHIPS_LIBS = \
|
||||
libchips.a \
|
||||
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
|
||||
@KDRIVE_LIBS@
|
||||
|
||||
Xchips_LDADD = \
|
||||
$(CHIPS_LIBS) \
|
||||
@XSERVER_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
Xchips_DEPENDENCIES = $(CHIPS_LIBS) @KDRIVE_LIBS@
|
||||
|
|
@ -1,341 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2001 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.18 2001/06/04 09:45:42 keithp Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "chips.h"
|
||||
#include <sys/io.h>
|
||||
|
||||
#undef CHIPS_DEBUG
|
||||
|
||||
Bool
|
||||
chipsCardInit (KdCardInfo *card)
|
||||
{
|
||||
int k;
|
||||
char *pixels;
|
||||
ChipsCardInfo *chipsc;
|
||||
CARD8 r00, r01, r02;
|
||||
CARD8 r39;
|
||||
|
||||
chipsc = (ChipsCardInfo *) xalloc (sizeof (ChipsCardInfo));
|
||||
if (!chipsc)
|
||||
return FALSE;
|
||||
|
||||
iopl (3);
|
||||
|
||||
if (!vesaInitialize (card, &chipsc->vesa))
|
||||
{
|
||||
xfree (chipsc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_PCI
|
||||
chipsc->window = (CARD32 *) (chipsc->cop_base + 0x10000);
|
||||
#else
|
||||
chipsc->window = 0;
|
||||
#endif
|
||||
card->driver = chipsc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
chipsScreenInit (KdScreenInfo *screen)
|
||||
{
|
||||
ChipsCardInfo *chipsc = screen->card->driver;
|
||||
ChipsScreenInfo *chipss;
|
||||
int screen_size, memory;
|
||||
CARD32 mmio_base;
|
||||
CARD32 mmio_size;
|
||||
|
||||
chipss = (ChipsScreenInfo *) xalloc (sizeof (ChipsScreenInfo));
|
||||
if (!chipss)
|
||||
return FALSE;
|
||||
memset (chipss, '\0', sizeof (ChipsScreenInfo));
|
||||
if (!vesaScreenInitialize (screen, &chipss->vesa))
|
||||
{
|
||||
xfree (chipss);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (chipss->vesa.mapping != VESA_LINEAR)
|
||||
screen->dumb = TRUE;
|
||||
if (!screen->dumb)
|
||||
{
|
||||
chipss->mmio_base = (CARD8 *) KdMapDevice (CHIPS_MMIO_BASE(chipss),
|
||||
CHIPS_MMIO_SIZE(chipss));
|
||||
|
||||
if (chipss->mmio_base)
|
||||
{
|
||||
KdSetMappedMode (CHIPS_MMIO_BASE(chipss),
|
||||
CHIPS_MMIO_SIZE(chipss),
|
||||
KD_MAPPED_MODE_REGISTERS);
|
||||
}
|
||||
else
|
||||
screen->dumb = TRUE;
|
||||
}
|
||||
else
|
||||
chipss->mmio_base = 0;
|
||||
|
||||
chipss->screen = chipss->vesa.fb;
|
||||
memory = chipss->vesa.fb_size;
|
||||
|
||||
screen_size = screen->fb[0].byteStride * screen->height;
|
||||
|
||||
if (chipss->screen && memory >= screen_size + 2048)
|
||||
{
|
||||
memory -= 2048;
|
||||
chipss->cursor_base = chipss->screen + memory - 2048;
|
||||
}
|
||||
else
|
||||
chipss->cursor_base = 0;
|
||||
memory -= screen_size;
|
||||
if (memory > screen->fb[0].byteStride)
|
||||
{
|
||||
chipss->off_screen = chipss->screen + screen_size;
|
||||
chipss->off_screen_size = memory;
|
||||
}
|
||||
else
|
||||
{
|
||||
chipss->off_screen = 0;
|
||||
chipss->off_screen_size = 0;
|
||||
}
|
||||
screen->driver = chipss;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
chipsInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
return vesaInitScreen (pScreen);
|
||||
}
|
||||
|
||||
#ifdef RANDR
|
||||
static Bool
|
||||
chipsRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation rotation,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
KdCheckSync (pScreen);
|
||||
|
||||
if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
chipsRandRInit (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPriv(pScreen);
|
||||
|
||||
pScrPriv->rrSetConfig = chipsRandRSetConfig;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
chipsFinishInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
Bool ret;
|
||||
ret = vesaFinishInitScreen (pScreen);
|
||||
#ifdef RANDR
|
||||
chipsRandRInit (pScreen);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
chipsCreateResources (ScreenPtr pScreen)
|
||||
{
|
||||
return vesaCreateResources (pScreen);
|
||||
}
|
||||
|
||||
CARD8
|
||||
chipsReadXR (ChipsScreenInfo *chipss, CARD8 index)
|
||||
{
|
||||
CARD8 value;
|
||||
outb (index, 0x3d6);
|
||||
value = inb (0x3d7);
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
chipsWriteXR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
|
||||
{
|
||||
outb (index, 0x3d6);
|
||||
outb (value, 0x3d7);
|
||||
}
|
||||
|
||||
CARD8
|
||||
chipsReadFR (ChipsScreenInfo *chipss, CARD8 index)
|
||||
{
|
||||
CARD8 value;
|
||||
outb (index, 0x3d0);
|
||||
value = inb (0x3d1);
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
chipsWriteFR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
|
||||
{
|
||||
outb (index, 0x3d0);
|
||||
outb (value, 0x3d1);
|
||||
}
|
||||
|
||||
CARD8
|
||||
chipsReadSeq (ChipsScreenInfo *chipss, CARD8 index)
|
||||
{
|
||||
CARD8 value;
|
||||
outb (index, 0x3c4);
|
||||
value = inb (0x3c5);
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
chipsWriteSeq (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
|
||||
{
|
||||
outb (index, 0x3c4);
|
||||
outb (value, 0x3c5);
|
||||
}
|
||||
|
||||
void
|
||||
chipsPreserve (KdCardInfo *card)
|
||||
{
|
||||
ChipsCardInfo *chipss = card->driver;
|
||||
vesaPreserve(card);
|
||||
}
|
||||
|
||||
void
|
||||
chipsSetMMIO (ChipsCardInfo *chipsc)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
chipsResetMMIO (ChipsCardInfo *chipsc)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
chipsEnable (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
ChipsCardInfo *chipsc = pScreenPriv->card->driver;
|
||||
|
||||
if (!vesaEnable (pScreen))
|
||||
return FALSE;
|
||||
chipsSetMMIO (chipsc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
chipsDPMS (ScreenPtr pScreen, int mode)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
chipsScreenInfo(pScreenPriv);
|
||||
|
||||
ErrorF ("seqreg 0x01 0x%x\n", chipsReadSeq (chipss, 0x1));
|
||||
ErrorF ("dpmsreg XR61 0x%x\n", chipsReadXR (chipss, 0x61));
|
||||
ErrorF ("dpmsreg XR73 0x%x\n", chipsReadXR (chipss, 0x73));
|
||||
|
||||
ErrorF ("flat panel FR05 0x%x\n", chipsReadFR (chipss, 0x5));
|
||||
ErrorF ("flat panel XR52 0x%x\n", chipsReadXR (chipss, 0x52));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
chipsDisable (ScreenPtr pScreen)
|
||||
{
|
||||
vesaDisable (pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
chipsRestore (KdCardInfo *card)
|
||||
{
|
||||
ChipsCardInfo *chipsc = card->driver;
|
||||
|
||||
chipsResetMMIO (chipsc);
|
||||
vesaRestore (card);
|
||||
}
|
||||
|
||||
void
|
||||
chipsScreenFini (KdScreenInfo *screen)
|
||||
{
|
||||
ChipsScreenInfo *chipss = (ChipsScreenInfo *) screen->driver;
|
||||
|
||||
if (chipss->mmio_base)
|
||||
{
|
||||
KdUnmapDevice ((void *) chipss->mmio_base, CHIPS_MMIO_SIZE(chipss));
|
||||
KdResetMappedMode (CHIPS_MMIO_BASE(chipss),
|
||||
CHIPS_MMIO_SIZE(chipss),
|
||||
KD_MAPPED_MODE_REGISTERS);
|
||||
}
|
||||
vesaScreenFini (screen);
|
||||
xfree (chipss);
|
||||
screen->driver = 0;
|
||||
}
|
||||
|
||||
void
|
||||
chipsCardFini (KdCardInfo *card)
|
||||
{
|
||||
ChipsCardInfo *chipsc = card->driver;
|
||||
|
||||
vesaCardFini (card);
|
||||
}
|
||||
|
||||
#define chipsCursorInit (void *) 0
|
||||
#define chipsCursorEnable (void *) 0
|
||||
#define chipsCursorDisable (void *) 0
|
||||
#define chipsCursorFini (void *) 0
|
||||
#define chipsRecolorCursor (void *) 0
|
||||
|
||||
KdCardFuncs chipsFuncs = {
|
||||
chipsCardInit, /* cardinit */
|
||||
chipsScreenInit, /* scrinit */
|
||||
chipsInitScreen, /* initScreen */
|
||||
chipsFinishInitScreen, /* finishInitScreen */
|
||||
chipsCreateResources, /* createRes */
|
||||
chipsPreserve, /* preserve */
|
||||
chipsEnable, /* enable */
|
||||
vesaDPMS, /* dpms */
|
||||
chipsDisable, /* disable */
|
||||
chipsRestore, /* restore */
|
||||
chipsScreenFini, /* scrfini */
|
||||
chipsCardFini, /* cardfini */
|
||||
|
||||
chipsCursorInit, /* initCursor */
|
||||
chipsCursorEnable, /* enableCursor */
|
||||
chipsCursorDisable, /* disableCursor */
|
||||
chipsCursorFini, /* finiCursor */
|
||||
chipsRecolorCursor, /* recolorCursor */
|
||||
|
||||
chipsDrawInit, /* initAccel */
|
||||
chipsDrawEnable, /* enableAccel */
|
||||
chipsDrawSync, /* syncAccel */
|
||||
chipsDrawDisable, /* disableAccel */
|
||||
chipsDrawFini, /* finiAccel */
|
||||
|
||||
vesaGetColors, /* getColors */
|
||||
vesaPutColors, /* putColors */
|
||||
};
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Id: chips.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chips.h,v 1.9 2000/11/29 08:42:25 keithp Exp $ */
|
||||
|
||||
#ifndef _CHIPS_H_
|
||||
#define _CHIPS_H_
|
||||
#include <vesa.h>
|
||||
|
||||
/*
|
||||
* offset from ioport beginning
|
||||
*/
|
||||
|
||||
#define HIQV
|
||||
#ifdef HIQV
|
||||
#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x400000)
|
||||
#else
|
||||
#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x200000)
|
||||
#endif
|
||||
#define CHIPS_MMIO_SIZE(c) (0x20000)
|
||||
|
||||
typedef volatile CARD8 VOL8;
|
||||
typedef volatile CARD16 VOL16;
|
||||
typedef volatile CARD32 VOL32;
|
||||
|
||||
typedef struct _chipsSave {
|
||||
int dummy;
|
||||
} ChipsSave;
|
||||
|
||||
typedef struct _chipsCardInfo {
|
||||
VesaCardPrivRec vesa;
|
||||
CARD32 *window;
|
||||
Bool mmio;
|
||||
ChipsSave save;
|
||||
} ChipsCardInfo;
|
||||
|
||||
#define getChipsCardInfo(kd) ((ChipsCardInfo *) ((kd)->card->driver))
|
||||
#define chipsCardInfo(kd) ChipsCardInfo *chipsc = getChipsCardInfo(kd)
|
||||
|
||||
typedef struct _chipsCursor {
|
||||
int width, height;
|
||||
int xhot, yhot;
|
||||
Bool has_cursor;
|
||||
CursorPtr pCursor;
|
||||
Pixel source, mask;
|
||||
} ChipsCursor;
|
||||
|
||||
#define CHIPS_CURSOR_WIDTH 64
|
||||
#define CHIPS_CURSOR_HEIGHT 64
|
||||
|
||||
typedef struct _chipsScreenInfo {
|
||||
VesaScreenPrivRec vesa;
|
||||
CARD8 *mmio_base;
|
||||
CARD8 *cursor_base;
|
||||
CARD8 *screen;
|
||||
CARD8 *off_screen;
|
||||
int off_screen_size;
|
||||
ChipsCursor cursor;
|
||||
} ChipsScreenInfo;
|
||||
|
||||
#define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver))
|
||||
#define chipsScreenInfo(kd) ChipsScreenInfo *chipss = getChipsScreenInfo(kd)
|
||||
|
||||
Bool
|
||||
chipsDrawInit (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsDrawEnable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsDrawSync (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsDrawDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsDrawFini (ScreenPtr pScreen);
|
||||
|
||||
CARD8
|
||||
chipsReadXR (ChipsScreenInfo *chipsc, CARD8 index);
|
||||
|
||||
void
|
||||
chipsWriteXR (ChipsScreenInfo *chipsc, CARD8 index, CARD8 value);
|
||||
|
||||
Bool
|
||||
chipsCursorInit (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsCursorEnable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsCursorDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsCursorFini (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
chipsRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
|
||||
|
||||
extern KdCardFuncs chipsFuncs;
|
||||
|
||||
#endif /* _CHIPS_H_ */
|
||||
|
|
@ -1,495 +0,0 @@
|
|||
/*
|
||||
* Id: tridentdraw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.10 2001/06/03 18:48:19 keithp Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "chips.h"
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "mistruct.h"
|
||||
#include "fontstruct.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "fb.h"
|
||||
#include "migc.h"
|
||||
#include "miline.h"
|
||||
|
||||
CARD8 chipsBltRop[16] = {
|
||||
/* GXclear */ 0x00, /* 0 */
|
||||
/* GXand */ 0x88, /* src AND dst */
|
||||
/* GXandReverse */ 0x44, /* src AND NOT dst */
|
||||
/* GXcopy */ 0xcc, /* src */
|
||||
/* GXandInverted*/ 0x22, /* NOT src AND dst */
|
||||
/* GXnoop */ 0xaa, /* dst */
|
||||
/* GXxor */ 0x66, /* src XOR dst */
|
||||
/* GXor */ 0xee, /* src OR dst */
|
||||
/* GXnor */ 0x11, /* NOT src AND NOT dst */
|
||||
/* GXequiv */ 0x99, /* NOT src XOR dst */
|
||||
/* GXinvert */ 0x55, /* NOT dst */
|
||||
/* GXorReverse */ 0xdd, /* src OR NOT dst */
|
||||
/* GXcopyInverted*/ 0x33, /* NOT src */
|
||||
/* GXorInverted */ 0xbb, /* NOT src OR dst */
|
||||
/* GXnand */ 0x77, /* NOT src OR NOT dst */
|
||||
/* GXset */ 0xff, /* 1 */
|
||||
};
|
||||
|
||||
CARD8 chipsSolidRop[16] = {
|
||||
/* GXclear */ 0x00, /* 0 */
|
||||
/* GXand */ 0xa0, /* src AND dst */
|
||||
/* GXandReverse */ 0x50, /* src AND NOT dst */
|
||||
/* GXcopy */ 0xf0, /* src */
|
||||
/* GXandInverted*/ 0x0a, /* NOT src AND dst */
|
||||
/* GXnoop */ 0xaa, /* dst */
|
||||
/* GXxor */ 0x5a, /* src XOR dst */
|
||||
/* GXor */ 0xfa, /* src OR dst */
|
||||
/* GXnor */ 0x05, /* NOT src AND NOT dst */
|
||||
/* GXequiv */ 0xa5, /* NOT src XOR dst */
|
||||
/* GXinvert */ 0x55, /* NOT dst */
|
||||
/* GXorReverse */ 0xf5, /* src OR NOT dst */
|
||||
/* GXcopyInverted*/ 0x0f, /* NOT src */
|
||||
/* GXorInverted */ 0xaf, /* NOT src OR dst */
|
||||
/* GXnand */ 0x5f, /* NOT src OR NOT dst */
|
||||
/* GXset */ 0xff, /* 1 */
|
||||
};
|
||||
|
||||
/* Definitions for the Chips and Technology BitBLT engine communication. */
|
||||
/* These are done using Memory Mapped IO, of the registers */
|
||||
/* BitBLT modes for register 93D0. */
|
||||
|
||||
#ifdef HIQV
|
||||
#define ctPATCOPY 0xF0
|
||||
#define ctLEFT2RIGHT 0x000
|
||||
#define ctRIGHT2LEFT 0x100
|
||||
#define ctTOP2BOTTOM 0x000
|
||||
#define ctBOTTOM2TOP 0x200
|
||||
#define ctSRCSYSTEM 0x400
|
||||
#define ctDSTSYSTEM 0x800
|
||||
#define ctSRCMONO 0x1000
|
||||
#define ctBGTRANSPARENT 0x22000
|
||||
#define ctCOLORTRANSENABLE 0x4000
|
||||
#define ctCOLORTRANSDISABLE 0x0
|
||||
#define ctCOLORTRANSDST 0x8000
|
||||
#define ctCOLORTRANSROP 0x0
|
||||
#define ctCOLORTRANSEQUAL 0x10000L
|
||||
#define ctCOLORTRANSNEQUAL 0x0
|
||||
#define ctPATMONO 0x40000L
|
||||
#define ctPATSOLID 0x80000L
|
||||
#define ctPATSTART0 0x000000L
|
||||
#define ctPATSTART1 0x100000L
|
||||
#define ctPATSTART2 0x200000L
|
||||
#define ctPATSTART3 0x300000L
|
||||
#define ctPATSTART4 0x400000L
|
||||
#define ctPATSTART5 0x500000L
|
||||
#define ctPATSTART6 0x600000L
|
||||
#define ctPATSTART7 0x700000L
|
||||
#define ctSRCFG 0x000000L /* Where is this for the 65550?? */
|
||||
#else
|
||||
#define ctPATCOPY 0xF0
|
||||
#define ctTOP2BOTTOM 0x100
|
||||
#define ctBOTTOM2TOP 0x000
|
||||
#define ctLEFT2RIGHT 0x200
|
||||
#define ctRIGHT2LEFT 0x000
|
||||
#define ctSRCFG 0x400
|
||||
#define ctSRCMONO 0x800
|
||||
#define ctPATMONO 0x1000
|
||||
#define ctBGTRANSPARENT 0x2000
|
||||
#define ctSRCSYSTEM 0x4000
|
||||
#define ctPATSOLID 0x80000L
|
||||
#define ctPATSTART0 0x00000L
|
||||
#define ctPATSTART1 0x10000L
|
||||
#define ctPATSTART2 0x20000L
|
||||
#define ctPATSTART3 0x30000L
|
||||
#define ctPATSTART4 0x40000L
|
||||
#define ctPATSTART5 0x50000L
|
||||
#define ctPATSTART6 0x60000L
|
||||
#define ctPATSTART7 0x70000L
|
||||
#endif
|
||||
|
||||
#define chipsFillPix(bpp,pixel) {\
|
||||
if (bpp == 8) \
|
||||
{ \
|
||||
pixel = pixel & 0xff; \
|
||||
} \
|
||||
else if (bpp == 16) \
|
||||
{ \
|
||||
pixel = pixel & 0xffff; \
|
||||
} \
|
||||
}
|
||||
|
||||
static VOL8 *mmio;
|
||||
static CARD32 byteStride;
|
||||
static CARD32 bytesPerPixel;
|
||||
static CARD32 pixelStride;
|
||||
|
||||
static void
|
||||
chipsSet (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
chipsScreenInfo(pScreenPriv);
|
||||
|
||||
mmio = chipss->mmio_base;
|
||||
byteStride = pScreenPriv->screen->fb[0].byteStride;
|
||||
bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3;
|
||||
pixelStride = pScreenPriv->screen->fb[0].pixelStride;
|
||||
}
|
||||
|
||||
#ifdef HIQV
|
||||
#define CHIPS_BR0 0x00 /* offset */
|
||||
#define CHIPS_BR1 0x04 /* bg */
|
||||
#define CHIPS_BR2 0x08 /* fg */
|
||||
#define CHIPS_BR3 0x0c /* monochrome */
|
||||
#define CHIPS_BR4 0x10 /* bitblt */
|
||||
#define CHIPS_BR5 0x14 /* pattern addr */
|
||||
#define CHIPS_BR6 0x18 /* source addr */
|
||||
#define CHIPS_BR7 0x1c /* dst addr */
|
||||
#define CHIPS_BR8 0x20 /* dst w/h */
|
||||
#else
|
||||
#define CHIPS_DR0 0x83d0
|
||||
#define CHIPS_DR1 0x87d0
|
||||
#define CHIPS_DR2 0x8bd0
|
||||
#define CHIPS_DR3 0x8fd0
|
||||
#define CHIPS_DR4 0x93d0
|
||||
#define CHIPS_DR5 0x97d0
|
||||
#define CHIPS_DR6 0x9bd0
|
||||
#define CHIPS_DR7 0x9fd0
|
||||
#endif
|
||||
|
||||
#define DBG(x)
|
||||
|
||||
static void
|
||||
chipsPitch (int src, int dst)
|
||||
{
|
||||
CARD32 p;
|
||||
|
||||
p = ((dst & 0xffff) << 16) | (src & 0xffff);
|
||||
DBG(ErrorF ("\tpitch 0x%x\n", p));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR0) = p;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR0) = p;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsBg (Pixel bg)
|
||||
{
|
||||
DBG(ErrorF ("\tbg 0x%x\n", bg));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR1) = bg & 0xffff;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR2) = bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsFg (Pixel fg)
|
||||
{
|
||||
DBG(ErrorF ("\tfg 0x%x\n", fg));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR2) = fg;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR3) = fg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsOp (CARD32 op)
|
||||
{
|
||||
DBG(ErrorF ("\top 0x%x\n", op));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR4) = op;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR4) = op;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsRopSolid (int rop)
|
||||
{
|
||||
CARD32 op;
|
||||
|
||||
op = chipsSolidRop[rop] | ctTOP2BOTTOM | ctLEFT2RIGHT | ctPATSOLID | ctPATMONO;
|
||||
chipsOp (op);
|
||||
}
|
||||
|
||||
static void
|
||||
chipsSrc (int addr)
|
||||
{
|
||||
DBG(ErrorF ("\tsrc 0x%x\n", addr));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR6) = addr;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR5) = addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsDst (int addr)
|
||||
{
|
||||
DBG(ErrorF ("\tdst 0x%x\n", addr));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR7) = addr;
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR6) = addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsWidthHeightGo (int w, int h)
|
||||
{
|
||||
DBG(ErrorF ("\twidth height %d/%d\n", w, h));
|
||||
#ifdef HIQV
|
||||
*(VOL32 *) (mmio + CHIPS_BR8) = ((h & 0xffff) << 16) | (w & 0xffff);
|
||||
#else
|
||||
*(VOL32 *) (mmio + CHIPS_DR7) = ((h & 0xffff) << 16) | (w & 0xffff);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
chipsWaitIdle (void)
|
||||
{
|
||||
#ifdef HIQV
|
||||
int timeout = 0;
|
||||
CARD8 tmp;
|
||||
VOL32 *br4 = (VOL32 *) (mmio + CHIPS_BR4);
|
||||
|
||||
DBG(ErrorF ("\tBR4 0x%x 0x%x\n", mmio + CHIPS_BR4, *br4));
|
||||
DBG(ErrorF ("\tXR20 0x%x\n", chipsReadXR (0, 0x20)));
|
||||
for (;;)
|
||||
{
|
||||
if ((*br4 & 0x80000000) == 0)
|
||||
break;
|
||||
tmp = chipsReadXR (0, 0x20);
|
||||
if ((tmp & 1) == 0)
|
||||
break;
|
||||
if (++timeout > 1000000)
|
||||
{
|
||||
ErrorF ("timeout\n");
|
||||
tmp = chipsReadXR (0, 0x20);
|
||||
chipsWriteXR (0, 0x20, tmp | 2);
|
||||
sleep (1);
|
||||
chipsWriteXR (0, 0x20, tmp);
|
||||
sleep (1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
while (*(VOL32 *) (mmio + CHIPS_DR4) & 0x00100000)
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
static Bool
|
||||
chipsPrepareSolid (PixmapPtr pPixmap,
|
||||
int alu,
|
||||
Pixel pm,
|
||||
Pixel fg)
|
||||
{
|
||||
FbBits depthMask;
|
||||
|
||||
DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
|
||||
depthMask = FbFullMask(pPixmap->drawable.depth);
|
||||
if ((pm & depthMask) != depthMask)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
chipsSet (pPixmap->drawable.pScreen);
|
||||
chipsWaitIdle ();
|
||||
chipsFillPix(pPixmap->drawable.bitsPerPixel,fg);
|
||||
chipsFg (fg);
|
||||
chipsBg (fg);
|
||||
chipsRopSolid (alu);
|
||||
chipsPitch (byteStride, byteStride);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
chipsSolid (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
CARD32 dst;
|
||||
int w, h;
|
||||
|
||||
DBG(ErrorF (" Solid %dx%d %dx%d\n", x1, y1, x2, y2));
|
||||
dst = y1 * byteStride + x1 * bytesPerPixel;
|
||||
w = (x2 - x1) * bytesPerPixel;
|
||||
h = (y2 - y1);
|
||||
chipsWaitIdle ();
|
||||
chipsDst (dst);
|
||||
chipsWidthHeightGo (w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
chipsDoneSolid (void)
|
||||
{
|
||||
}
|
||||
|
||||
static CARD32 copyOp;
|
||||
|
||||
static Bool
|
||||
chipsPrepareCopy (PixmapPtr pSrcPixmap,
|
||||
PixmapPtr pDstPixmap,
|
||||
int dx,
|
||||
int dy,
|
||||
int alu,
|
||||
Pixel pm)
|
||||
{
|
||||
FbBits depthMask;
|
||||
|
||||
DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
|
||||
depthMask = FbFullMask(pDstPixmap->drawable.depth);
|
||||
if ((pm & depthMask) != depthMask)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
copyOp = chipsBltRop[alu];
|
||||
if (dy >= 0)
|
||||
copyOp |= ctTOP2BOTTOM;
|
||||
else
|
||||
copyOp |= ctBOTTOM2TOP;
|
||||
if (dx >= 0)
|
||||
copyOp |= ctLEFT2RIGHT;
|
||||
else
|
||||
copyOp |= ctRIGHT2LEFT;
|
||||
chipsSet (pDstPixmap->drawable.pScreen);
|
||||
chipsWaitIdle ();
|
||||
chipsOp (copyOp);
|
||||
chipsPitch (byteStride, byteStride);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
chipsCopy (int srcX,
|
||||
int srcY,
|
||||
int dstX,
|
||||
int dstY,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
int src, dst;
|
||||
if ((copyOp & (ctTOP2BOTTOM|ctBOTTOM2TOP)) == ctBOTTOM2TOP)
|
||||
{
|
||||
src = (srcY + h - 1) * byteStride;
|
||||
dst = (dstY + h - 1) * byteStride;
|
||||
}
|
||||
else
|
||||
{
|
||||
src = srcY * byteStride;
|
||||
dst = dstY * byteStride;
|
||||
}
|
||||
if ((copyOp & (ctLEFT2RIGHT|ctRIGHT2LEFT)) == ctRIGHT2LEFT)
|
||||
{
|
||||
src = src + (srcX + w) * bytesPerPixel - 1;
|
||||
dst = dst + (dstX + w) * bytesPerPixel - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
src = src + srcX * bytesPerPixel;
|
||||
dst = dst + dstX * bytesPerPixel;
|
||||
}
|
||||
chipsWaitIdle ();
|
||||
chipsSrc (src);
|
||||
chipsDst (dst);
|
||||
chipsWidthHeightGo (w * bytesPerPixel, h);
|
||||
}
|
||||
|
||||
static void
|
||||
chipsDoneCopy (void)
|
||||
{
|
||||
}
|
||||
|
||||
KaaScreenInfoRec chipsKaa = {
|
||||
chipsPrepareSolid,
|
||||
chipsSolid,
|
||||
chipsDoneSolid,
|
||||
|
||||
chipsPrepareCopy,
|
||||
chipsCopy,
|
||||
chipsDoneCopy,
|
||||
|
||||
0, 0, 0
|
||||
};
|
||||
|
||||
Bool
|
||||
chipsDrawInit (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
|
||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
||||
case 8:
|
||||
case 16:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!kaaDrawInit (pScreen, &chipsKaa))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
chipsDrawEnable (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
chipsScreenInfo(pScreenPriv);
|
||||
CARD8 mode = 0x00;
|
||||
|
||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
||||
case 8:
|
||||
mode = 0x00;
|
||||
break;
|
||||
case 16:
|
||||
mode = 0x10;
|
||||
break;
|
||||
}
|
||||
chipsSet (pScreen);
|
||||
chipsWaitIdle ();
|
||||
chipsWriteXR (chipss, 0x20, mode);
|
||||
|
||||
KdMarkSync (pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
chipsDrawDisable (ScreenPtr pScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
chipsDrawFini (ScreenPtr pScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
chipsDrawSync (ScreenPtr pScreen)
|
||||
{
|
||||
chipsSet (pScreen);
|
||||
chipsWaitIdle ();
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Id: chipsstub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
|
||||
*
|
||||
* Copyright 1999 SuSE, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chipsstub.c,v 1.1 2001/09/05 07:12:42 keithp Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "chips.h"
|
||||
|
||||
extern int chips_clk, chips_mclk;
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
KdCardAttr attr;
|
||||
|
||||
KdCardInfoAdd (&chipsFuncs, &attr, 0);
|
||||
}
|
||||
|
||||
void
|
||||
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput (pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput (int argc, char **argv)
|
||||
{
|
||||
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg();
|
||||
vesaUseMsg();
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!(ret = vesaProcessArgument (argc, argv, i)))
|
||||
ret = KdProcessArgument(argc, argv, i);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
INCLUDES = \
|
||||
@KDRIVE_INCS@ \
|
||||
@XSERVER_CFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libfake.a
|
||||
|
||||
bin_PROGRAMS = Xfake
|
||||
|
||||
if TSLIB
|
||||
TSLIB_FLAG = -lts
|
||||
endif
|
||||
|
||||
libfake_a_SOURCES = \
|
||||
fake.c \
|
||||
kbd.c \
|
||||
os.c \
|
||||
mouse.c \
|
||||
fake.h
|
||||
|
||||
Xfake_SOURCES = \
|
||||
fakeinit.c
|
||||
|
||||
Xfake_LDADD = \
|
||||
libfake.a \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
Xfake_DEPENDENCIES = \
|
||||
libfake.a \
|
||||
@KDRIVE_LIBS@
|
||||
|
||||
|
|
@ -1,494 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "fake.h"
|
||||
|
||||
extern int KdTsPhyScreen;
|
||||
|
||||
Bool
|
||||
fakeInitialize (KdCardInfo *card, FakePriv *priv)
|
||||
{
|
||||
priv->base = 0;
|
||||
priv->bytes_per_line = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeCardInit (KdCardInfo *card)
|
||||
{
|
||||
FakePriv *priv;
|
||||
|
||||
priv = (FakePriv *) xalloc (sizeof (FakePriv));
|
||||
if (!priv)
|
||||
return FALSE;
|
||||
|
||||
if (!fakeInitialize (card, priv))
|
||||
{
|
||||
xfree (priv);
|
||||
return FALSE;
|
||||
}
|
||||
card->driver = priv;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
fakeModeSupported (KdScreenInfo *screen,
|
||||
const KdMonitorTiming *t)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv)
|
||||
{
|
||||
const KdMonitorTiming *t;
|
||||
|
||||
if (!screen->width || !screen->height)
|
||||
{
|
||||
screen->width = 1024;
|
||||
screen->height = 768;
|
||||
screen->rate = 72;
|
||||
}
|
||||
if (!screen->fb[0].depth)
|
||||
screen->fb[0].depth = 16;
|
||||
|
||||
t = KdFindMode (screen, fakeModeSupported);
|
||||
screen->rate = t->rate;
|
||||
screen->width = t->horizontal;
|
||||
screen->height = t->vertical;
|
||||
|
||||
if (screen->fb[0].depth <= 8)
|
||||
{
|
||||
screen->fb[0].visuals = ((1 << StaticGray) |
|
||||
(1 << GrayScale) |
|
||||
(1 << StaticColor) |
|
||||
(1 << PseudoColor) |
|
||||
(1 << TrueColor) |
|
||||
(1 << DirectColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].visuals = (1 << TrueColor);
|
||||
#define Mask(o,l) (((1 << l) - 1) << o)
|
||||
if (screen->fb[0].depth <= 15)
|
||||
{
|
||||
screen->fb[0].depth = 15;
|
||||
screen->fb[0].bitsPerPixel = 16;
|
||||
screen->fb[0].redMask = Mask (10, 5);
|
||||
screen->fb[0].greenMask = Mask (5, 5);
|
||||
screen->fb[0].blueMask = Mask (0, 5);
|
||||
}
|
||||
else if (screen->fb[0].depth <= 16)
|
||||
{
|
||||
screen->fb[0].depth = 16;
|
||||
screen->fb[0].bitsPerPixel = 16;
|
||||
screen->fb[0].redMask = Mask (11, 5);
|
||||
screen->fb[0].greenMask = Mask (5, 6);
|
||||
screen->fb[0].blueMask = Mask (0, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].depth = 24;
|
||||
screen->fb[0].bitsPerPixel = 32;
|
||||
screen->fb[0].redMask = Mask (16, 8);
|
||||
screen->fb[0].greenMask = Mask (8, 8);
|
||||
screen->fb[0].blueMask = Mask (0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
scrpriv->randr = screen->randr;
|
||||
|
||||
return fakeMapFramebuffer (screen);
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeScreenInit (KdScreenInfo *screen)
|
||||
{
|
||||
FakeScrPriv *scrpriv;
|
||||
|
||||
scrpriv = xalloc (sizeof (FakeScrPriv));
|
||||
if (!scrpriv)
|
||||
return FALSE;
|
||||
memset (scrpriv, '\0', sizeof (FakeScrPriv));
|
||||
screen->driver = scrpriv;
|
||||
if (!fakeScreenInitialize (screen, scrpriv))
|
||||
{
|
||||
screen->driver = 0;
|
||||
xfree (scrpriv);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void *
|
||||
fakeWindowLinear (ScreenPtr pScreen,
|
||||
CARD32 row,
|
||||
CARD32 offset,
|
||||
int mode,
|
||||
CARD32 *size,
|
||||
void *closure)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FakePriv *priv = pScreenPriv->card->driver;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return 0;
|
||||
*size = priv->bytes_per_line;
|
||||
return priv->base + row * priv->bytes_per_line;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeMapFramebuffer (KdScreenInfo *screen)
|
||||
{
|
||||
FakeScrPriv *scrpriv = screen->driver;
|
||||
KdMouseMatrix m;
|
||||
FakePriv *priv = screen->card->driver;
|
||||
|
||||
if (scrpriv->randr != RR_Rotate_0)
|
||||
scrpriv->shadow = TRUE;
|
||||
else
|
||||
scrpriv->shadow = FALSE;
|
||||
|
||||
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||
|
||||
KdSetMouseMatrix (&m);
|
||||
|
||||
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
|
||||
if (priv->base)
|
||||
free (priv->base);
|
||||
priv->base = malloc (priv->bytes_per_line * screen->height);
|
||||
screen->memory_base = (CARD8 *) (priv->base);
|
||||
screen->memory_size = 0;
|
||||
screen->off_screen_base = 0;
|
||||
|
||||
if (scrpriv->shadow)
|
||||
{
|
||||
if (!KdShadowFbAlloc (screen, 0,
|
||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].byteStride = priv->bytes_per_line;
|
||||
screen->fb[0].pixelStride = (priv->bytes_per_line * 8/
|
||||
screen->fb[0].bitsPerPixel);
|
||||
screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fakeSetScreenSizes (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FakeScrPriv *scrpriv = screen->driver;
|
||||
|
||||
if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||
{
|
||||
pScreen->width = screen->width;
|
||||
pScreen->height = screen->height;
|
||||
pScreen->mmWidth = screen->width_mm;
|
||||
pScreen->mmHeight = screen->height_mm;
|
||||
}
|
||||
else
|
||||
{
|
||||
pScreen->width = screen->width;
|
||||
pScreen->height = screen->height;
|
||||
pScreen->mmWidth = screen->height_mm;
|
||||
pScreen->mmHeight = screen->width_mm;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeUnmapFramebuffer (KdScreenInfo *screen)
|
||||
{
|
||||
FakePriv *priv = screen->card->driver;
|
||||
KdShadowFbFree (screen, 0);
|
||||
if (priv->base)
|
||||
{
|
||||
free (priv->base);
|
||||
priv->base = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeSetShadow (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FakeScrPriv *scrpriv = screen->driver;
|
||||
ShadowUpdateProc update;
|
||||
ShadowWindowProc window;
|
||||
|
||||
window = fakeWindowLinear;
|
||||
update = 0;
|
||||
if (scrpriv->randr)
|
||||
update = shadowUpdateRotatePacked;
|
||||
else
|
||||
update = shadowUpdatePacked;
|
||||
return KdShadowSet (pScreen, scrpriv->randr, update, window);
|
||||
}
|
||||
|
||||
|
||||
#ifdef RANDR
|
||||
Bool
|
||||
fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FakeScrPriv *scrpriv = screen->driver;
|
||||
RRScreenSizePtr pSize;
|
||||
Rotation randr;
|
||||
int n;
|
||||
|
||||
*rotations = RR_Rotate_All|RR_Reflect_All;
|
||||
|
||||
for (n = 0; n < pScreen->numDepths; n++)
|
||||
if (pScreen->allowedDepths[n].numVids)
|
||||
break;
|
||||
if (n == pScreen->numDepths)
|
||||
return FALSE;
|
||||
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
screen->width,
|
||||
screen->height,
|
||||
screen->width_mm,
|
||||
screen->height_mm);
|
||||
|
||||
randr = KdSubRotation (scrpriv->randr, screen->randr);
|
||||
|
||||
RRSetCurrentConfig (pScreen, randr, 0, pSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation randr,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FakeScrPriv *scrpriv = screen->driver;
|
||||
Bool wasEnabled = pScreenPriv->enabled;
|
||||
FakeScrPriv oldscr;
|
||||
int oldwidth;
|
||||
int oldheight;
|
||||
int oldmmwidth;
|
||||
int oldmmheight;
|
||||
int newwidth, newheight;
|
||||
|
||||
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||
{
|
||||
newwidth = pSize->width;
|
||||
newheight = pSize->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
newwidth = pSize->height;
|
||||
newheight = pSize->width;
|
||||
}
|
||||
|
||||
if (wasEnabled)
|
||||
KdDisableScreen (pScreen);
|
||||
|
||||
oldscr = *scrpriv;
|
||||
|
||||
oldwidth = screen->width;
|
||||
oldheight = screen->height;
|
||||
oldmmwidth = pScreen->mmWidth;
|
||||
oldmmheight = pScreen->mmHeight;
|
||||
|
||||
/*
|
||||
* Set new configuration
|
||||
*/
|
||||
|
||||
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
||||
|
||||
KdOffscreenSwapOut (screen->pScreen);
|
||||
|
||||
fakeUnmapFramebuffer (screen);
|
||||
|
||||
if (!fakeMapFramebuffer (screen))
|
||||
goto bail4;
|
||||
|
||||
KdShadowUnset (screen->pScreen);
|
||||
|
||||
if (!fakeSetShadow (screen->pScreen))
|
||||
goto bail4;
|
||||
|
||||
fakeSetScreenSizes (screen->pScreen);
|
||||
|
||||
/*
|
||||
* Set frame buffer mapping
|
||||
*/
|
||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||
pScreen->width,
|
||||
pScreen->height,
|
||||
screen->fb[0].depth,
|
||||
screen->fb[0].bitsPerPixel,
|
||||
screen->fb[0].byteStride,
|
||||
screen->fb[0].frameBuffer);
|
||||
|
||||
/* set the subpixel order */
|
||||
|
||||
KdSetSubpixelOrder (pScreen, scrpriv->randr);
|
||||
if (wasEnabled)
|
||||
KdEnableScreen (pScreen);
|
||||
|
||||
return TRUE;
|
||||
|
||||
bail4:
|
||||
fakeUnmapFramebuffer (screen);
|
||||
*scrpriv = oldscr;
|
||||
(void) fakeMapFramebuffer (screen);
|
||||
pScreen->width = oldwidth;
|
||||
pScreen->height = oldheight;
|
||||
pScreen->mmWidth = oldmmwidth;
|
||||
pScreen->mmHeight = oldmmheight;
|
||||
|
||||
if (wasEnabled)
|
||||
KdEnableScreen (pScreen);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeRandRInit (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
||||
if (!RRScreenInit (pScreen))
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
pScrPriv->rrGetInfo = fakeRandRGetInfo;
|
||||
pScrPriv->rrSetConfig = fakeRandRSetConfig;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
fakeCreateColormap (ColormapPtr pmap)
|
||||
{
|
||||
return fbInitializeColormap (pmap);
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
#ifdef TOUCHSCREEN
|
||||
KdTsPhyScreen = pScreen->myNum;
|
||||
#endif
|
||||
|
||||
pScreen->CreateColormap = fakeCreateColormap;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeFinishInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
if (!shadowSetup (pScreen))
|
||||
return FALSE;
|
||||
|
||||
#ifdef RANDR
|
||||
if (!fakeRandRInit (pScreen))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
fakeCreateResources (ScreenPtr pScreen)
|
||||
{
|
||||
return fakeSetShadow (pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
fakePreserve (KdCardInfo *card)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeEnable (ScreenPtr pScreen)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fakeDPMS (ScreenPtr pScreen, int mode)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fakeDisable (ScreenPtr pScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fakeRestore (KdCardInfo *card)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fakeScreenFini (KdScreenInfo *screen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fakeCardFini (KdCardInfo *card)
|
||||
{
|
||||
FakePriv *priv = card->driver;
|
||||
|
||||
if (priv->base)
|
||||
free (priv->base);
|
||||
xfree (priv);
|
||||
}
|
||||
|
||||
void
|
||||
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
while (n--)
|
||||
{
|
||||
pdefs->red = 0;
|
||||
pdefs->green = 0;
|
||||
pdefs->blue = 0;
|
||||
pdefs++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _FBDEV_H_
|
||||
#define _FBDEV_H_
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "kdrive.h"
|
||||
|
||||
#ifdef RANDR
|
||||
#include "randrstr.h"
|
||||
#endif
|
||||
|
||||
typedef struct _fakePriv {
|
||||
CARD8 *base;
|
||||
int bytes_per_line;
|
||||
} FakePriv;
|
||||
|
||||
typedef struct _fakeScrPriv {
|
||||
Rotation randr;
|
||||
Bool shadow;
|
||||
PixmapPtr pShadow;
|
||||
} FakeScrPriv;
|
||||
|
||||
extern KdCardFuncs fakeFuncs;
|
||||
|
||||
Bool
|
||||
fakeInitialize (KdCardInfo *card, FakePriv *priv);
|
||||
|
||||
Bool
|
||||
fakeCardInit (KdCardInfo *card);
|
||||
|
||||
Bool
|
||||
fakeScreenInit (KdScreenInfo *screen);
|
||||
|
||||
Bool
|
||||
fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv);
|
||||
|
||||
Bool
|
||||
fakeInitScreen (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fakeFinishInitScreen (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fakeCreateResources (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
fakePreserve (KdCardInfo *card);
|
||||
|
||||
Bool
|
||||
fakeEnable (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fakeDPMS (ScreenPtr pScreen, int mode);
|
||||
|
||||
void
|
||||
fakeDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
fakeRestore (KdCardInfo *card);
|
||||
|
||||
void
|
||||
fakeScreenFini (KdScreenInfo *screen);
|
||||
|
||||
void
|
||||
fakeCardFini (KdCardInfo *card);
|
||||
|
||||
void
|
||||
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
||||
|
||||
void
|
||||
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
||||
|
||||
Bool
|
||||
fakeMapFramebuffer (KdScreenInfo *screen);
|
||||
|
||||
void *
|
||||
fakeWindowLinear (ScreenPtr pScreen,
|
||||
CARD32 row,
|
||||
CARD32 offset,
|
||||
int mode,
|
||||
CARD32 *size,
|
||||
void *closure);
|
||||
|
||||
void
|
||||
fakeSetScreenSizes (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fakeUnmapFramebuffer (KdScreenInfo *screen);
|
||||
|
||||
Bool
|
||||
fakeSetShadow (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fakeCreateColormap (ColormapPtr pmap);
|
||||
|
||||
#ifdef RANDR
|
||||
Bool
|
||||
fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
|
||||
|
||||
Bool
|
||||
fakeRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation randr,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize);
|
||||
Bool
|
||||
fakeRandRInit (ScreenPtr pScreen);
|
||||
|
||||
#endif
|
||||
|
||||
extern KdMouseFuncs FakeMouseFuncs;
|
||||
|
||||
extern KdKeyboardFuncs FakeKeyboardFuncs;
|
||||
|
||||
extern KdOsFuncs FakeOsFuncs;
|
||||
|
||||
#endif /* _FBDEV_H_ */
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "fake.h"
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
KdCardAttr attr;
|
||||
|
||||
KdCardInfoAdd (&fakeFuncs, &attr, 0);
|
||||
}
|
||||
|
||||
void
|
||||
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput (pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput (int argc, char **argv)
|
||||
{
|
||||
KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs);
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg();
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
return KdProcessArgument (argc, argv, i);
|
||||
}
|
||||
|
||||
void
|
||||
OsVendorInit (void)
|
||||
{
|
||||
KdOsInit (&FakeOsFuncs);
|
||||
}
|
||||
|
||||
KdCardFuncs fakeFuncs = {
|
||||
fakeCardInit, /* cardinit */
|
||||
fakeScreenInit, /* scrinit */
|
||||
fakeInitScreen, /* initScreen */
|
||||
fakeFinishInitScreen, /* finishInitScreen */
|
||||
fakeCreateResources, /* createRes */
|
||||
fakePreserve, /* preserve */
|
||||
fakeEnable, /* enable */
|
||||
fakeDPMS, /* dpms */
|
||||
fakeDisable, /* disable */
|
||||
fakeRestore, /* restore */
|
||||
fakeScreenFini, /* scrfini */
|
||||
fakeCardFini, /* cardfini */
|
||||
|
||||
0, /* initCursor */
|
||||
0, /* enableCursor */
|
||||
0, /* disableCursor */
|
||||
0, /* finiCursor */
|
||||
0, /* recolorCursor */
|
||||
|
||||
0, /* initAccel */
|
||||
0, /* enableAccel */
|
||||
0, /* syncAccel */
|
||||
0, /* disableAccel */
|
||||
0, /* finiAccel */
|
||||
|
||||
fakeGetColors, /* getColors */
|
||||
fakePutColors, /* putColors */
|
||||
};
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
* Id: kbd.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/fake/kbd.c,v 1.1 1999/11/19 13:53:53 hohndel Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "fake.h"
|
||||
#include "kkeymap.h"
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#define FAKE_WIDTH 2
|
||||
|
||||
KeySym FakeKeymap[] = {
|
||||
/* 1 8 */ XK_Escape, NoSymbol,
|
||||
/* 2 9 */ XK_1, XK_exclam,
|
||||
/* 3 10 */ XK_2, XK_at,
|
||||
/* 4 11 */ XK_3, XK_numbersign,
|
||||
/* 5 12 */ XK_4, XK_dollar,
|
||||
/* 6 13 */ XK_5, XK_percent,
|
||||
/* 7 14 */ XK_6, XK_asciicircum,
|
||||
/* 8 15 */ XK_7, XK_ampersand,
|
||||
/* 9 16 */ XK_8, XK_asterisk,
|
||||
/* 10 17 */ XK_9, XK_parenleft,
|
||||
/* 11 18 */ XK_0, XK_parenright,
|
||||
/* 12 19 */ XK_minus, XK_underscore,
|
||||
/* 13 20 */ XK_equal, XK_plus,
|
||||
/* 14 21 */ XK_BackSpace, NoSymbol,
|
||||
/* 15 22 */ XK_Tab, NoSymbol,
|
||||
/* 16 23 */ XK_Q, NoSymbol,
|
||||
/* 17 24 */ XK_W, NoSymbol,
|
||||
/* 18 25 */ XK_E, NoSymbol,
|
||||
/* 19 26 */ XK_R, NoSymbol,
|
||||
/* 20 27 */ XK_T, NoSymbol,
|
||||
/* 21 28 */ XK_Y, NoSymbol,
|
||||
/* 22 29 */ XK_U, NoSymbol,
|
||||
/* 23 30 */ XK_I, NoSymbol,
|
||||
/* 24 31 */ XK_O, NoSymbol,
|
||||
/* 25 32 */ XK_P, NoSymbol,
|
||||
/* 26 33 */ XK_bracketleft, XK_braceleft,
|
||||
/* 27 34 */ XK_bracketright, XK_braceright,
|
||||
/* 28 35 */ XK_Return, NoSymbol,
|
||||
/* 29 36 */ XK_Control_L, NoSymbol,
|
||||
/* 30 37 */ XK_A, NoSymbol,
|
||||
/* 31 38 */ XK_S, NoSymbol,
|
||||
/* 32 39 */ XK_D, NoSymbol,
|
||||
/* 33 40 */ XK_F, NoSymbol,
|
||||
/* 34 41 */ XK_G, NoSymbol,
|
||||
/* 35 42 */ XK_H, NoSymbol,
|
||||
/* 36 43 */ XK_J, NoSymbol,
|
||||
/* 37 44 */ XK_K, NoSymbol,
|
||||
/* 38 45 */ XK_L, NoSymbol,
|
||||
/* 39 46 */ XK_semicolon, XK_colon,
|
||||
/* 40 47 */ XK_apostrophe, XK_quotedbl,
|
||||
/* 41 48 */ XK_grave, XK_asciitilde,
|
||||
/* 42 49 */ XK_Shift_L, NoSymbol,
|
||||
/* 43 50 */ XK_backslash, XK_bar,
|
||||
/* 44 51 */ XK_Z, NoSymbol,
|
||||
/* 45 52 */ XK_X, NoSymbol,
|
||||
/* 46 53 */ XK_C, NoSymbol,
|
||||
/* 47 54 */ XK_V, NoSymbol,
|
||||
/* 48 55 */ XK_B, NoSymbol,
|
||||
/* 49 56 */ XK_N, NoSymbol,
|
||||
/* 50 57 */ XK_M, NoSymbol,
|
||||
/* 51 58 */ XK_comma, XK_less,
|
||||
/* 52 59 */ XK_period, XK_greater,
|
||||
/* 53 60 */ XK_slash, XK_question,
|
||||
/* 54 61 */ XK_Shift_R, NoSymbol,
|
||||
/* 55 62 */ XK_KP_Multiply, NoSymbol,
|
||||
/* 56 63 */ XK_Alt_L, XK_Meta_L,
|
||||
/* 57 64 */ XK_space, NoSymbol,
|
||||
/* 58 65 */ XK_Caps_Lock, NoSymbol,
|
||||
/* 59 66 */ XK_F1, NoSymbol,
|
||||
/* 60 67 */ XK_F2, NoSymbol,
|
||||
/* 61 68 */ XK_F3, NoSymbol,
|
||||
/* 62 69 */ XK_F4, NoSymbol,
|
||||
/* 63 70 */ XK_F5, NoSymbol,
|
||||
/* 64 71 */ XK_F6, NoSymbol,
|
||||
/* 65 72 */ XK_F7, NoSymbol,
|
||||
/* 66 73 */ XK_F8, NoSymbol,
|
||||
/* 67 74 */ XK_F9, NoSymbol,
|
||||
/* 68 75 */ XK_F10, NoSymbol,
|
||||
/* 69 76 */ XK_Break, XK_Pause,
|
||||
/* 70 77 */ XK_Scroll_Lock, NoSymbol,
|
||||
/* 71 78 */ XK_KP_Home, XK_KP_7,
|
||||
/* 72 79 */ XK_KP_Up, XK_KP_8,
|
||||
/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
|
||||
/* 74 81 */ XK_KP_Subtract, NoSymbol,
|
||||
/* 75 82 */ XK_KP_Left, XK_KP_4,
|
||||
/* 76 83 */ XK_KP_5, NoSymbol,
|
||||
/* 77 84 */ XK_KP_Right, XK_KP_6,
|
||||
/* 78 85 */ XK_KP_Add, NoSymbol,
|
||||
/* 79 86 */ XK_KP_End, XK_KP_1,
|
||||
/* 80 87 */ XK_KP_Down, XK_KP_2,
|
||||
/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
|
||||
/* 82 89 */ XK_KP_Insert, XK_KP_0,
|
||||
/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
|
||||
/* 84 91 */ NoSymbol, NoSymbol,
|
||||
/* 85 92 */ NoSymbol, NoSymbol,
|
||||
/* 86 93 */ NoSymbol, NoSymbol,
|
||||
/* 87 94 */ XK_F11, NoSymbol,
|
||||
/* 88 95 */ XK_F12, NoSymbol,
|
||||
|
||||
/* These are remapped from the extended set (using ExtendMap) */
|
||||
|
||||
/* 89 96 */ XK_Control_R, NoSymbol,
|
||||
/* 90 97 */ XK_KP_Enter, NoSymbol,
|
||||
/* 91 98 */ XK_KP_Divide, NoSymbol,
|
||||
/* 92 99 */ XK_Sys_Req, XK_Print,
|
||||
/* 93 100 */ XK_Alt_R, XK_Meta_R,
|
||||
/* 94 101 */ XK_Num_Lock, NoSymbol,
|
||||
/* 95 102 */ XK_Home, NoSymbol,
|
||||
/* 96 103 */ XK_Up, NoSymbol,
|
||||
/* 97 104 */ XK_Page_Up, NoSymbol,
|
||||
/* 98 105 */ XK_Left, NoSymbol,
|
||||
/* 99 106 */ XK_Right, NoSymbol,
|
||||
/* 100 107 */ XK_End, NoSymbol,
|
||||
/* 101 108 */ XK_Down, NoSymbol,
|
||||
/* 102 109 */ XK_Page_Down, NoSymbol,
|
||||
/* 103 110 */ XK_Insert, NoSymbol,
|
||||
/* 104 111 */ XK_Delete, NoSymbol,
|
||||
/* 105 112 */ XK_Super_L, NoSymbol,
|
||||
/* 106 113 */ XK_Super_R, NoSymbol,
|
||||
/* 107 114 */ XK_Menu, NoSymbol,
|
||||
|
||||
/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
|
||||
/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
|
||||
/* 110 117 */ XK_Up, NoSymbol, /* joypad */
|
||||
/* 111 118 */ XK_Down, NoSymbol,
|
||||
/* 112 119 */ XK_Left, NoSymbol,
|
||||
/* 113 120 */ XK_Right, NoSymbol,
|
||||
/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
|
||||
/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
|
||||
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
|
||||
};
|
||||
|
||||
static void
|
||||
FakeKeyboardLoad (void)
|
||||
{
|
||||
kdMinScanCode = 1;
|
||||
kdKeymapWidth = FAKE_WIDTH;
|
||||
kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
|
||||
memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
|
||||
}
|
||||
|
||||
static int
|
||||
FakeKeyboardInit (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
FakeKeyboardFini (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
FakeKeyboardLeds (int leds)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
FakeKeyboardBell (int volume, int frequency, int duration)
|
||||
{
|
||||
}
|
||||
|
||||
KdKeyboardFuncs FakeKeyboardFuncs = {
|
||||
FakeKeyboardLoad,
|
||||
FakeKeyboardInit,
|
||||
FakeKeyboardLeds,
|
||||
FakeKeyboardBell,
|
||||
FakeKeyboardFini,
|
||||
0,
|
||||
};
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#define NEED_EVENTS
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xpoll.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "kdrive.h"
|
||||
|
||||
static Bool
|
||||
MouseInit (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
MouseFini (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KdMouseFuncs FakeMouseFuncs = {
|
||||
MouseInit,
|
||||
MouseFini,
|
||||
};
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "fake.h"
|
||||
|
||||
static int
|
||||
FakeInit (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
FakeEnable (void)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool
|
||||
FakeSpecialKey (KeySym sym)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
FakeDisable (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
FakeFini (void)
|
||||
{
|
||||
}
|
||||
|
||||
KdOsFuncs FakeOsFuncs = {
|
||||
FakeInit,
|
||||
FakeEnable,
|
||||
FakeSpecialKey,
|
||||
FakeDisable,
|
||||
FakeFini,
|
||||
0
|
||||
};
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
|
||||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Imakefile,v 1.4 2001/05/23 08:56:08 alanh Exp $
|
||||
KDRIVE=..
|
||||
#include "../Kdrive.tmpl"
|
||||
|
||||
#if XipaqServer
|
||||
DEFINES = -DXIPAQ
|
||||
#endif
|
||||
|
||||
SRCS = fbdev.c fbinit.c
|
||||
|
||||
OBJS = fbdev.o fbinit.o
|
||||
|
||||
INCLUDES = $(KDINCS) -I.
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
NormalLibraryTarget(fbdev,$(OBJS))
|
||||
InstallManPage(Xfbdev,$(MANDIR))
|
||||
DependTarget()
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
INCLUDES = \
|
||||
@KDRIVE_INCS@ \
|
||||
@XSERVER_CFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libfbdev.a
|
||||
|
||||
bin_PROGRAMS = Xfbdev
|
||||
|
||||
if TSLIB
|
||||
TSLIB_FLAG = -lts
|
||||
endif
|
||||
|
||||
libfbdev_a_SOURCES = \
|
||||
fbdev.c \
|
||||
fbdev.h
|
||||
|
||||
Xfbdev_SOURCES = \
|
||||
fbinit.c
|
||||
|
||||
Xfbdev_LDADD = \
|
||||
libfbdev.a \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
Xfbdev_DEPENDENCIES = \
|
||||
libfbdev.a \
|
||||
@KDRIVE_LIBS@
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
.\" $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.4 2001/01/27 18:20:40 dawes Exp $
|
||||
.\"
|
||||
.TH Xfbdev 1 __vendorversion__
|
||||
.SH NAME
|
||||
Xfbdev \- Linux framebuffer device tiny X server
|
||||
.SH SYNOPSIS
|
||||
.B Xfbdev
|
||||
.RI [ :display ]
|
||||
.RI [ option ...]
|
||||
.SH DESCRIPTION
|
||||
.B Xfbdev
|
||||
is a generic X server for Linux.
|
||||
.B Xfbdev
|
||||
doesn't know about any particular hardware, and uses the framebuffer
|
||||
provided by the Linux framebuffer device.
|
||||
.SH OPTIONS
|
||||
.B Xfbdev
|
||||
accepts the common options of the Xkdrive family of servers. Please
|
||||
see Xkdrive(1).
|
||||
.SH KEYBOARD
|
||||
To be written.
|
||||
.SH SEE ALSO
|
||||
X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1).
|
||||
.SH AUTHORS
|
||||
The
|
||||
.B Xfbdev
|
||||
server was written by Keith Packard.
|
||||
|
||||
|
|
@ -1,807 +0,0 @@
|
|||
/*
|
||||
* Id: fbdev.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.31 2002/10/14 18:01:40 keithp Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "fbdev.h"
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
extern int KdTsPhyScreen;
|
||||
|
||||
Bool
|
||||
fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
|
||||
{
|
||||
int k;
|
||||
unsigned long off;
|
||||
if ((priv->fd = open("/dev/fb0", O_RDWR)) < 0 && \
|
||||
(priv->fd = open("/dev/fb/0", O_RDWR)) < 0) {
|
||||
perror("Error opening /dev/fb0");
|
||||
return FALSE;
|
||||
}
|
||||
/* quiet valgrind */
|
||||
memset (&priv->fix, '\0', sizeof (priv->fix));
|
||||
if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
|
||||
perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
|
||||
close (priv->fd);
|
||||
return FALSE;
|
||||
}
|
||||
/* quiet valgrind */
|
||||
memset (&priv->var, '\0', sizeof (priv->var));
|
||||
if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) {
|
||||
perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
|
||||
close (priv->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->fb_base = (unsigned char *) mmap ((caddr_t) NULL,
|
||||
priv->fix.smem_len,
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED,
|
||||
priv->fd, 0);
|
||||
|
||||
if (priv->fb_base == (char *)-1)
|
||||
{
|
||||
perror("ERROR: mmap framebuffer fails!");
|
||||
close (priv->fd);
|
||||
return FALSE;
|
||||
}
|
||||
off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize();
|
||||
priv->fb = priv->fb_base + off;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevCardInit (KdCardInfo *card)
|
||||
{
|
||||
FbdevPriv *priv;
|
||||
|
||||
priv = (FbdevPriv *) xalloc (sizeof (FbdevPriv));
|
||||
if (!priv)
|
||||
return FALSE;
|
||||
|
||||
if (!fbdevInitialize (card, priv))
|
||||
{
|
||||
xfree (priv);
|
||||
return FALSE;
|
||||
}
|
||||
card->driver = priv;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define FBDEV_KLUDGE_FORMAT
|
||||
#ifdef FBDEV_KLUDGE_FORMAT
|
||||
static Pixel
|
||||
fbdevMakeContig (Pixel orig, Pixel others)
|
||||
{
|
||||
Pixel low;
|
||||
|
||||
low = lowbit (orig) >> 1;
|
||||
while (low && (others & low) == 0)
|
||||
{
|
||||
orig |= low;
|
||||
low >>= 1;
|
||||
}
|
||||
return orig;
|
||||
}
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
fbdevModeSupported (KdScreenInfo *screen,
|
||||
const KdMonitorTiming *t)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
fbdevConvertMonitorTiming (const KdMonitorTiming *t, struct fb_var_screeninfo *var)
|
||||
{
|
||||
memset (var, 0, sizeof (struct fb_var_screeninfo));
|
||||
|
||||
var->xres = t->horizontal;
|
||||
var->yres = t->vertical;
|
||||
var->xres_virtual = t->horizontal;
|
||||
var->yres_virtual = t->vertical;
|
||||
var->xoffset = 0;
|
||||
var->yoffset = 0;
|
||||
var->pixclock = t->clock ? 1000000000 / t->clock : 0;
|
||||
var->left_margin = t->hbp;
|
||||
var->right_margin = t->hfp;
|
||||
var->upper_margin = t->vbp;
|
||||
var->lower_margin = t->vfp;
|
||||
var->hsync_len = t->hblank - t->hfp - t->hbp;
|
||||
var->vsync_len = t->vblank - t->vfp - t->vbp;
|
||||
|
||||
var->sync = 0;
|
||||
var->vmode = 0;
|
||||
|
||||
if (t->hpol == KdSyncPositive)
|
||||
var->sync |= FB_SYNC_HOR_HIGH_ACT;
|
||||
if (t->vpol == KdSyncPositive)
|
||||
var->sync |= FB_SYNC_VERT_HIGH_ACT;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||
{
|
||||
FbdevPriv *priv = screen->card->driver;
|
||||
Pixel allbits;
|
||||
int depth;
|
||||
Bool gray;
|
||||
struct fb_var_screeninfo var;
|
||||
const KdMonitorTiming *t;
|
||||
int k;
|
||||
|
||||
if (!screen->width || !screen->height)
|
||||
{
|
||||
if (ioctl (priv->fd, FBIOGET_VSCREENINFO, &var) >= 0) {
|
||||
screen->width = var.xres;
|
||||
screen->height = var.yres;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->width = 1024;
|
||||
screen->height = 768;
|
||||
}
|
||||
screen->rate = 103; /* FIXME: should get proper value from fb driver */
|
||||
}
|
||||
if (!screen->fb[0].depth)
|
||||
screen->fb[0].depth = 16;
|
||||
|
||||
t = KdFindMode (screen, fbdevModeSupported);
|
||||
screen->rate = t->rate;
|
||||
screen->width = t->horizontal;
|
||||
screen->height = t->vertical;
|
||||
|
||||
/* Now try setting the mode */
|
||||
fbdevConvertMonitorTiming (t, &var);
|
||||
|
||||
var.activate = FB_ACTIVATE_NOW;
|
||||
var.bits_per_pixel = screen->fb[0].depth;
|
||||
var.nonstd = 0;
|
||||
var.grayscale = 0;
|
||||
|
||||
k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &var);
|
||||
|
||||
if (k < 0)
|
||||
{
|
||||
fprintf (stderr, "error: %s\n", strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Now get the new screeninfo */
|
||||
ioctl (priv->fd, FBIOGET_VSCREENINFO, &priv->var);
|
||||
depth = priv->var.bits_per_pixel;
|
||||
gray = priv->var.grayscale;
|
||||
|
||||
switch (priv->fix.visual) {
|
||||
case FB_VISUAL_PSEUDOCOLOR:
|
||||
if (gray)
|
||||
{
|
||||
screen->fb[0].visuals = (1 << StaticGray);
|
||||
/* could also support GrayScale, but what's the point? */
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].visuals = ((1 << StaticGray) |
|
||||
(1 << GrayScale) |
|
||||
(1 << StaticColor) |
|
||||
(1 << PseudoColor) |
|
||||
(1 << TrueColor) |
|
||||
(1 << DirectColor));
|
||||
}
|
||||
screen->fb[0].blueMask = 0x00;
|
||||
screen->fb[0].greenMask = 0x00;
|
||||
screen->fb[0].redMask = 0x00;
|
||||
break;
|
||||
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
||||
if (gray)
|
||||
{
|
||||
screen->fb[0].visuals = (1 << StaticGray);
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].visuals = (1 << StaticColor);
|
||||
}
|
||||
screen->fb[0].blueMask = 0x00;
|
||||
screen->fb[0].greenMask = 0x00;
|
||||
screen->fb[0].redMask = 0x00;
|
||||
break;
|
||||
case FB_VISUAL_TRUECOLOR:
|
||||
case FB_VISUAL_DIRECTCOLOR:
|
||||
screen->fb[0].visuals = (1 << TrueColor);
|
||||
#define Mask(o,l) (((1 << l) - 1) << o)
|
||||
screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
|
||||
screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
|
||||
screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
|
||||
#ifdef FBDEV_KLUDGE_FORMAT
|
||||
/*
|
||||
* This is a kludge so that Render will work -- fill in the gaps
|
||||
* in the pixel
|
||||
*/
|
||||
screen->fb[0].redMask = fbdevMakeContig (screen->fb[0].redMask,
|
||||
screen->fb[0].greenMask|
|
||||
screen->fb[0].blueMask);
|
||||
|
||||
screen->fb[0].greenMask = fbdevMakeContig (screen->fb[0].greenMask,
|
||||
screen->fb[0].redMask|
|
||||
screen->fb[0].blueMask);
|
||||
|
||||
screen->fb[0].blueMask = fbdevMakeContig (screen->fb[0].blueMask,
|
||||
screen->fb[0].redMask|
|
||||
screen->fb[0].greenMask);
|
||||
|
||||
#endif
|
||||
allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
|
||||
depth = 32;
|
||||
while (depth && !(allbits & (1 << (depth - 1))))
|
||||
depth--;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
screen->fb[0].depth = depth;
|
||||
screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
|
||||
|
||||
scrpriv->randr = screen->randr;
|
||||
|
||||
return fbdevMapFramebuffer (screen);
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevScreenInit (KdScreenInfo *screen)
|
||||
{
|
||||
FbdevScrPriv *scrpriv;
|
||||
|
||||
scrpriv = xalloc (sizeof (FbdevScrPriv));
|
||||
if (!scrpriv)
|
||||
return FALSE;
|
||||
memset (scrpriv, '\0', sizeof (FbdevScrPriv));
|
||||
screen->driver = scrpriv;
|
||||
if (!fbdevScreenInitialize (screen, scrpriv))
|
||||
{
|
||||
screen->driver = 0;
|
||||
xfree (scrpriv);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void *
|
||||
fbdevWindowLinear (ScreenPtr pScreen,
|
||||
CARD32 row,
|
||||
CARD32 offset,
|
||||
int mode,
|
||||
CARD32 *size,
|
||||
void *closure)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return 0;
|
||||
*size = priv->fix.line_length;
|
||||
return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevMapFramebuffer (KdScreenInfo *screen)
|
||||
{
|
||||
FbdevScrPriv *scrpriv = screen->driver;
|
||||
KdMouseMatrix m;
|
||||
FbdevPriv *priv = screen->card->driver;
|
||||
|
||||
if (scrpriv->randr != RR_Rotate_0)
|
||||
scrpriv->shadow = TRUE;
|
||||
else
|
||||
scrpriv->shadow = FALSE;
|
||||
|
||||
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||
|
||||
KdSetMouseMatrix (&m);
|
||||
|
||||
screen->width = priv->var.xres;
|
||||
screen->height = priv->var.yres;
|
||||
screen->memory_base = (CARD8 *) (priv->fb);
|
||||
screen->memory_size = priv->fix.smem_len;
|
||||
|
||||
if (scrpriv->shadow)
|
||||
{
|
||||
if (!KdShadowFbAlloc (screen, 0,
|
||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
||||
return FALSE;
|
||||
screen->off_screen_base = screen->memory_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[0].byteStride = priv->fix.line_length;
|
||||
screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
|
||||
priv->var.bits_per_pixel);
|
||||
screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
|
||||
screen->off_screen_base = screen->fb[0].byteStride * screen->height;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fbdevSetScreenSizes (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FbdevScrPriv *scrpriv = screen->driver;
|
||||
FbdevPriv *priv = screen->card->driver;
|
||||
|
||||
if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||
{
|
||||
pScreen->width = priv->var.xres;
|
||||
pScreen->height = priv->var.yres;
|
||||
pScreen->mmWidth = screen->width_mm;
|
||||
pScreen->mmHeight = screen->height_mm;
|
||||
}
|
||||
else
|
||||
{
|
||||
pScreen->width = priv->var.yres;
|
||||
pScreen->height = priv->var.xres;
|
||||
pScreen->mmWidth = screen->height_mm;
|
||||
pScreen->mmHeight = screen->width_mm;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevUnmapFramebuffer (KdScreenInfo *screen)
|
||||
{
|
||||
KdShadowFbFree (screen, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevSetShadow (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FbdevScrPriv *scrpriv = screen->driver;
|
||||
FbdevPriv *priv = screen->card->driver;
|
||||
ShadowUpdateProc update;
|
||||
ShadowWindowProc window;
|
||||
int useYX = 0;
|
||||
|
||||
#ifdef __arm__
|
||||
/* Use variant copy routines that always read left to right in the
|
||||
shadow framebuffer. Reading vertical strips is exceptionally
|
||||
slow on XScale due to cache effects. */
|
||||
useYX = 1;
|
||||
#endif
|
||||
|
||||
window = fbdevWindowLinear;
|
||||
update = 0;
|
||||
if (scrpriv->randr)
|
||||
if (priv->var.bits_per_pixel == 16) {
|
||||
switch (scrpriv->randr) {
|
||||
case RR_Rotate_90:
|
||||
if (useYX)
|
||||
update = shadowUpdateRotate16_90YX;
|
||||
else
|
||||
update = shadowUpdateRotate16_90;
|
||||
break;
|
||||
case RR_Rotate_180:
|
||||
update = shadowUpdateRotate16_180;
|
||||
break;
|
||||
case RR_Rotate_270:
|
||||
if (useYX)
|
||||
update = shadowUpdateRotate16_270YX;
|
||||
else
|
||||
update = shadowUpdateRotate16_270;
|
||||
break;
|
||||
default:
|
||||
update = shadowUpdateRotate16;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
update = shadowUpdateRotatePacked;
|
||||
else
|
||||
update = shadowUpdatePacked;
|
||||
return KdShadowSet (pScreen, scrpriv->randr, update, window);
|
||||
}
|
||||
|
||||
|
||||
#ifdef RANDR
|
||||
Bool
|
||||
fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FbdevScrPriv *scrpriv = screen->driver;
|
||||
RRScreenSizePtr pSize;
|
||||
Rotation randr;
|
||||
int n;
|
||||
|
||||
*rotations = RR_Rotate_All|RR_Reflect_All;
|
||||
|
||||
for (n = 0; n < pScreen->numDepths; n++)
|
||||
if (pScreen->allowedDepths[n].numVids)
|
||||
break;
|
||||
if (n == pScreen->numDepths)
|
||||
return FALSE;
|
||||
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
screen->width,
|
||||
screen->height,
|
||||
screen->width_mm,
|
||||
screen->height_mm);
|
||||
|
||||
randr = KdSubRotation (scrpriv->randr, screen->randr);
|
||||
|
||||
RRSetCurrentConfig (pScreen, randr, 0, pSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation randr,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
FbdevScrPriv *scrpriv = screen->driver;
|
||||
Bool wasEnabled = pScreenPriv->enabled;
|
||||
FbdevScrPriv oldscr;
|
||||
int oldwidth;
|
||||
int oldheight;
|
||||
int oldmmwidth;
|
||||
int oldmmheight;
|
||||
int newwidth, newheight;
|
||||
|
||||
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||
{
|
||||
newwidth = pSize->width;
|
||||
newheight = pSize->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
newwidth = pSize->height;
|
||||
newheight = pSize->width;
|
||||
}
|
||||
|
||||
if (wasEnabled)
|
||||
KdDisableScreen (pScreen);
|
||||
|
||||
oldscr = *scrpriv;
|
||||
|
||||
oldwidth = screen->width;
|
||||
oldheight = screen->height;
|
||||
oldmmwidth = pScreen->mmWidth;
|
||||
oldmmheight = pScreen->mmHeight;
|
||||
|
||||
/*
|
||||
* Set new configuration
|
||||
*/
|
||||
|
||||
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
||||
|
||||
KdOffscreenSwapOut (screen->pScreen);
|
||||
|
||||
fbdevUnmapFramebuffer (screen);
|
||||
|
||||
if (!fbdevMapFramebuffer (screen))
|
||||
goto bail4;
|
||||
|
||||
KdShadowUnset (screen->pScreen);
|
||||
|
||||
if (!fbdevSetShadow (screen->pScreen))
|
||||
goto bail4;
|
||||
|
||||
fbdevSetScreenSizes (screen->pScreen);
|
||||
|
||||
/*
|
||||
* Set frame buffer mapping
|
||||
*/
|
||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||
pScreen->width,
|
||||
pScreen->height,
|
||||
screen->fb[0].depth,
|
||||
screen->fb[0].bitsPerPixel,
|
||||
screen->fb[0].byteStride,
|
||||
screen->fb[0].frameBuffer);
|
||||
|
||||
/* set the subpixel order */
|
||||
|
||||
KdSetSubpixelOrder (pScreen, scrpriv->randr);
|
||||
if (wasEnabled)
|
||||
KdEnableScreen (pScreen);
|
||||
|
||||
return TRUE;
|
||||
|
||||
bail4:
|
||||
fbdevUnmapFramebuffer (screen);
|
||||
*scrpriv = oldscr;
|
||||
(void) fbdevMapFramebuffer (screen);
|
||||
pScreen->width = oldwidth;
|
||||
pScreen->height = oldheight;
|
||||
pScreen->mmWidth = oldmmwidth;
|
||||
pScreen->mmHeight = oldmmheight;
|
||||
|
||||
if (wasEnabled)
|
||||
KdEnableScreen (pScreen);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevRandRInit (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
||||
if (!RRScreenInit (pScreen))
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
pScrPriv->rrGetInfo = fbdevRandRGetInfo;
|
||||
pScrPriv->rrSetConfig = fbdevRandRSetConfig;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
fbdevCreateColormap (ColormapPtr pmap)
|
||||
{
|
||||
ScreenPtr pScreen = pmap->pScreen;
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
VisualPtr pVisual;
|
||||
int i;
|
||||
int nent;
|
||||
xColorItem *pdefs;
|
||||
|
||||
switch (priv->fix.visual) {
|
||||
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
||||
pVisual = pmap->pVisual;
|
||||
nent = pVisual->ColormapEntries;
|
||||
pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem));
|
||||
if (!pdefs)
|
||||
return FALSE;
|
||||
for (i = 0; i < nent; i++)
|
||||
pdefs[i].pixel = i;
|
||||
fbdevGetColors (pScreen, 0, nent, pdefs);
|
||||
for (i = 0; i < nent; i++)
|
||||
{
|
||||
pmap->red[i].co.local.red = pdefs[i].red;
|
||||
pmap->red[i].co.local.green = pdefs[i].green;
|
||||
pmap->red[i].co.local.blue = pdefs[i].blue;
|
||||
}
|
||||
DEALLOCATE_LOCAL (pdefs);
|
||||
return TRUE;
|
||||
default:
|
||||
return fbInitializeColormap (pmap);
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
#ifdef TOUCHSCREEN
|
||||
KdTsPhyScreen = pScreen->myNum;
|
||||
#endif
|
||||
|
||||
pScreen->CreateColormap = fbdevCreateColormap;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevFinishInitScreen (ScreenPtr pScreen)
|
||||
{
|
||||
if (!shadowSetup (pScreen))
|
||||
return FALSE;
|
||||
|
||||
#ifdef RANDR
|
||||
if (!fbdevRandRInit (pScreen))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
fbdevCreateResources (ScreenPtr pScreen)
|
||||
{
|
||||
return fbdevSetShadow (pScreen);
|
||||
}
|
||||
|
||||
void
|
||||
fbdevPreserve (KdCardInfo *card)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevEnable (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
int k;
|
||||
|
||||
priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
|
||||
|
||||
/* display it on the LCD */
|
||||
k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
|
||||
if (k < 0)
|
||||
{
|
||||
perror ("FBIOPUT_VSCREENINFO");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
|
||||
{
|
||||
struct fb_cmap cmap;
|
||||
int i;
|
||||
|
||||
for (i = 0;
|
||||
i < (1 << priv->var.red.length) ||
|
||||
i < (1 << priv->var.green.length) ||
|
||||
i < (1 << priv->var.blue.length); i++)
|
||||
{
|
||||
priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
|
||||
priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
|
||||
priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
|
||||
}
|
||||
cmap.start = 0;
|
||||
cmap.len = i;
|
||||
cmap.red = &priv->red[0];
|
||||
cmap.green = &priv->green[0];
|
||||
cmap.blue = &priv->blue[0];
|
||||
cmap.transp = 0;
|
||||
ioctl (priv->fd, FBIOPUTCMAP, &cmap);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbdevDPMS (ScreenPtr pScreen, int mode)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
static int oldmode = -1;
|
||||
|
||||
if (mode == oldmode)
|
||||
return TRUE;
|
||||
#ifdef FBIOPUT_POWERMODE
|
||||
if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0)
|
||||
{
|
||||
oldmode = mode;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
#ifdef FBIOBLANK
|
||||
if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0)
|
||||
{
|
||||
oldmode = mode;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
fbdevDisable (ScreenPtr pScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fbdevRestore (KdCardInfo *card)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fbdevScreenFini (KdScreenInfo *screen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fbdevCardFini (KdCardInfo *card)
|
||||
{
|
||||
FbdevPriv *priv = card->driver;
|
||||
|
||||
munmap (priv->fb_base, priv->fix.smem_len);
|
||||
close (priv->fd);
|
||||
xfree (priv);
|
||||
}
|
||||
|
||||
void
|
||||
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
struct fb_cmap cmap;
|
||||
int p;
|
||||
int k;
|
||||
int min, max;
|
||||
|
||||
min = 256;
|
||||
max = 0;
|
||||
for (k = 0; k < n; k++)
|
||||
{
|
||||
if (pdefs[k].pixel < min)
|
||||
min = pdefs[k].pixel;
|
||||
if (pdefs[k].pixel > max)
|
||||
max = pdefs[k].pixel;
|
||||
}
|
||||
cmap.start = min;
|
||||
cmap.len = max - min + 1;
|
||||
cmap.red = &priv->red[min];
|
||||
cmap.green = &priv->green[min];;
|
||||
cmap.blue = &priv->blue[min];
|
||||
cmap.transp = 0;
|
||||
k = ioctl (priv->fd, FBIOGETCMAP, &cmap);
|
||||
if (k < 0)
|
||||
{
|
||||
perror ("can't get colormap");
|
||||
return;
|
||||
}
|
||||
while (n--)
|
||||
{
|
||||
p = pdefs->pixel;
|
||||
pdefs->red = priv->red[p];
|
||||
pdefs->green = priv->green[p];
|
||||
pdefs->blue = priv->blue[p];
|
||||
pdefs++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||
struct fb_cmap cmap;
|
||||
int p;
|
||||
int min, max;
|
||||
|
||||
min = 256;
|
||||
max = 0;
|
||||
while (n--)
|
||||
{
|
||||
p = pdefs->pixel;
|
||||
priv->red[p] = pdefs->red;
|
||||
priv->green[p] = pdefs->green;
|
||||
priv->blue[p] = pdefs->blue;
|
||||
if (p < min)
|
||||
min = p;
|
||||
if (p > max)
|
||||
max = p;
|
||||
pdefs++;
|
||||
}
|
||||
cmap.start = min;
|
||||
cmap.len = max - min + 1;
|
||||
cmap.red = &priv->red[min];
|
||||
cmap.green = &priv->green[min];
|
||||
cmap.blue = &priv->blue[min];
|
||||
cmap.transp = 0;
|
||||
ioctl (priv->fd, FBIOPUTCMAP, &cmap);
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
/*
|
||||
* Id: fbdev.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.h,v 1.11 2001/06/03 21:52:45 keithp Exp $ */
|
||||
|
||||
#ifndef _FBDEV_H_
|
||||
#define _FBDEV_H_
|
||||
#include <stdio.h>
|
||||
#include <linux/fb.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include "kdrive.h"
|
||||
|
||||
#ifdef RANDR
|
||||
#include "randrstr.h"
|
||||
#endif
|
||||
|
||||
typedef struct _fbdevPriv {
|
||||
struct fb_var_screeninfo var;
|
||||
struct fb_fix_screeninfo fix;
|
||||
__u16 red[256];
|
||||
__u16 green[256];
|
||||
__u16 blue[256];
|
||||
int fd;
|
||||
char *fb;
|
||||
char *fb_base;
|
||||
} FbdevPriv;
|
||||
|
||||
typedef struct _fbdevScrPriv {
|
||||
Rotation randr;
|
||||
Bool shadow;
|
||||
PixmapPtr pShadow;
|
||||
} FbdevScrPriv;
|
||||
|
||||
extern KdCardFuncs fbdevFuncs;
|
||||
|
||||
Bool
|
||||
fbdevInitialize (KdCardInfo *card, FbdevPriv *priv);
|
||||
|
||||
Bool
|
||||
fbdevCardInit (KdCardInfo *card);
|
||||
|
||||
Bool
|
||||
fbdevScreenInit (KdScreenInfo *screen);
|
||||
|
||||
Bool
|
||||
fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
|
||||
|
||||
Bool
|
||||
fbdevInitScreen (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fbdevFinishInitScreen (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fbdevCreateResources (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
fbdevPreserve (KdCardInfo *card);
|
||||
|
||||
Bool
|
||||
fbdevEnable (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fbdevDPMS (ScreenPtr pScreen, int mode);
|
||||
|
||||
void
|
||||
fbdevDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
fbdevRestore (KdCardInfo *card);
|
||||
|
||||
void
|
||||
fbdevScreenFini (KdScreenInfo *screen);
|
||||
|
||||
void
|
||||
fbdevCardFini (KdCardInfo *card);
|
||||
|
||||
void
|
||||
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
||||
|
||||
void
|
||||
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
||||
|
||||
Bool
|
||||
fbdevMapFramebuffer (KdScreenInfo *screen);
|
||||
|
||||
void *
|
||||
fbdevWindowLinear (ScreenPtr pScreen,
|
||||
CARD32 row,
|
||||
CARD32 offset,
|
||||
int mode,
|
||||
CARD32 *size,
|
||||
void *closure);
|
||||
|
||||
void
|
||||
fbdevSetScreenSizes (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fbdevUnmapFramebuffer (KdScreenInfo *screen);
|
||||
|
||||
Bool
|
||||
fbdevSetShadow (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
fbdevCreateColormap (ColormapPtr pmap);
|
||||
|
||||
#ifdef RANDR
|
||||
Bool
|
||||
fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
|
||||
|
||||
Bool
|
||||
fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||
Rotation randr,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize);
|
||||
Bool
|
||||
fbdevRandRInit (ScreenPtr pScreen);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _FBDEV_H_ */
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Id: fbinit.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/fbinit.c,v 1.8 2001/05/29 17:47:55 keithp Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <fbdev.h>
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
KdCardAttr attr;
|
||||
|
||||
KdCardInfoAdd (&fbdevFuncs, &attr, 0);
|
||||
}
|
||||
|
||||
void
|
||||
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput (pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput (int argc, char **argv)
|
||||
{
|
||||
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
|
||||
#ifdef TOUCHSCREEN
|
||||
KdInitTouchScreen (&TsFuncs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg();
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
return KdProcessArgument (argc, argv, i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
KdCardFuncs fbdevFuncs = {
|
||||
fbdevCardInit, /* cardinit */
|
||||
fbdevScreenInit, /* scrinit */
|
||||
fbdevInitScreen, /* initScreen */
|
||||
fbdevFinishInitScreen, /* finishInitScreen */
|
||||
fbdevCreateResources, /* createRes */
|
||||
fbdevPreserve, /* preserve */
|
||||
fbdevEnable, /* enable */
|
||||
fbdevDPMS, /* dpms */
|
||||
fbdevDisable, /* disable */
|
||||
fbdevRestore, /* restore */
|
||||
fbdevScreenFini, /* scrfini */
|
||||
fbdevCardFini, /* cardfini */
|
||||
|
||||
0, /* initCursor */
|
||||
0, /* enableCursor */
|
||||
0, /* disableCursor */
|
||||
0, /* finiCursor */
|
||||
0, /* recolorCursor */
|
||||
|
||||
0, /* initAccel */
|
||||
0, /* enableAccel */
|
||||
0, /* syncAccel */
|
||||
0, /* disableAccel */
|
||||
0, /* finiAccel */
|
||||
|
||||
fbdevGetColors, /* getColors */
|
||||
fbdevPutColors, /* putColors */
|
||||
};
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
|
||||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/i810/Imakefile,v 1.6 2000/10/20 00:19:51 keithp Exp $
|
||||
KDRIVE=..
|
||||
#include "../Kdrive.tmpl"
|
||||
|
||||
#if BuildXvExt
|
||||
XVSRCS = i810_video.c
|
||||
XVOBJS = i810_video.o
|
||||
#endif
|
||||
|
||||
SRCS = i810.c i810stub.c i810draw.c i810_cursor.c $(XVSRCS)
|
||||
|
||||
OBJS = i810.o i810stub.o i810draw.o i810_cursor.o $(XVOBJS)
|
||||
|
||||
DEFINES = XvExtensionDefines /* -DI810CFG_SHOW_OVERSCAN */
|
||||
|
||||
INCLUDES = -I. $(KDINCS)
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
NormalLibraryTarget(i810,$(OBJS))
|
||||
DependTarget()
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
INCLUDES = \
|
||||
@KDRIVE_INCS@ \
|
||||
@XSERVER_CFLAGS@
|
||||
|
||||
bin_PROGRAMS = Xi810
|
||||
|
||||
noinst_LIBRARIES = libi810.a
|
||||
|
||||
if TSLIB
|
||||
TSLIB_FLAG = -lts
|
||||
endif
|
||||
|
||||
libi810_a_SOURCES = \
|
||||
i810_cursor.c \
|
||||
i810_video.c \
|
||||
i810draw.c \
|
||||
i810draw.h \
|
||||
i810reg.h \
|
||||
i810.c \
|
||||
i810.h
|
||||
|
||||
Xi810_SOURCES = \
|
||||
i810stub.c
|
||||
|
||||
I810_LIBS = \
|
||||
libi810.a \
|
||||
@KDRIVE_LIBS@
|
||||
|
||||
Xi810_LDADD = \
|
||||
$(I810_LIBS) \
|
||||
@XSERVER_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
Xi810_DEPENDENCIES = $(I810_LIBS) @KDRIVE_LIBS@
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,503 +0,0 @@
|
|||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/* $RCSId: $ */
|
||||
|
||||
/*
|
||||
* Author:
|
||||
* Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*/
|
||||
|
||||
#ifndef _I810_H_
|
||||
#define _I810_H_
|
||||
|
||||
#include "i810_reg.h"
|
||||
|
||||
/* Globals */
|
||||
|
||||
typedef struct _I810Rec *I810Ptr;
|
||||
|
||||
/* Linear region allocated in framebuffer.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long Start;
|
||||
unsigned long End;
|
||||
unsigned long Size;
|
||||
} I810MemRange;
|
||||
|
||||
typedef struct {
|
||||
int tail_mask;
|
||||
I810MemRange mem;
|
||||
unsigned char *virtual_start;
|
||||
int head;
|
||||
int tail;
|
||||
int space;
|
||||
} I810RingBuffer;
|
||||
|
||||
typedef struct {
|
||||
unsigned char DisplayControl;
|
||||
unsigned char PixelPipeCfg0;
|
||||
unsigned char PixelPipeCfg1;
|
||||
unsigned char PixelPipeCfg2;
|
||||
unsigned short VideoClk2_M;
|
||||
unsigned short VideoClk2_N;
|
||||
unsigned char VideoClk2_DivisorSel;
|
||||
unsigned char AddressMapping;
|
||||
unsigned char IOControl;
|
||||
unsigned char BitBLTControl;
|
||||
unsigned char ExtVertTotal;
|
||||
unsigned char ExtVertDispEnd;
|
||||
unsigned char ExtVertSyncStart;
|
||||
unsigned char ExtVertBlankStart;
|
||||
unsigned char ExtHorizTotal;
|
||||
unsigned char ExtHorizBlank;
|
||||
unsigned char ExtOffset;
|
||||
unsigned char InterlaceControl;
|
||||
unsigned int LMI_FIFO_Watermark;
|
||||
|
||||
unsigned int LprbTail;
|
||||
unsigned int LprbHead;
|
||||
unsigned int LprbStart;
|
||||
unsigned int LprbLen;
|
||||
|
||||
unsigned int Fence[8];
|
||||
|
||||
unsigned short OverlayActiveStart;
|
||||
unsigned short OverlayActiveEnd;
|
||||
|
||||
|
||||
} I810RegRec, *I810RegPtr;
|
||||
|
||||
#define minb(p) *(volatile CARD8 *)(i810c->MMIOBase + (p))
|
||||
#define moutb(p,v) *(volatile CARD8 *)(i810c->MMIOBase + (p)) = (v)
|
||||
|
||||
#define OUT_RING(n) { \
|
||||
if (I810_DEBUG & DEBUG_VERBOSE_RING) \
|
||||
ErrorF( "OUT_RING %x: %x\n", outring, n); \
|
||||
*(volatile unsigned int *)(virt + outring) = n; \
|
||||
outring += 4; \
|
||||
outring &= ringmask; \
|
||||
}
|
||||
|
||||
#define ADVANCE_LP_RING() { \
|
||||
i810c->LpRing.tail = outring; \
|
||||
OUTREG(LP_RING + RING_TAIL, outring); \
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LP_RING_MESSAGE(n) \
|
||||
ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__)
|
||||
#else
|
||||
#define LP_RING_MESSAGE(n) \
|
||||
ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
#define BEGIN_LP_RING(n) \
|
||||
unsigned int outring, ringmask; \
|
||||
volatile unsigned char *virt; \
|
||||
if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) i810Sync( screen ); \
|
||||
if (i810c->LpRing.space < n*4) i810WaitLpRing( screen, n*4, 0); \
|
||||
i810c->LpRing.space -= n*4; \
|
||||
if (I810_DEBUG & DEBUG_VERBOSE_RING) \
|
||||
LP_RING_MESSAGE(n); \
|
||||
outring = i810c->LpRing.tail; \
|
||||
ringmask = i810c->LpRing.tail_mask; \
|
||||
virt = i810c->LpRing.virtual_start;
|
||||
|
||||
/* Memory mapped register access macros */
|
||||
#define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr))
|
||||
#define INREG16(addr) *(volatile CARD16 *)(i810c->MMIOBase + (addr))
|
||||
#define INREG(addr) *(volatile CARD32 *)(i810c->MMIOBase + (addr))
|
||||
|
||||
#define OUTREG8(addr, val) do { \
|
||||
*(volatile CARD8 *)(i810c->MMIOBase + (addr)) = (val); \
|
||||
if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
|
||||
ErrorF( "OUTREG8(%x, %x)\n", addr, val); \
|
||||
} while (0)
|
||||
|
||||
#define OUTREG16(addr, val) do { \
|
||||
*(volatile CARD16 *)(i810c->MMIOBase + (addr)) = (val); \
|
||||
if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
|
||||
ErrorF( "OUTREG16(%x, %x)\n", addr, val); \
|
||||
} while (0)
|
||||
|
||||
#define OUTREG(addr, val) do { \
|
||||
*(volatile CARD32 *)(i810c->MMIOBase + (addr)) = (val); \
|
||||
if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
|
||||
ErrorF( "OUTREG(%x, %x)\n", addr, val); \
|
||||
} while (0)
|
||||
|
||||
/* To remove all debugging, make sure I810_DEBUG is defined as a
|
||||
* preprocessor symbol, and equal to zero.
|
||||
*/
|
||||
|
||||
#define I810_DEBUG 0
|
||||
|
||||
#ifndef I810_DEBUG
|
||||
#warning "Debugging enabled - expect reduced performance"
|
||||
extern int I810_DEBUG;
|
||||
#endif
|
||||
|
||||
#define DEBUG_VERBOSE_ACCEL 0x1
|
||||
#define DEBUG_VERBOSE_SYNC 0x2
|
||||
#define DEBUG_VERBOSE_VGA 0x4
|
||||
#define DEBUG_VERBOSE_RING 0x8
|
||||
#define DEBUG_VERBOSE_OUTREG 0x10
|
||||
#define DEBUG_VERBOSE_MEMORY 0x20
|
||||
#define DEBUG_VERBOSE_CURSOR 0x40
|
||||
#define DEBUG_ALWAYS_SYNC 0x80
|
||||
#define DEBUG_VERBOSE_DRI 0x100
|
||||
|
||||
|
||||
/* Size of the mmio region.
|
||||
*/
|
||||
#define I810_REG_SIZE 0x80000
|
||||
|
||||
/* PCI identifiers */
|
||||
#ifndef PCI_CHIP_I810
|
||||
#define PCI_CHIP_I810 0x7121
|
||||
#define PCI_CHIP_I810_DC100 0x7123
|
||||
#define PCI_CHIP_I810_E 0x7125
|
||||
#define PCI_CHIP_I815 0x1132
|
||||
#define PCI_CHIP_I810_BRIDGE 0x7120
|
||||
#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
|
||||
#define PCI_CHIP_I810_E_BRIDGE 0x7124
|
||||
#define PCI_CHIP_I815_BRIDGE 0x1130
|
||||
#endif
|
||||
|
||||
|
||||
#define IS_I810(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I810 || \
|
||||
i810c->PciInfo->chipType == PCI_CHIP_I810_DC100 || \
|
||||
i810c->PciInfo->chipType == PCI_CHIP_I810_E)
|
||||
#define IS_I815(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I815)
|
||||
|
||||
|
||||
/* default number of VGA registers stored internally */
|
||||
#define VGA_NUM_CRTC 25 /* 0x19 */
|
||||
#define VGA_NUM_SEQ 5
|
||||
#define VGA_NUM_GFX 9
|
||||
#define VGA_NUM_ATTR 21
|
||||
|
||||
/*
|
||||
* Settings of standard VGA registers.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char MiscOutReg; /* */
|
||||
unsigned char CRTC[VGA_NUM_CRTC]; /* Crtc Controller */
|
||||
unsigned char Sequencer[VGA_NUM_SEQ]; /* Video Sequencer */
|
||||
unsigned char Graphics[VGA_NUM_GFX]; /* Video Graphics */
|
||||
unsigned char Attribute[VGA_NUM_ATTR]; /* Video Atribute */
|
||||
unsigned char DAC[768]; /* Internal Colorlookuptable */
|
||||
} vgaRegRec, *vgaRegPtr;
|
||||
|
||||
|
||||
typedef struct _i810VGARec *i810VGAPtr;
|
||||
|
||||
/* VGA registers */
|
||||
typedef struct _i810VGARec {
|
||||
int IOBase; /* I/O Base address */
|
||||
CARD8 * MMIOBase; /* Pointer to MMIO start */
|
||||
vgaRegRec SavedReg; /* saved registers */
|
||||
vgaRegRec ModeReg; /* register settings for
|
||||
current mode */
|
||||
Bool ShowOverscan;
|
||||
Bool paletteEnabled;
|
||||
Bool cmapSaved;
|
||||
} i810VGARec;
|
||||
|
||||
typedef struct _i810CardInfo {
|
||||
int videoRam;
|
||||
int MaxClock;
|
||||
long FbMapSize;
|
||||
int cpp; /* chars per pixel */
|
||||
|
||||
unsigned long LinearAddr;
|
||||
unsigned long MMIOAddr;
|
||||
|
||||
unsigned char *MMIOBase;
|
||||
unsigned char *FbBase;
|
||||
|
||||
Bool GttBound;
|
||||
Bool agpAcquired2d;
|
||||
int VramKey;
|
||||
unsigned long VramOffset;
|
||||
int DcacheKey;
|
||||
unsigned long DcacheOffset;
|
||||
int HwcursKey;
|
||||
unsigned long HwcursOffset;
|
||||
|
||||
I810MemRange DcacheMem;
|
||||
I810MemRange SysMem;
|
||||
|
||||
I810MemRange SavedDcacheMem;
|
||||
I810MemRange SavedSysMem;
|
||||
|
||||
unsigned int bufferOffset; /* for I810SelectBuffer */
|
||||
Bool DoneFrontAlloc;
|
||||
BoxRec FbMemBox;
|
||||
I810MemRange FrontBuffer;
|
||||
I810MemRange Scratch;
|
||||
I810MemRange XvMem;
|
||||
|
||||
int LmFreqSel;
|
||||
|
||||
i810VGARec vga;
|
||||
|
||||
I810RegRec SavedReg;
|
||||
I810RegRec ModeReg;
|
||||
I810RingBuffer LpRing;
|
||||
|
||||
unsigned int BR[20];
|
||||
|
||||
int CursorOffset;
|
||||
unsigned long CursorPhysical;
|
||||
unsigned long CursorStart;
|
||||
unsigned long OverlayPhysical;
|
||||
unsigned long OverlayStart;
|
||||
int colorKey;
|
||||
|
||||
Bool NeedToSync; /* Need to sync accel stuff */
|
||||
|
||||
int nextColorExpandBuf;
|
||||
|
||||
ScreenBlockHandlerProcPtr BlockHandler;
|
||||
|
||||
#ifdef XV
|
||||
KdVideoAdaptorPtr adaptor;
|
||||
#endif
|
||||
|
||||
} I810CardInfo;
|
||||
|
||||
#define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver))
|
||||
#define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd)
|
||||
|
||||
#define getI810ScreenInfo(kd) ((I810ScreenInfo *) ((kd)->screen->driver))
|
||||
#define i810ScreenInfo(kd) I810ScreenInfo *i810s = getI810ScreenInfo(kd)
|
||||
|
||||
typedef struct _i810Cursor {
|
||||
int width, height;
|
||||
int xhot, yhot;
|
||||
Bool has_cursor;
|
||||
CursorPtr pCursor;
|
||||
} i810Cursor, *i810CursorPtr;
|
||||
|
||||
typedef struct _i810ScreenInfo {
|
||||
i810Cursor cursor;
|
||||
} I810ScreenInfo;
|
||||
|
||||
#define I810_CURSOR_HEIGHT 64
|
||||
#define I810_CURSOR_WIDTH 64
|
||||
|
||||
/* init functions (i810.c) */
|
||||
|
||||
Bool
|
||||
i810CardInit (KdCardInfo *card);
|
||||
|
||||
Bool
|
||||
i810ScreenInit (KdScreenInfo *screen);
|
||||
|
||||
/* The cursor functions (i810_cursor.c) */
|
||||
|
||||
Bool
|
||||
i810CursorInit(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
i810CursorEnable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
i810CursorDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
i810CursorFini (ScreenPtr pScreen);
|
||||
|
||||
/* Accel functions (i810draw.c) */
|
||||
|
||||
Bool
|
||||
i810InitAccel(ScreenPtr);
|
||||
|
||||
void
|
||||
i810EnableAccel (ScreenPtr);
|
||||
|
||||
void
|
||||
i810SyncAccel (ScreenPtr);
|
||||
|
||||
void
|
||||
i810DisableAccel (ScreenPtr);
|
||||
|
||||
void
|
||||
i810FiniAccel (ScreenPtr);
|
||||
|
||||
void
|
||||
i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox,
|
||||
unsigned long pixel, int alu, unsigned long planemask);
|
||||
|
||||
|
||||
extern KdCardFuncs i810Funcs;
|
||||
|
||||
/* Standard VGA registers */
|
||||
|
||||
#define VGA_ATTR_INDEX 0x3C0
|
||||
#define VGA_ATTR_DATA_W 0x3C0
|
||||
#define VGA_ATTR_DATA_R 0x3C1
|
||||
#define VGA_IN_STAT_0 0x3C2 /* read */
|
||||
#define VGA_MISC_OUT_W 0x3C2 /* write */
|
||||
#define VGA_ENABLE 0x3C3
|
||||
#define VGA_SEQ_INDEX 0x3C4
|
||||
#define VGA_SEQ_DATA 0x3C5
|
||||
#define VGA_DAC_MASK 0x3C6
|
||||
#define VGA_DAC_READ_ADDR 0x3C7
|
||||
#define VGA_DAC_WRITE_ADDR 0x3C8
|
||||
#define VGA_DAC_DATA 0x3C9
|
||||
#define VGA_FEATURE_R 0x3CA /* read */
|
||||
#define VGA_MISC_OUT_R 0x3CC /* read */
|
||||
#define VGA_GRAPH_INDEX 0x3CE
|
||||
#define VGA_GRAPH_DATA 0x3CF
|
||||
|
||||
#define VGA_IOBASE_MONO 0x3B0
|
||||
#define VGA_IOBASE_COLOR 0x3D0
|
||||
|
||||
#define VGA_CRTC_INDEX_OFFSET 0x04
|
||||
#define VGA_CRTC_DATA_OFFSET 0x05
|
||||
#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
|
||||
#define VGA_FEATURE_W_OFFSET 0x0A /* write */
|
||||
|
||||
/* VGA stuff */
|
||||
#define BIT_PLANE 3 /* Which plane we write to in mono mode */
|
||||
|
||||
/* DAC indices for white and black */
|
||||
#define WHITE_VALUE 0x3F
|
||||
#define BLACK_VALUE 0x00
|
||||
#define OVERSCAN_VALUE 0x01
|
||||
|
||||
#define OVERSCAN 0x11 /* Index of OverScan register */
|
||||
|
||||
void
|
||||
i810VGAUnlock(i810VGAPtr vgap);
|
||||
|
||||
void
|
||||
i810VGALock(i810VGAPtr vgap);
|
||||
|
||||
Bool
|
||||
i810VGAInit(KdScreenInfo *scrninfp, const KdMonitorTiming *t);
|
||||
|
||||
void
|
||||
i810VGABlankScreen(KdCardInfo *card, Bool on);
|
||||
|
||||
void
|
||||
i810AdjustFrame(KdScreenInfo *screen, int x, int y, int flags);
|
||||
|
||||
Bool
|
||||
i810VGAMapMem(KdCardInfo *card);
|
||||
|
||||
void
|
||||
i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags);
|
||||
|
||||
void
|
||||
i810PrintErrorState(KdCardInfo *card);
|
||||
|
||||
void
|
||||
i810VGAGetIOBase(i810VGAPtr vgap);
|
||||
|
||||
/*
|
||||
* MMIO versions of the register access functions. These require
|
||||
* hwp->MemBase to be set in such a way that when the standard VGA port
|
||||
* address is added the correct memory address results.
|
||||
*/
|
||||
|
||||
#define Vminb(p) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)))
|
||||
#define Vmoutb(p,v) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)) = (v))
|
||||
|
||||
#define mmioWriteCrtc(vgap, index, value) { \
|
||||
Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index); \
|
||||
Vmoutb(vgap->IOBase + VGA_CRTC_DATA_OFFSET, value); \
|
||||
}
|
||||
|
||||
#define mmioReadCrtc(vgap, index) ( \
|
||||
Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index), \
|
||||
Vminb(vgap->IOBase + VGA_CRTC_DATA_OFFSET) \
|
||||
)
|
||||
|
||||
#define mmioWriteGr(vgap, index, value) { \
|
||||
Vmoutb(VGA_GRAPH_INDEX, index); \
|
||||
Vmoutb(VGA_GRAPH_DATA, value); \
|
||||
}
|
||||
|
||||
#define mmioReadGr(vgap, index) ( \
|
||||
Vmoutb(VGA_GRAPH_INDEX, index), \
|
||||
Vminb(VGA_GRAPH_DATA) \
|
||||
)
|
||||
|
||||
#define mmioWriteSeq(vgap, index, value) {\
|
||||
Vmoutb(VGA_SEQ_INDEX, index); \
|
||||
Vmoutb(VGA_SEQ_DATA, value); \
|
||||
}
|
||||
|
||||
#define mmioReadSeq(vgap, index) ( \
|
||||
Vmoutb(VGA_SEQ_INDEX, index), \
|
||||
Vminb(VGA_SEQ_DATA) \
|
||||
)
|
||||
|
||||
#define mmioWriteAttr(vgap, index, value) { \
|
||||
(void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
|
||||
Vmoutb(VGA_ATTR_INDEX, index); \
|
||||
Vmoutb(VGA_ATTR_DATA_W, value); \
|
||||
}
|
||||
|
||||
#define mmioReadAttr(vgap, index) ( \
|
||||
(void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET), \
|
||||
Vmoutb(VGA_ATTR_INDEX, index), \
|
||||
Vminb(VGA_ATTR_DATA_R) \
|
||||
)
|
||||
|
||||
#define mmioWriteMiscOut(vgap, value) Vmoutb(VGA_MISC_OUT_W, value)
|
||||
|
||||
|
||||
#define mmioReadMiscOut(vgap) Vminb(VGA_MISC_OUT_R)
|
||||
|
||||
#define mmioEnablePalette(vgap) { \
|
||||
(void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
|
||||
Vmoutb(VGA_ATTR_INDEX, 0x00); \
|
||||
vgap->paletteEnabled = TRUE; \
|
||||
}
|
||||
|
||||
#define mmioDisablePalette(vgap) { \
|
||||
(void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
|
||||
Vmoutb(VGA_ATTR_INDEX, 0x20); \
|
||||
vgap->paletteEnabled = FALSE; \
|
||||
}
|
||||
|
||||
#define mmioWriteDacWriteAddr(vgap, value) Vmoutb(VGA_DAC_WRITE_ADDR, value)
|
||||
|
||||
#define mmioWriteDacData(vgap, value) Vmoutb(VGA_DAC_DATA, value)
|
||||
|
||||
#endif /* _I810_H_ */
|
||||
|
|
@ -1,418 +0,0 @@
|
|||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
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 PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c,v 1.2 2001/12/10 16:34:20 keithp Exp $ */
|
||||
|
||||
/* i810_cursor.c: KDrive hardware cursor routines for the i810 chipset */
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "kdrive.h"
|
||||
#include "kxv.h"
|
||||
#include "i810.h"
|
||||
#include "cursorstr.h"
|
||||
|
||||
#define SetupCursor(s) KdScreenPriv(s); \
|
||||
i810CardInfo(pScreenPriv); \
|
||||
i810ScreenInfo(pScreenPriv); \
|
||||
i810Cursor *pCurPriv = &i810s->cursor
|
||||
|
||||
|
||||
static void
|
||||
writeStandardMMIO(I810CardInfo *i810c, int addr, CARD8 val) {
|
||||
moutb(addr, val);
|
||||
}
|
||||
|
||||
void
|
||||
_i810MoveCursor(ScreenPtr pScreen, int x, int y) {
|
||||
SetupCursor(pScreen);
|
||||
int flag;
|
||||
|
||||
if (I810_DEBUG & DEBUG_VERBOSE_CURSOR)
|
||||
ErrorF( "I810SetCursorPosition %d %d\n", x, y);
|
||||
|
||||
x += i810c->CursorOffset;
|
||||
|
||||
if (x >= 0) flag = CURSOR_X_POS;
|
||||
else {
|
||||
flag = CURSOR_X_NEG;
|
||||
x=-x;
|
||||
}
|
||||
|
||||
OUTREG8( CURSOR_X_LO, x&0xFF);
|
||||
OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag));
|
||||
|
||||
if (y >= 0) flag = CURSOR_Y_POS;
|
||||
else {
|
||||
flag = CURSOR_Y_NEG;
|
||||
y=-y;
|
||||
}
|
||||
OUTREG8( CURSOR_Y_LO, y&0xFF);
|
||||
OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag));
|
||||
|
||||
/* Enable cursor */
|
||||
OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
|
||||
OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
|
||||
|
||||
}
|
||||
|
||||
static void i810LoadCursor(ScreenPtr pScreen, int x, int y);
|
||||
|
||||
static void
|
||||
i810MoveCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (!pCurPriv->has_cursor)
|
||||
return;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
_i810MoveCursor (pScreen, x, y);
|
||||
|
||||
i810LoadCursor(pScreen, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_i810SetCursorColors(ScreenPtr pScreen) { /* int bg, int fg */
|
||||
|
||||
SetupCursor(pScreen);
|
||||
int tmp;
|
||||
|
||||
int bg = 0xffffff;
|
||||
int fg = 0x000000;
|
||||
|
||||
tmp=INREG8(PIXPIPE_CONFIG_0);
|
||||
tmp |= EXTENDED_PALETTE;
|
||||
OUTREG8( PIXPIPE_CONFIG_0, tmp);
|
||||
|
||||
writeStandardMMIO(i810c, DACMASK, 0xFF);
|
||||
writeStandardMMIO(i810c, DACWX, 0x04);
|
||||
|
||||
writeStandardMMIO(i810c, DACDATA, (bg & 0x00FF0000) >> 16);
|
||||
writeStandardMMIO(i810c, DACDATA, (bg & 0x0000FF00) >> 8);
|
||||
writeStandardMMIO(i810c, DACDATA, (bg & 0x000000FF));
|
||||
|
||||
writeStandardMMIO(i810c, DACDATA, (fg & 0x00FF0000) >> 16);
|
||||
writeStandardMMIO(i810c, DACDATA, (fg & 0x0000FF00) >> 8);
|
||||
writeStandardMMIO(i810c, DACDATA, (fg & 0x000000FF));
|
||||
|
||||
tmp=INREG8( PIXPIPE_CONFIG_0 );
|
||||
tmp &= ~EXTENDED_PALETTE;
|
||||
OUTREG8( PIXPIPE_CONFIG_0, tmp );
|
||||
}
|
||||
|
||||
#define InvertBits32(v) { \
|
||||
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
|
||||
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
|
||||
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
|
||||
}
|
||||
|
||||
static void i810LoadCursor(ScreenPtr pScreen, int x, int y) {
|
||||
|
||||
SetupCursor(pScreen);
|
||||
|
||||
int w, h;
|
||||
unsigned short r;
|
||||
unsigned int *msk, *mskLine, *src, *srcLine;
|
||||
|
||||
int i, j;
|
||||
int src_stride, src_width;
|
||||
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
CursorBitsPtr bits = pCursor->bits;
|
||||
CARD8 tmp;
|
||||
unsigned int *ram, *ramLine;
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
pCurPriv->xhot = pCursor->bits->xhot;
|
||||
pCurPriv->yhot = pCursor->bits->yhot;
|
||||
|
||||
ramLine = (unsigned int *) (i810c->FbBase + i810c->CursorStart);
|
||||
mskLine = (unsigned int *) (bits->mask);
|
||||
srcLine = (unsigned int *) (bits->source);
|
||||
|
||||
h = bits->height;
|
||||
if (h > I810_CURSOR_HEIGHT)
|
||||
h = I810_CURSOR_HEIGHT;
|
||||
|
||||
src_stride = BitmapBytePad(bits->width); /* bytes per line */
|
||||
src_stride = (src_stride +3) >> 2;
|
||||
src_width = (bits->width + 31) >> 5;
|
||||
|
||||
for (i = 0; i < I810_CURSOR_HEIGHT; i++) {
|
||||
|
||||
msk = mskLine;
|
||||
src = srcLine;
|
||||
ram = ramLine;
|
||||
mskLine += src_stride;
|
||||
srcLine += src_stride;
|
||||
ramLine += I810_CURSOR_WIDTH / 16;
|
||||
|
||||
for (j = 0; j < I810_CURSOR_WIDTH / 32; j++) {
|
||||
|
||||
unsigned long m, s, b1, b2;
|
||||
|
||||
if (i < h && j < src_width)
|
||||
{
|
||||
m = *msk++;
|
||||
s = *src++ & m;
|
||||
m = ~m;
|
||||
/* mask off right side */
|
||||
if (j == src_width - 1 && (bits->width & 31))
|
||||
{
|
||||
m |= 0xffffffff << (bits->width & 31);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = 0xffffffff;
|
||||
s = 0x00000000;
|
||||
}
|
||||
|
||||
InvertBits32(s);
|
||||
InvertBits32(m);
|
||||
|
||||
ram[2+j]=s;
|
||||
ram[0+j]=m;
|
||||
}
|
||||
}
|
||||
/* Set new color */
|
||||
_i810SetCursorColors (pScreen);
|
||||
|
||||
/* Move to new position */
|
||||
_i810MoveCursor (pScreen, x, y);
|
||||
|
||||
/* Enable cursor */
|
||||
OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
|
||||
OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
|
||||
|
||||
tmp = INREG8( PIXPIPE_CONFIG_0 );
|
||||
tmp |= HW_CURSOR_ENABLE;
|
||||
OUTREG8( PIXPIPE_CONFIG_0, tmp);
|
||||
}
|
||||
|
||||
static void
|
||||
i810UnloadCursor(ScreenPtr pScreen) {
|
||||
|
||||
SetupCursor(pScreen);
|
||||
|
||||
unsigned char tmp;
|
||||
|
||||
tmp=INREG8( PIXPIPE_CONFIG_0 );
|
||||
tmp &= ~HW_CURSOR_ENABLE;
|
||||
OUTREG8( PIXPIPE_CONFIG_0, tmp);
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return TRUE;
|
||||
|
||||
/* miRecolorCursor does this */
|
||||
if (pCurPriv->pCursor == pCursor)
|
||||
{
|
||||
if (pCursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
miPointerPosition (&x, &y);
|
||||
i810LoadCursor (pScreen, x, y);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
i810UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
i810SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pCursor)
|
||||
i810LoadCursor (pScreen, x, y);
|
||||
else
|
||||
i810UnloadCursor (pScreen);
|
||||
}
|
||||
|
||||
miPointerSpriteFuncRec i810PointerSpriteFuncs = {
|
||||
i810RealizeCursor,
|
||||
i810UnrealizeCursor,
|
||||
i810SetCursor,
|
||||
i810MoveCursor,
|
||||
};
|
||||
|
||||
static void
|
||||
i810QueryBestSize (int class,
|
||||
unsigned short *pwidth, unsigned short *pheight,
|
||||
ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
switch (class)
|
||||
{
|
||||
case CursorShape:
|
||||
if (*pwidth > pCurPriv->width)
|
||||
*pwidth = pCurPriv->width;
|
||||
if (*pheight > pCurPriv->height)
|
||||
*pheight = pCurPriv->height;
|
||||
if (*pwidth > pScreen->width)
|
||||
*pwidth = pScreen->width;
|
||||
if (*pheight > pScreen->height)
|
||||
*pheight = pScreen->height;
|
||||
break;
|
||||
default:
|
||||
fbQueryBestSize (class, pwidth, pheight, pScreen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
i810CursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
|
||||
SetupCursor(pScreen);
|
||||
|
||||
if (!i810c->CursorStart) {
|
||||
pCurPriv->has_cursor = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pCurPriv->width = I810_CURSOR_WIDTH;
|
||||
pCurPriv->height= I810_CURSOR_HEIGHT;
|
||||
pScreen->QueryBestSize = i810QueryBestSize;
|
||||
miPointerInitialize (pScreen,
|
||||
&i810PointerSpriteFuncs,
|
||||
&kdPointerScreenFuncs,
|
||||
FALSE);
|
||||
pCurPriv->has_cursor = TRUE;
|
||||
pCurPriv->pCursor = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
i810CursorEnable (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (pCurPriv->has_cursor)
|
||||
{
|
||||
if (pCurPriv->pCursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
miPointerPosition (&x, &y);
|
||||
i810LoadCursor (pScreen, x, y);
|
||||
}
|
||||
else
|
||||
i810UnloadCursor (pScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
i810CursorDisable (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pCurPriv->has_cursor)
|
||||
{
|
||||
if (pCurPriv->pCursor)
|
||||
{
|
||||
i810UnloadCursor (pScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
i810CursorFini (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
pCurPriv->pCursor = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1,696 +0,0 @@
|
|||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
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 PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
|
||||
|
||||
**************************************************************************/
|
||||
/* $RCSId: xc/programs/Xserver/hw/kdrive/i810/i810_reg.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*
|
||||
* based on the i740 driver by
|
||||
* Kevin E. Martin <kevin@precisioninsight.com>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* I/O register offsets
|
||||
*/
|
||||
#define SRX 0x3C4 /* p208 */
|
||||
#define GRX 0x3CE /* p213 */
|
||||
#define ARX 0x3C0 /* p224 */
|
||||
|
||||
/* VGA Color Palette Registers */
|
||||
#define DACMASK 0x3C6 /* p232 */
|
||||
#define DACSTATE 0x3C7 /* p232 */
|
||||
#define DACRX 0x3C7 /* p233 */
|
||||
#define DACWX 0x3C8 /* p233 */
|
||||
#define DACDATA 0x3C9 /* p233 */
|
||||
|
||||
/* CRT Controller Registers (CRX) */
|
||||
#define START_ADDR_HI 0x0C /* p246 */
|
||||
#define START_ADDR_LO 0x0D /* p247 */
|
||||
#define VERT_SYNC_END 0x11 /* p249 */
|
||||
#define EXT_VERT_TOTAL 0x30 /* p257 */
|
||||
#define EXT_VERT_DISPLAY 0x31 /* p258 */
|
||||
#define EXT_VERT_SYNC_START 0x32 /* p259 */
|
||||
#define EXT_VERT_BLANK_START 0x33 /* p260 */
|
||||
#define EXT_HORIZ_TOTAL 0x35 /* p261 */
|
||||
#define EXT_HORIZ_BLANK 0x39 /* p261 */
|
||||
#define EXT_START_ADDR 0x40 /* p262 */
|
||||
#define EXT_START_ADDR_ENABLE 0x80
|
||||
#define EXT_OFFSET 0x41 /* p263 */
|
||||
#define EXT_START_ADDR_HI 0x42 /* p263 */
|
||||
#define INTERLACE_CNTL 0x70 /* p264 */
|
||||
#define INTERLACE_ENABLE 0x80
|
||||
#define INTERLACE_DISABLE 0x00
|
||||
|
||||
/* Miscellaneous Output Register
|
||||
*/
|
||||
#define MSR_R 0x3CC /* p207 */
|
||||
#define MSR_W 0x3C2 /* p207 */
|
||||
#define IO_ADDR_SELECT 0x01
|
||||
|
||||
#define MDA_BASE 0x3B0 /* p207 */
|
||||
#define CGA_BASE 0x3D0 /* p207 */
|
||||
|
||||
/* CR80 - IO Control, p264
|
||||
*/
|
||||
#define IO_CTNL 0x80
|
||||
#define EXTENDED_ATTR_CNTL 0x02
|
||||
#define EXTENDED_CRTC_CNTL 0x01
|
||||
|
||||
/* GR10 - Address mapping, p221
|
||||
*/
|
||||
#define ADDRESS_MAPPING 0x10
|
||||
#define PAGE_TO_LOCAL_MEM_ENABLE 0x10
|
||||
#define GTT_MEM_MAP_ENABLE 0x08
|
||||
#define PACKED_MODE_ENABLE 0x04
|
||||
#define LINEAR_MODE_ENABLE 0x02
|
||||
#define PAGE_MAPPING_ENABLE 0x01
|
||||
|
||||
/* Blitter control, p378
|
||||
*/
|
||||
#define BITBLT_CNTL 0x7000c
|
||||
#define COLEXP_MODE 0x30
|
||||
#define COLEXP_8BPP 0x00
|
||||
#define COLEXP_16BPP 0x10
|
||||
#define COLEXP_24BPP 0x20
|
||||
#define COLEXP_RESERVED 0x30
|
||||
#define BITBLT_STATUS 0x01
|
||||
|
||||
/* p375.
|
||||
*/
|
||||
#define DISPLAY_CNTL 0x70008
|
||||
#define VGA_WRAP_MODE 0x02
|
||||
#define VGA_WRAP_AT_256KB 0x00
|
||||
#define VGA_NO_WRAP 0x02
|
||||
#define GUI_MODE 0x01
|
||||
#define STANDARD_VGA_MODE 0x00
|
||||
#define HIRES_MODE 0x01
|
||||
|
||||
/* p375
|
||||
*/
|
||||
#define PIXPIPE_CONFIG_0 0x70009
|
||||
#define DAC_8_BIT 0x80
|
||||
#define DAC_6_BIT 0x00
|
||||
#define HW_CURSOR_ENABLE 0x10
|
||||
#define EXTENDED_PALETTE 0x01
|
||||
|
||||
/* p375
|
||||
*/
|
||||
#define PIXPIPE_CONFIG_1 0x7000a
|
||||
#define DISPLAY_COLOR_MODE 0x0F
|
||||
#define DISPLAY_VGA_MODE 0x00
|
||||
#define DISPLAY_8BPP_MODE 0x02
|
||||
#define DISPLAY_15BPP_MODE 0x04
|
||||
#define DISPLAY_16BPP_MODE 0x05
|
||||
#define DISPLAY_24BPP_MODE 0x06
|
||||
#define DISPLAY_32BPP_MODE 0x07
|
||||
|
||||
/* p375
|
||||
*/
|
||||
#define PIXPIPE_CONFIG_2 0x7000b
|
||||
#define DISPLAY_GAMMA_ENABLE 0x08
|
||||
#define DISPLAY_GAMMA_DISABLE 0x00
|
||||
#define OVERLAY_GAMMA_ENABLE 0x04
|
||||
#define OVERLAY_GAMMA_DISABLE 0x00
|
||||
|
||||
|
||||
/* p380
|
||||
*/
|
||||
#define DISPLAY_BASE 0x70020
|
||||
#define DISPLAY_BASE_MASK 0x03fffffc
|
||||
|
||||
|
||||
/* Cursor control registers, pp383-384
|
||||
*/
|
||||
#define CURSOR_CONTROL 0x70080
|
||||
#define CURSOR_ORIGIN_SCREEN 0x00
|
||||
#define CURSOR_ORIGIN_DISPLAY 0x10
|
||||
#define CURSOR_MODE 0x07
|
||||
#define CURSOR_MODE_DISABLE 0x00
|
||||
#define CURSOR_MODE_32_4C_AX 0x01
|
||||
#define CURSOR_MODE_64_3C 0x04
|
||||
#define CURSOR_MODE_64_4C_AX 0x05
|
||||
#define CURSOR_MODE_64_4C 0x06
|
||||
#define CURSOR_MODE_RESERVED 0x07
|
||||
#define CURSOR_BASEADDR 0x70084
|
||||
#define CURSOR_BASEADDR_MASK 0x1FFFFF00
|
||||
#define CURSOR_X_LO 0x70088
|
||||
#define CURSOR_X_HI 0x70089
|
||||
#define CURSOR_X_POS 0x00
|
||||
#define CURSOR_X_NEG 0x80
|
||||
#define CURSOR_Y_LO 0x7008A
|
||||
#define CURSOR_Y_HI 0x7008B
|
||||
#define CURSOR_Y_POS 0x00
|
||||
#define CURSOR_Y_NEG 0x80
|
||||
|
||||
|
||||
|
||||
/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
|
||||
* not sure they refer to local (graphics) memory.
|
||||
*
|
||||
* These details are for the local memory control registers,
|
||||
* (pp301-310). The test machines are not equiped with local memory,
|
||||
* so nothing is tested. Only a single row seems to be supported.
|
||||
*/
|
||||
#define DRAM_ROW_TYPE 0x3000
|
||||
#define DRAM_ROW_0 0x01
|
||||
#define DRAM_ROW_0_SDRAM 0x01
|
||||
#define DRAM_ROW_0_EMPTY 0x00
|
||||
#define DRAM_ROW_CNTL_LO 0x3001
|
||||
#define DRAM_PAGE_MODE_CTRL 0x10
|
||||
#define DRAM_RAS_TO_CAS_OVRIDE 0x08
|
||||
#define DRAM_CAS_LATENCY 0x04
|
||||
#define DRAM_RAS_TIMING 0x02
|
||||
#define DRAM_RAS_PRECHARGE 0x01
|
||||
#define DRAM_ROW_CNTL_HI 0x3002
|
||||
#define DRAM_REFRESH_RATE 0x18
|
||||
#define DRAM_REFRESH_DISABLE 0x00
|
||||
#define DRAM_REFRESH_60HZ 0x08
|
||||
#define DRAM_REFRESH_FAST_TEST 0x10
|
||||
#define DRAM_REFRESH_RESERVED 0x18
|
||||
#define DRAM_SMS 0x07
|
||||
#define DRAM_SMS_NORMAL 0x00
|
||||
#define DRAM_SMS_NOP_ENABLE 0x01
|
||||
#define DRAM_SMS_ABPCE 0x02
|
||||
#define DRAM_SMS_MRCE 0x03
|
||||
#define DRAM_SMS_CBRCE 0x04
|
||||
|
||||
/* p307
|
||||
*/
|
||||
#define DPMS_SYNC_SELECT 0x5002
|
||||
#define VSYNC_CNTL 0x08
|
||||
#define VSYNC_ON 0x00
|
||||
#define VSYNC_OFF 0x08
|
||||
#define HSYNC_CNTL 0x02
|
||||
#define HSYNC_ON 0x00
|
||||
#define HSYNC_OFF 0x02
|
||||
|
||||
|
||||
|
||||
/* p317, 319
|
||||
*/
|
||||
#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
|
||||
#define VCLK2_VCO_N 0x600a
|
||||
#define VCLK2_VCO_DIV_SEL 0x6012
|
||||
#define POST_DIV_SELECT 0x70
|
||||
#define POST_DIV_1 0x00
|
||||
#define POST_DIV_2 0x10
|
||||
#define POST_DIV_4 0x20
|
||||
#define POST_DIV_8 0x30
|
||||
#define POST_DIV_16 0x40
|
||||
#define POST_DIV_32 0x50
|
||||
#define VCO_LOOP_DIV_BY_4M 0x00
|
||||
#define VCO_LOOP_DIV_BY_16M 0x04
|
||||
|
||||
|
||||
/* Instruction Parser Mode Register
|
||||
* - p281
|
||||
* - 2 new bits.
|
||||
*/
|
||||
#define INST_PM 0x20c0
|
||||
#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
|
||||
#define SYNC_PACKET_FLUSH_ENABLE 0x10
|
||||
#define TWO_D_INST_DISABLE 0x08
|
||||
#define THREE_D_INST_DISABLE 0x04
|
||||
#define STATE_VAR_UPDATE_DISABLE 0x02
|
||||
#define PAL_STIP_DISABLE 0x01
|
||||
|
||||
#define INST_DONE 0x2090
|
||||
#define INST_PS 0x20c4
|
||||
|
||||
#define MEMMODE 0x20dc
|
||||
|
||||
|
||||
/* Instruction parser error register. p279
|
||||
*/
|
||||
#define IPEIR 0x2088
|
||||
#define IPEHR 0x208C
|
||||
|
||||
|
||||
/* General error reporting regs, p296
|
||||
*/
|
||||
#define EIR 0x20B0
|
||||
#define EMR 0x20B4
|
||||
#define ESR 0x20B8
|
||||
#define IP_ERR 0x0001
|
||||
#define ERROR_RESERVED 0xffc6
|
||||
|
||||
|
||||
/* Interrupt Control Registers
|
||||
* - new bits for i810
|
||||
* - new register hwstam (mask)
|
||||
*/
|
||||
#define HWSTAM 0x2098 /* p290 */
|
||||
#define IER 0x20a0 /* p291 */
|
||||
#define IIR 0x20a4 /* p292 */
|
||||
#define IMR 0x20a8 /* p293 */
|
||||
#define ISR 0x20ac /* p294 */
|
||||
#define HW_ERROR 0x8000
|
||||
#define SYNC_STATUS_TOGGLE 0x1000
|
||||
#define DPY_0_FLIP_PENDING 0x0800
|
||||
#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
|
||||
#define OVL_0_FLIP_PENDING 0x0200
|
||||
#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
|
||||
#define DPY_0_VBLANK 0x0080
|
||||
#define DPY_0_EVENT 0x0040
|
||||
#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
|
||||
#define DPY_1_EVENT 0x0010 /* not implemented on i810 */
|
||||
#define HOST_PORT_EVENT 0x0008 /* */
|
||||
#define CAPTURE_EVENT 0x0004 /* */
|
||||
#define USER_DEFINED 0x0002
|
||||
#define BREAKPOINT 0x0001
|
||||
|
||||
|
||||
#define INTR_RESERVED (0x6000 | \
|
||||
DPY_1_FLIP_PENDING | \
|
||||
OVL_1_FLIP_PENDING | \
|
||||
DPY_1_VBLANK | \
|
||||
DPY_1_EVENT | \
|
||||
HOST_PORT_EVENT | \
|
||||
CAPTURE_EVENT )
|
||||
|
||||
/* FIFO Watermark and Burst Length Control Register
|
||||
*
|
||||
* - different offset and contents on i810 (p299) (fewer bits per field)
|
||||
* - some overlay fields added
|
||||
* - what does it all mean?
|
||||
*/
|
||||
#define FWATER_BLC 0x20d8
|
||||
#define MM_BURST_LENGTH 0x00700000
|
||||
#define MM_FIFO_WATERMARK 0x0001F000
|
||||
#define LM_BURST_LENGTH 0x00000700
|
||||
#define LM_FIFO_WATERMARK 0x0000001F
|
||||
|
||||
|
||||
/* Fence/Tiling ranges [0..7]
|
||||
*/
|
||||
#define FENCE 0x2000
|
||||
#define FENCE_NR 8
|
||||
|
||||
#define FENCE_START_MASK 0x03F80000
|
||||
#define FENCE_X_MAJOR 0x00000000
|
||||
#define FENCE_Y_MAJOR 0x00001000
|
||||
#define FENCE_SIZE_MASK 0x00000700
|
||||
#define FENCE_SIZE_512K 0x00000000
|
||||
#define FENCE_SIZE_1M 0x00000100
|
||||
#define FENCE_SIZE_2M 0x00000200
|
||||
#define FENCE_SIZE_4M 0x00000300
|
||||
#define FENCE_SIZE_8M 0x00000400
|
||||
#define FENCE_SIZE_16M 0x00000500
|
||||
#define FENCE_SIZE_32M 0x00000600
|
||||
#define FENCE_PITCH_MASK 0x00000070
|
||||
#define FENCE_PITCH_1 0x00000000
|
||||
#define FENCE_PITCH_2 0x00000010
|
||||
#define FENCE_PITCH_4 0x00000020
|
||||
#define FENCE_PITCH_8 0x00000030
|
||||
#define FENCE_PITCH_16 0x00000040
|
||||
#define FENCE_PITCH_32 0x00000050
|
||||
#define FENCE_VALID 0x00000001
|
||||
|
||||
|
||||
/* Registers to control page table, p274
|
||||
*/
|
||||
#define PGETBL_CTL 0x2020
|
||||
#define PGETBL_ADDR_MASK 0xFFFFF000
|
||||
#define PGETBL_ENABLE_MASK 0x00000001
|
||||
#define PGETBL_ENABLED 0x00000001
|
||||
|
||||
/* Register containing pge table error results, p276
|
||||
*/
|
||||
#define PGE_ERR 0x2024
|
||||
#define PGE_ERR_ADDR_MASK 0xFFFFF000
|
||||
#define PGE_ERR_ID_MASK 0x00000038
|
||||
#define PGE_ERR_CAPTURE 0x00000000
|
||||
#define PGE_ERR_OVERLAY 0x00000008
|
||||
#define PGE_ERR_DISPLAY 0x00000010
|
||||
#define PGE_ERR_HOST 0x00000018
|
||||
#define PGE_ERR_RENDER 0x00000020
|
||||
#define PGE_ERR_BLITTER 0x00000028
|
||||
#define PGE_ERR_MAPPING 0x00000030
|
||||
#define PGE_ERR_CMD_PARSER 0x00000038
|
||||
#define PGE_ERR_TYPE_MASK 0x00000007
|
||||
#define PGE_ERR_INV_TABLE 0x00000000
|
||||
#define PGE_ERR_INV_PTE 0x00000001
|
||||
#define PGE_ERR_MIXED_TYPES 0x00000002
|
||||
#define PGE_ERR_PAGE_MISS 0x00000003
|
||||
#define PGE_ERR_ILLEGAL_TRX 0x00000004
|
||||
#define PGE_ERR_LOCAL_MEM 0x00000005
|
||||
#define PGE_ERR_TILED 0x00000006
|
||||
|
||||
|
||||
|
||||
/* Page table entries loaded via mmio region, p323
|
||||
*/
|
||||
#define PTE_BASE 0x10000
|
||||
#define PTE_ADDR_MASK 0x3FFFF000
|
||||
#define PTE_TYPE_MASK 0x00000006
|
||||
#define PTE_LOCAL 0x00000002
|
||||
#define PTE_MAIN_UNCACHED 0x00000000
|
||||
#define PTE_MAIN_CACHED 0x00000006
|
||||
#define PTE_VALID_MASK 0x00000001
|
||||
#define PTE_VALID 0x00000001
|
||||
|
||||
|
||||
/* Ring buffer registers, p277, overview p19
|
||||
*/
|
||||
#define LP_RING 0x2030
|
||||
#define HP_RING 0x2040
|
||||
|
||||
#define RING_TAIL 0x00
|
||||
#define TAIL_ADDR 0x000FFFF8
|
||||
|
||||
#define RING_HEAD 0x04
|
||||
#define HEAD_WRAP_COUNT 0xFFE00000
|
||||
#define HEAD_WRAP_ONE 0x00200000
|
||||
#define HEAD_ADDR 0x001FFFFC
|
||||
|
||||
#define RING_START 0x08
|
||||
#define START_ADDR 0x00FFFFF8
|
||||
|
||||
#define RING_LEN 0x0C
|
||||
#define RING_NR_PAGES 0x000FF000
|
||||
#define RING_REPORT_MASK 0x00000006
|
||||
#define RING_REPORT_64K 0x00000002
|
||||
#define RING_REPORT_128K 0x00000004
|
||||
#define RING_NO_REPORT 0x00000000
|
||||
#define RING_VALID_MASK 0x00000001
|
||||
#define RING_VALID 0x00000001
|
||||
#define RING_INVALID 0x00000000
|
||||
|
||||
|
||||
|
||||
/* BitBlt Instructions
|
||||
*
|
||||
* There are many more masks & ranges yet to add.
|
||||
*/
|
||||
#define BR00_BITBLT_CLIENT 0x40000000
|
||||
#define BR00_OP_COLOR_BLT 0x10000000
|
||||
#define BR00_OP_SRC_COPY_BLT 0x10C00000
|
||||
#define BR00_OP_FULL_BLT 0x11400000
|
||||
#define BR00_OP_MONO_SRC_BLT 0x11800000
|
||||
#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
|
||||
#define BR00_OP_MONO_PAT_BLT 0x11C00000
|
||||
#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
|
||||
#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
|
||||
|
||||
|
||||
#define BR00_TPCY_DISABLE 0x00000000
|
||||
#define BR00_TPCY_ENABLE 0x00000010
|
||||
|
||||
#define BR00_TPCY_ROP 0x00000000
|
||||
#define BR00_TPCY_NO_ROP 0x00000020
|
||||
#define BR00_TPCY_EQ 0x00000000
|
||||
#define BR00_TPCY_NOT_EQ 0x00000040
|
||||
|
||||
#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
|
||||
|
||||
#define BR00_PAT_VERT_ALIGN 0x000000e0
|
||||
|
||||
#define BR00_LENGTH 0x0000000F
|
||||
|
||||
#define BR09_DEST_ADDR 0x03FFFFFF
|
||||
|
||||
#define BR11_SOURCE_PITCH 0x00003FFF
|
||||
|
||||
#define BR12_SOURCE_ADDR 0x03FFFFFF
|
||||
|
||||
#define BR13_SOLID_PATTERN 0x80000000
|
||||
#define BR13_RIGHT_TO_LEFT 0x40000000
|
||||
#define BR13_LEFT_TO_RIGHT 0x00000000
|
||||
#define BR13_MONO_TRANSPCY 0x20000000
|
||||
#define BR13_USE_DYN_DEPTH 0x04000000
|
||||
#define BR13_DYN_8BPP 0x00000000
|
||||
#define BR13_DYN_16BPP 0x01000000
|
||||
#define BR13_DYN_24BPP 0x02000000
|
||||
#define BR13_ROP_MASK 0x00FF0000
|
||||
#define BR13_DEST_PITCH 0x0000FFFF
|
||||
#define BR13_PITCH_SIGN_BIT 0x00008000
|
||||
|
||||
#define BR14_DEST_HEIGHT 0xFFFF0000
|
||||
#define BR14_DEST_WIDTH 0x0000FFFF
|
||||
|
||||
#define BR15_PATTERN_ADDR 0x03FFFFFF
|
||||
|
||||
#define BR16_SOLID_PAT_COLOR 0x00FFFFFF
|
||||
#define BR16_BACKGND_PAT_CLR 0x00FFFFFF
|
||||
|
||||
#define BR17_FGND_PAT_CLR 0x00FFFFFF
|
||||
|
||||
#define BR18_SRC_BGND_CLR 0x00FFFFFF
|
||||
#define BR19_SRC_FGND_CLR 0x00FFFFFF
|
||||
|
||||
|
||||
/* Instruction parser instructions
|
||||
*/
|
||||
|
||||
#define INST_PARSER_CLIENT 0x00000000
|
||||
#define INST_OP_FLUSH 0x02000000
|
||||
#define INST_FLUSH_MAP_CACHE 0x00000001
|
||||
|
||||
#define INST_DEST_BUFFER_INFO 0x06800000
|
||||
|
||||
#define INST_FRONT_BUFFER_INFO 0x06000000
|
||||
#define FRONT_INFO_ASYNC_FLIP 1<<6
|
||||
#define FRONT_INFO_PITCH_B 8
|
||||
|
||||
#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
|
||||
|
||||
|
||||
/* Registers in the i810 host-pci bridge pci config space which affect
|
||||
* the i810 graphics operations.
|
||||
*/
|
||||
#define SMRAM_MISCC 0x70
|
||||
#define GMS 0x000000c0
|
||||
#define GMS_DISABLE 0x00000000
|
||||
#define GMS_ENABLE_BARE 0x00000040
|
||||
#define GMS_ENABLE_512K 0x00000080
|
||||
#define GMS_ENABLE_1M 0x000000c0
|
||||
#define USMM 0x00000030
|
||||
#define USMM_DISABLE 0x00000000
|
||||
#define USMM_TSEG_ZERO 0x00000010
|
||||
#define USMM_TSEG_512K 0x00000020
|
||||
#define USMM_TSEG_1M 0x00000030
|
||||
#define GFX_MEM_WIN_SIZE 0x00010000
|
||||
#define GFX_MEM_WIN_32M 0x00010000
|
||||
#define GFX_MEM_WIN_64M 0x00000000
|
||||
|
||||
/* Overkill? I don't know. Need to figure out top of mem to make the
|
||||
* SMRAM calculations come out. Linux seems to have problems
|
||||
* detecting it all on its own, so this seems a reasonable double
|
||||
* check to any user supplied 'mem=...' boot param.
|
||||
*
|
||||
* ... unfortunately this reg doesn't work according to spec on the
|
||||
* test hardware.
|
||||
*/
|
||||
#define WHTCFG_PAMR_DRP 0x50
|
||||
#define SYS_DRAM_ROW_0_SHIFT 16
|
||||
#define SYS_DRAM_ROW_1_SHIFT 20
|
||||
#define DRAM_MASK 0x0f
|
||||
#define DRAM_VALUE_0 0
|
||||
#define DRAM_VALUE_1 8
|
||||
/* No 2 value defined */
|
||||
#define DRAM_VALUE_3 16
|
||||
#define DRAM_VALUE_4 16
|
||||
#define DRAM_VALUE_5 24
|
||||
#define DRAM_VALUE_6 32
|
||||
#define DRAM_VALUE_7 32
|
||||
#define DRAM_VALUE_8 48
|
||||
#define DRAM_VALUE_9 64
|
||||
#define DRAM_VALUE_A 64
|
||||
#define DRAM_VALUE_B 96
|
||||
#define DRAM_VALUE_C 128
|
||||
#define DRAM_VALUE_D 128
|
||||
#define DRAM_VALUE_E 192
|
||||
#define DRAM_VALUE_F 256 /* nice one, geezer */
|
||||
#define LM_FREQ_MASK 0x10
|
||||
#define LM_FREQ_133 0x10
|
||||
#define LM_FREQ_100 0x00
|
||||
|
||||
|
||||
|
||||
|
||||
/* These are 3d state registers, but the state is invarient, so we let
|
||||
* the X server handle it:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
|
||||
*/
|
||||
#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
|
||||
#define CC1_UPDATE_KILL_WRITE (1<<28)
|
||||
#define CC1_ENABLE_KILL_WRITE (1<<27)
|
||||
#define CC1_DISABLE_KILL_WRITE 0
|
||||
#define CC1_UPDATE_COLOR_IDX (1<<26)
|
||||
#define CC1_UPDATE_CHROMA_LOW (1<<25)
|
||||
#define CC1_UPDATE_CHROMA_HI (1<<24)
|
||||
#define CC1_CHROMA_LOW_MASK ((1<<24)-1)
|
||||
#define CC2_COLOR_IDX_SHIFT 24
|
||||
#define CC2_COLOR_IDX_MASK (0xff<<24)
|
||||
#define CC2_CHROMA_HI_MASK ((1<<24)-1)
|
||||
|
||||
|
||||
#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
|
||||
#define CS_UPDATE_LOAD (1<<17)
|
||||
#define CS_UPDATE_USE (1<<16)
|
||||
#define CS_UPDATE_LOAD (1<<17)
|
||||
#define CS_LOAD_CTX0 0
|
||||
#define CS_LOAD_CTX1 (1<<8)
|
||||
#define CS_USE_CTX0 0
|
||||
#define CS_USE_CTX1 (1<<0)
|
||||
|
||||
/* 3D Rendering Engine */
|
||||
|
||||
#define RENDER_CLIENT 0x60000000
|
||||
|
||||
/* Primitive rendering instruction */
|
||||
|
||||
#define GFX_PRIMITIVE 0x1f000000
|
||||
#define PRIMITIVE_TRIANGLE 0 << 18
|
||||
#define PRIMITIVE_TRI_STRIP 1 << 18
|
||||
#define PRIMITIVE_TRI_REV_STRIP 2 << 18
|
||||
#define PRIMITIVE_TRI_FAN 3 << 18
|
||||
#define PRIMITIVE_POLYGON 4 << 18
|
||||
#define PRIMITIVE_LINE 5 << 18
|
||||
#define PRIMITIVE_LINE_STRIP 6 << 18
|
||||
#define PRIMITIVE_RECTANGLE 7 << 18
|
||||
|
||||
/* Vertex format instruction */
|
||||
#define GFX_VERTEX_FORMAT 0x05000000
|
||||
#define VERTEX_0_TEXCOORDS 0 << 8
|
||||
#define VERTEX_1_TEXCOORDS 1 << 8
|
||||
#define VERTEX_2_TEXCOORDS 2 << 8
|
||||
#define VERTEX_SPECULAR_FOG 1 << 7
|
||||
#define VERTEX_DIFFUSE_ALPHA 1 << 6
|
||||
#define VERTEX_Z_OFFSET 1 << 5
|
||||
#define VERTEX_POS_XYZ 1 << 1
|
||||
#define VERTEX_POS_XYZ_RHW 2 << 1
|
||||
#define VERTEX_POS_XY 3 << 1
|
||||
#define VERTEX_POS_XY_RHW 4 << 1
|
||||
|
||||
/* Drawing Rectangle Info instruction */
|
||||
|
||||
#define GFX_DRAWING_RECTANGLE_INFO 0x1d800003
|
||||
#define GFX_DRAWING_CLIP_DISABLE 1<<31
|
||||
|
||||
/* Boolean enable 1 */
|
||||
#define GFX_BOOLEAN_ENA_1 0x03000000
|
||||
#define BOOL1_ALPHA_SETUP_MASK 1<<17
|
||||
#define BOOL1_ALPHA_SETUP_BIT 1<<16
|
||||
#define BOOL1_FOG_ENABLE_MASK 1<<7
|
||||
#define BOOL1_FOG_ENABLE_BIT 1<<6
|
||||
#define BOOL1_ALPHA_TEST_MASK 1<<5
|
||||
#define BOOL1_ALPHA_TEST_BIT 1<<4
|
||||
#define BOOL1_BLEND_ENABLE_MASK 1<<3
|
||||
#define BOOL1_BLEND_ENABLE_BIT 1<<2
|
||||
#define BOOL1_Z_ENABLE_MASK 1<<1
|
||||
#define BOOL1_Z_ENABLE_BIT 1<<0
|
||||
|
||||
/* Boolean enable 2 */
|
||||
#define GFX_BOOLEAN_ENA_2 0x04000000
|
||||
#define BOOL2_MAPPING_CACHE_MASK 1<<17
|
||||
#define BOOL2_MAPPING_CACHE_BIT 1<<16
|
||||
#define BOOL2_ALPHA_DITHER_MASK 1<<15
|
||||
#define BOOL2_ALPHA_DITHER_BIT 1<<14
|
||||
#define BOOL2_FOG_DITHER_MASK 1<<13
|
||||
#define BOOL2_FOG_DITHER_BIT 1<<12
|
||||
#define BOOL2_SPECULAR_DITHER_MASK 1<<11
|
||||
#define BOOL2_SPECULAR_DITHER_BIT 1<<10
|
||||
#define BOOL2_COLOR_DITHER_MASK 1<<9
|
||||
#define BOOL2_COLOR_DITHER_BIT 1<<8
|
||||
#define BOOL2_FB_WRITE_MASK 1<<3
|
||||
#define BOOL2_FB_WRITE_BIT 1<<2
|
||||
#define BOOL2_Z_WRITE_MASK 1<<1
|
||||
#define BOOL2_Z_WRITE_BIT 1<<0
|
||||
|
||||
/* Dest buffer variables */
|
||||
|
||||
#define GFX_DEST_BUFFER_VARIABLES 0x1d850000
|
||||
|
||||
#define DEST_BUF_VAR_8BIT 0 << 8
|
||||
#define DEST_BUF_VAR_555 1 << 8
|
||||
#define DEST_BUF_VAR_565 2 << 8
|
||||
|
||||
/* map color blend stages */
|
||||
|
||||
#define GFX_MAP_COLOR_BLEND_STAGES 0
|
||||
|
||||
#define MAP_BLEND_STAGE_B 20
|
||||
#define MAP_BLEND_ACC_SEL_MASK 1<<19
|
||||
#define MAP_BLEND_ACC_SEL_BIT 1<<18
|
||||
#define MAP_BLEND_ARG1_MASK 1<<17
|
||||
#define MAP_BLEND_ARG1_B 14
|
||||
#define MAP_BLEND_REPLICATE_ARG1 1<<13
|
||||
#define MAP_BLEND_INVERT_ARG1 1<<12
|
||||
|
||||
#define MAP_BLEND_ARG2_MASK 1<<11
|
||||
#define MAP_BLEND_ARG2_B 8
|
||||
#define MAP_BLEND_REPLICATE_ARG2 1<<7
|
||||
#define MAP_BLEND_INVERT_ARG2 1<<6
|
||||
|
||||
#define MAP_BLEND_COLOR_OP_MASK 1<<5
|
||||
#define MAP_BLEND_COLOR_OP_B 0
|
||||
|
||||
#define GFX_SCISSOR_ENABLE 0x1c800000
|
||||
|
||||
#define SCISSOR_ENABLE_MASK 1<<1
|
||||
#define SCISSOR_ENABLE_BIT 1<<0
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,606 +0,0 @@
|
|||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/* Hardware accelerated drawing for KDrive i810 driver.
|
||||
Author: Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "kdrive.h"
|
||||
#ifdef XV
|
||||
#include "kxv.h"
|
||||
#endif
|
||||
#include "i810.h"
|
||||
#include "i810_reg.h"
|
||||
|
||||
//#include "Xmd.h"
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "mistruct.h"
|
||||
#include "fontstruct.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "fb.h"
|
||||
#include "migc.h"
|
||||
#include "miline.h"
|
||||
#include "picturestr.h"
|
||||
|
||||
#define NUM_STACK_RECTS 1024
|
||||
|
||||
void
|
||||
i810Sync( KdScreenInfo *screen );
|
||||
int
|
||||
i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis );
|
||||
|
||||
void
|
||||
i810EmitInvarientState(KdScreenInfo *screen)
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
BEGIN_LP_RING( 10 );
|
||||
|
||||
OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
|
||||
OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 );
|
||||
OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
|
||||
OUT_RING( 0 );
|
||||
|
||||
|
||||
OUT_RING( GFX_OP_COLOR_CHROMA_KEY );
|
||||
OUT_RING( CC1_UPDATE_KILL_WRITE |
|
||||
CC1_DISABLE_KILL_WRITE |
|
||||
CC1_UPDATE_COLOR_IDX |
|
||||
CC1_UPDATE_CHROMA_LOW |
|
||||
CC1_UPDATE_CHROMA_HI |
|
||||
0);
|
||||
OUT_RING( 0 );
|
||||
OUT_RING( 0 );
|
||||
|
||||
/* No depth buffer in KDrive yet */
|
||||
/* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */
|
||||
/* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */
|
||||
|
||||
ADVANCE_LP_RING();
|
||||
}
|
||||
|
||||
static unsigned int i810PatternRop[16] = {
|
||||
0x00, /* GXclear */
|
||||
0xA0, /* GXand */
|
||||
0x50, /* GXandReverse */
|
||||
0xF0, /* GXcopy */
|
||||
0x0A, /* GXandInvert */
|
||||
0xAA, /* GXnoop */
|
||||
0x5A, /* GXxor */
|
||||
0xFA, /* GXor */
|
||||
0x05, /* GXnor */
|
||||
0xA5, /* GXequiv */
|
||||
0x55, /* GXinvert */
|
||||
0xF5, /* GXorReverse */
|
||||
0x0F, /* GXcopyInvert */
|
||||
0xAF, /* GXorInverted */
|
||||
0x5F, /* GXnand */
|
||||
0xFF /* GXset */
|
||||
};
|
||||
|
||||
void
|
||||
i810SetupForSolidFill(KdScreenInfo *screen, int color, int rop,
|
||||
unsigned int planemask)
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
|
||||
ErrorF( "i810SetupForFillRectSolid color: %x rop: %x mask: %x\n",
|
||||
color, rop, planemask);
|
||||
|
||||
/* Color blit, p166 */
|
||||
i810c->BR[13] = (BR13_SOLID_PATTERN |
|
||||
(i810PatternRop[rop] << 16) |
|
||||
(screen->width * i810c->cpp));
|
||||
i810c->BR[16] = color;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
i810SubsequentSolidFillRect(KdScreenInfo *screen, int x, int y, int w, int h)
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
|
||||
ErrorF( "i810SubsequentFillRectSolid %d,%d %dx%d\n",
|
||||
x,y,w,h);
|
||||
|
||||
{
|
||||
BEGIN_LP_RING(6);
|
||||
|
||||
OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 );
|
||||
OUT_RING( i810c->BR[13] );
|
||||
OUT_RING( (h << 16) | (w * i810c->cpp));
|
||||
OUT_RING( i810c->bufferOffset +
|
||||
(y * screen->width + x) * i810c->cpp);
|
||||
|
||||
OUT_RING( i810c->BR[16]);
|
||||
OUT_RING( 0 ); /* pad to quadword */
|
||||
|
||||
ADVANCE_LP_RING();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
i810FillOk (GCPtr pGC)
|
||||
{
|
||||
FbBits depthMask;
|
||||
|
||||
switch (pGC->fillStyle) {
|
||||
case FillSolid:
|
||||
return TRUE;
|
||||
/* More cases later... */
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox,
|
||||
unsigned long pixel, int alu, unsigned long planemask)
|
||||
{
|
||||
i810SetupForSolidFill(screen, pixel, alu, planemask);
|
||||
while (nBox--)
|
||||
{
|
||||
i810SubsequentSolidFillRect(screen, pBox->x1, pBox->y1,
|
||||
pBox->x2-pBox->x1, pBox->y2-pBox->y1);
|
||||
pBox++;
|
||||
}
|
||||
KdMarkSync(screen->pScreen);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
i810PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
|
||||
int nrectFill, xRectangle *prectInit)
|
||||
{
|
||||
|
||||
|
||||
xRectangle *prect;
|
||||
RegionPtr prgnClip;
|
||||
register BoxPtr pbox;
|
||||
register BoxPtr pboxClipped;
|
||||
BoxPtr pboxClippedBase;
|
||||
BoxPtr pextent;
|
||||
BoxRec stackRects[NUM_STACK_RECTS];
|
||||
FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
|
||||
int numRects;
|
||||
int n;
|
||||
int xorg, yorg;
|
||||
int x, y;
|
||||
KdScreenPriv(pDrawable->pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
if (!i810FillOk (pGC))
|
||||
{
|
||||
KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit);
|
||||
return;
|
||||
}
|
||||
prgnClip = fbGetCompositeClip(pGC);
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
|
||||
if (xorg || yorg)
|
||||
{
|
||||
prect = prectInit;
|
||||
n = nrectFill;
|
||||
while(n--)
|
||||
{
|
||||
prect->x += xorg;
|
||||
prect->y += yorg;
|
||||
prect++;
|
||||
}
|
||||
}
|
||||
|
||||
prect = prectInit;
|
||||
|
||||
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
|
||||
if (numRects > NUM_STACK_RECTS)
|
||||
{
|
||||
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
|
||||
if (!pboxClippedBase)
|
||||
return;
|
||||
}
|
||||
else
|
||||
pboxClippedBase = stackRects;
|
||||
|
||||
pboxClipped = pboxClippedBase;
|
||||
|
||||
if (REGION_NUM_RECTS(prgnClip) == 1)
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_RECTS(prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
if ((pboxClipped->x1 = prect->x) < x1)
|
||||
pboxClipped->x1 = x1;
|
||||
|
||||
if ((pboxClipped->y1 = prect->y) < y1)
|
||||
pboxClipped->y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
pboxClipped->x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
pboxClipped->y2 = by2;
|
||||
|
||||
prect++;
|
||||
if ((pboxClipped->x1 < pboxClipped->x2) &&
|
||||
(pboxClipped->y1 < pboxClipped->y2))
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
if ((box.x1 = prect->x) < x1)
|
||||
box.x1 = x1;
|
||||
|
||||
if ((box.y1 = prect->y) < y1)
|
||||
box.y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
box.x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
box.y2 = by2;
|
||||
|
||||
prect++;
|
||||
|
||||
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
|
||||
continue;
|
||||
|
||||
n = REGION_NUM_RECTS (prgnClip);
|
||||
pbox = REGION_RECTS(prgnClip);
|
||||
|
||||
/* clip the rectangle to each box in the clip region
|
||||
this is logically equivalent to calling Intersect()
|
||||
*/
|
||||
while(n--)
|
||||
{
|
||||
pboxClipped->x1 = max(box.x1, pbox->x1);
|
||||
pboxClipped->y1 = max(box.y1, pbox->y1);
|
||||
pboxClipped->x2 = min(box.x2, pbox->x2);
|
||||
pboxClipped->y2 = min(box.y2, pbox->y2);
|
||||
pbox++;
|
||||
|
||||
/* see if clipping left anything */
|
||||
if(pboxClipped->x1 < pboxClipped->x2 &&
|
||||
pboxClipped->y1 < pboxClipped->y2)
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pboxClipped != pboxClippedBase)
|
||||
{
|
||||
switch (pGC->fillStyle) {
|
||||
case FillSolid:
|
||||
i810FillBoxSolid(screen,
|
||||
pboxClipped-pboxClippedBase, pboxClippedBase,
|
||||
pGC->fgPixel, pGC->alu, pGC->planemask);
|
||||
break;
|
||||
/* More cases later... */
|
||||
}
|
||||
}
|
||||
if (pboxClippedBase != stackRects)
|
||||
xfree(pboxClippedBase);
|
||||
}
|
||||
|
||||
void
|
||||
i810RefreshRing(KdScreenInfo *screen)
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
|
||||
i810c->LpRing.tail = INREG(LP_RING + RING_TAIL);
|
||||
i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8);
|
||||
if (i810c->LpRing.space < 0)
|
||||
i810c->LpRing.space += i810c->LpRing.mem.Size;
|
||||
|
||||
i810c->NeedToSync = TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis )
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
I810RingBuffer *ring = &(i810c->LpRing);
|
||||
int iters = 0;
|
||||
int start = 0;
|
||||
int now = 0;
|
||||
int last_head = 0;
|
||||
int first = 0;
|
||||
|
||||
/* If your system hasn't moved the head pointer in 2 seconds, I'm going to
|
||||
* call it crashed.
|
||||
*/
|
||||
if (timeout_millis == 0)
|
||||
timeout_millis = 2000;
|
||||
|
||||
if (I810_DEBUG) {
|
||||
fprintf(stderr, "i810WaitLpRing %d\n", n);
|
||||
first = GetTimeInMillis();
|
||||
}
|
||||
|
||||
while (ring->space < n)
|
||||
{
|
||||
int i;
|
||||
|
||||
ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
|
||||
ring->space = ring->head - (ring->tail+8);
|
||||
|
||||
if (ring->space < 0)
|
||||
ring->space += ring->mem.Size;
|
||||
|
||||
iters++;
|
||||
now = GetTimeInMillis();
|
||||
if ( start == 0 || now < start || ring->head != last_head) {
|
||||
if (I810_DEBUG)
|
||||
if (now > start)
|
||||
fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
|
||||
start = now;
|
||||
last_head = ring->head;
|
||||
} else if ( now - start > timeout_millis ) {
|
||||
|
||||
i810PrintErrorState( screen->card );
|
||||
fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
|
||||
FatalError("lockup\n");
|
||||
}
|
||||
|
||||
for (i = 0 ; i < 2000 ; i++)
|
||||
;
|
||||
}
|
||||
|
||||
if (I810_DEBUG)
|
||||
{
|
||||
now = GetTimeInMillis();
|
||||
if (now - first) {
|
||||
fprintf(stderr,"Elapsed %d ms\n", now - first);
|
||||
fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
|
||||
}
|
||||
}
|
||||
|
||||
return iters;
|
||||
}
|
||||
|
||||
void
|
||||
i810Sync( KdScreenInfo *screen )
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = card->driver;
|
||||
|
||||
if (I810_DEBUG)
|
||||
fprintf(stderr, "i810Sync\n");
|
||||
|
||||
/* Send a flush instruction and then wait till the ring is empty.
|
||||
* This is stronger than waiting for the blitter to finish as it also
|
||||
* flushes the internal graphics caches.
|
||||
*/
|
||||
{
|
||||
BEGIN_LP_RING(2);
|
||||
OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
|
||||
OUT_RING( 0 ); /* pad to quadword */
|
||||
ADVANCE_LP_RING();
|
||||
}
|
||||
|
||||
i810WaitLpRing(screen, i810c->LpRing.mem.Size - 8, 0 );
|
||||
|
||||
i810c->LpRing.space = i810c->LpRing.mem.Size - 8;
|
||||
i810c->nextColorExpandBuf = 0;
|
||||
}
|
||||
|
||||
static const GCOps i810Ops = {
|
||||
KdCheckFillSpans,
|
||||
KdCheckSetSpans,
|
||||
KdCheckPutImage,
|
||||
KdCheckCopyArea,
|
||||
KdCheckCopyPlane,
|
||||
KdCheckPolyPoint,
|
||||
KdCheckPolylines,
|
||||
KdCheckPolySegment,
|
||||
miPolyRectangle,
|
||||
KdCheckPolyArc,
|
||||
miFillPolygon,
|
||||
i810PolyFillRect,
|
||||
miPolyFillArc,
|
||||
miPolyText8,
|
||||
miPolyText16,
|
||||
miImageText8,
|
||||
miImageText16,
|
||||
KdCheckImageGlyphBlt,
|
||||
KdCheckPolyGlyphBlt,
|
||||
KdCheckPushPixels,
|
||||
#ifdef NEED_LINEHELPER
|
||||
,NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
i810ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
|
||||
{
|
||||
FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
|
||||
|
||||
fbValidateGC (pGC, changes, pDrawable);
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
pGC->ops = (GCOps *) &i810Ops;
|
||||
else
|
||||
pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
|
||||
}
|
||||
|
||||
GCFuncs i810GCFuncs = {
|
||||
i810ValidateGC,
|
||||
miChangeGC,
|
||||
miCopyGC,
|
||||
miDestroyGC,
|
||||
miChangeClip,
|
||||
miDestroyClip,
|
||||
miCopyClip
|
||||
};
|
||||
|
||||
int
|
||||
i810CreateGC (GCPtr pGC)
|
||||
{
|
||||
if (!fbCreateGC (pGC))
|
||||
return FALSE;
|
||||
|
||||
if (pGC->depth != 1)
|
||||
pGC->funcs = &i810GCFuncs;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
i810SetRingRegs( KdScreenInfo *screen ) {
|
||||
unsigned int itemp;
|
||||
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
OUTREG(LP_RING + RING_TAIL, 0 );
|
||||
OUTREG(LP_RING + RING_HEAD, 0 );
|
||||
|
||||
itemp = INREG(LP_RING + RING_START);
|
||||
itemp &= ~(START_ADDR);
|
||||
itemp |= i810c->LpRing.mem.Start;
|
||||
OUTREG(LP_RING + RING_START, itemp );
|
||||
|
||||
itemp = INREG(LP_RING + RING_LEN);
|
||||
itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK);
|
||||
itemp |= ((i810c->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID);
|
||||
OUTREG(LP_RING + RING_LEN, itemp );
|
||||
}
|
||||
|
||||
Bool
|
||||
i810InitAccel(ScreenPtr pScreen)
|
||||
{
|
||||
|
||||
/* fprintf(stderr,"i810InitAccel\n"); */
|
||||
|
||||
/*
|
||||
* Hook up asynchronous drawing
|
||||
*/
|
||||
KdScreenInitAsync (pScreen);
|
||||
/*
|
||||
* Replace various fb screen functions
|
||||
*/
|
||||
pScreen->CreateGC = i810CreateGC;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
i810EnableAccel(ScreenPtr pScreen)
|
||||
{
|
||||
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
KdCardInfo *card = screen->card;
|
||||
I810CardInfo *i810c = (I810CardInfo *) card->driver;
|
||||
|
||||
/* fprintf(stderr,"i810EnableAccel\n"); */
|
||||
|
||||
if (i810c->LpRing.mem.Size == 0) {
|
||||
ErrorF("No memory for LpRing!! Acceleration not functional!!\n");
|
||||
}
|
||||
|
||||
i810SetRingRegs( screen );
|
||||
|
||||
KdMarkSync (pScreen);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
i810SyncAccel(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
i810Sync(screen);
|
||||
}
|
||||
|
||||
void
|
||||
i810DisableAccel(ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
/* fprintf(stderr,"i810DisableAccel\n"); */
|
||||
i810RefreshRing( screen );
|
||||
i810Sync( screen );
|
||||
}
|
||||
|
||||
void
|
||||
i810FiniAccel(ScreenPtr pScreen)
|
||||
{
|
||||
/* fprintf(stderr,"i810FiniAccel\n"); */
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/* Hardware accelerated drawing for KDrive i810 driver, header file.
|
||||
Author: Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _I810DRAW_H_
|
||||
#define _I810DRAW_H_
|
||||
|
||||
void i810RefreshRing(KdScreenInfo *screen);
|
||||
int i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis );
|
||||
void i810Sync( KdScreenInfo *screen );
|
||||
|
||||
#endif /* _I810DRAW_H_ */
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/* $RCSId: $ */
|
||||
/* COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 2000, 2001 Nokia Home Communications
|
||||
|
||||
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, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
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
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
X Window System is a trademark of The Open Group */
|
||||
|
||||
/* Stub functions for the i810 KDrive driver
|
||||
Author: Pontus Lidman <pontus.lidman@nokia.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "kdrive.h"
|
||||
#include "kxv.h"
|
||||
#include "i810.h"
|
||||
|
||||
static const int i810Cards[]={ PCI_CHIP_I810, PCI_CHIP_I810_DC100, PCI_CHIP_I810_E };
|
||||
|
||||
#define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0]))
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
KdCardAttr attr;
|
||||
int i;
|
||||
|
||||
Bool LinuxFindPci(CARD16, CARD16, CARD32, KdCardAttr *);
|
||||
|
||||
for (i = 0; i < numI810Cards; i++)
|
||||
if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr))
|
||||
KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput (pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput (int argc, char **argv)
|
||||
{
|
||||
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg();
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
int ret;
|
||||
int KdProcessArgument(int, char **, int);
|
||||
|
||||
ret = KdProcessArgument(argc, argv, i);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/igs/Imakefile,v 1.2 2000/05/24 23:52:47 keithp Exp $
|
||||
KDRIVE=..
|
||||
#include "../Kdrive.tmpl"
|
||||
|
||||
SRCS = igs.c igscmap.c igscurs.c igsdraw.c igsreg.c igsstub.c
|
||||
|
||||
OBJS = igs.o igscmap.o igscurs.o igsdraw.o igsreg.o igsstub.o
|
||||
|
||||
INCLUDES = -I. $(KDINCS)
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
NormalLibraryTarget(igs,$(OBJS))
|
||||
DependTarget()
|
||||
|
|
@ -1,669 +0,0 @@
|
|||
/*
|
||||
* $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.c,v 1.2 2000/05/24 23:52:47 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 SuSE, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "igs.h"
|
||||
|
||||
Bool
|
||||
igsCardInit (KdCardInfo *card)
|
||||
{
|
||||
int k;
|
||||
char *pixels;
|
||||
IgsCardInfo *igsc;
|
||||
|
||||
igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo));
|
||||
if (!igsc)
|
||||
return FALSE;
|
||||
|
||||
memset (igsc, '\0', sizeof (IgsCardInfo));
|
||||
|
||||
igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0] +
|
||||
IGS_FB,
|
||||
IGS_MEM);
|
||||
|
||||
igsc->vga = (VOL8 *) KdMapDevice (card->attr.address[0] +
|
||||
IGS_VGA,
|
||||
64 * 1024);
|
||||
|
||||
igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] +
|
||||
IGS_COP_OFFSET,
|
||||
sizeof (Cop5xxx));
|
||||
|
||||
igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] +
|
||||
IGS_COP_DATA,
|
||||
IGS_COP_DATA_LEN);
|
||||
|
||||
igsRegInit (&igsc->igsvga, igsc->vga);
|
||||
|
||||
card->driver = igsc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsModeSupported (KdScreenInfo *screen,
|
||||
const KdMonitorTiming *t)
|
||||
{
|
||||
/* make sure the clock isn't too fast */
|
||||
if (t->clock > IGS_MAX_CLOCK)
|
||||
return FALSE;
|
||||
/* width must be a multiple of 16 */
|
||||
if (t->horizontal & 0xf)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsModeUsable (KdScreenInfo *screen)
|
||||
{
|
||||
KdCardInfo *card = screen->card;
|
||||
int screen_size;
|
||||
int pixel_width;
|
||||
int byte_width;
|
||||
int fb = 0;
|
||||
|
||||
screen_size = 0;
|
||||
if (screen->fb[fb].depth >= 24)
|
||||
{
|
||||
screen->fb[fb].depth = 24;
|
||||
if (screen->fb[fb].bitsPerPixel != 24)
|
||||
screen->fb[fb].bitsPerPixel = 32;
|
||||
}
|
||||
else if (screen->fb[fb].depth >= 16)
|
||||
{
|
||||
screen->fb[fb].depth = 16;
|
||||
screen->fb[fb].bitsPerPixel = 16;
|
||||
}
|
||||
else if (screen->fb[fb].depth >= 15)
|
||||
{
|
||||
screen->fb[fb].depth = 15;
|
||||
screen->fb[fb].bitsPerPixel = 16;
|
||||
}
|
||||
else if (screen->fb[fb].depth >= 12)
|
||||
{
|
||||
screen->fb[fb].depth = 12;
|
||||
screen->fb[fb].bitsPerPixel = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->fb[fb].depth = 8;
|
||||
screen->fb[fb].bitsPerPixel = 8;
|
||||
}
|
||||
|
||||
byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
|
||||
pixel_width = screen->width;
|
||||
screen->fb[fb].pixelStride = pixel_width;
|
||||
screen->fb[fb].byteStride = byte_width;
|
||||
screen_size += byte_width * screen->height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsScreenInit (KdScreenInfo *screen)
|
||||
{
|
||||
IgsCardInfo *igsc = screen->card->driver;
|
||||
int fb = 0;
|
||||
IgsScreenInfo *igss;
|
||||
int screen_size, memory;
|
||||
int pattern_size;
|
||||
int tile_size;
|
||||
int stipple_size;
|
||||
int poffset, boffset;
|
||||
const KdMonitorTiming *t;
|
||||
|
||||
if (!screen->width || !screen->height)
|
||||
{
|
||||
screen->width = 800;
|
||||
screen->height = 600;
|
||||
screen->rate = 72;
|
||||
}
|
||||
if (!screen->fb[0].depth)
|
||||
screen->fb[0].depth = 8;
|
||||
|
||||
t = KdFindMode (screen, igsModeSupported);
|
||||
|
||||
screen->rate = t->rate;
|
||||
screen->width = t->horizontal;
|
||||
screen->height = t->vertical;
|
||||
|
||||
if (!KdTuneMode (screen, igsModeUsable, igsModeSupported))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
igss = (IgsScreenInfo *) xalloc (sizeof (IgsScreenInfo));
|
||||
if (!igss)
|
||||
return FALSE;
|
||||
|
||||
memset (igss, '\0', sizeof (IgsScreenInfo));
|
||||
|
||||
screen_size = screen->fb[fb].byteStride * screen->height;
|
||||
memory = IGS_MEM;
|
||||
memory -= screen_size;
|
||||
if (memory >= 1024)
|
||||
{
|
||||
igss->cursor_offset = memory - 1024;
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
igss->cursor_base = (CARD8 *) KdMapDevice (card->attr.address[0] +
|
||||
igss->cursor_offset,
|
||||
1024);
|
||||
#else
|
||||
igss->cursor_base = igsc->frameBuffer + igss->cursor_offset;
|
||||
#endif
|
||||
memory -= 1024;
|
||||
}
|
||||
else
|
||||
igss->cursor_base = 0;
|
||||
|
||||
tile_size = IgsTileSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN;
|
||||
stipple_size = IgsStippleSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN;
|
||||
pattern_size = tile_size + stipple_size;
|
||||
if (memory >= pattern_size)
|
||||
{
|
||||
boffset = screen_size;
|
||||
poffset = boffset * 8 / screen->fb[fb].bitsPerPixel;
|
||||
igss->tile.offset = poffset;
|
||||
igss->tile.base = igsc->frameBuffer + boffset;
|
||||
|
||||
boffset = screen_size + tile_size;
|
||||
poffset = boffset * 8 / screen->fb[fb].bitsPerPixel;
|
||||
igss->stipple.offset = poffset;
|
||||
igss->stipple.base = igsc->frameBuffer + boffset;
|
||||
|
||||
memory -= pattern_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
igss->tile.base = 0;
|
||||
igss->stipple.base = 0;
|
||||
}
|
||||
|
||||
switch (screen->fb[fb].depth) {
|
||||
case 8:
|
||||
screen->fb[fb].visuals = ((1 << StaticGray) |
|
||||
(1 << GrayScale) |
|
||||
(1 << StaticColor) |
|
||||
(1 << PseudoColor) |
|
||||
(1 << TrueColor) |
|
||||
(1 << DirectColor));
|
||||
screen->fb[fb].blueMask = 0x00;
|
||||
screen->fb[fb].greenMask = 0x00;
|
||||
screen->fb[fb].redMask = 0x00;
|
||||
break;
|
||||
case 15:
|
||||
screen->fb[fb].visuals = (1 << TrueColor);
|
||||
screen->fb[fb].blueMask = 0x001f;
|
||||
screen->fb[fb].greenMask = 0x03e0;
|
||||
screen->fb[fb].redMask = 0x7c00;
|
||||
break;
|
||||
case 16:
|
||||
screen->fb[fb].visuals = (1 << TrueColor);
|
||||
screen->fb[fb].blueMask = 0x001f;
|
||||
screen->fb[fb].greenMask = 0x07e0;
|
||||
screen->fb[fb].redMask = 0xf800;
|
||||
break;
|
||||
case 24:
|
||||
screen->fb[fb].visuals = (1 << TrueColor);
|
||||
screen->fb[fb].blueMask = 0x0000ff;
|
||||
screen->fb[fb].greenMask = 0x00ff00;
|
||||
screen->fb[fb].redMask = 0xff0000;
|
||||
break;
|
||||
}
|
||||
|
||||
screen->fb[fb].pixelStride = screen->width;
|
||||
screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
|
||||
screen->fb[fb].frameBuffer = igsc->frameBuffer;
|
||||
if (!igsc->cop)
|
||||
screen->dumb = TRUE;
|
||||
screen->driver = igss;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsInitScreen(ScreenPtr pScreen)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
igsPreserve (KdCardInfo *card)
|
||||
{
|
||||
IgsCardInfo *igsc = card->driver;
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
igsSave (igsvga);
|
||||
}
|
||||
|
||||
void
|
||||
igsSetBlank (IgsVga *igsvga, Bool blank)
|
||||
{
|
||||
igsSetImm(igsvga, igs_screen_off, blank ? 1 : 0);
|
||||
}
|
||||
|
||||
void
|
||||
igsSetSync (IgsCardInfo *igsc, int hsync, int vsync)
|
||||
{
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
igsSet (igsvga, igs_mexhsyn, hsync);
|
||||
igsSet (igsvga, igs_mexvsyn, vsync);
|
||||
VgaFlush (&igsvga->card);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Clock synthesis:
|
||||
*
|
||||
* scale = p ? (2 * p) : 1
|
||||
* f_out = f_ref * ((M + 1) / ((N + 1) * scale))
|
||||
*
|
||||
* Constraints:
|
||||
*
|
||||
* 1. 115MHz <= f_ref * ((M + 1) / (N + 1)) <= 260 MHz
|
||||
* 2. N >= 1
|
||||
*
|
||||
* Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank))
|
||||
* Horizontal refresh rate = clock / (hsize + hblank)
|
||||
*/
|
||||
|
||||
/* all in kHz */
|
||||
|
||||
void
|
||||
igsGetClock (int target, int *Mp, int *Np, int *Pp, int maxM, int maxN, int maxP, int minVco)
|
||||
{
|
||||
int M, N, P, bestM, bestN;
|
||||
int f_vco, f_out;
|
||||
int err, abserr, besterr;
|
||||
|
||||
/*
|
||||
* Compute correct P value to keep VCO in range
|
||||
*/
|
||||
for (P = 0; P <= maxP; P++)
|
||||
{
|
||||
f_vco = target * IGS_SCALE(P);
|
||||
if (f_vco >= minVco)
|
||||
break;
|
||||
}
|
||||
|
||||
/* M = f_out / f_ref * ((N + 1) * IGS_SCALE(P)); */
|
||||
besterr = target;
|
||||
for (N = 1; N <= maxN; N++)
|
||||
{
|
||||
M = ((target * (N + 1) * IGS_SCALE(P) + (IGS_CLOCK_REF/2)) + IGS_CLOCK_REF/2) / IGS_CLOCK_REF - 1;
|
||||
if (0 <= M && M <= maxM)
|
||||
{
|
||||
f_out = IGS_CLOCK(M,N,P);
|
||||
err = target - f_out;
|
||||
if (err < 0)
|
||||
err = -err;
|
||||
if (err < besterr)
|
||||
{
|
||||
besterr = err;
|
||||
bestM = M;
|
||||
bestN = N;
|
||||
}
|
||||
}
|
||||
}
|
||||
*Mp = bestM;
|
||||
*Np = bestN;
|
||||
*Pp = P;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsEnable (ScreenPtr pScreen)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdCardInfo *card = pScreenPriv->card;
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
IgsCardInfo *igsc = card->driver;
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
const KdMonitorTiming *t;
|
||||
int hactive, hblank, hfp, hbp;
|
||||
int vactive, vblank, vfp, vbp;
|
||||
int hsize;
|
||||
int fb = 0;
|
||||
int m, n, r;
|
||||
int h_total;
|
||||
int h_display_end;
|
||||
int h_blank_start;
|
||||
int h_blank_end;
|
||||
int h_sync_start;
|
||||
int h_sync_end;
|
||||
int h_screen_off;
|
||||
int v_total;
|
||||
int v_retrace_start;
|
||||
int v_retrace_end;
|
||||
int v_display_end;
|
||||
int v_blank_start;
|
||||
int v_blank_end;
|
||||
int offset;
|
||||
int num_fetch;
|
||||
int m_m, m_n, m_r;
|
||||
|
||||
|
||||
igsSetBlank (igsvga, TRUE);
|
||||
|
||||
t = KdFindMode (screen, igsModeSupported);
|
||||
|
||||
igsGetClock (t->clock, &m, &n, &r, 2047, 255, 7, IGS_MIN_VCO);
|
||||
|
||||
/*
|
||||
* Set the chip so that 0x400000 is a big-endian frame buffer
|
||||
* with the correct byte swapping enabled
|
||||
*/
|
||||
igsSet (igsvga, igs_biga22force, 0);
|
||||
igsSet (igsvga, igs_biga22en, 1);
|
||||
igsSet (igsvga, igs_biga24en, 1);
|
||||
/*
|
||||
* Enable 8-bit DACs
|
||||
*/
|
||||
igsSet (igsvga, igs_rampwdn, 0);
|
||||
igsSet (igsvga, igs_dac6_8, 1);
|
||||
igsSet (igsvga, igs_dacpwdn, 0);
|
||||
/*
|
||||
* Set overscan to black
|
||||
*/
|
||||
igsSet (igsvga, igs_overscan_red, 0x00);
|
||||
igsSet (igsvga, igs_overscan_green, 0x00);
|
||||
igsSet (igsvga, igs_overscan_blue, 0x00);
|
||||
/*
|
||||
* Enable PCI retries
|
||||
*/
|
||||
igsSet (igsvga, igs_iow_retry, 1);
|
||||
igsSet (igsvga, igs_mw_retry, 1);
|
||||
igsSet (igsvga, igs_mr_retry, 1);
|
||||
igsSet (igsvga, igs_pci_burst_write, 1);
|
||||
igsSet (igsvga, igs_pci_burst_read, 1);
|
||||
/*
|
||||
* Set FIFO
|
||||
*/
|
||||
igsSet (igsvga, igs_memgopg, 1);
|
||||
igsSet (igsvga, igs_memr2wpg, 0);
|
||||
igsSet (igsvga, igs_crtff16, 0);
|
||||
igsSet (igsvga, igs_fifomust, 0xff);
|
||||
igsSet (igsvga, igs_fifogen, 0xff);
|
||||
/*
|
||||
* Enable CRT reg access
|
||||
*/
|
||||
igsSetImm (igsvga, igs_ena_vr_access, 1);
|
||||
igsSetImm (igsvga, igs_crt_protect, 0);
|
||||
|
||||
hfp = t->hfp;
|
||||
hbp = t->hbp;
|
||||
hblank = t->hblank;
|
||||
hactive = t->horizontal;
|
||||
offset = screen->fb[0].byteStride;
|
||||
|
||||
vfp = t->vfp;
|
||||
vbp = t->vbp;
|
||||
vblank = t->vblank;
|
||||
vactive = t->vertical;
|
||||
|
||||
/*
|
||||
* Compute character lengths for horizontal timing values
|
||||
*/
|
||||
hactive = screen->width / 8;
|
||||
hblank /= 8;
|
||||
hfp /= 8;
|
||||
hbp /= 8;
|
||||
offset /= 8;
|
||||
|
||||
switch (screen->fb[fb].bitsPerPixel) {
|
||||
case 8:
|
||||
igsSet (igsvga, igs_overscan_red, pScreen->blackPixel);
|
||||
igsSet (igsvga, igs_overscan_green, pScreen->blackPixel);
|
||||
igsSet (igsvga, igs_overscan_blue, pScreen->blackPixel);
|
||||
igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8);
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_8);
|
||||
igsSet (igsvga, igs_ramdacbypass, 0);
|
||||
break;
|
||||
case 16:
|
||||
igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_16);
|
||||
igsSet (igsvga, igs_ramdacbypass, 1);
|
||||
switch (screen->fb[fb].depth) {
|
||||
case 12:
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_4444);
|
||||
break;
|
||||
case 15:
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_5551);
|
||||
break;
|
||||
case 16:
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_565);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
igsSet (igsvga, igs_ramdacbypass, 1);
|
||||
igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8);
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_888);
|
||||
break;
|
||||
case 32:
|
||||
igsSet (igsvga, igs_ramdacbypass, 1);
|
||||
igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_32);
|
||||
igsSet (igsvga, igs_mode_sel, IGS_MODE_8888);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute horizontal register values from timings
|
||||
*/
|
||||
h_total = hactive + hblank - 5;
|
||||
h_display_end = hactive - 1;
|
||||
|
||||
h_sync_start = hactive + hfp;
|
||||
h_sync_end = hactive + hblank - hbp;
|
||||
/*
|
||||
* pad the blank values narrow a bit and use the border_select to
|
||||
* eliminate the remaining border; don't know why, but it doesn't
|
||||
* work in the documented fashion
|
||||
*/
|
||||
h_blank_start = hactive - 1;
|
||||
h_blank_end = hactive + hblank - 1 - 1;
|
||||
|
||||
num_fetch = (t->horizontal * screen->fb[fb].bitsPerPixel / 64) + 1;
|
||||
|
||||
v_total = vactive + vblank - 2;
|
||||
v_display_end = vactive - 1;
|
||||
|
||||
v_blank_start = vactive - 1;
|
||||
v_blank_end = v_blank_start + vblank - 1;
|
||||
|
||||
v_retrace_start = vactive + vfp;
|
||||
v_retrace_end = vactive + vblank - vbp;
|
||||
|
||||
#if 0
|
||||
#define chk(a,b,c) fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", a, igsGet(igsvga, b), c);
|
||||
|
||||
chk("h_total", igs_h_total, h_total);
|
||||
chk("h_display_end", igs_h_de_end, h_display_end);
|
||||
chk("h_sync_start", igs_h_rstart, h_sync_start);
|
||||
chk("h_sync_end", igs_h_rend, h_sync_end&0x1f);
|
||||
chk("h_blank_start", igs_h_bstart, h_blank_start);
|
||||
chk("h_blank_end", igs_h_bend, h_blank_end&0x3f);
|
||||
chk("offset", igs_offset, offset);
|
||||
chk("num_fetch", igs_num_fetch, num_fetch);
|
||||
|
||||
chk("v_total", igs_v_total, v_total);
|
||||
chk("v_display_end", igs_v_de_end, v_display_end);
|
||||
chk("v_blank_start", igs_v_bstart, v_blank_start);
|
||||
chk("v_blank_end", igs_v_bend, v_blank_end&0xf);
|
||||
chk("v_retrace_start", igs_v_rstart, v_retrace_start);
|
||||
chk("v_retrace_end", igs_v_rend, v_retrace_end&0xf);
|
||||
chk("vclk_m", igs_vclk_m, m);
|
||||
chk("vclk_n", igs_vclk_n, n);
|
||||
chk("vclk_p", igs_vclk_p, r);
|
||||
|
||||
fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", "vclk",
|
||||
IGS_CLOCK(igsGet(igsvga,igs_vclk_m),
|
||||
igsGet(igsvga,igs_vclk_n),
|
||||
igsGet(igsvga,igs_vclk_p)),
|
||||
IGS_CLOCK(m,n,r));
|
||||
#endif
|
||||
igsSet (igsvga, igs_h_total, h_total);
|
||||
igsSet (igsvga, igs_h_de_end, h_display_end);
|
||||
igsSet (igsvga, igs_h_rstart, h_sync_start);
|
||||
igsSet (igsvga, igs_h_rend, h_sync_end);
|
||||
igsSet (igsvga, igs_h_bstart, h_blank_start);
|
||||
igsSet (igsvga, igs_h_bend, h_blank_end);
|
||||
igsSet (igsvga, igs_offset, offset);
|
||||
igsSet (igsvga, igs_num_fetch, num_fetch);
|
||||
|
||||
igsSet (igsvga, igs_v_total, v_total);
|
||||
igsSet (igsvga, igs_v_de_end, v_display_end);
|
||||
igsSet (igsvga, igs_v_bstart, v_blank_start);
|
||||
igsSet (igsvga, igs_v_bend, v_blank_end&0xf);
|
||||
igsSet (igsvga, igs_v_rstart, v_retrace_start);
|
||||
igsSet (igsvga, igs_v_rend, v_retrace_end&0xf);
|
||||
|
||||
igsSet (igsvga, igs_vclk_m, m);
|
||||
igsSet (igsvga, igs_vclk_n, n);
|
||||
igsSet (igsvga, igs_vclk_p, r);
|
||||
igsSet (igsvga, igs_vfsel, IGS_CLOCK(m, n, 0) >= 180000);
|
||||
VgaFlush (&igsvga->card);
|
||||
|
||||
igsSetImm (igsvga, igs_frqlat, 0);
|
||||
igsSetImm (igsvga, igs_frqlat, 1);
|
||||
igsSetImm (igsvga, igs_frqlat, 0);
|
||||
|
||||
igsSetBlank (igsvga, FALSE);
|
||||
#if 0
|
||||
#define dbg(a,b) fprintf(stderr, "%20.20s = 0x%x\n", a, igsGet(igsvga,b))
|
||||
|
||||
#include "reg.dbg"
|
||||
|
||||
{
|
||||
VGA16 reg;
|
||||
char buf[128];
|
||||
|
||||
for (reg = 0; reg < IGS_NREG; reg++)
|
||||
fprintf(stderr, "%20.20s = 0x%02x\n", igsRegName(buf, reg),
|
||||
VgaFetch (&igsvga->card, reg));
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
igsDPMS (ScreenPtr pScreen, int mode)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
IgsCardInfo *igsc = pScreenPriv->card->driver;
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
switch (mode) {
|
||||
case KD_DPMS_NORMAL:
|
||||
igsSetSync (igsc, 0, 0);
|
||||
igsSetBlank (igsvga, FALSE);
|
||||
break;
|
||||
case KD_DPMS_STANDBY:
|
||||
igsSetBlank (igsvga, TRUE);
|
||||
igsSetSync (igsc, 1, 0);
|
||||
break;
|
||||
case KD_DPMS_SUSPEND:
|
||||
igsSetBlank (igsvga, TRUE);
|
||||
igsSetSync (igsc, 0, 1);
|
||||
break;
|
||||
case KD_DPMS_POWERDOWN:
|
||||
igsSetBlank (igsvga, TRUE);
|
||||
igsSetSync (igsc, 1, 1);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
igsDisable (ScreenPtr pScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
igsRestore (KdCardInfo *card)
|
||||
{
|
||||
IgsCardInfo *igsc = card->driver;
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
igsReset (igsvga);
|
||||
}
|
||||
|
||||
void
|
||||
igsScreenFini (KdScreenInfo *screen)
|
||||
{
|
||||
IgsScreenInfo *igss = (IgsScreenInfo *) screen->driver;
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
if (igss->cursor_base)
|
||||
KdUnmapDevice ((void *) igss->cursor_base, 1024);
|
||||
#endif
|
||||
xfree (igss);
|
||||
screen->driver = 0;
|
||||
}
|
||||
|
||||
void
|
||||
igsCardFini (KdCardInfo *card)
|
||||
{
|
||||
IgsCardInfo *igsc = card->driver;
|
||||
|
||||
if (igsc->copData)
|
||||
KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN);
|
||||
if (igsc->cop)
|
||||
KdUnmapDevice ((void *) igsc->cop, sizeof (Cop5xxx));
|
||||
if (igsc->vga)
|
||||
KdUnmapDevice ((void *) igsc->vga, 64 * 1024);
|
||||
if (igsc->frameBuffer)
|
||||
KdUnmapDevice (igsc->frameBuffer, IGS_MEM);
|
||||
xfree (igsc);
|
||||
card->driver = 0;
|
||||
}
|
||||
|
||||
KdCardFuncs igsFuncs = {
|
||||
igsCardInit, /* cardinit */
|
||||
igsScreenInit, /* scrinit */
|
||||
igsInitScreen,
|
||||
igsPreserve, /* preserve */
|
||||
igsEnable, /* enable */
|
||||
igsDPMS, /* dpms */
|
||||
igsDisable, /* disable */
|
||||
igsRestore, /* restore */
|
||||
igsScreenFini, /* scrfini */
|
||||
igsCardFini, /* cardfini */
|
||||
|
||||
igsCursorInit, /* initCursor */
|
||||
igsCursorEnable, /* enableCursor */
|
||||
igsCursorDisable, /* disableCursor */
|
||||
igsCursorFini, /* finiCursor */
|
||||
0, /* recolorCursor */
|
||||
|
||||
igsDrawInit, /* initAccel */
|
||||
igsDrawEnable, /* enableAccel */
|
||||
igsDrawSync, /* drawSync */
|
||||
igsDrawDisable, /* disableAccel */
|
||||
igsDrawFini, /* finiAccel */
|
||||
|
||||
igsGetColors, /* getColors */
|
||||
igsPutColors, /* putColors */
|
||||
};
|
||||
|
|
@ -1,329 +0,0 @@
|
|||
/*
|
||||
* $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.h,v 1.1 2000/05/06 22:17:43 keithp Exp $
|
||||
*
|
||||
* Copyright © 1999 SuSE, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _IGS_H_
|
||||
#define _IGS_H_
|
||||
|
||||
#include "kdrive.h"
|
||||
#include "igsreg.h"
|
||||
|
||||
extern KdCardFuncs igsFuncs;
|
||||
|
||||
/*
|
||||
* FB 0x00000000
|
||||
* VGA 0x00800000
|
||||
* Blt window 0x008a0000
|
||||
* Coprocessor 0x008bf000
|
||||
*/
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define IGS_FB 0x00400000
|
||||
#else
|
||||
#define IGS_FB 0x00000000
|
||||
#endif
|
||||
#define IGS_VGA 0x00800000
|
||||
#define IGS_COP_DATA 0x008a0000
|
||||
#define IGS_COP_DATA_LEN 0x00010000
|
||||
#define IGS_COP_OFFSET 0x008bf000
|
||||
/* give audio 1/2 meg at end */
|
||||
#if 1
|
||||
#define IGS_MEM ((4096-512)*1024)
|
||||
#else
|
||||
#define IGS_MEM ((4096)*1024)
|
||||
#endif
|
||||
|
||||
#define IGS_CLOCK_REF 24576 /* KHz */
|
||||
|
||||
#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1)
|
||||
|
||||
#define IGS_CLOCK(m,n,p) ((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p)))
|
||||
|
||||
#define IGS_MAX_CLOCK 260000
|
||||
|
||||
#define IGS_MIN_VCO 115000
|
||||
|
||||
typedef volatile CARD8 VOL8;
|
||||
typedef volatile CARD16 VOL16;
|
||||
typedef volatile CARD32 VOL32;
|
||||
|
||||
typedef struct _Cop5xxx {
|
||||
VOL8 pad000[0x10]; /* 0x000 */
|
||||
|
||||
VOL32 control; /* 0x010 */
|
||||
#define IGS_CONTROL_HBLTW_RDYZ 0x0100
|
||||
#define IGS_CONTROL_MALLWBEPTZ 0x0200
|
||||
#define IGS_CONTROL_CMDFF 0x0400
|
||||
#define IGS_CONTROL_SOP 0x0800
|
||||
#define IGS_CONTROL_OPS 0x1000
|
||||
#define IGS_CONTROL_TER 0x2000
|
||||
#define IGS_CONTROL_HBACKZ 0x4000
|
||||
#define IGS_CONTROL_BUSY 0x8000
|
||||
|
||||
VOL8 pad014[0x04]; /* 0x014 */
|
||||
|
||||
VOL32 src1_stride; /* 0x018 */
|
||||
|
||||
VOL32 format; /* 0x01c */
|
||||
|
||||
#define IGS_FORMAT_8BPP 0
|
||||
#define IGS_FORMAT_16BPP 1
|
||||
#define IGS_FORMAT_24BPP 2
|
||||
#define IGS_FORMAT_32BPP 3
|
||||
|
||||
VOL32 bres_error; /* 0x020 */
|
||||
VOL32 bres_k1; /* 0x024 */
|
||||
VOL32 bres_k2; /* 0x028 */
|
||||
VOL8 pad02c[0x1c]; /* 0x02c */
|
||||
|
||||
VOL32 mix; /* 0x048 */
|
||||
#define IGS_MIX_FG 0x00ff
|
||||
#define IGS_MIX_BG 0xff00
|
||||
#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8))
|
||||
|
||||
#define IGS_MIX_ZERO 0x0
|
||||
#define IGS_MIX_SRC_AND_DST 0x1
|
||||
#define IGS_MIX_SRC_AND_NOT_DST 0x2
|
||||
#define IGS_MIX_SRC 0x3
|
||||
#define IGS_MIX_NOT_SRC_AND_DST 0x4
|
||||
#define IGS_MIX_DST 0x5
|
||||
#define IGS_MIX_SRC_XOR_DST 0x6
|
||||
#define IGS_MIX_SRC_OR_DST 0x7
|
||||
#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8
|
||||
#define IGS_MIX_SRC_XOR_NOT_DST 0x9
|
||||
#define IGS_MIX_NOT_DST 0xa
|
||||
#define IGS_MIX_SRC_OR_NOT_DST 0xb
|
||||
#define IGS_MIX_NOT_SRC 0xc
|
||||
#define IGS_MIX_NOT_SRC_OR_DST 0xd
|
||||
#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe
|
||||
#define IGS_MIX_ONE 0xf
|
||||
|
||||
VOL32 colorComp; /* 0x04c */
|
||||
VOL32 planemask; /* 0x050 */
|
||||
|
||||
VOL8 pad054[0x4]; /* 0x054 */
|
||||
|
||||
VOL32 fg; /* 0x058 */
|
||||
VOL32 bg; /* 0x05c */
|
||||
VOL32 dim; /* 0x060 */
|
||||
#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16))
|
||||
VOL8 pad5[0x0c]; /* 0x064 */
|
||||
|
||||
VOL32 src1_base_address; /* 0x070 */
|
||||
VOL8 pad074[0x04]; /* 0x074 */
|
||||
|
||||
VOL32 rotate; /* 0x078 */
|
||||
#define IGS_MAKE_ROTATE(x,y) ((x) | ((y) << 16))
|
||||
VOL32 operation; /* 0x07c */
|
||||
|
||||
/* OCT[2:0] */
|
||||
#define IGS_DRAW_X_MAJOR 0x00000000
|
||||
#define IGS_DRAW_Y_MAJOR 0x00000001
|
||||
#define IGS_DRAW_T_B 0x00000000
|
||||
#define IGS_DRAW_B_T 0x00000002
|
||||
#define IGS_DRAW_L_R 0x00000000
|
||||
#define IGS_DRAW_R_L 0x00000004
|
||||
|
||||
/* Draw_Mode[1:0] */
|
||||
#define IGS_DRAW_ALL 0x00000000
|
||||
#define IGS_DRAW_NOT_FIRST 0x00000010
|
||||
#define IGS_DRAW_NOT_LAST 0x00000020
|
||||
#define IGS_DRAW_NOT_FIRST_LAST 0x00000030
|
||||
|
||||
/* TRPS[1:0] */
|
||||
#define IGS_TRANS_SRC1 0x00000000
|
||||
#define IGS_TRANS_SRC2 0x00000100
|
||||
#define IGS_TRANS_DST 0x00000200
|
||||
/* TRPS2 Transparent Invert */
|
||||
#define IGS_TRANS_INVERT 0x00000400
|
||||
/* TRPS3, Transparent Enable */
|
||||
#define IGS_TRANS_ENABLE 0x00000800
|
||||
|
||||
/* PPS[3:0], Pattern Pixel Select */
|
||||
#define IGS_PIXEL_TEXT_OPAQUE 0x00001000
|
||||
#define IGS_PIXEL_STIP_OPAQUE 0x00002000
|
||||
#define IGS_PIXEL_LINE_OPAQUE 0x00003000
|
||||
#define IGS_PIXEL_TEXT_TRANS 0x00005000
|
||||
#define IGS_PIXEL_STIP_TRANS 0x00006000
|
||||
#define IGS_PIXEL_LINE_TRANS 0x00007000
|
||||
#define IGS_PIXEL_FG 0x00008000
|
||||
#define IGS_PIXEL_TILE 0x00009000
|
||||
#define IGS_PIXEL_TILE_OPAQUE 0x0000d000
|
||||
|
||||
/* HostBltEnable[1:0] */
|
||||
#define IGS_HBLT_DISABLE 0x00000000
|
||||
#define IGS_HBLT_READ 0x00010000
|
||||
#define IGS_HBLT_WRITE_1 0x00020000
|
||||
#define IGS_HBLT_WRITE_2 0x00030000
|
||||
|
||||
/* Src2MapSelect[2:0], Src2 map select mode */
|
||||
#define IGS_SRC2_NORMAL 0x00000000
|
||||
#define IGS_SRC2_MONO_OPAQUE 0x00100000
|
||||
#define IGS_SRC2_FG 0x00200000
|
||||
#define IGS_SRC2_MONO_TRANS 0x00500000
|
||||
|
||||
/* StepFunction[3:0], Step function select */
|
||||
#define IGS_STEP_DRAW_AND_STEP 0x04000000
|
||||
#define IGS_STEP_LINE_DRAW 0x05000000
|
||||
#define IGS_STEP_PXBLT 0x08000000
|
||||
#define IGS_STEP_INVERT_PXBLT 0x09000000
|
||||
#define IGS_STEP_TERNARY_PXBLT 0x0b000000
|
||||
|
||||
/* FGS */
|
||||
#define IGS_FGS_FG 0x00000000
|
||||
#define IGS_FGS_SRC 0x20000000
|
||||
|
||||
/* BGS */
|
||||
#define IGS_BGS_BG 0x00000000
|
||||
#define IGS_BGS_SRC 0x80000000
|
||||
VOL8 pad080[0x90]; /* 0x080 */
|
||||
|
||||
VOL32 debug_control; /* 0x110 */
|
||||
VOL8 pad114[0x04]; /* 0x114 */
|
||||
|
||||
VOL32 src2_stride; /* 0x118 */
|
||||
VOL8 pad11c[0x14]; /* 0x11c */
|
||||
|
||||
VOL32 extension; /* 0x130 */
|
||||
|
||||
#define IGS_BURST_ENABLE 0x01
|
||||
#define IGS_STYLE_LINE 0x02
|
||||
#define IGS_ADDITIONAL_WAIT 0x04
|
||||
#define IGS_BLOCK_COP_REG 0x08
|
||||
#define IGS_TURBO_MONO 0x10
|
||||
#define IGS_SELECT_SAMPLE 0x40
|
||||
#define IGS_MDSBL_RD_B_WR 0x80
|
||||
#define IGS_WRMRSTZ 0x100
|
||||
#define IGS_TEST_MTST 0x200
|
||||
|
||||
VOL32 style_line; /* 0x134 */
|
||||
#define IGS_MAKE_STILE_LINE(roll_over,inc,pattern,accumulator) \
|
||||
((roll_over) | \
|
||||
((style_line_inc) << 8) | \
|
||||
((style_line_patern) << 16) | \
|
||||
((style_line_accumullator) << 24))
|
||||
VOL32 style_line_pattern_index; /* 0x138 */
|
||||
|
||||
VOL32 mono_burst_total; /* 0x13c */
|
||||
VOL8 pad140[0x10]; /* 0x140 */
|
||||
|
||||
VOL32 pat_x_rotate; /* 0x150 */
|
||||
VOL8 pad154[0x1c]; /* 0x154 */
|
||||
|
||||
VOL32 src1_start; /* 0x170 */
|
||||
VOL32 src2_start; /* 0x174 */
|
||||
VOL32 dst_start; /* 0x178 */
|
||||
VOL8 pad17c[0x9c]; /* 0x17c */
|
||||
|
||||
VOL32 dst_stride; /* 0x218 */
|
||||
} Cop5xxx;
|
||||
|
||||
typedef struct _igsCardInfo {
|
||||
Cop5xxx *cop;
|
||||
VOL8 *vga;
|
||||
VOL32 *copData;
|
||||
CARD8 *frameBuffer;
|
||||
IgsVga igsvga;
|
||||
} IgsCardInfo;
|
||||
|
||||
#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver))
|
||||
#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd)
|
||||
|
||||
typedef struct _igsCursor {
|
||||
int width, height;
|
||||
int xhot, yhot;
|
||||
Bool has_cursor;
|
||||
CursorPtr pCursor;
|
||||
Pixel source, mask;
|
||||
} IgsCursor;
|
||||
|
||||
#define IGS_CURSOR_WIDTH 64
|
||||
#define IGS_CURSOR_HEIGHT 64
|
||||
|
||||
typedef struct _igsPattern {
|
||||
INT32 xrot, yrot;
|
||||
CARD32 serial_number;
|
||||
CARD8 *base;
|
||||
CARD32 offset;
|
||||
} IgsPattern;
|
||||
|
||||
#define IGS_NUM_PATTERN 8
|
||||
#define IGS_PATTERN_WIDTH 8
|
||||
#define IGS_PATTERN_HEIGHT 8
|
||||
|
||||
typedef struct _igsPatternCache {
|
||||
CARD8 *base;
|
||||
CARD32 offset;
|
||||
IgsPattern pattern[IGS_NUM_PATTERN];
|
||||
int next;
|
||||
} IgsPatternCache;
|
||||
|
||||
typedef struct _igsScreenInfo {
|
||||
CARD8 *cursor_base;
|
||||
CARD32 cursor_offset;
|
||||
IgsCursor cursor;
|
||||
IgsPatternCache tile;
|
||||
IgsPatternCache stipple;
|
||||
} IgsScreenInfo;
|
||||
|
||||
#define IgsTileSize(bpp) (IGS_PATTERN_WIDTH*(bpp)/8*IGS_PATTERN_HEIGHT)
|
||||
#define IgsStippleSize(bpp) (IGS_PATTERN_WIDTH/8*IGS_PATTERN_HEIGHT)
|
||||
|
||||
#define getIgsScreenInfo(kd) ((IgsScreenInfo *) ((kd)->screen->driver))
|
||||
#define igsScreenInfo(kd) IgsScreenInfo *igss = getIgsScreenInfo(kd)
|
||||
|
||||
Bool
|
||||
igsDrawInit (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsDrawEnable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsDrawDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsDrawSync (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsDrawFini (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
|
||||
|
||||
void
|
||||
igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
|
||||
|
||||
Bool
|
||||
igsCursorInit (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsCursorEnable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsCursorDisable (ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
igsCursorFini (ScreenPtr pScreen);
|
||||
|
||||
#endif /* _IGS_H_ */
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* $RCSId: $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "igs.h"
|
||||
|
||||
#define IGS_DAC_SHIFT 8
|
||||
void
|
||||
igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
igsCardInfo(pScreenPriv);
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
while (ndef--)
|
||||
{
|
||||
igsSetImm (igsvga, igs_dac_read_index, pdefs->pixel);
|
||||
pdefs->red = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
|
||||
pdefs->green = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
|
||||
pdefs->blue = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT;
|
||||
pdefs++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
igsCardInfo(pScreenPriv);
|
||||
IgsVga *igsvga = &igsc->igsvga;
|
||||
|
||||
while (ndef--)
|
||||
{
|
||||
igsSetImm (igsvga, igs_dac_write_index, pdefs->pixel);
|
||||
igsSetImm (igsvga, igs_dac_data, pdefs->red >> IGS_DAC_SHIFT);
|
||||
igsSetImm (igsvga, igs_dac_data, pdefs->green >> IGS_DAC_SHIFT);
|
||||
igsSetImm (igsvga, igs_dac_data, pdefs->blue >> IGS_DAC_SHIFT);
|
||||
pdefs++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
/*
|
||||
* $RCSId: $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "igs.h"
|
||||
#include "cursorstr.h"
|
||||
|
||||
#define SetupCursor(s) KdScreenPriv(s); \
|
||||
igsCardInfo(pScreenPriv); \
|
||||
igsScreenInfo(pScreenPriv); \
|
||||
IgsCursor *pCurPriv = &igss->cursor; \
|
||||
IgsVga *igsvga = &igsc->igsvga
|
||||
|
||||
static void
|
||||
_igsMoveCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
CARD8 xoff, yoff;
|
||||
|
||||
x -= pCurPriv->xhot;
|
||||
xoff = 0;
|
||||
if (x < 0)
|
||||
{
|
||||
xoff = -x;
|
||||
x = 0;
|
||||
}
|
||||
y -= pCurPriv->yhot;
|
||||
yoff = 0;
|
||||
if (y < 0)
|
||||
{
|
||||
yoff = -y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
igsSet (igsvga, igs_sprite_x, x);
|
||||
igsSet (igsvga, igs_sprite_preset_x, xoff);
|
||||
igsSet (igsvga, igs_sprite_y, y);
|
||||
igsSet (igsvga, igs_sprite_preset_y, yoff);
|
||||
}
|
||||
|
||||
static void
|
||||
igsMoveCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (!pCurPriv->has_cursor)
|
||||
return;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
_igsMoveCursor (pScreen, x, y);
|
||||
VgaFlush (&igsvga->card);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
igsSetCursorColors (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
|
||||
igsSetImm (igsvga, igs_cursor_write_index, 0);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->backRed >> 8);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->backGreen >> 8);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->backBlue >> 8);
|
||||
igsSetImm (igsvga, igs_cursor_write_index, 1);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->foreRed >> 8);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->foreGreen >> 8);
|
||||
igsSetImm (igsvga, igs_cursor_data, pCursor->foreBlue >> 8);
|
||||
}
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define IgsAdjustCursor(v) { \
|
||||
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
|
||||
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
|
||||
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
|
||||
v = ((v & 0x00ff00ff) << 8) | ((v >> 8) & 0x00ff00ff); \
|
||||
v = ((v & 0x0000ffff) <<16) | ((v >>16) & 0x0000ffff); \
|
||||
}
|
||||
#else
|
||||
#define IgsAdjustCursor(v)
|
||||
#endif
|
||||
|
||||
#define ExplodeBits2(v) (((v) & 1) | (((v) & 2) << 1))
|
||||
#define ExplodeBits4(v) ((ExplodeBits2((v) >> 2) << 4) | \
|
||||
(ExplodeBits2((v) & 0x3)))
|
||||
#define ExplodeBits8(v) ((ExplodeBits4((v) >> 4) << 8) | \
|
||||
(ExplodeBits4((v) & 0xf)))
|
||||
#define ExplodeBits16(v) ((ExplodeBits8((v) >> 8) << 16) | \
|
||||
(ExplodeBits8((v) & 0xff)))
|
||||
static void
|
||||
igsLoadCursor (ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
CursorPtr pCursor = pCurPriv->pCursor;
|
||||
CursorBitsPtr bits = pCursor->bits;
|
||||
int w, h;
|
||||
CARD32 *ram, *msk, *mskLine, *src, *srcLine;
|
||||
int i, j;
|
||||
int cursor_address;
|
||||
int lwsrc;
|
||||
unsigned char ramdac_control_;
|
||||
CARD32 offset;
|
||||
CARD32 b0, b1;
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
pCurPriv->xhot = pCursor->bits->xhot;
|
||||
pCurPriv->yhot = pCursor->bits->yhot;
|
||||
|
||||
/*
|
||||
* Stick new image into cursor memory
|
||||
*/
|
||||
ram = (CARD32 *) igss->cursor_base;
|
||||
mskLine = (CARD32 *) bits->mask;
|
||||
srcLine = (CARD32 *) bits->source;
|
||||
|
||||
h = bits->height;
|
||||
if (h > IGS_CURSOR_HEIGHT)
|
||||
h = IGS_CURSOR_HEIGHT;
|
||||
|
||||
lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
|
||||
|
||||
for (i = 0; i < IGS_CURSOR_HEIGHT; i++) {
|
||||
msk = mskLine;
|
||||
src = srcLine;
|
||||
mskLine += lwsrc;
|
||||
srcLine += lwsrc;
|
||||
for (j = 0; j < IGS_CURSOR_WIDTH / 32; j++) {
|
||||
|
||||
CARD32 m, s;
|
||||
|
||||
if (i < h && j < lwsrc)
|
||||
{
|
||||
m = *msk++;
|
||||
s = *src++;
|
||||
IgsAdjustCursor(m);
|
||||
IgsAdjustCursor(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
m = 0;
|
||||
s = 0;
|
||||
}
|
||||
s &= m;
|
||||
m = ~m;
|
||||
b0 = ExplodeBits16(s&0xffff) | (ExplodeBits16(m&0xffff)<<1);
|
||||
b1 = ExplodeBits16(s>>16) | (ExplodeBits16(m>>16)<<1);
|
||||
*ram++ = b0;
|
||||
*ram++ = b1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set new color */
|
||||
igsSetCursorColors (pScreen);
|
||||
|
||||
/* Set address for cursor bits */
|
||||
offset = igss->cursor_offset;
|
||||
offset >>= 10;
|
||||
igsSet (igsvga, igs_sprite_addr, offset);
|
||||
|
||||
/* Assume TV interpolation off */
|
||||
igsSet (igsvga, igs_hcshf, 3);
|
||||
/* Enable the cursor */
|
||||
igsSet (igsvga, igs_sprite_visible, 1);
|
||||
igsSet (igsvga, igs_sprite_64x64, 1);
|
||||
/* Move to new position */
|
||||
_igsMoveCursor (pScreen, x, y);
|
||||
|
||||
VgaFlush (&igsvga->card);
|
||||
}
|
||||
|
||||
static void
|
||||
igsUnloadCursor (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
/* Disable cursor */
|
||||
igsSet (igsvga, igs_sprite_visible, 0);
|
||||
VgaFlush (&igsvga->card);
|
||||
}
|
||||
|
||||
static Bool
|
||||
igsRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return TRUE;
|
||||
|
||||
/* miRecolorCursor does this */
|
||||
if (pCurPriv->pCursor == pCursor)
|
||||
{
|
||||
if (pCursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
miPointerPosition (&x, &y);
|
||||
igsLoadCursor (pScreen, x, y);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
igsUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
igsSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
SetupCursor(pScreen);
|
||||
|
||||
pCurPriv->pCursor = pCursor;
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pCursor)
|
||||
igsLoadCursor (pScreen, x, y);
|
||||
else
|
||||
igsUnloadCursor (pScreen);
|
||||
}
|
||||
|
||||
miPointerSpriteFuncRec igsPointerSpriteFuncs = {
|
||||
igsRealizeCursor,
|
||||
igsUnrealizeCursor,
|
||||
igsSetCursor,
|
||||
igsMoveCursor,
|
||||
};
|
||||
|
||||
static void
|
||||
igsQueryBestSize (int class,
|
||||
unsigned short *pwidth, unsigned short *pheight,
|
||||
ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
switch (class)
|
||||
{
|
||||
case CursorShape:
|
||||
if (*pwidth > pCurPriv->width)
|
||||
*pwidth = pCurPriv->width;
|
||||
if (*pheight > pCurPriv->height)
|
||||
*pheight = pCurPriv->height;
|
||||
if (*pwidth > pScreen->width)
|
||||
*pwidth = pScreen->width;
|
||||
if (*pheight > pScreen->height)
|
||||
*pheight = pScreen->height;
|
||||
break;
|
||||
default:
|
||||
fbQueryBestSize (class, pwidth, pheight, pScreen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
igsCursorInit (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (!igss->cursor_base)
|
||||
{
|
||||
pCurPriv->has_cursor = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pCurPriv->width = IGS_CURSOR_WIDTH;
|
||||
pCurPriv->height= IGS_CURSOR_HEIGHT;
|
||||
pScreen->QueryBestSize = igsQueryBestSize;
|
||||
miPointerInitialize (pScreen,
|
||||
&igsPointerSpriteFuncs,
|
||||
&kdPointerScreenFuncs,
|
||||
FALSE);
|
||||
pCurPriv->has_cursor = TRUE;
|
||||
pCurPriv->pCursor = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
igsCursorEnable (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (pCurPriv->has_cursor)
|
||||
{
|
||||
if (pCurPriv->pCursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
miPointerPosition (&x, &y);
|
||||
igsLoadCursor (pScreen, x, y);
|
||||
}
|
||||
else
|
||||
igsUnloadCursor (pScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
igsCursorDisable (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
if (!pScreenPriv->enabled)
|
||||
return;
|
||||
|
||||
if (pCurPriv->has_cursor)
|
||||
{
|
||||
if (pCurPriv->pCursor)
|
||||
{
|
||||
igsUnloadCursor (pScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
igsCursorFini (ScreenPtr pScreen)
|
||||
{
|
||||
SetupCursor (pScreen);
|
||||
|
||||
pCurPriv->pCursor = NULL;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,260 +0,0 @@
|
|||
/*
|
||||
* $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsdraw.h,v 1.1 2000/05/06 22:17:43 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _IGSDRAW_H_
|
||||
#define _IGSDRAW_H_
|
||||
|
||||
extern CARD8 igsPatRop[];
|
||||
|
||||
#define SetupIgs(s) KdScreenPriv(s); \
|
||||
igsCardInfo(pScreenPriv); \
|
||||
Cop5xxx *cop = igsc->cop; \
|
||||
int cop_stride = pScreenPriv->screen->fb[0].pixelStride
|
||||
|
||||
#define _igsWaitLoop(cop,mask,value) { \
|
||||
int __loop = 1000000; \
|
||||
while (((cop)->control & (mask)) != (value)) { \
|
||||
if (--__loop <= 0) { \
|
||||
FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _igsWaitDone(cop) _igsWaitLoop(cop, \
|
||||
(IGS_CONTROL_BUSY| \
|
||||
IGS_CONTROL_MALLWBEPTZ), \
|
||||
0)
|
||||
|
||||
#if 1
|
||||
#define _igsWaitFull(cop) _igsWaitLoop(cop, \
|
||||
IGS_CONTROL_CMDFF, \
|
||||
0)
|
||||
#else
|
||||
#define _igsWaitFull(cop) _igsWaitDone(cop)
|
||||
#endif
|
||||
|
||||
#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop)
|
||||
#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \
|
||||
(IGS_CONTROL_HBACKZ| \
|
||||
IGS_CONTROL_CMDFF), \
|
||||
0)
|
||||
|
||||
#define _igsReset(cop) ((cop)->control = 0)
|
||||
|
||||
#define IgsInvertBits32(v) { \
|
||||
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
|
||||
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
|
||||
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
|
||||
}
|
||||
|
||||
#define IgsInvertBits16(v) { \
|
||||
v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
|
||||
v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
|
||||
v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
|
||||
}
|
||||
|
||||
#define IgsInvertBits8(v) { \
|
||||
v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
|
||||
v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
|
||||
v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
|
||||
}
|
||||
|
||||
#define IgsByteSwap32(x) ((x) = (((x) >> 24) | \
|
||||
(((x) >> 8) & 0xff00) | \
|
||||
(((x) << 8) & 0xff0000) | \
|
||||
((x) << 24)))
|
||||
|
||||
#define IgsByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8))
|
||||
|
||||
#define igsPatternDimOk(d) ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0))
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define IgsAdjustBits32(b) IgsInvertBits32(b)
|
||||
#define IgsAdjustBits16(x) IgsInvertBits16(x)
|
||||
#else
|
||||
#define IgsAdjustBits32(x) IgsByteSwap32(x)
|
||||
#define IgsAdjustBits16(x) IgsByteSwap16(x)
|
||||
#endif
|
||||
|
||||
#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
|
||||
(cop)->fg = (pix); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_FG | \
|
||||
IGS_HBLT_DISABLE | \
|
||||
IGS_SRC2_NORMAL | \
|
||||
IGS_STEP_PXBLT | \
|
||||
IGS_FGS_FG | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
|
||||
(cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \
|
||||
(cop)->src1_start = (base); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_TILE | \
|
||||
IGS_HBLT_DISABLE | \
|
||||
IGS_SRC2_NORMAL | \
|
||||
IGS_STEP_PXBLT | \
|
||||
IGS_FGS_SRC | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
|
||||
(cop)->src1_start = (base); \
|
||||
(cop)->fg = (pix); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_STIP_TRANS | \
|
||||
IGS_HBLT_DISABLE | \
|
||||
IGS_SRC2_NORMAL | \
|
||||
IGS_STEP_PXBLT | \
|
||||
IGS_FGS_FG | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
|
||||
(cop)->src1_start = (base); \
|
||||
(cop)->fg = (_fg); \
|
||||
(cop)->bg = (_bg); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_STIP_OPAQUE | \
|
||||
IGS_HBLT_DISABLE | \
|
||||
IGS_SRC2_NORMAL | \
|
||||
IGS_STEP_PXBLT | \
|
||||
IGS_FGS_FG | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsRect(cop,x,y,w,h,cmd) { \
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->dst_start = (x) + (y) * (cop_stride); \
|
||||
(cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
|
||||
(cop)->operation = (cmd); \
|
||||
}
|
||||
|
||||
#define _igsPatRect(cop,x,y,w,h,cmd) { \
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->dst_start = (x) + (y) * (cop_stride); \
|
||||
(cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \
|
||||
(cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
|
||||
(cop)->operation = (cmd); \
|
||||
}
|
||||
|
||||
#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
|
||||
(cop)->src1_stride = cop_stride - 1; \
|
||||
(cmd) = (IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_FG | \
|
||||
IGS_HBLT_DISABLE | \
|
||||
IGS_SRC2_NORMAL | \
|
||||
IGS_STEP_PXBLT | \
|
||||
IGS_FGS_SRC | \
|
||||
IGS_BGS_BG); \
|
||||
if (backwards) (cmd) |= IGS_DRAW_R_L; \
|
||||
if (upsidedown) (cmd) |= IGS_DRAW_B_T; \
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define _igsPreparePlaneBlt(cop) { \
|
||||
_igsReset(cop); \
|
||||
(cop)->dst_stride = cop_stride - 1; \
|
||||
(cop)->src1_stride = cop_stride - 1; \
|
||||
(cop)->src2_stride = cop_stride - 1; \
|
||||
(cop)->format = IGS_FORMAT_16BPP; \
|
||||
(cop)->src1_start = 0; \
|
||||
(cop)->src2_start = 0; \
|
||||
}
|
||||
#else
|
||||
#define _igsPreparePlaneBlt(cop)
|
||||
#endif
|
||||
|
||||
#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \
|
||||
_igsWaitIdleEmpty(cop); \
|
||||
_igsPreparePlaneBlt(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
|
||||
(cop)->fg = (fg_pix); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_FG | \
|
||||
IGS_HBLT_WRITE_2 | \
|
||||
IGS_SRC2_MONO_TRANS | \
|
||||
IGS_STEP_TERNARY_PXBLT | \
|
||||
IGS_FGS_FG | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \
|
||||
_igsWaitIdleEmpty(cop); \
|
||||
_igsPreparePlaneBlt(cop); \
|
||||
(cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
|
||||
(cop)->fg = (fg_pix); \
|
||||
(cop)->bg = (bg_pix); \
|
||||
(cmd) = (IGS_DRAW_T_B | \
|
||||
IGS_DRAW_L_R | \
|
||||
IGS_DRAW_ALL | \
|
||||
IGS_PIXEL_FG | \
|
||||
IGS_HBLT_WRITE_2 | \
|
||||
IGS_SRC2_MONO_OPAQUE | \
|
||||
IGS_STEP_TERNARY_PXBLT | \
|
||||
IGS_FGS_FG | \
|
||||
IGS_BGS_BG); \
|
||||
}
|
||||
|
||||
#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \
|
||||
/* _igsWaitFull(cop); */ \
|
||||
(cop)->dst_start = (x) + (y) * (cop_stride); \
|
||||
(cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \
|
||||
(cop)->operation = (cmd); \
|
||||
/* _igsWaitHostBltAck(cop); */ \
|
||||
}
|
||||
|
||||
#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \
|
||||
_igsWaitFull(cop); \
|
||||
(cop)->dst_start = (dx) + (dy) * cop_stride; \
|
||||
(cop)->src1_start = (sx) + (sy) * cop_stride; \
|
||||
(cop)->src1_stride = cop_stride - 1; \
|
||||
(cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
|
||||
(cop)->operation = (cmd); \
|
||||
}
|
||||
|
||||
#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
|
||||
|
||||
#endif
|
||||
|
|
@ -1,971 +0,0 @@
|
|||
/*
|
||||
* $RCSId: $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "igsreg.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define CR00 IGS_CR+0x00
|
||||
#define CR01 IGS_CR+0x01
|
||||
#define CR02 IGS_CR+0x02
|
||||
#define CR03 IGS_CR+0x03
|
||||
#define CR04 IGS_CR+0x04
|
||||
#define CR05 IGS_CR+0x05
|
||||
#define CR06 IGS_CR+0x06
|
||||
#define CR07 IGS_CR+0x07
|
||||
#define CR08 IGS_CR+0x08
|
||||
#define CR09 IGS_CR+0x09
|
||||
#define CR0A IGS_CR+0x0A
|
||||
#define CR0B IGS_CR+0x0B
|
||||
#define CR0C IGS_CR+0x0C
|
||||
#define CR0D IGS_CR+0x0D
|
||||
#define CR0E IGS_CR+0x0E
|
||||
#define CR0F IGS_CR+0x0F
|
||||
#define CR10 IGS_CR+0x10
|
||||
#define CR11 IGS_CR+0x11
|
||||
#define CR12 IGS_CR+0x12
|
||||
#define CR13 IGS_CR+0x13
|
||||
#define CR14 IGS_CR+0x14
|
||||
#define CR15 IGS_CR+0x15
|
||||
#define CR16 IGS_CR+0x16
|
||||
#define CR17 IGS_CR+0x17
|
||||
#define CR18 IGS_CR+0x18
|
||||
#define CR19 IGS_CR+0x19
|
||||
#define CR1A IGS_CR+0x1A
|
||||
#define CR1B IGS_CR+0x1B
|
||||
#define CR1C IGS_CR+0x1C
|
||||
#define CR1D IGS_CR+0x1D
|
||||
#define CR1E IGS_CR+0x1E
|
||||
#define CR1F IGS_CR+0x1F
|
||||
#define CR20 IGS_CR+0x20
|
||||
#define CR21 IGS_CR+0x21
|
||||
#define CR22 IGS_CR+0x22
|
||||
#define CR23 IGS_CR+0x23
|
||||
#define CR24 IGS_CR+0x24
|
||||
#define CR25 IGS_CR+0x25
|
||||
#define CR26 IGS_CR+0x26
|
||||
#define CR27 IGS_CR+0x27
|
||||
#define CR28 IGS_CR+0x28
|
||||
#define CR29 IGS_CR+0x29
|
||||
#define CR2A IGS_CR+0x2A
|
||||
#define CR2B IGS_CR+0x2B
|
||||
#define CR2C IGS_CR+0x2C
|
||||
#define CR2D IGS_CR+0x2D
|
||||
#define CR2E IGS_CR+0x2E
|
||||
#define CR2F IGS_CR+0x2F
|
||||
#define CR30 IGS_CR+0x30
|
||||
#define CR31 IGS_CR+0x31
|
||||
#define CR32 IGS_CR+0x32
|
||||
#define CR33 IGS_CR+0x33
|
||||
#define CR34 IGS_CR+0x34
|
||||
#define CR35 IGS_CR+0x35
|
||||
#define CR36 IGS_CR+0x36
|
||||
#define CR37 IGS_CR+0x37
|
||||
#define CR38 IGS_CR+0x38
|
||||
#define CR39 IGS_CR+0x39
|
||||
#define CR3A IGS_CR+0x3A
|
||||
#define CR3B IGS_CR+0x3B
|
||||
#define CR3C IGS_CR+0x3C
|
||||
#define CR3D IGS_CR+0x3D
|
||||
#define CR3E IGS_CR+0x3E
|
||||
#define CR3F IGS_CR+0x3F
|
||||
#define CR40 IGS_CR+0x40
|
||||
#define CR41 IGS_CR+0x41
|
||||
#define CR42 IGS_CR+0x42
|
||||
#define CR43 IGS_CR+0x43
|
||||
#define CR44 IGS_CR+0x44
|
||||
#define CR45 IGS_CR+0x45
|
||||
#define CR46 IGS_CR+0x46
|
||||
#define CR47 IGS_CR+0x47
|
||||
#define CR48 IGS_CR+0x48
|
||||
|
||||
#define CR_FIRST CR00
|
||||
#define CR_LAST CR48
|
||||
|
||||
#define SR00 IGS_SR+0x00
|
||||
#define SR01 IGS_SR+0x01
|
||||
#define SR02 IGS_SR+0x02
|
||||
#define SR03 IGS_SR+0x03
|
||||
#define SR04 IGS_SR+0x04
|
||||
|
||||
#define SR_FIRST SR00
|
||||
#define SR_LAST SR04
|
||||
|
||||
#define AR00 IGS_AR+0x00
|
||||
#define AR01 IGS_AR+0x01
|
||||
#define AR02 IGS_AR+0x02
|
||||
#define AR03 IGS_AR+0x03
|
||||
#define AR04 IGS_AR+0x04
|
||||
#define AR05 IGS_AR+0x05
|
||||
#define AR06 IGS_AR+0x06
|
||||
#define AR07 IGS_AR+0x07
|
||||
#define AR08 IGS_AR+0x08
|
||||
#define AR09 IGS_AR+0x09
|
||||
#define AR0A IGS_AR+0x0A
|
||||
#define AR0B IGS_AR+0x0B
|
||||
#define AR0C IGS_AR+0x0C
|
||||
#define AR0D IGS_AR+0x0D
|
||||
#define AR0E IGS_AR+0x0E
|
||||
#define AR0F IGS_AR+0x0F
|
||||
#define AR10 IGS_AR+0x10
|
||||
#define AR11 IGS_AR+0x11
|
||||
#define AR12 IGS_AR+0x12
|
||||
#define AR13 IGS_AR+0x13
|
||||
#define AR14 IGS_AR+0x14
|
||||
|
||||
#define AR_FIRST AR00
|
||||
#define AR_LAST AR14
|
||||
|
||||
#define GR00 IGS_GR+0x00
|
||||
#define GR01 IGS_GR+0x01
|
||||
#define GR02 IGS_GR+0x02
|
||||
#define GR03 IGS_GR+0x03
|
||||
#define GR04 IGS_GR+0x04
|
||||
#define GR05 IGS_GR+0x05
|
||||
#define GR06 IGS_GR+0x06
|
||||
#define GR07 IGS_GR+0x07
|
||||
#define GR08 IGS_GR+0x08
|
||||
#define GR09 IGS_GR+0x09
|
||||
#define GR0A IGS_GR+0x0A
|
||||
#define GR0B IGS_GR+0x0B
|
||||
#define GR0C IGS_GR+0x0C
|
||||
#define GR0D IGS_GR+0x0D
|
||||
#define GR0E IGS_GR+0x0E
|
||||
#define GR0F IGS_GR+0x0F
|
||||
#define GR10 IGS_GR+0x10
|
||||
#define GR11 IGS_GR+0x11
|
||||
#define GR12 IGS_GR+0x12
|
||||
#define GR13 IGS_GR+0x13
|
||||
#define GR14 IGS_GR+0x14
|
||||
#define GR15 IGS_GR+0x15
|
||||
#define GR16 IGS_GR+0x16
|
||||
#define GR17 IGS_GR+0x17
|
||||
#define GR18 IGS_GR+0x18
|
||||
#define GR19 IGS_GR+0x19
|
||||
#define GR1A IGS_GR+0x1A
|
||||
#define GR1B IGS_GR+0x1B
|
||||
#define GR1C IGS_GR+0x1C
|
||||
#define GR1D IGS_GR+0x1D
|
||||
#define GR1E IGS_GR+0x1E
|
||||
#define GR1F IGS_GR+0x1F
|
||||
#define GR20 IGS_GR+0x20
|
||||
#define GR21 IGS_GR+0x21
|
||||
#define GR22 IGS_GR+0x22
|
||||
#define GR23 IGS_GR+0x23
|
||||
#define GR24 IGS_GR+0x24
|
||||
#define GR25 IGS_GR+0x25
|
||||
#define GR26 IGS_GR+0x26
|
||||
#define GR27 IGS_GR+0x27
|
||||
#define GR28 IGS_GR+0x28
|
||||
#define GR29 IGS_GR+0x29
|
||||
#define GR2A IGS_GR+0x2A
|
||||
#define GR2B IGS_GR+0x2B
|
||||
#define GR2C IGS_GR+0x2C
|
||||
#define GR2D IGS_GR+0x2D
|
||||
#define GR2E IGS_GR+0x2E
|
||||
#define GR2F IGS_GR+0x2F
|
||||
#define GR30 IGS_GR+0x30
|
||||
#define GR31 IGS_GR+0x31
|
||||
#define GR32 IGS_GR+0x32
|
||||
#define GR33 IGS_GR+0x33
|
||||
#define GR34 IGS_GR+0x34
|
||||
#define GR35 IGS_GR+0x35
|
||||
#define GR36 IGS_GR+0x36
|
||||
#define GR37 IGS_GR+0x37
|
||||
#define GR38 IGS_GR+0x38
|
||||
#define GR39 IGS_GR+0x39
|
||||
#define GR3A IGS_GR+0x3A
|
||||
#define GR3B IGS_GR+0x3B
|
||||
#define GR3C IGS_GR+0x3C
|
||||
#define GR3D IGS_GR+0x3D
|
||||
#define GR3E IGS_GR+0x3E
|
||||
#define GR3F IGS_GR+0x3F
|
||||
#define GR40 IGS_GR+0x40
|
||||
#define GR41 IGS_GR+0x41
|
||||
#define GR42 IGS_GR+0x42
|
||||
#define GR43 IGS_GR+0x43
|
||||
#define GR44 IGS_GR+0x44
|
||||
#define GR45 IGS_GR+0x45
|
||||
#define GR46 IGS_GR+0x46
|
||||
#define GR47 IGS_GR+0x47
|
||||
#define GR48 IGS_GR+0x48
|
||||
#define GR49 IGS_GR+0x49
|
||||
#define GR4A IGS_GR+0x4A
|
||||
#define GR4B IGS_GR+0x4B
|
||||
#define GR4C IGS_GR+0x4C
|
||||
#define GR4D IGS_GR+0x4D
|
||||
#define GR4E IGS_GR+0x4E
|
||||
#define GR4F IGS_GR+0x4F
|
||||
#define GR50 IGS_GR+0x50
|
||||
#define GR51 IGS_GR+0x51
|
||||
#define GR52 IGS_GR+0x52
|
||||
#define GR53 IGS_GR+0x53
|
||||
#define GR54 IGS_GR+0x54
|
||||
#define GR55 IGS_GR+0x55
|
||||
#define GR56 IGS_GR+0x56
|
||||
#define GR57 IGS_GR+0x57
|
||||
#define GR58 IGS_GR+0x58
|
||||
#define GR59 IGS_GR+0x59
|
||||
#define GR5A IGS_GR+0x5A
|
||||
#define GR5B IGS_GR+0x5B
|
||||
#define GR5C IGS_GR+0x5C
|
||||
#define GR5D IGS_GR+0x5D
|
||||
#define GR5E IGS_GR+0x5E
|
||||
#define GR5F IGS_GR+0x5F
|
||||
#define GR60 IGS_GR+0x60
|
||||
#define GR61 IGS_GR+0x61
|
||||
#define GR62 IGS_GR+0x62
|
||||
#define GR63 IGS_GR+0x63
|
||||
#define GR64 IGS_GR+0x64
|
||||
#define GR65 IGS_GR+0x65
|
||||
#define GR66 IGS_GR+0x66
|
||||
#define GR67 IGS_GR+0x67
|
||||
#define GR68 IGS_GR+0x68
|
||||
#define GR69 IGS_GR+0x69
|
||||
#define GR6A IGS_GR+0x6A
|
||||
#define GR6B IGS_GR+0x6B
|
||||
#define GR6C IGS_GR+0x6C
|
||||
#define GR6D IGS_GR+0x6D
|
||||
#define GR6E IGS_GR+0x6E
|
||||
#define GR6F IGS_GR+0x6F
|
||||
#define GR70 IGS_GR+0x70
|
||||
#define GR71 IGS_GR+0x71
|
||||
#define GR72 IGS_GR+0x72
|
||||
#define GR73 IGS_GR+0x73
|
||||
#define GR74 IGS_GR+0x74
|
||||
#define GR75 IGS_GR+0x75
|
||||
#define GR76 IGS_GR+0x76
|
||||
#define GR77 IGS_GR+0x77
|
||||
#define GR78 IGS_GR+0x78
|
||||
#define GR79 IGS_GR+0x79
|
||||
#define GR7A IGS_GR+0x7A
|
||||
#define GR7B IGS_GR+0x7B
|
||||
#define GR7C IGS_GR+0x7C
|
||||
#define GR7D IGS_GR+0x7D
|
||||
#define GR7E IGS_GR+0x7E
|
||||
#define GR7F IGS_GR+0x7F
|
||||
#define GR80 IGS_GR+0x80
|
||||
#define GR81 IGS_GR+0x81
|
||||
#define GR82 IGS_GR+0x82
|
||||
#define GR83 IGS_GR+0x83
|
||||
#define GR84 IGS_GR+0x84
|
||||
#define GR85 IGS_GR+0x85
|
||||
#define GR86 IGS_GR+0x86
|
||||
#define GR87 IGS_GR+0x87
|
||||
#define GR88 IGS_GR+0x88
|
||||
#define GR89 IGS_GR+0x89
|
||||
#define GR8A IGS_GR+0x8A
|
||||
#define GR8B IGS_GR+0x8B
|
||||
#define GR8C IGS_GR+0x8C
|
||||
#define GR8D IGS_GR+0x8D
|
||||
#define GR8E IGS_GR+0x8E
|
||||
#define GR8F IGS_GR+0x8F
|
||||
#define GR90 IGS_GR+0x90
|
||||
#define GR91 IGS_GR+0x91
|
||||
#define GR92 IGS_GR+0x92
|
||||
#define GR93 IGS_GR+0x93
|
||||
#define GR94 IGS_GR+0x94
|
||||
#define GR95 IGS_GR+0x95
|
||||
#define GR96 IGS_GR+0x96
|
||||
#define GR97 IGS_GR+0x97
|
||||
#define GR98 IGS_GR+0x98
|
||||
#define GR99 IGS_GR+0x99
|
||||
#define GR9A IGS_GR+0x9A
|
||||
#define GR9B IGS_GR+0x9B
|
||||
#define GR9C IGS_GR+0x9C
|
||||
#define GR9D IGS_GR+0x9D
|
||||
#define GR9E IGS_GR+0x9E
|
||||
#define GR9F IGS_GR+0x9F
|
||||
#define GRA0 IGS_GR+0xA0
|
||||
#define GRA1 IGS_GR+0xA1
|
||||
#define GRA2 IGS_GR+0xA2
|
||||
#define GRA3 IGS_GR+0xA3
|
||||
#define GRA4 IGS_GR+0xA4
|
||||
#define GRA5 IGS_GR+0xA5
|
||||
#define GRA6 IGS_GR+0xA6
|
||||
#define GRA7 IGS_GR+0xA7
|
||||
#define GRA8 IGS_GR+0xA8
|
||||
#define GRA9 IGS_GR+0xA9
|
||||
#define GRAA IGS_GR+0xAA
|
||||
#define GRAB IGS_GR+0xAB
|
||||
#define GRAC IGS_GR+0xAC
|
||||
#define GRAD IGS_GR+0xAD
|
||||
#define GRAE IGS_GR+0xAE
|
||||
#define GRAF IGS_GR+0xAF
|
||||
#define GRB0 IGS_GR+0xB0
|
||||
#define GRB1 IGS_GR+0xB1
|
||||
#define GRB2 IGS_GR+0xB2
|
||||
#define GRB3 IGS_GR+0xB3
|
||||
#define GRB4 IGS_GR+0xB4
|
||||
#define GRB5 IGS_GR+0xB5
|
||||
#define GRB6 IGS_GR+0xB6
|
||||
#define GRB7 IGS_GR+0xB7
|
||||
#define GRB8 IGS_GR+0xB8
|
||||
#define GRB9 IGS_GR+0xB9
|
||||
#define GRBA IGS_GR+0xBA
|
||||
#define GRBB IGS_GR+0xBB
|
||||
#define GRBC IGS_GR+0xBC
|
||||
#define GRBD IGS_GR+0xBD
|
||||
#define GRBE IGS_GR+0xBE
|
||||
#define GRBF IGS_GR+0xBF
|
||||
|
||||
#define GR_FIRST GR00
|
||||
#define GR_LAST GRBF
|
||||
|
||||
#define GREX3C IGS_GREX+(0x3c-IGS_GREXBASE)
|
||||
|
||||
VgaReg igs_h_total[] = {
|
||||
CR00, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_de_end[] = {
|
||||
CR01, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_bstart[] = {
|
||||
CR02, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_bend[] = {
|
||||
CR03, 0, 5,
|
||||
CR05, 7, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_de_skew[] = {
|
||||
CR03, 5, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_ena_vr_access[] = {
|
||||
CR03, 7, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_rstart[] = {
|
||||
CR04, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_rend[] = {
|
||||
CR05, 0, 5,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_h_rdelay[] = {
|
||||
CR05, 5, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_total[] = {
|
||||
CR06, 0, 8,
|
||||
CR07, 0, 1,
|
||||
CR07, 5, 1,
|
||||
GR11, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_rstart[] = {
|
||||
CR10, 0, 8,
|
||||
CR07, 2, 1,
|
||||
CR07, 7, 1,
|
||||
GR11, 2, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_rend[] = {
|
||||
CR11, 0, 4,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_clear_v_int[] = {
|
||||
CR11, 4, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_disable_v_int[] = {
|
||||
CR11, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_bandwidth[] = {
|
||||
CR11, 6, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_crt_protect[] = {
|
||||
CR11, 7, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_de_end[] = {
|
||||
CR12, 0, 8,
|
||||
CR07, 1, 1,
|
||||
CR07, 6, 1,
|
||||
GR11, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_offset[] = {
|
||||
CR13, 0, 8,
|
||||
GR15, 4, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_bstart[] = {
|
||||
CR15, 0, 8,
|
||||
CR07, 3, 1,
|
||||
CR09, 5, 1,
|
||||
GR11, 3, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_v_bend[] = {
|
||||
CR16, 0, 7,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_linecomp[] = {
|
||||
CR18, 0, 8,
|
||||
CR07, 4, 1,
|
||||
CR09, 6, 1,
|
||||
GR11, 4, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_ivideo[] = {
|
||||
GR11, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_num_fetch[] = {
|
||||
GR14, 0, 8,
|
||||
GR15, 0, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_wcrt0[] = {
|
||||
CR1F, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_wcrt1[] = {
|
||||
CR1F, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_rcrts1[] = {
|
||||
CR1F, 4, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_selwk[] = {
|
||||
CR1F, 6, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dot_clock_8[] = {
|
||||
SR01, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_screen_off[] = {
|
||||
SR01, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_enable_write_plane[] = {
|
||||
SR02, 0, 4,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mexhsyn[] = {
|
||||
GR16, 0, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mexvsyn[] = {
|
||||
GR16, 2, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_pci_burst_write[] = {
|
||||
GR30, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_pci_burst_read[] = {
|
||||
GR30, 7, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_iow_retry[] = {
|
||||
GREX3C, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mw_retry[] = {
|
||||
GREX3C, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mr_retry[] = {
|
||||
GREX3C, 2, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
|
||||
|
||||
VgaReg igs_biga22en[] = {
|
||||
GR3D, 4, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_biga24en[] = {
|
||||
GR3D, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_biga22force[] = {
|
||||
GR3D, 6, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_bigswap[] = {
|
||||
GR3F, 0, 6,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
/* #define IGS_BIGSWAP_8 0x3f */
|
||||
/* #define IGS_BIGSWAP_16 0x2a */
|
||||
/* #define IGS_BIGSWAP_32 0x00 */
|
||||
|
||||
VgaReg igs_sprite_x[] = {
|
||||
GR50, 0, 8,
|
||||
GR51, 0, 3,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_sprite_preset_x[] = {
|
||||
GR52, 0, 6,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_sprite_y[] = {
|
||||
GR53, 0, 8,
|
||||
GR54, 0, 3,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_sprite_preset_y[] = {
|
||||
GR55, 0, 6,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_sprite_visible[] = {
|
||||
GR56, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_sprite_64x64[] = {
|
||||
GR56, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mgrext[] = {
|
||||
GR57, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_hcshf[] = {
|
||||
GR57, 4, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mbpfix[] = {
|
||||
GR57, 6, 2,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_overscan_red[] = {
|
||||
GR58, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_overscan_green[] = {
|
||||
GR59, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_overscan_blue[] = {
|
||||
GR5A, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_memgopg[] = {
|
||||
GR73, 2, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_memr2wpg[] = {
|
||||
GR73, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_crtff16[] = {
|
||||
GR73, 3, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_fifomust[] = {
|
||||
GR74, 0, 5,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_fifogen[] = {
|
||||
GR75, 0, 5,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_mode_sel[] = {
|
||||
GR77, 0, 4,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
/* #define IGS_MODE_TEXT 0 */
|
||||
/* #define IGS_MODE_8 1 */
|
||||
/* #define IGS_MODE_565 2 */
|
||||
/* #define IGS_MODE_5551 6 */
|
||||
/* #define IGS_MODE_8888 3 */
|
||||
/* #define IGS_MODE_888 4 */
|
||||
/* #define IGS_MODE_332 9 */
|
||||
/* #define IGS_MODE_4444 10 */
|
||||
|
||||
VgaReg igs_sprite_addr[] = {
|
||||
GR7E, 0, 8,
|
||||
GR7F, 0, 4,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_fastmpie[] = {
|
||||
GR9E, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_vclk_m[] = {
|
||||
GRB0, 0, 8,
|
||||
GRBA, 0, 3,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_vclk_n[] = {
|
||||
GRB1, 0, 5,
|
||||
GRBA, 3, 3,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_vfsel[] = {
|
||||
GRB1, 5, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_vclk_p[] = {
|
||||
GRB1, 6, 2,
|
||||
GRBA, 6, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_frqlat[] = {
|
||||
GRB9, 7, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
|
||||
VgaReg igs_dac_mask[] = {
|
||||
IGS_DAC + 0, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dac_read_index[] = {
|
||||
IGS_DAC + 1, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dac_write_index[] = {
|
||||
IGS_DAC + 2, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dac_data[] = {
|
||||
IGS_DAC + 3, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_rampwdn[] = {
|
||||
IGS_DACEX + 0, 0, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dac6_8[] = {
|
||||
IGS_DACEX + 0, 1, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_ramdacbypass[] = {
|
||||
IGS_DACEX + 0, 4, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_dacpwdn[] = {
|
||||
IGS_DACEX + 0, 6, 1,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_cursor_read_index[] = {
|
||||
IGS_DACEX + 1, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_cursor_write_index[] = {
|
||||
IGS_DACEX + 2, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VgaReg igs_cursor_data[] = {
|
||||
IGS_DACEX + 3, 0, 8,
|
||||
VGA_REG_END
|
||||
};
|
||||
|
||||
VGA8
|
||||
_igsInb (VgaCard *card, VGA16 port)
|
||||
{
|
||||
VGAVOL8 *reg;
|
||||
|
||||
if (card->closure)
|
||||
return VgaReadMemb ((VGA32) card->closure + port);
|
||||
else
|
||||
return VgaInb (port);
|
||||
}
|
||||
|
||||
void
|
||||
_igsOutb (VgaCard *card, VGA8 value, VGA16 port)
|
||||
{
|
||||
if (card->closure)
|
||||
VgaWriteMemb (value, (VGA32) card->closure + port);
|
||||
else
|
||||
VgaOutb (value, port);
|
||||
}
|
||||
|
||||
void
|
||||
_igsRegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write)
|
||||
{
|
||||
if (reg < IGS_SR + IGS_NSR)
|
||||
{
|
||||
map->access = VgaAccessIndIo;
|
||||
map->port = 0x3c4;
|
||||
map->addr = 0;
|
||||
map->value = 1;
|
||||
map->index = reg - IGS_SR;
|
||||
}
|
||||
else if (reg < IGS_GR + IGS_NGR)
|
||||
{
|
||||
map->access = VgaAccessIndIo;
|
||||
map->port = 0x3ce;
|
||||
map->addr = 0;
|
||||
map->value = 1;
|
||||
map->index = reg - IGS_GR;
|
||||
}
|
||||
else if (reg < IGS_GREX + IGS_NGREX)
|
||||
{
|
||||
VGA8 gr33;
|
||||
|
||||
map->access = VgaAccessDone;
|
||||
_igsOutb (card, 0x33, 0x3ce);
|
||||
gr33 = _igsInb (card, 0x3cf);
|
||||
_igsOutb (card, gr33 | 0x40, 0x3cf);
|
||||
_igsOutb (card, IGS_GREXBASE + reg - IGS_GREX, 0x3ce);
|
||||
if (write)
|
||||
_igsOutb (card, map->value, 0x3cf);
|
||||
else
|
||||
map->value = _igsInb (card, 0x3cf);
|
||||
_igsOutb (card, 0x33, 0x3ce);
|
||||
_igsOutb (card, gr33, 0x3cf);
|
||||
return;
|
||||
}
|
||||
else if (reg < IGS_AR + IGS_NAR)
|
||||
{
|
||||
reg -= IGS_AR;
|
||||
map->access = VgaAccessDone;
|
||||
/* reset AFF to index */
|
||||
(void) _igsInb (card, 0x3da);
|
||||
if (reg >= 16)
|
||||
reg |= 0x20;
|
||||
_igsOutb (card, reg, 0x3c0);
|
||||
if (write)
|
||||
_igsOutb (card, map->value, 0x3c0);
|
||||
else
|
||||
map->value = _igsInb (card, 0x3c1);
|
||||
if (!(reg & 0x20))
|
||||
{
|
||||
/* enable video display again */
|
||||
(void) _igsInb (card, 0x3da);
|
||||
_igsOutb (card, 0x20, 0x3c0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (reg < IGS_CR + IGS_NCR)
|
||||
{
|
||||
map->access = VgaAccessIndIo;
|
||||
map->port = 0x3d4;
|
||||
map->addr = 0;
|
||||
map->value = 1;
|
||||
map->index = reg - IGS_CR;
|
||||
}
|
||||
else if (reg < IGS_DAC + IGS_NDAC)
|
||||
{
|
||||
map->access = VgaAccessIo;
|
||||
map->port = 0x3c6 + reg - IGS_DAC;
|
||||
}
|
||||
else if (reg < IGS_DACEX + IGS_NDACEX)
|
||||
{
|
||||
VGA8 gr56;
|
||||
reg = 0x3c6 + reg - IGS_DACEX;
|
||||
map->access = VgaAccessDone;
|
||||
_igsOutb (card, 0x56, 0x3ce);
|
||||
gr56 = _igsInb (card, 0x3cf);
|
||||
_igsOutb (card, gr56 | 4, 0x3cf);
|
||||
if (write)
|
||||
_igsOutb (card, map->value, reg);
|
||||
else
|
||||
map->value = _igsInb (card, reg);
|
||||
_igsOutb (card, gr56, 0x3cf);
|
||||
return;
|
||||
}
|
||||
else switch (reg) {
|
||||
case IGS_MISC_OUT:
|
||||
map->access = VgaAccessIo;
|
||||
if (write)
|
||||
map->port = 0x3c2;
|
||||
else
|
||||
map->port = 0x3cc;
|
||||
break;
|
||||
case IGS_INPUT_STATUS_1:
|
||||
map->access = VgaAccessIo;
|
||||
map->port = 0x3da;
|
||||
break;
|
||||
}
|
||||
if (card->closure)
|
||||
{
|
||||
map->port = map->port + (VGA32) card->closure;
|
||||
if (map->access == VgaAccessIo)
|
||||
map->access = VgaAccessMem;
|
||||
if (map->access == VgaAccessIndIo)
|
||||
map->access = VgaAccessIndMem;
|
||||
}
|
||||
}
|
||||
|
||||
VgaSave igsSaves[] = {
|
||||
CR00, CR18,
|
||||
SR01, SR02,
|
||||
GR11, GRBA,
|
||||
IGS_MISC_OUT, IGS_MISC_OUT,
|
||||
VGA_SAVE_END
|
||||
};
|
||||
|
||||
void
|
||||
igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio)
|
||||
{
|
||||
igsvga->card.map = _igsRegMap;
|
||||
igsvga->card.closure = (void *) mmio;
|
||||
igsvga->card.max = IGS_NREG;
|
||||
igsvga->card.values = igsvga->values;
|
||||
igsvga->card.saves = igsSaves;
|
||||
}
|
||||
|
||||
void
|
||||
igsSave (IgsVga *igsvga)
|
||||
{
|
||||
igsSetImm (igsvga, igs_wcrt0, 1);
|
||||
igsSetImm (igsvga, igs_wcrt1, 1);
|
||||
igsSetImm (igsvga, igs_rcrts1, 1);
|
||||
igsSetImm (igsvga, igs_selwk, 1);
|
||||
VgaPreserve (&igsvga->card);
|
||||
}
|
||||
|
||||
void
|
||||
igsReset (IgsVga *igsvga)
|
||||
{
|
||||
VgaRestore (&igsvga->card);
|
||||
igsSetImm (igsvga, igs_frqlat, 0);
|
||||
igsSetImm (igsvga, igs_frqlat, 1);
|
||||
igsSetImm (igsvga, igs_frqlat, 0);
|
||||
VgaFinish (&igsvga->card);
|
||||
}
|
||||
|
||||
char *
|
||||
igsRegName(char *buf, VGA16 reg)
|
||||
{
|
||||
if (reg < IGS_SR + IGS_NSR)
|
||||
{
|
||||
sprintf (buf, " SR%02X", reg - IGS_SR);
|
||||
}
|
||||
else if (reg < IGS_GR + IGS_NGR)
|
||||
{
|
||||
sprintf (buf, " GR%02X", reg - IGS_GR);
|
||||
}
|
||||
else if (reg < IGS_GREX + IGS_NGREX)
|
||||
{
|
||||
sprintf (buf, " GRX%02X", reg - IGS_GREX + IGS_GREXBASE);
|
||||
}
|
||||
else if (reg < IGS_AR + IGS_NAR)
|
||||
{
|
||||
sprintf (buf, " AR%02X", reg - IGS_AR);
|
||||
}
|
||||
else if (reg < IGS_CR + IGS_NCR)
|
||||
{
|
||||
sprintf (buf, " CR%02X", reg - IGS_CR);
|
||||
}
|
||||
else if (reg < IGS_DAC + IGS_NDAC)
|
||||
{
|
||||
sprintf (buf, " DAC%02X", reg - IGS_DAC);
|
||||
}
|
||||
else if (reg < IGS_DACEX + IGS_NDACEX)
|
||||
{
|
||||
sprintf (buf, "DACX%02X", reg - IGS_DACEX);
|
||||
}
|
||||
else switch (reg) {
|
||||
case IGS_MISC_OUT:
|
||||
sprintf (buf, "MISC_O");
|
||||
break;
|
||||
case IGS_INPUT_STATUS_1:
|
||||
sprintf (buf, "IN_S_1");
|
||||
break;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* $RCSId: $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _IGSREG_H_
|
||||
#define _IGSREG_H_
|
||||
|
||||
#include "vga.h"
|
||||
|
||||
#define IGS_SR 0
|
||||
#define IGS_NSR 5
|
||||
#define IGS_GR (IGS_SR+IGS_NSR)
|
||||
#define IGS_NGR 0xC0
|
||||
#define IGS_GREX (IGS_GR+IGS_NGR)
|
||||
#define IGS_GREXBASE 0x3c
|
||||
#define IGS_NGREX 1
|
||||
#define IGS_AR (IGS_GREX+IGS_NGREX)
|
||||
#define IGS_NAR 0x15
|
||||
#define IGS_CR (IGS_AR+IGS_NAR)
|
||||
#define IGS_NCR 0x48
|
||||
#define IGS_DAC (IGS_CR+IGS_NCR)
|
||||
#define IGS_NDAC 4
|
||||
#define IGS_DACEX (IGS_DAC+IGS_NDAC)
|
||||
#define IGS_NDACEX 4
|
||||
#define IGS_MISC_OUT (IGS_DACEX + IGS_NDACEX)
|
||||
#define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1)
|
||||
#define IGS_NREG (IGS_INPUT_STATUS_1+1)
|
||||
|
||||
extern VgaReg igs_h_total[];
|
||||
extern VgaReg igs_h_de_end[];
|
||||
extern VgaReg igs_h_bstart[];
|
||||
extern VgaReg igs_h_bend[];
|
||||
extern VgaReg igs_de_skew[];
|
||||
extern VgaReg igs_ena_vr_access[];
|
||||
extern VgaReg igs_h_rstart[];
|
||||
extern VgaReg igs_h_rend[];
|
||||
extern VgaReg igs_h_rdelay[];
|
||||
extern VgaReg igs_v_total[];
|
||||
extern VgaReg igs_v_rstart[];
|
||||
extern VgaReg igs_v_rend[];
|
||||
extern VgaReg igs_clear_v_int[];
|
||||
extern VgaReg igs_disable_v_int[];
|
||||
extern VgaReg igs_bandwidth[];
|
||||
extern VgaReg igs_crt_protect[];
|
||||
extern VgaReg igs_v_de_end[];
|
||||
extern VgaReg igs_offset[];
|
||||
extern VgaReg igs_v_bstart[];
|
||||
extern VgaReg igs_v_bend[];
|
||||
extern VgaReg igs_linecomp[];
|
||||
extern VgaReg igs_ivideo[];
|
||||
extern VgaReg igs_num_fetch[];
|
||||
extern VgaReg igs_wcrt0[];
|
||||
extern VgaReg igs_wcrt1[];
|
||||
extern VgaReg igs_rcrts1[];
|
||||
extern VgaReg igs_selwk[];
|
||||
extern VgaReg igs_dot_clock_8[];
|
||||
extern VgaReg igs_screen_off[];
|
||||
extern VgaReg igs_enable_write_plane[];
|
||||
extern VgaReg igs_mexhsyn[];
|
||||
extern VgaReg igs_mexvsyn[];
|
||||
extern VgaReg igs_pci_burst_write[];
|
||||
extern VgaReg igs_pci_burst_read[];
|
||||
extern VgaReg igs_iow_retry[];
|
||||
extern VgaReg igs_mw_retry[];
|
||||
extern VgaReg igs_mr_retry[];
|
||||
extern VgaReg igs_biga22en[];
|
||||
extern VgaReg igs_biga24en[];
|
||||
extern VgaReg igs_biga22force[];
|
||||
extern VgaReg igs_bigswap[];
|
||||
#define IGS_BIGSWAP_8 0x3f
|
||||
#define IGS_BIGSWAP_16 0x2a
|
||||
#define IGS_BIGSWAP_32 0x00
|
||||
extern VgaReg igs_sprite_x[];
|
||||
extern VgaReg igs_sprite_preset_x[];
|
||||
extern VgaReg igs_sprite_y[];
|
||||
extern VgaReg igs_sprite_preset_y[];
|
||||
extern VgaReg igs_sprite_visible[];
|
||||
extern VgaReg igs_sprite_64x64[];
|
||||
extern VgaReg igs_mgrext[];
|
||||
extern VgaReg igs_hcshf[];
|
||||
extern VgaReg igs_mbpfix[];
|
||||
extern VgaReg igs_overscan_red[];
|
||||
extern VgaReg igs_overscan_green[];
|
||||
extern VgaReg igs_overscan_blue[];
|
||||
extern VgaReg igs_memgopg[];
|
||||
extern VgaReg igs_memr2wpg[];
|
||||
extern VgaReg igs_crtff16[];
|
||||
extern VgaReg igs_fifomust[];
|
||||
extern VgaReg igs_fifogen[];
|
||||
extern VgaReg igs_mode_sel[];
|
||||
#define IGS_MODE_TEXT 0
|
||||
#define IGS_MODE_8 1
|
||||
#define IGS_MODE_565 2
|
||||
#define IGS_MODE_5551 6
|
||||
#define IGS_MODE_8888 3
|
||||
#define IGS_MODE_888 4
|
||||
#define IGS_MODE_332 9
|
||||
#define IGS_MODE_4444 10
|
||||
extern VgaReg igs_sprite_addr[];
|
||||
extern VgaReg igs_fastmpie[];
|
||||
extern VgaReg igs_vclk_m[];
|
||||
extern VgaReg igs_vclk_n[];
|
||||
extern VgaReg igs_vfsel[];
|
||||
extern VgaReg igs_vclk_p[];
|
||||
extern VgaReg igs_frqlat[];
|
||||
extern VgaReg igs_dac_mask[];
|
||||
extern VgaReg igs_dac_read_index[];
|
||||
extern VgaReg igs_dac_write_index[];
|
||||
extern VgaReg igs_dac_data[];
|
||||
extern VgaReg igs_rampwdn[];
|
||||
extern VgaReg igs_dac6_8[];
|
||||
extern VgaReg igs_ramdacbypass[];
|
||||
extern VgaReg igs_dacpwdn[];
|
||||
extern VgaReg igs_cursor_read_index[];
|
||||
extern VgaReg igs_cursor_write_index[];
|
||||
extern VgaReg igs_cursor_data[];
|
||||
|
||||
#define igsGet(sv,r) VgaGet(&(sv)->card, (r))
|
||||
#define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r))
|
||||
#define igsSet(sv,r,v) VgaSet(&(sv)->card, (r), (v))
|
||||
#define igsSetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v))
|
||||
|
||||
typedef struct _igsVga {
|
||||
VgaCard card;
|
||||
VgaValue values[IGS_NREG];
|
||||
} IgsVga;
|
||||
|
||||
void
|
||||
igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio);
|
||||
|
||||
void
|
||||
igsSave (IgsVga *igsvga);
|
||||
|
||||
void
|
||||
igsReset (IgsVga *igsvga);
|
||||
|
||||
#endif /* _IGSREG_H_ */
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsstub.c,v 1.2 2000/05/24 23:52:48 keithp Exp $
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "igs.h"
|
||||
|
||||
void
|
||||
InitCard (char *name)
|
||||
{
|
||||
KdCardAttr attr;
|
||||
CARD32 count;
|
||||
|
||||
count = 0;
|
||||
#ifdef EMBED
|
||||
attr.address[0] = 0x10000000; /* Adomo Wing video base address */
|
||||
attr.io = 0;
|
||||
attr.naddr = 1;
|
||||
#else
|
||||
while (LinuxFindPci (0x10ea, 0x5000, count, &attr))
|
||||
#endif
|
||||
{
|
||||
KdCardInfoAdd (&igsFuncs, &attr, 0);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
KdInitOutput (pScreenInfo, argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
InitInput (int argc, char **argv)
|
||||
{
|
||||
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
|
||||
}
|
||||
|
||||
void
|
||||
ddxUseMsg (void)
|
||||
{
|
||||
KdUseMsg ();
|
||||
}
|
||||
|
||||
int
|
||||
ddxProcessArgument (int argc, char **argv, int i)
|
||||
{
|
||||
return KdProcessArgument (argc, argv, i);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue