- Added Makefile - Deleted references to old headers - Added prototypes all over the place - Lots of type updates (drmHandle -> drm_handle_t etc.) - Added __driCreateNewScreen(), deleted __driCreateScreen() - Fixed context creation to match other drivers - Fixed various bitfield names - Bumped driver date Still nowhere close to usable, the DDX isn't DRI-aware and there's no DRM.tags/shimmering_gears
# src/mesa/drivers/dri/trident/Makefile | |||||
TOP = ../../../../.. | |||||
include $(TOP)/configs/current | |||||
LIBNAME = trident_dri.so | |||||
# Not yet | |||||
# MINIGLX_SOURCES = server/trident_dri.c | |||||
COMMON_SOURCES = \ | |||||
../../common/driverfuncs.c \ | |||||
../common/mm.c \ | |||||
../common/utils.c \ | |||||
../common/texmem.c \ | |||||
../common/vblank.c \ | |||||
../common/xmlconfig.c \ | |||||
../common/dri_util.c \ | |||||
../common/glcontextmodes.c | |||||
DRIVER_SOURCES = \ | |||||
trident_context.c \ | |||||
trident_state.c \ | |||||
trident_vb.c \ | |||||
trident_dd.c \ | |||||
trident_tris.c | |||||
C_SOURCES = \ | |||||
$(COMMON_SOURCES) \ | |||||
$(DRIVER_SOURCES) | |||||
ASM_SOURCES = | |||||
include ../Makefile.template | |||||
symlinks: |
#include "context.h" | #include "context.h" | ||||
#include "simple_list.h" | #include "simple_list.h" | ||||
#include "mem.h" | |||||
#include "matrix.h" | #include "matrix.h" | ||||
#include "extensions.h" | #include "extensions.h" | ||||
#if defined(USE_X86_ASM) | #if defined(USE_X86_ASM) | ||||
#include "X86/common_x86_asm.h" | #include "X86/common_x86_asm.h" | ||||
#endif | #endif | ||||
#include "simple_list.h" | #include "simple_list.h" | ||||
#include "mem.h" | |||||
#include "mm.h" | #include "mm.h" | ||||
static const struct gl_pipeline_stage *trident_pipeline[] = { | |||||
#include "drivers/common/driverfuncs.h" | |||||
#include "dri_util.h" | |||||
static const struct tnl_pipeline_stage *trident_pipeline[] = { | |||||
&_tnl_vertex_transform_stage, | &_tnl_vertex_transform_stage, | ||||
&_tnl_normal_transform_stage, | &_tnl_normal_transform_stage, | ||||
&_tnl_lighting_stage, | &_tnl_lighting_stage, | ||||
}; | }; | ||||
GLboolean tridentCreateContext( Display *dpy, const __GLcontextModes *glVisual, | |||||
GLboolean tridentCreateContext( const __GLcontextModes *glVisual, | |||||
__DRIcontextPrivate *driContextPriv, | __DRIcontextPrivate *driContextPriv, | ||||
void *sharedContextPrivate) | void *sharedContextPrivate) | ||||
{ | { | ||||
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; | __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; | ||||
tridentContextPtr tmesa; | tridentContextPtr tmesa; | ||||
tridentScreenPtr tridentscrn; | tridentScreenPtr tridentscrn; | ||||
struct dd_function_table functions; | |||||
#if 0 | #if 0 | ||||
drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+ | drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+ | ||||
sizeof(XF86DRISAREARec)); | sizeof(XF86DRISAREARec)); | ||||
else | else | ||||
shareCtx = NULL; | shareCtx = NULL; | ||||
tmesa->glCtx = _mesa_create_context(glVisual, shareCtx, tmesa, GL_TRUE); | |||||
_mesa_init_driver_functions(&functions); | |||||
tmesa->glCtx = | |||||
_mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa); | |||||
if (!tmesa->glCtx) { | if (!tmesa->glCtx) { | ||||
FREE(tmesa); | FREE(tmesa); | ||||
return GL_FALSE; | return GL_FALSE; | ||||
} | } | ||||
tmesa->display = dpy; | |||||
tmesa->driContext = driContextPriv; | tmesa->driContext = driContextPriv; | ||||
tmesa->driScreen = sPriv; | tmesa->driScreen = sPriv; | ||||
tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */ | tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */ | ||||
tmesa->hHWContext = driContextPriv->hHWContext; | tmesa->hHWContext = driContextPriv->hHWContext; | ||||
tmesa->driHwLock = &sPriv->pSAREA->lock; | |||||
tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock; | |||||
tmesa->driFd = sPriv->fd; | tmesa->driFd = sPriv->fd; | ||||
#if 0 | #if 0 | ||||
tmesa->sarea = saPriv; | tmesa->sarea = saPriv; | ||||
tridentDDInitTriFuncs( ctx ); | tridentDDInitTriFuncs( ctx ); | ||||
tridentDDInitState( tmesa ); | tridentDDInitState( tmesa ); | ||||
driContextPriv->driverPrivate = (void *)tmesa; | |||||
driContextPriv->driverPrivate = (void *)tmesa; | |||||
UNLOCK_HARDWARE(tmesa); | UNLOCK_HARDWARE(tmesa); | ||||
return GL_TRUE; | |||||
return GL_TRUE; | |||||
} | } | ||||
static void | static void | ||||
tmesa->glCtx->DriverCtx = NULL; | tmesa->glCtx->DriverCtx = NULL; | ||||
_mesa_destroy_context(tmesa->glCtx); | _mesa_destroy_context(tmesa->glCtx); | ||||
Xfree(tmesa); | |||||
_mesa_free(tmesa); | |||||
driContextPriv->driverPrivate = NULL; | driContextPriv->driverPrivate = NULL; | ||||
} | } | ||||
} | } | ||||
static GLboolean | static GLboolean | ||||
tridentCreateBuffer( Display *dpy, | |||||
__DRIscreenPrivate *driScrnPriv, | |||||
tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, | |||||
__DRIdrawablePrivate *driDrawPriv, | __DRIdrawablePrivate *driDrawPriv, | ||||
const __GLcontextModes *mesaVis, | const __GLcontextModes *mesaVis, | ||||
GLboolean isPixmap ) | GLboolean isPixmap ) | ||||
} | } | ||||
static void | static void | ||||
tridentSwapBuffers(Display *dpy, void *drawablePrivate) | |||||
tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate) | |||||
{ | { | ||||
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; | __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; | ||||
(void) dpy; | |||||
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { | if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { | ||||
tridentContextPtr tmesa; | tridentContextPtr tmesa; | ||||
tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate; | tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate; | ||||
ctx = tmesa->glCtx; | ctx = tmesa->glCtx; | ||||
if (ctx->Visual.doubleBufferMode) { | if (ctx->Visual.doubleBufferMode) { | ||||
_mesa_swapbuffers( ctx ); /* flush pending rendering comands */ | |||||
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ | |||||
tridentCopyBuffer( dPriv ); | tridentCopyBuffer( dPriv ); | ||||
} | } | ||||
} | } | ||||
return GL_TRUE; | return GL_TRUE; | ||||
} | } | ||||
static GLboolean | |||||
tridentOpenFullScreen(__DRIcontextPrivate *driContextPriv) | |||||
{ | |||||
return GL_TRUE; | |||||
} | |||||
static GLboolean | |||||
tridentCloseFullScreen(__DRIcontextPrivate *driContextPriv) | |||||
{ | |||||
return GL_TRUE; | |||||
} | |||||
tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv ) | tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv ) | ||||
{ | { | ||||
TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; | TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; | ||||
tridentScreenPtr tridentScreen; | tridentScreenPtr tridentScreen; | ||||
int i; | |||||
#if 0 | #if 0 | ||||
/* Check the DRI version */ | /* Check the DRI version */ | ||||
FREE(tridentScreen); | FREE(tridentScreen); | ||||
return GL_FALSE; | return GL_FALSE; | ||||
} | } | ||||
printf("MAPPED at 0x%x\n",tridentScreen->mmio.map); | |||||
printf("MAPPED at %p\n", tridentScreen->mmio.map); | |||||
return tridentScreen; | return tridentScreen; | ||||
} | } | ||||
tridentSwapBuffers, | tridentSwapBuffers, | ||||
tridentMakeCurrent, | tridentMakeCurrent, | ||||
tridentUnbindContext, | tridentUnbindContext, | ||||
tridentOpenFullScreen, | |||||
tridentCloseFullScreen | |||||
}; | }; | ||||
/* | |||||
* This is the bootstrap function for the driver. | |||||
* The __driCreateScreen name is the symbol that libGL.so fetches. | |||||
* Return: pointer to a __DRIscreenPrivate. | |||||
*/ | |||||
void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, | |||||
int numConfigs, __GLXvisualConfig *config) | |||||
#ifndef USE_NEW_INTERFACE | |||||
#error trident_dri.so is new-interface only. | |||||
#else | |||||
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; | |||||
PUBLIC void *__driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, | |||||
__DRIscreen *psc, | |||||
const __GLcontextModes * modes, | |||||
const __DRIversion * ddx_version, | |||||
const __DRIversion * dri_version, | |||||
const __DRIversion * drm_version, | |||||
const __DRIframebuffer * frame_buffer, | |||||
drmAddress pSAREA, int fd, | |||||
int internal_api_version, | |||||
__GLcontextModes ** driver_modes ) | |||||
{ | { | ||||
__DRIscreenPrivate *psp; | |||||
psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &tridentAPI); | |||||
return (void *) psp; | |||||
__DRIscreenPrivate *psp; | |||||
/* XXX version checks */ | |||||
psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, | |||||
ddx_version, dri_version, drm_version, | |||||
frame_buffer, pSAREA, fd, | |||||
internal_api_version, &tridentAPI); | |||||
if ( psp != NULL ) { | |||||
create_context_modes = (PFNGLXCREATECONTEXTMODES) | |||||
glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" ); | |||||
#if 0 | |||||
if ( create_context_modes != NULL ) { | |||||
TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; | |||||
*driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, | |||||
GL_TRUE ); | |||||
} | |||||
#endif | |||||
} | |||||
return (void *) psp; | |||||
} | } | ||||
#endif | |||||
void __driRegisterExtensions(void) | void __driRegisterExtensions(void) | ||||
{ | { | ||||
/* No extensions */ | /* No extensions */ |
#ifndef _TRIDENT_CONTEXT_H_ | #ifndef _TRIDENT_CONTEXT_H_ | ||||
#define _TRIDENT_CONTEXT_H_ | #define _TRIDENT_CONTEXT_H_ | ||||
#include "compiler.h" | |||||
#include "dri_util.h" | #include "dri_util.h" | ||||
#include "macros.h" | #include "macros.h" | ||||
#include "mtypes.h" | #include "mtypes.h" | ||||
#include "tnl_dd/t_dd_vertex.h" | #include "tnl_dd/t_dd_vertex.h" | ||||
#undef TAG | #undef TAG | ||||
/* these require that base be dword-aligned */ | |||||
static inline void MMIO_OUT32(unsigned char *base, unsigned int offset, | |||||
unsigned int val) | |||||
{ | |||||
unsigned int *addr = (unsigned int *)(base + offset); | |||||
*addr = val; | |||||
} | |||||
static inline unsigned int MMIO_IN32(unsigned char *base, unsigned int offset) | |||||
{ | |||||
unsigned int *addr = (unsigned int *)(base + offset); | |||||
return *addr; | |||||
} | |||||
#define MMIO_OUT8(base, offset, val) *((base) + (offset)) = (val) | |||||
#define MMIO_IN8(base, offset) *((base) + (offset)) | |||||
struct trident_context; | struct trident_context; | ||||
typedef struct trident_context tridentContextRec; | typedef struct trident_context tridentContextRec; | ||||
typedef struct trident_context *tridentContextPtr; | typedef struct trident_context *tridentContextPtr; | ||||
const tridentVertex * ); | const tridentVertex * ); | ||||
typedef struct { | typedef struct { | ||||
drmHandle handle; /* Handle to the DRM region */ | |||||
drm_handle_t handle; /* Handle to the DRM region */ | |||||
drmSize size; /* Size of the DRM region */ | drmSize size; /* Size of the DRM region */ | ||||
unsigned char *map; /* Mapping of the DRM region */ | unsigned char *map; /* Mapping of the DRM region */ | ||||
} tridentRegionRec, *tridentRegionPtr; | } tridentRegionRec, *tridentRegionPtr; | ||||
/* Mirrors of some DRI state | /* Mirrors of some DRI state | ||||
*/ | */ | ||||
Display *display; /* X server display */ | |||||
int lastStamp; /* mirror driDrawable->lastStamp */ | int lastStamp; /* mirror driDrawable->lastStamp */ | ||||
drmContext hHWContext; | |||||
drm_context_t hHWContext; | |||||
drmLock *driHwLock; | drmLock *driHwLock; | ||||
int driFd; | int driFd; | ||||
GLint readOffset, readPitch; | GLint readOffset, readPitch; | ||||
GLuint numClipRects; /* Cliprects for the draw buffer */ | GLuint numClipRects; /* Cliprects for the draw buffer */ | ||||
XF86DRIClipRectPtr pClipRects; | |||||
drm_clip_rect_t *pClipRects; | |||||
GLint scissor; | GLint scissor; | ||||
XF86DRIClipRectRec ScissorRect; /* Current software scissor */ | |||||
drm_clip_rect_t ScissorRect; /* Current software scissor */ | |||||
GLuint Fallback; | GLuint Fallback; | ||||
GLuint RenderIndex; | GLuint RenderIndex; | ||||
void tridentDDInitStateFuncs( GLcontext *ctx ); | void tridentDDInitStateFuncs( GLcontext *ctx ); | ||||
void tridentDDInitTextureFuncs( GLcontext *ctx ); | void tridentDDInitTextureFuncs( GLcontext *ctx ); | ||||
void tridentDDInitTriFuncs( GLcontext *ctx ); | void tridentDDInitTriFuncs( GLcontext *ctx ); | ||||
extern void tridentBuildVertices( GLcontext *ctx, | extern void tridentBuildVertices( GLcontext *ctx, | ||||
GLuint start, | GLuint start, | ||||
GLuint count, | GLuint count, | ||||
GLuint newinputs ); | GLuint newinputs ); | ||||
extern void tridentInitVB( GLcontext *ctx ); | |||||
extern void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv ); | |||||
extern void tridentFallback( tridentContextPtr tmesa, GLuint bit, | |||||
GLboolean mode ); | |||||
extern void tridentCheckTexSizes( GLcontext *ctx ); | |||||
extern void tridentChooseVertexState( GLcontext *ctx ); | |||||
extern void tridentDDUpdateHWState( GLcontext *ctx ); | |||||
extern void tridentUploadHwStateLocked( tridentContextPtr tmesa ); | |||||
#define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx)) | #define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx)) | ||||
#include "swrast/swrast.h" | #include "swrast/swrast.h" | ||||
#include "context.h" | #include "context.h" | ||||
#define TRIDENT_DATE "20020318" | |||||
#define TRIDENT_DATE "20041223" | |||||
/* Return the width and height of the current color buffer. | /* Return the width and height of the current color buffer. | ||||
*/ | */ |
#ifndef _TRIDENT_DRI_ | |||||
#define _TRIDENT_DRI_ | |||||
#include "xf86drm.h" | |||||
typedef struct { | |||||
drm_handle_t regs; | |||||
drmSize regsSize; | |||||
drmAddress regsMap; | |||||
int deviceID; | |||||
int width; | |||||
int height; | |||||
int mem; | |||||
int frontOffset; | |||||
int frontPitch; | |||||
int backOffset; | |||||
int backPitch; | |||||
int depthOffset; | |||||
int depthPitch; | |||||
int cpp; | |||||
#if 0 | |||||
int textureOffset; | |||||
int textureSize; | |||||
#endif | |||||
unsigned int sarea_priv_offset; | |||||
} TRIDENTDRIRec, *TRIDENTDRIPtr; | |||||
#endif |
/* XXX tridentGetLock doesn't exist... */ | |||||
#define LOCK_HARDWARE(tmesa) \ | |||||
do { \ | |||||
char __ret = 0; \ | |||||
DRM_CAS(tmesa->driHwLock, tmesa->hHWContext, \ | |||||
DRM_LOCK_HELD | tmesa->hHWContext, __ret); \ | |||||
} while (0) | |||||
#define UNLOCK_HARDWARE(tmesa) \ | |||||
DRM_UNLOCK(tmesa->driFd, tmesa->driHwLock, tmesa->hHWContext) |
*/ | */ | ||||
#include "trident_context.h" | #include "trident_context.h" | ||||
#include "trident_lock.h" | #include "trident_lock.h" | ||||
#include "array_cache/acache.h" | |||||
#include "swrast/swrast.h" | #include "swrast/swrast.h" | ||||
#include "swrast_setup/swrast_setup.h" | |||||
#include "tnl/tnl.h" | |||||
#define TRIDENTPACKCOLOR332(r, g, b) \ | #define TRIDENTPACKCOLOR332(r, g, b) \ | ||||
(((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) | (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) | ||||
{ | { | ||||
unsigned char *MMIO; | unsigned char *MMIO; | ||||
tridentContextPtr tmesa; | tridentContextPtr tmesa; | ||||
GLint nbox, i, ret; | |||||
GLint nbox, i; | |||||
int busy; | int busy; | ||||
XF86DRIClipRectPtr pbox; | |||||
drm_clip_rect_t *pbox; | |||||
assert(dPriv); | assert(dPriv); | ||||
assert(dPriv->driContextPriv); | assert(dPriv->driContextPriv); | ||||
for ( i = 0 ; i < nbox ; i++ ) { | for ( i = 0 ; i < nbox ; i++ ) { | ||||
#if 0 | #if 0 | ||||
GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox ); | GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox ); | ||||
XF86DRIClipRectPtr b = tmesa->sarea->boxes; | |||||
drm_clip_rect_t *b = tmesa->sarea->boxes; | |||||
GLint n = 0; | GLint n = 0; | ||||
for ( ; i < nr ; i++ ) { | for ( ; i < nr ; i++ ) { | ||||
{ | { | ||||
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | ||||
unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | ||||
__DRIdrawablePrivate *dPriv = tmesa->driDrawable; | |||||
int busy; | int busy; | ||||
GLuint flags = 0; | GLuint flags = 0; | ||||
GLint i; | GLint i; | ||||
GLint ret; | |||||
#define DRM_TRIDENT_FRONT 0x01 | #define DRM_TRIDENT_FRONT 0x01 | ||||
#define DRM_TRIDENT_BACK 0x02 | #define DRM_TRIDENT_BACK 0x02 | ||||
for ( i = 0 ; i < tmesa->numClipRects ; i++ ) { | for ( i = 0 ; i < tmesa->numClipRects ; i++ ) { | ||||
#if 0 | #if 0 | ||||
int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects ); | int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects ); | ||||
XF86DRIClipRectPtr box = tmesa->pClipRects; | |||||
XF86DRIClipRectPtr b = tmesa->sarea->boxes; | |||||
drm_clip_rect_t *box = tmesa->pClipRects; | |||||
drm_clip_rect_t *b = tmesa->sarea->boxes; | |||||
GLint n = 0; | GLint n = 0; | ||||
if ( !all ) { | if ( !all ) { | ||||
switch ( mode ) { | switch ( mode ) { | ||||
case GL_FRONT_LEFT: | case GL_FRONT_LEFT: | ||||
if (dPriv->numClipRects == 0) { | if (dPriv->numClipRects == 0) { | ||||
static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0}; | |||||
static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; | |||||
tmesa->numClipRects = 1; | tmesa->numClipRects = 1; | ||||
tmesa->pClipRects = &zeroareacliprect; | tmesa->pClipRects = &zeroareacliprect; | ||||
} else { | } else { | ||||
tmesa->numClipRects = dPriv->numClipRects; | tmesa->numClipRects = dPriv->numClipRects; | ||||
tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects; | |||||
tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects; | |||||
} | } | ||||
tmesa->drawX = dPriv->x; | tmesa->drawX = dPriv->x; | ||||
tmesa->drawY = dPriv->y; | tmesa->drawY = dPriv->y; | ||||
case GL_BACK_LEFT: | case GL_BACK_LEFT: | ||||
if ( dPriv->numBackClipRects == 0 ) { | if ( dPriv->numBackClipRects == 0 ) { | ||||
if (dPriv->numClipRects == 0) { | if (dPriv->numClipRects == 0) { | ||||
static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0}; | |||||
static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; | |||||
tmesa->numClipRects = 1; | tmesa->numClipRects = 1; | ||||
tmesa->pClipRects = &zeroareacliprect; | tmesa->pClipRects = &zeroareacliprect; | ||||
} else { | } else { | ||||
tmesa->numClipRects = dPriv->numClipRects; | tmesa->numClipRects = dPriv->numClipRects; | ||||
tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pClipRects; | |||||
tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects; | |||||
tmesa->drawX = dPriv->x; | tmesa->drawX = dPriv->x; | ||||
tmesa->drawY = dPriv->y; | tmesa->drawY = dPriv->y; | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
tmesa->numClipRects = dPriv->numBackClipRects; | tmesa->numClipRects = dPriv->numBackClipRects; | ||||
tmesa->pClipRects = (XF86DRIClipRectPtr)dPriv->pBackClipRects; | |||||
tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pBackClipRects; | |||||
tmesa->drawX = dPriv->backX; | tmesa->drawX = dPriv->backX; | ||||
tmesa->drawY = dPriv->backY; | tmesa->drawY = dPriv->backY; | ||||
} | } | ||||
#endif | #endif | ||||
} | } | ||||
#if 0 | |||||
static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) | static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) | ||||
{ | { | ||||
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | ||||
color[0], color[1], | color[0], color[1], | ||||
color[2], color[3] ); | color[2], color[3] ); | ||||
} | } | ||||
#endif | |||||
void tridentDDUpdateState( GLcontext *ctx, GLuint new_state ) | void tridentDDUpdateState( GLcontext *ctx, GLuint new_state ) | ||||
{ | { |
#include "tnl/t_context.h" | #include "tnl/t_context.h" | ||||
#include "tnl/t_pipeline.h" | #include "tnl/t_pipeline.h" | ||||
#include "swrast/swrast.h" | #include "swrast/swrast.h" | ||||
#include "swrast_setup/swrast_setup.h" | |||||
static int first = 1; | static int first = 1; | ||||
int DrawTriangle( tridentContextPtr tmesa) | int DrawTriangle( tridentContextPtr tmesa) | ||||
{ | { | ||||
volatile unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | |||||
unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | |||||
dmaBufRec clr; | dmaBufRec clr; | ||||
printf("DRAW TRI\n"); | printf("DRAW TRI\n"); | ||||
const tridentVertex *v0 ) | const tridentVertex *v0 ) | ||||
{ | { | ||||
unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | ||||
(void) MMIO; | |||||
} | } | ||||
static INLINE void trident_draw_line( tridentContextPtr tmesa, | static INLINE void trident_draw_line( tridentContextPtr tmesa, | ||||
const tridentVertex *v1 ) | const tridentVertex *v1 ) | ||||
{ | { | ||||
unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | unsigned char *MMIO = tmesa->tridentScreen->mmio.map; | ||||
(void) MMIO; | |||||
} | } | ||||
static INLINE void trident_draw_triangle( tridentContextPtr tmesa, | static INLINE void trident_draw_triangle( tridentContextPtr tmesa, | ||||
* primitives are being drawn, and only for the unaccelerated | * primitives are being drawn, and only for the unaccelerated | ||||
* primitives. | * primitives. | ||||
*/ | */ | ||||
#if 0 | |||||
static void | static void | ||||
trident_fallback_quad( tridentContextPtr tmesa, | trident_fallback_quad( tridentContextPtr tmesa, | ||||
const tridentVertex *v0, | const tridentVertex *v0, | ||||
trident_translate_vertex( ctx, v3, &v[3] ); | trident_translate_vertex( ctx, v3, &v[3] ); | ||||
_swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); | _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); | ||||
} | } | ||||
#endif | |||||
/* XXX hack to get the prototype defined in time... */ | |||||
void trident_translate_vertex(GLcontext *ctx, const tridentVertex *src, | |||||
SWvertex *dst); | |||||
static void | static void | ||||
trident_fallback_tri( tridentContextPtr tmesa, | trident_fallback_tri( tridentContextPtr tmesa, | ||||
static struct { | static struct { | ||||
points_func points; | |||||
line_func line; | |||||
triangle_func triangle; | |||||
quad_func quad; | |||||
tnl_points_func points; | |||||
tnl_line_func line; | |||||
tnl_triangle_func triangle; | |||||
tnl_quad_func quad; | |||||
} rast_tab[TRIDENT_MAX_TRIFUNC]; | } rast_tab[TRIDENT_MAX_TRIFUNC]; | ||||
#endif | #endif | ||||
static void tridentResetLineStipple( GLcontext *ctx ); | static void tridentResetLineStipple( GLcontext *ctx ); | ||||
#if 0 | |||||
static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ); | static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ); | ||||
#endif | |||||
static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ); | static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ); | ||||
#define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \ | #define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \ | ||||
* which renders strips as strips, the equivalent calculations are | * which renders strips as strips, the equivalent calculations are | ||||
* performed in tridentrender.c. | * performed in tridentrender.c. | ||||
*/ | */ | ||||
#if 0 | |||||
static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ) | static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ) | ||||
{ | { | ||||
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | ||||
if (tmesa->hw_primitive != hwprim) | if (tmesa->hw_primitive != hwprim) | ||||
tmesa->hw_primitive = hwprim; | tmesa->hw_primitive = hwprim; | ||||
} | } | ||||
#endif | |||||
static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ) | static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ) | ||||
{ | { | ||||
static void tridentResetLineStipple( GLcontext *ctx ) | static void tridentResetLineStipple( GLcontext *ctx ) | ||||
{ | { | ||||
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | ||||
(void) tmesa; | |||||
/* Reset the hardware stipple counter. | /* Reset the hardware stipple counter. | ||||
*/ | */ |
*/ | */ | ||||
#include "glheader.h" | #include "glheader.h" | ||||
#include "mtypes.h" | #include "mtypes.h" | ||||
#include "mem.h" | |||||
#include "macros.h" | #include "macros.h" | ||||
#include "colormac.h" | #include "colormac.h" | ||||
#include "mmath.h" | |||||
#include "swrast_setup/swrast_setup.h" | #include "swrast_setup/swrast_setup.h" | ||||
#include "swrast/swrast.h" | #include "swrast/swrast.h" | ||||
static struct { | static struct { | ||||
void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); | void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); | ||||
interp_func interp; | |||||
copy_pv_func copy_pv; | |||||
tnl_interp_func interp; | |||||
tnl_copy_pv_func copy_pv; | |||||
GLboolean (*check_tex_sizes)( GLcontext *ctx ); | GLboolean (*check_tex_sizes)( GLcontext *ctx ); | ||||
GLuint vertex_size; | GLuint vertex_size; | ||||
GLuint vertex_stride_shift; | GLuint vertex_stride_shift; | ||||
#define DO_PTEX (IND & TRIDENT_PTEX_BIT) | #define DO_PTEX (IND & TRIDENT_PTEX_BIT) | ||||
#define VERTEX tridentVertex | #define VERTEX tridentVertex | ||||
#define VERTEX_COLOR trident_color_t | |||||
#define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | #define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); | ||||
#define GET_VIEWPORT_MAT() tmesa->hw_viewport | #define GET_VIEWPORT_MAT() tmesa->hw_viewport | ||||
#define GET_TEXSOURCE(n) tmesa->tmu_source[n] | #define GET_TEXSOURCE(n) tmesa->tmu_source[n] | ||||
#define GET_VERTEX_FORMAT() tmesa->vertex_format | #define GET_VERTEX_FORMAT() tmesa->vertex_format | ||||
#define GET_VERTEX_SIZE() tmesa->vertex_size | |||||
#define GET_VERTEX_STORE() tmesa->verts | #define GET_VERTEX_STORE() tmesa->verts | ||||
#define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift | #define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift | ||||
#define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor | #define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor | ||||
if (!newinputs) | if (!newinputs) | ||||
return; | return; | ||||
if (newinputs & VERT_CLIP) { | |||||
if (newinputs & VERT_BIT_POS) { | |||||
setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride ); | setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride ); | ||||
} else { | } else { | ||||
GLuint ind = 0; | GLuint ind = 0; | ||||
if (newinputs & VERT_RGBA) | |||||
if (newinputs & VERT_BIT_COLOR0) | |||||
ind |= TRIDENT_RGBA_BIT; | ind |= TRIDENT_RGBA_BIT; | ||||
if (newinputs & VERT_SPEC_RGB) | |||||
if (newinputs & VERT_BIT_COLOR1) | |||||
ind |= TRIDENT_SPEC_BIT; | ind |= TRIDENT_SPEC_BIT; | ||||
if (newinputs & VERT_TEX0) | |||||
if (newinputs & VERT_BIT_TEX0) | |||||
ind |= TRIDENT_TEX0_BIT; | ind |= TRIDENT_TEX0_BIT; | ||||
if (newinputs & VERT_TEX1) | |||||
if (newinputs & VERT_BIT_TEX1) | |||||
ind |= TRIDENT_TEX1_BIT; | ind |= TRIDENT_TEX1_BIT; | ||||
if (newinputs & VERT_FOG_COORD) | |||||
if (newinputs & VERT_BIT_FOG) | |||||
ind |= TRIDENT_FOG_BIT; | ind |= TRIDENT_FOG_BIT; | ||||
if (tmesa->SetupIndex & TRIDENT_PTEX_BIT) | if (tmesa->SetupIndex & TRIDENT_PTEX_BIT) | ||||
if (ctx->Fog.Enabled) | if (ctx->Fog.Enabled) | ||||
ind |= TRIDENT_FOG_BIT; | ind |= TRIDENT_FOG_BIT; | ||||
if (ctx->Texture._ReallyEnabled) { | |||||
if (ctx->Texture.Unit[0]._ReallyEnabled) { | |||||
ind |= TRIDENT_TEX0_BIT; | ind |= TRIDENT_TEX0_BIT; | ||||
if (ctx->Texture.Unit[0]._ReallyEnabled && | |||||
ctx->Texture.Unit[1]._ReallyEnabled) { | |||||
if (ctx->Texture.Unit[1]._ReallyEnabled) { | |||||
ind |= TRIDENT_TEX1_BIT; | ind |= TRIDENT_TEX1_BIT; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (tmesa->UbyteSecondaryColor.Ptr) { | if (tmesa->UbyteSecondaryColor.Ptr) { | ||||
ALIGN_FREE(tmesa->UbyteSecondaryColor.Ptr); | |||||
ALIGN_FREE((void *)tmesa->UbyteSecondaryColor.Ptr); | |||||
tmesa->UbyteSecondaryColor.Ptr = 0; | tmesa->UbyteSecondaryColor.Ptr = 0; | ||||
} | } | ||||
if (tmesa->UbyteColor.Ptr) { | if (tmesa->UbyteColor.Ptr) { | ||||
ALIGN_FREE(tmesa->UbyteColor.Ptr); | |||||
ALIGN_FREE((void *)tmesa->UbyteColor.Ptr); | |||||
tmesa->UbyteColor.Ptr = 0; | tmesa->UbyteColor.Ptr = 0; | ||||
} | } | ||||
} | } |