Initial/partial documentation to the functions/structures that make the Radeon subset driver.

This commit is contained in:
Jose Fonseca 2003-02-16 20:48:08 +00:00
parent c9118dfaba
commit 75019b24d1
14 changed files with 1109 additions and 513 deletions

View file

@ -1,40 +1,40 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.4 2002/09/10 00:39:39 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
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.
**************************************************************************/
/**
* \file radeon_context.c
* \brief Device specific context initialization.
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
* 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.
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.4 2002/09/10 00:39:39 dawes Exp $ */
#include "glheader.h"
#include "imports.h"
#include "api_arrayelt.h"
@ -62,8 +62,15 @@ int RADEON_DEBUG = (0);
#endif
/* Return the width and height of the given buffer.
/**
* \brief Return the width and height of the given buffer.
*
* \param buffer frame buffer. Not used.
* \param width will hold the width of the buffer.
* \param height will hold the height of the buffer.
*
* Returns the width and height of the current drawable while holding the
* hardware lock.
*/
static void radeonGetBufferSize( GLframebuffer *buffer,
GLuint *width, GLuint *height )
@ -77,7 +84,19 @@ static void radeonGetBufferSize( GLframebuffer *buffer,
UNLOCK_HARDWARE( rmesa );
}
/* Return various strings for glGetString().
/**
* \brief Return various strings for glGetString().
*
* \param ctx GL context.
* \param name name of the string to return.
*
* \param pointer to a static string describing the aspect specified by \p
* name.
*
* \sa glGetString().
*
* Returns the wanted string, appending miscellaneous information (such as AGP
* mode, processor abilities, TCL support, etc.) for the GL_RENDERER aspect.
*/
static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
{
@ -150,7 +169,10 @@ static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
}
/* Extension strings exported by the R100 driver.
/**
* \brief Device specific extension names exported by the R100 driver.
*
* \note None in the case of the subset driver.
*/
static const char * const radeon_extensions[] =
{
@ -181,7 +203,13 @@ static const char * const radeon_extensions[] =
NULL
};
/* Initialize the extensions supported by this driver.
/**
* \brief Initialize the extensions supported by this driver.
*
* \param ctx GL context.
*
* Enables the imaging extensions and every extension specified in in the
* radeon_extensions table.
*/
static void radeonInitExtensions( GLcontext *ctx )
{
@ -194,6 +222,14 @@ static void radeonInitExtensions( GLcontext *ctx )
}
/**
* \brief Resize the buffers.
*
* \param buffer frame buffer to be resized.
*
* Informs the software rasterizer (if enabled at compile time) of the buffer
* resizing.
*/
static void ResizeBuffers( GLframebuffer *buffer )
{
#if _HAVE_SWRAST
@ -202,7 +238,10 @@ static void ResizeBuffers( GLframebuffer *buffer )
}
/* Initialize the driver's misc functions.
/**
* \brief Initialize the driver miscellaneous function callbacks.
*
* \param ctx GL context.
*/
static void radeonInitDriverFuncs( GLcontext *ctx )
{
@ -217,7 +256,24 @@ static void radeonInitDriverFuncs( GLcontext *ctx )
/* Create the device specific context.
/**
* \brief Create the device specific context.
*
* \param glVisual visual information.
* \param driContextPriv DRI specific context data.
* \param sharedContextPrivate shared context.
*
* \return GL_TRUE if successful, or GL_FALSE otherwise.
*
* Allocates a Radeon context and initializes it, adding a Mesa context. Fills
* in with information from the Radeon specific screen data in
* __DRIscreenPrivateRec::private, such as the SAREA pointer, DMA buffers
* addresses and texture heaps.
*
* Calls the radeonInit* functions to populate the driver callback functions.
*
* If compiled with debug support, reads the RADEON_DEBUG environment variable
* and sets the debugging flags accordingly.
*/
static GLboolean
radeonCreateContext( const __GLcontextModes *glVisual,
@ -436,9 +492,15 @@ radeonCreateContext( const __GLcontextModes *glVisual,
}
/* Destroy the device specific context.
*/
/* Destroy the Mesa and driver specific context data.
/**
* \brief Destroy the device specific context data.
*
* \param driContextPriv DRI specific context data.
*
* If destroying the currently bound context, fires the vertices and unbinds it first.
*
* Frees the radeon context resources, freeing the Mesa context. Frees the private texture object from
* the shared context data if its reference count reaches zero.
*/
static void
radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
@ -516,8 +578,14 @@ radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
/* Create and initialize the Mesa and driver specific pixmap buffer
/**
* \brief Create and initialize the Mesa and device specific pixmap buffer
* data.
*
* \param driScrnPriv DRI specific screen data.
* \param driDrawPriv DRI specific drawable data.
* \param mesaVis visual.
* \param isPixmap must be GL_FALSE. Not implemented.
*/
static GLboolean
radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
@ -552,6 +620,13 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
/**
* \brief Destroy device specific pixmap data.
*
* \param driDrawPriv DRI specific drawable data.
*
* Destroys Mesa framebuffer.
*/
static void
radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
@ -559,7 +634,14 @@ radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
}
/**
* \brief Swap buffers.
*
* \param dPriv DRI specific drawable data.
*
* If in double buffer mode it dispatches the call, either to
* radeonCopyBuffer() or radeonPageFlip() if page flipping is enabled.
*/
static void
radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
{
@ -587,8 +669,16 @@ radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
}
/* Force the context `c' to be the current context and associate with it
* buffer `b'.
/**
* \brief Set the current context.
*
* \param driContextPriv DRI specific context data to be activated.
* \param driDrawPriv DRI specific drawable data, to which the context is to be associated for writing.
* \param driReadPriv DRI specific drawable data, to which the context is to be associated for reading.
*
* \return GL_TRUE on success, or GL_FALSE on failure.
*
*
*/
static GLboolean
radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
@ -633,7 +723,11 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
return GL_TRUE;
}
/* Force the context `c' to be unbound from its buffer.
/**
* \brief Unbind context from its buffer.
*
* Calls radeonVtxfmtUnbindContext().
*/
static GLboolean
radeonUnbindContext( __DRIcontextPrivate *driContextPriv )
@ -647,12 +741,22 @@ radeonUnbindContext( __DRIcontextPrivate *driContextPriv )
return GL_TRUE;
}
/* Fullscreen mode isn't used for much -- could be a way to shrink
/**
* \brief Open/close fullscreen mode.
*
* Fullscreen mode isn't used for much -- could be a way to shrink
* front/back buffers & get more texture memory if the client has
* changed the video resolution.
*
* Pageflipping is now done automatically whenever there is a single
* 3d client.
*
* \param driContextPriv DRI specific context data. Not used.
*
* \return always GL_TRUE.
*
* This function is a no-op.
*/
static GLboolean
radeonOpenCloseFullScreen( __DRIcontextPrivate *driContextPriv )
@ -670,8 +774,14 @@ __driRegisterExtensions( void )
/* Initialize the driver specific screen private data. (Called as
* callback from __driUtilCreateScreen below).
/**
* \brief Initialize the driver specific screen private data.
*
* \param sPriv DRI specific screen data.
*
* \return GL_TRUE on success or GL_FALSE on faillure.
*
* Called as callback from __driCreateScreen below.
*/
static GLboolean
radeonInitDriver( __DRIscreenPrivate *sPriv )
@ -686,7 +796,9 @@ radeonInitDriver( __DRIscreenPrivate *sPriv )
}
/**
* \brief Driver interface structure
*/
static struct __DriverAPIRec radeonAPI = {
radeonInitDriver,
radeonDestroyScreen,
@ -703,10 +815,12 @@ static struct __DriverAPIRec radeonAPI = {
/*
* This is the bootstrap function for the driver.
/**
* \brief Bootstrap function for the driver.
*
* The __driCreateScreen name is the symbol that libGL.so fetches.
* Return: pointer to a __DRIscreenPrivate.
*
* \return pointer to a __DRIscreenPrivate.
*/
void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config)

View file

@ -1,39 +1,41 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.4 2002/09/10 00:39:39 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
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.
**************************************************************************/
/**
* \file radeon_context.h
* \brief Radeon OpenGL context definition.
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
* 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.
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.4 2002/09/10 00:39:39 dawes Exp $ */
#ifndef __RADEON_CONTEXT_H__
#define __RADEON_CONTEXT_H__
@ -70,14 +72,14 @@ struct radeon_scissor_state {
XF86DRIClipRectRec rect;
GLboolean enabled;
GLuint numClipRects; /* Cliprects active */
GLuint numAllocedClipRects; /* Cliprects available */
GLuint numClipRects; /**< \brief Cliprects active */
GLuint numAllocedClipRects; /**< \brief Cliprects available */
XF86DRIClipRectPtr pClipRects;
};
struct radeon_stencilbuffer_state {
GLboolean hwBuffer;
GLuint clear; /* rb3d_stencilrefmask value */
GLuint clear; /**< \brief rb3d_stencilrefmask value */
};
struct radeon_stipple_state {
@ -92,45 +94,55 @@ struct radeon_stipple_state {
typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr;
/* Texture object in locally shared texture space.
/**
* \brief Texture object in locally shared texture space.
*/
struct radeon_tex_obj {
radeonTexObjPtr next, prev;
struct gl_texture_object *tObj; /* Mesa texture object */
/** \brief Mesa texture object */
struct gl_texture_object *tObj;
PMemBlock memBlock; /* Memory block containing texture */
GLuint bufAddr; /* Offset to start of locally
shared texture block */
/** \brief Memory block containing texture */
PMemBlock memBlock;
/** \brief Offset to start of locally shared texture block */
GLuint bufAddr;
/**
* Flags for whether or not images need to be uploaded to local or AGP
* texture space
*/
GLuint dirty_images;
GLuint dirty_images; /* Flags for whether or not
images need to be uploaded to
local or AGP texture space */
/**
* Flags (1 per texunit) for whether or not this texobj has dirty hardware
* state (pp_*) that needs to be brought into the texunit.
*/
GLuint dirty_state;
GLuint dirty_state; /* Flags (1 per texunit) for
whether or not this texobj
has dirty hardware state
(pp_*) that needs to be
brought into the
texunit. */
GLint heap; /* Texture heap currently stored in */
/** \brief Texture heap currently stored in */
GLint heap;
drmRadeonTexImage image[RADEON_MAX_TEXTURE_LEVELS];
GLint totalSize; /* Total size of the texture
including all mipmap levels */
/* Total size of the texture including all mipmap levels */
GLint totalSize;
GLuint pp_txfilter; /* hardware register values */
GLuint pp_txformat;
GLuint pp_txoffset;
GLuint pp_border_color;
/* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the
/* \name Images to upload
*
* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the
* images to upload.
*/
/*@{*/
GLint firstLevel;
GLint lastLevel;
GLint lastLevel;
/*@}*/
};
@ -145,14 +157,17 @@ struct radeon_texture_state {
};
/**
* \brief Radeon state atom double-linked list.
*/
struct radeon_state_atom {
struct radeon_state_atom *next, *prev;
const char *name; /* for debug */
int cmd_size; /* size in bytes */
const char *name; /**< \brief for debug */
int cmd_size; /**< \brief size in bytes */
GLuint is_tcl;
int *cmd; /* one or more cmd's */
int *lastcmd; /* one or more cmd's */
GLboolean (*check)( GLcontext * ); /* is this state active? */
int *cmd; /**< \brief one or more cmd's */
int *lastcmd; /**< \brief one or more cmd's */
GLboolean (*check)( GLcontext * ); /**< \brief is this state active? */
};
@ -359,38 +374,49 @@ struct radeon_state_atom {
struct radeon_hw_state {
/* All state should be on one of these lists:
/**
* \name State
*
* All state should be on one of these lists
*/
struct radeon_state_atom dirty; /* dirty list head placeholder */
struct radeon_state_atom clean; /* clean list head placeholder */
/*@{*/
struct radeon_state_atom dirty; /**< \brief dirty list head placeholder */
struct radeon_state_atom clean; /**< \brief clean list head placeholder */
/*@}*/
/* Hardware state, stored as cmdbuf commands:
* -- Need to doublebuffer for
* - reviving state after loss of context
* - eliding noop statechange loops? (except line stipple count)
/**
* \name Hardware state
*
* Stored as cmdbuf commands:
* - Need to doublebuffer for
* - reviving state after loss of context
* - eliding no-op statechange loops? (except line stipple count)
*/
/*@{*/
struct radeon_state_atom ctx;
struct radeon_state_atom set;
struct radeon_state_atom lin;
struct radeon_state_atom msk;
struct radeon_state_atom vpt;
struct radeon_state_atom tcl;
struct radeon_state_atom tcl; /**< \ brief TCL */
struct radeon_state_atom msc;
struct radeon_state_atom tex[2];
struct radeon_state_atom zbs;
struct radeon_state_atom mtl;
struct radeon_state_atom mat[5];
struct radeon_state_atom lit[8]; /* includes vec, scl commands */
struct radeon_state_atom mat[5]; /**< \brief matrix transformations */
struct radeon_state_atom lit[8]; /**< \brief includes vec, scl commands */
struct radeon_state_atom ucp[6];
struct radeon_state_atom eye; /* eye pos */
struct radeon_state_atom grd; /* guard band clipping */
struct radeon_state_atom fog;
struct radeon_state_atom eye; /**< \brief eye pos */
struct radeon_state_atom grd; /**< \brief guard band clipping */
struct radeon_state_atom fog; /**< \brief fog */
struct radeon_state_atom glt;
/*@}*/
};
/**
* \brief Derived state for internal purposes:
*/
struct radeon_state {
/* Derived state for internal purposes:
*/
struct radeon_colorbuffer_state color;
struct radeon_depthbuffer_state depth;
struct radeon_pixel_state pixel;
@ -410,10 +436,11 @@ struct radeon_texture {
GLint numHeaps;
};
/* Need refcounting on dma buffers:
/**
* \brief Reference counting on DMA buffers.
*/
struct radeon_dma_buffer {
int refcount; /* the number of retained regions in buf */
int refcount; /**< \brief the number of retained regions in \p buf */
drmBufPtr buf;
};
@ -421,12 +448,15 @@ struct radeon_dma_buffer {
(rvb)->address - rmesa->dma.buf0_address + \
(rvb)->start)
/* A retained region, eg vertices for indexed vertices.
/**
* \brief A retained region.
*
* e.g. vertices for indexed vertices.
*/
struct radeon_dma_region {
struct radeon_dma_buffer *buf;
char *address; /* == buf->address */
int start, end, ptr; /* offsets from start of buf */
char *address; /**< \brief == buf->address */
int start, end, ptr; /**< \brief offsets from start of \p buf */
int aos_start;
int aos_stride;
int aos_size;
@ -434,22 +464,25 @@ struct radeon_dma_region {
struct radeon_dma {
/* Active dma region. Allocations for vertices and retained
* regions come from here. Also used for emitting random vertices,
* these may be flushed by calling flush_current();
/**
* \brief Active dma region.
*
* Allocations for vertices and retained regions come from here. Also used
* for emitting random vertices, these may be flushed by calling
* flush_current();
*/
struct radeon_dma_region current;
void (*flush)( radeonContextPtr );
char *buf0_address; /* start of buf[0], for index calcs */
GLuint nr_released_bufs; /* flush after so many buffers released */
char *buf0_address; /**< \brief start of buf[0], for index calcs */
GLuint nr_released_bufs; /**< \brief flush after so many buffers released */
};
struct radeon_dri_mirror {
__DRIcontextPrivate *context; /* DRI context */
__DRIscreenPrivate *screen; /* DRI screen */
__DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
__DRIcontextPrivate *context; /**< \brief DRI context */
__DRIscreenPrivate *screen; /**< \brief DRI screen */
__DRIdrawablePrivate *drawable; /**< \brief DRI drawable bound to this ctx */
drmContext hwContext;
drmLock *hwLock;
@ -501,61 +534,86 @@ struct radeon_ioctl {
/**
* \brief Radeon GL context.
*/
struct radeon_context {
GLcontext *glCtx; /* Mesa context */
/* Driver and hardware state management
/**
* \brief Mesa context.
*/
GLcontext *glCtx;
/**
* \name Driver and hardware state management
*/
/*@{*/
struct radeon_hw_state hw;
struct radeon_state state;
/*@}*/
/* Texture object bookkeeping
/**
* \brief Texture object bookkeeping
*/
struct radeon_texture texture;
/* Rasterization and vertex state:
/**
* \name Rasterization and vertex state
*/
/*@{*/
GLuint TclFallback;
GLuint Fallback;
GLuint NewGLState;
/*@}*/
/* Temporaries for translating away float colors:
/**
* \name Temporaries for translating away float colors
*/
/*@{*/
struct gl_client_array UbyteColor;
struct gl_client_array UbyteSecondaryColor;
/*@}*/
/* Vertex buffers
/**
* \name Vertex buffers
*/
/*@{*/
struct radeon_ioctl ioctl;
struct radeon_dma dma;
struct radeon_store store;
/*@}*/
/* Page flipping
/**
* \brief Page flipping
*/
GLuint doPageFlip;
/* Busy waiting
/**
* \name Busy waiting
*/
/*@{*/
GLuint do_usleeps;
GLuint do_irqs;
GLuint irqsEmitted;
drmRadeonIrqWait iw;
/*@}*/
/* Drawable, cliprect and scissor information
/**
* \name Drawable, cliprect and scissor information
*/
GLuint numClipRects; /* Cliprects for the draw buffer */
/*@{*/
GLuint numClipRects; /**< \brief Cliprects for the draw buffer */
XF86DRIClipRectPtr pClipRects;
unsigned int lastStamp;
GLboolean lost_context;
radeonScreenPtr radeonScreen; /* Screen private DRI data */
RADEONSAREAPrivPtr sarea; /* Private SAREA data */
radeonScreenPtr radeonScreen; /**< Screen private DRI data */
RADEONSAREAPrivPtr sarea; /**< \brief Private SAREA data */
/*@}*/
/* TCL stuff
/**
* \name TCL stuff
*/
/*@{*/
GLmatrix TexGenMatrix[RADEON_MAX_TEXTURE_UNITS];
GLboolean recheck_texgen[RADEON_MAX_TEXTURE_UNITS];
GLboolean TexGenNeedNormals[RADEON_MAX_TEXTURE_UNITS];
@ -563,8 +621,10 @@ struct radeon_context {
GLuint TexGenEnabled;
GLmatrix tmpmat;
GLuint last_ReallyEnabled;
/*@}*/
/* VBI
/**
* \brief VBI
*/
GLuint vbl_seq;
@ -582,11 +642,16 @@ struct radeon_context {
*/
/* struct radeon_vbinfo vb; */
/* Mirrors of some DRI state
/**
* \brief Mirrors of some DRI state
*/
struct radeon_dri_mirror dri;
};
/**
* Macro to get the pointer to the Radeon context from the GL context.
*/
#define RADEON_CONTEXT(ctx) ((radeonContextPtr)(ctx->DriverCtx))
@ -604,6 +669,7 @@ static __inline GLuint radeonPackColor( GLuint cpp,
}
}
/* ================================================================
* Debugging:
*/

View file

@ -1,4 +1,11 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.7 2002/09/16 18:05:19 eich Exp $ */
/**
* \file radeon_ioctl.c
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
@ -27,13 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.7 2002/09/16 18:05:19 eich Exp $ */
#include "glheader.h"
#include "imports.h"
@ -59,9 +60,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
static void radeonWaitForIdle( radeonContextPtr rmesa );
/* =============================================================
* Kernel command buffer handling
/***************************************************************
* \name Kernel command buffer handling
*/
/*@{*/
static void print_state_atom( struct radeon_state_atom *state )
{
@ -132,8 +134,9 @@ void radeonEmitState( radeonContextPtr rmesa )
/* Fire a section of the retained (indexed_verts) buffer as a regular
* primtive.
/**
* Fire a section of the retained (indexed_verts) buffer as a regular
* primitive.
*/
extern void radeonEmitVbufPrim( radeonContextPtr rmesa,
GLuint vertex_format,
@ -323,8 +326,9 @@ static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
}
/* Note: does not emit any commands to avoid recursion on
* radeonAllocCmdBuf.
/**
* \note Does not emit any commands to avoid recursion on
* radeonAllocCmdBuf().
*/
void radeonFlushCmdBuf( radeonContextPtr rmesa, const char *caller )
{
@ -341,11 +345,13 @@ void radeonFlushCmdBuf( radeonContextPtr rmesa, const char *caller )
}
}
/*@}*/
/* =============================================================
* Hardware vertex buffer handling
/***************************************************************
* \name Hardware vertex buffer handling
*/
/*@{*/
void radeonRefillCurrentDmaRegion( radeonContextPtr rmesa )
{
@ -452,8 +458,9 @@ void radeonReleaseDmaRegion( radeonContextPtr rmesa,
region->start = 0;
}
/* Allocates a region from rmesa->dma.current. If there isn't enough
* space in current, grab a new buffer (and discard what was left of current)
/**
* Allocates a region from rmesa->dma.current. If there isn't enough space in
* current, grab a new buffer (and discard what was left of current)
*/
void radeonAllocDmaRegion( radeonContextPtr rmesa,
struct radeon_dma_region *region,
@ -500,9 +507,13 @@ void radeonAllocDmaRegionVerts( radeonContextPtr rmesa,
radeonAllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
}
/* ================================================================
* SwapBuffers with client-side throttling
/*@}*/
/******************************************************************
* \name SwapBuffers with client-side throttling
*/
/*@{*/
static GLuint radeonGetLastFrame (radeonContextPtr rmesa)
{
@ -596,7 +607,8 @@ static void radeonWaitForFrameCompletion( radeonContextPtr rmesa )
}
}
/* Copy the back color buffer to the front color buffer.
/**
* \brief Copy the back color buffer to the front color buffer.
*/
void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
{
@ -707,10 +719,14 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
}
/*@}*/
/* ================================================================
/******************************************************************
* Buffer clear
*/
/*@{*/
#define RADEON_MAX_CLEARS 256
static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
@ -965,7 +981,8 @@ void radeonFlush( GLcontext *ctx )
}
}
/* Make sure all commands have been sent to the hardware and have
/**
* Make sure all commands have been sent to the hardware and have
* completed processing.
*/
void radeonFinish( GLcontext *ctx )
@ -984,6 +1001,11 @@ void radeonFinish( GLcontext *ctx )
}
/**
* \brief Setup the GL context callbacks.
*
* \sa Called by radeonCreateContext().
*/
void radeonInitIoctlFuncs( GLcontext *ctx )
{
ctx->Driver.Clear = radeonClear;
@ -991,3 +1013,4 @@ void radeonInitIoctlFuncs( GLcontext *ctx )
ctx->Driver.Flush = radeonFlush;
}
/*@}*/

View file

@ -1,4 +1,10 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.4 2002/09/16 18:05:20 eich Exp $ */
/**
* \file radeon_ioctl.h
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
@ -27,12 +33,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.4 2002/09/16 18:05:20 eich Exp $ */
#ifndef __RADEON_IOCTL_H__
#define __RADEON_IOCTL_H__
@ -104,7 +105,8 @@ extern void radeonCompatEmitPrimitive( radeonContextPtr rmesa,
* Helper macros:
*/
/* Close off the last primitive, if it exists.
/**
* \brief Close off the last primitive, if it exists.
*/
#define RADEON_NEWPRIM( rmesa ) \
do { \
@ -112,7 +114,8 @@ do { \
rmesa->dma.flush( rmesa ); \
} while (0)
/* Can accomodate several state changes and primitive changes without
/**
* Can accomodate several state changes and primitive changes without
* actually firing the buffer.
*/
#define RADEON_STATECHANGE( rmesa, ATOM ) \
@ -143,7 +146,8 @@ static __inline int RADEON_DB_STATECHANGE(
}
/* Fire the buffered vertices no matter what.
/**
* \brief Fire the buffered vertices no matter what.
*/
#define RADEON_FIREVERTICES( rmesa ) \
do { \
@ -152,7 +156,8 @@ do { \
} \
} while (0)
/* Alloc space in the command buffer
/**
* \brief Allocate space in the command buffer
*/
static __inline char *radeonAllocCmdBuf( radeonContextPtr rmesa,
int bytes, const char *where )
@ -170,6 +175,4 @@ static __inline char *radeonAllocCmdBuf( radeonContextPtr rmesa,
}
#endif /* __RADEON_IOCTL_H__ */

View file

@ -1,39 +1,39 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.4 2002/02/22 21:45:00 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
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@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*
/**
* \file radeon_screen.c
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
* 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.
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.4 2002/02/22 21:45:00 dawes Exp $ */
#include "glheader.h"
#include "imports.h"
@ -60,7 +60,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
/* Create the device specific screen private data struct.
/**
* \brief Create the device specific screen private data struct.
*
* \param sPriv DRI screen private data.
*
* \return pointer to the device specific screen private data.
*
* Checks the version compatability of the DRI extension, the DDX driver and
* the DRM driver.
*
* Disables the TCL for DRM versions less than 1.3.x, or if the RADEON_COMPAT
* environment variable is set. Requests the AGP buffer offset to the DRM for
* versions >=1.3.x, and the IRQ number for >=1.6.x.
*
* Maps the MMIO region, the status region, the vertex buffers and (if
* available) the AGP texture region.
*
* Fills in the device screen private data with the DRI screen private data
* supplied.
*/
radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
{
@ -246,7 +264,13 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
return radeonScreen;
}
/* Destroy the device specific screen private data struct.
/**
* \brief Destroy the device specific screen private data struct.
*
* \param sPriv DRI screen private data.
*
* Unmaps all previously mapped regions and deallocates the device specific
* private data.
*/
void radeonDestroyScreen( __DRIscreenPrivate *sPriv )
{

View file

@ -1,39 +1,39 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.3 2002/02/22 21:45:01 dawes Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
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.
**************************************************************************/
/**
* \file radeon_screen.h
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
* 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.
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.3 2002/02/22 21:45:01 dawes Exp $ */
#ifndef __RADEON_SCREEN_H__
#define __RADEON_SCREEN_H__
@ -48,22 +48,28 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_sarea.h"
/**
* \brief DRM region information.
*/
typedef struct {
drmHandle handle; /* Handle to the DRM region */
drmSize size; /* Size of the DRM region */
drmAddress map; /* Mapping of the DRM region */
drmHandle handle; /**< \brief Handle to the DRM region */
drmSize size; /**< \brief Size of the DRM region */
drmAddress map; /**< \brief Mapping of the DRM region */
} radeonRegionRec, *radeonRegionPtr;
/* chipset features */
#define RADEON_CHIPSET_TCL (1 << 0)
/**
* \brief Device specific screen private data.
*/
typedef struct {
int chipset;
int cpp;
int IsPCI; /* Current card is a PCI card */
int AGPMode;
unsigned int irq; /* IRQ number (0 means none) */
int IsPCI; /**< \brief Current card is a PCI card */
int AGPMode; /**< \brief AGP mode */
unsigned int irq; /**< \brief IRQ number (0 means none) */
unsigned int frontOffset;
unsigned int frontPitch;
@ -73,11 +79,15 @@ typedef struct {
unsigned int depthOffset;
unsigned int depthPitch;
/* Shared texture data */
/**
* \name Shared texture data
*/
/*@{*/
int numTexHeaps;
int texOffset[RADEON_NR_TEX_HEAPS];
int texSize[RADEON_NR_TEX_HEAPS];
int logTexGranularity[RADEON_NR_TEX_HEAPS];
/*@}*/
radeonRegionRec mmio;
radeonRegionRec status;
@ -89,7 +99,7 @@ typedef struct {
__DRIscreenPrivate *driScreen;
unsigned int sarea_priv_offset;
unsigned int agp_buffer_offset; /* offset in card memory space */
unsigned int agp_buffer_offset; /**< offset in card memory space */
} radeonScreenRec, *radeonScreenPtr;
extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv );

View file

@ -1,4 +1,10 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.5 2002/09/16 18:05:20 eich Exp $ */
/**
* \file radeon_state.c
*
* \author Gareth Hughes <gareth@valinux.com>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Copyright 2000, 2001 VA Linux Systems Inc., Fremont, California.
*
@ -22,12 +28,10 @@
* 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:
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.5 2002/09/16 18:05:20 eich Exp $ */
#include "glheader.h"
#include "imports.h"
#include "api_arrayelt.h"
@ -61,10 +65,23 @@
#define TEXMAT_2 5
/* =============================================================
* Alpha blending
/***************************************************************
* \name Alpha blending
*/
/*@{*/
/**
* \brief Specify the alpha test function
*
* \param ctx GL context.
* \param func alpha comparison function.
* \param ref reference alpha value.
*
* \sa glAlphaFunc().
*
* Calculates the appropriate new value of the RADEON_PP_MISC register and
* informs the state change.
*/
static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -143,6 +160,18 @@ static void radeonBlendEquation( GLcontext *ctx, GLenum mode )
}
#endif
/**
* \brief Specify the blending factors.
*
* \param ctx GL context.
* \param sfactor source factor.
* \param dfactor destination factor.
*
* Calculates the appropriate new value of the RADEON_RB3D_BLENDCNTL register and informs of the state change.
*
* If the final state not supported by the hardward it fallbacks to software
* rendering.
*/
static void radeonBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -245,6 +274,10 @@ static void radeonBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
}
}
/**
* Alias for radeonBlendFunc()
*/
static void radeonBlendFuncSeparate( GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
@ -252,11 +285,26 @@ static void radeonBlendFuncSeparate( GLcontext *ctx,
radeonBlendFunc( ctx, sfactorRGB, dfactorRGB );
}
/*@}*/
/* =============================================================
* Depth testing
/***************************************************************
* \name Depth testing
*/
/*@{*/
#if _HAVE_FULL_GL
/**
* \brief Specify the function for depth comparisons.
*
* \param ctx GL context.
* \param func depth comparison function.
*
* \sa glDepthFunc().
*
* Calculates the appropriate new value of the RADEON_RB3D_ZSTENCILCNTL
* register and informs of the state change.
*/
static void radeonDepthFunc( GLcontext *ctx, GLenum func )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -292,7 +340,17 @@ static void radeonDepthFunc( GLcontext *ctx, GLenum func )
}
}
/**
* \brief Enable or disable depth buffering.
*
* \param ctx GL context
* \param flag whether depth buferring is enabled or not.
*
* \sa glDepthBuffer().
*
* Calculates the appropriate new value of the RADEON_RB3D_ZSTENCILCNTL
* register and informs of the state change.
*/
static void radeonDepthMask( GLcontext *ctx, GLboolean flag )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -305,6 +363,16 @@ static void radeonDepthMask( GLcontext *ctx, GLboolean flag )
}
}
/**
* \brief Specify the clear value for the depth buffer.
*
* \param d depth value to be used when clering the depth buffer.
*
* \sa glClearDepth().
*
* Calculates the new value of RADEON_RB3D_ZSTENCILCNTL register. It's not
* necessary to inform of the sate change.
*/
static void radeonClearDepth( GLcontext *ctx, GLclampd d )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -322,12 +390,23 @@ static void radeonClearDepth( GLcontext *ctx, GLclampd d )
}
#endif
/*@}*/
/* =============================================================
* Scissoring
/***************************************************************
* \name Scissoring
*/
/*@{*/
/**
* \brief Intersection of two cliprects.
*
* \param out resulting clirect.
* \param a fist cliprect.
* \param b second cliprect.
*
* \return GL_TRUE if the cliprects intersect, or GL_FALSE otherwise.
*/
static GLboolean intersect_rect( XF86DRIClipRectPtr out,
XF86DRIClipRectPtr a,
XF86DRIClipRectPtr b )
@ -417,11 +496,28 @@ static void radeonScissor( GLcontext *ctx,
}
/*@}*/
/* =============================================================
* Culling
/***************************************************************
* \name Culling
*/
/*@{*/
/**
* \brief Specify whether culling should be made.
*
* \param ctx GL context.
* \param unused not used.
*
* \note the Cull mode is already stored in the GL context.
*
* \sa glCullFace().
*
* Calculates the new values of the RADEON_SET_SE_CNTL and
* RADEON_TCL_UCP_VERT_BLEND_CTL registers and informs of the state change if
* they are different.
*/
static void radeonCullFace( GLcontext *ctx, GLenum unused )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -459,6 +555,17 @@ static void radeonCullFace( GLcontext *ctx, GLenum unused )
}
}
/**
* \brief Specify orientation of front-facing polygons.
*
* \param ctx GL context.
* \param mode orientation.
*
* \sa glFrontFace().
*
* Calculates the new values of the RADEON_SET_SE_CNTL and
* RADEON_TCL_UCP_VERT_BLEND_CTL registers and informs of the state change.
*/
static void radeonFrontFace( GLcontext *ctx, GLenum mode )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -480,9 +587,24 @@ static void radeonFrontFace( GLcontext *ctx, GLenum mode )
}
}
/*@}*/
/* =============================================================
* Line state
/***************************************************************
* \name Line state
*/
/*@{*/
/**
* \brief Specify the line width.
*
* \param ctx GL context.
* \param widthf width of rasterized lines.
*
* \sa glLineWidth().
*
* Calculates the new values of the RADEON_LIN_SE_LINE_WIDTH and
* RADEON_SET_SE_CNTL registers and informs of the state change.
*/
static void radeonLineWidth( GLcontext *ctx, GLfloat widthf )
{
@ -501,6 +623,18 @@ static void radeonLineWidth( GLcontext *ctx, GLfloat widthf )
}
}
/**
* \brief Specify the line stipple pattern.
*
* \param ctx GL context.
* \param factor scale factor.
* \param pattern bit pattern.
*
* \sa glLineStipple().
*
* Calculates the new values of the RADEON_LIN_RE_LINE_PATTERN register and
* informs of the state change.
*/
static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -510,9 +644,27 @@ static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern));
}
/*@}*/
/* =============================================================
* Masks
/***************************************************************
* \name Masks
*/
/*@{*/
/**
* \brief Specify the masking of frame buffer color components.
*
* \param ctx GL context.
* \param r whether the red component should be written.
* \param g whether the green component should be written.
* \param b whether the blue component should be written.
* \param a whether the alpha component should be written.
*
* \sa glColorMask().
*
* Calculates the new value of the RADEON_MSK_RB3D_PLANEMASK register and
* informs of the state change if it varies.
*/
static void radeonColorMask( GLcontext *ctx,
GLboolean r, GLboolean g,
@ -531,10 +683,14 @@ static void radeonColorMask( GLcontext *ctx,
}
}
/*@}*/
/* =============================================================
* Polygon state
/***************************************************************
* \name Polygon state
*/
/*@{*/
#if _HAVE_FULL_GL
static void radeonPolygonOffset( GLcontext *ctx,
GLfloat factor, GLfloat units )
@ -573,9 +729,6 @@ static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
}
#endif
static void radeonShadeModel( GLcontext *ctx, GLenum mode )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -609,13 +762,28 @@ static void radeonShadeModel( GLcontext *ctx, GLenum mode )
}
}
/*@}*/
/* =============================================================
* Stencil
/***************************************************************
* \name Stencil
*/
/*@{*/
/**
* \brief Specify the stencil testing function.
*
* \param ctx GL context.
* \param func test function.
* \param ref reference value for the stencil test.
* \param mask bit mask to be ANDed with both the reference and stored values
* when the test is done.
*
* \sa glStencilFunc().
*
* Calculates the new value of the RADEON_CTX_RB3D_ZSTENCILCNTL and
* RADEON_MSK_RB3D_STENCILREFMASK registers and informs of the state change.
*/
static void radeonStencilFunc( GLcontext *ctx, GLenum func,
GLint ref, GLuint mask )
{
@ -660,6 +828,17 @@ static void radeonStencilFunc( GLcontext *ctx, GLenum func,
rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask;
}
/**
* \brief Specify the stencil writing mask.
*
* \param ctx GL context.
* \param mask bit mask to control the writing of the bits in the stencil plane.
*
* \sa glStencilMask().
*
* Calculates the new value of the RADEON_MSK_RB3D_STENCILREFMASK register and
* informs of the state change.
*/
static void radeonStencilMask( GLcontext *ctx, GLuint mask )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -670,6 +849,21 @@ static void radeonStencilMask( GLcontext *ctx, GLuint mask )
(ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT);
}
/**
* \brief Specify the stencil test actions.
*
* \param ctx GL context.
* \param fail action to take when the stencil test fails.
* \param zfail action to take when the stencil test passes, but the depth test
* fails.
* \param zpass action to take when both the stencil test and the depth test
* fail.
*
* \sa glStencilOp().
*
* Calculates the new value of the RADEON_CTX_RB3D_ZSTENCILCNTL register and
* informs of the state change.
*/
static void radeonStencilOp( GLcontext *ctx, GLenum fail,
GLenum zfail, GLenum zpass )
{
@ -748,6 +942,15 @@ static void radeonStencilOp( GLcontext *ctx, GLenum fail,
#endif
}
/**
* \brief Specify the clear value for the stencil buffer.
*
* \param ctx GL context.
* \param s the index used when the stencil buffer is used. Not used.
*
* Sets the new value of stencil clear register with the value stored in the GL
* context.
*/
static void radeonClearStencil( GLcontext *ctx, GLint s )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -758,10 +961,13 @@ static void radeonClearStencil( GLcontext *ctx, GLint s )
(ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT));
}
/*@}*/
/* =============================================================
* Window position and viewport transformation
/***************************************************************
* \name Window position and viewport transformation
*/
/*@{*/
/*
* To correctly position primitives:
@ -795,7 +1001,21 @@ void radeonUpdateWindow( GLcontext *ctx )
}
/**
* \brief Set the viewport.
*
* \param ctx GL context.
* \param x \e x position of the lower left corner of the viewport rectangle.
* Not used.
* \param y \e y position of the lower left corner of the viewport rectangle.
* Not used.
* \param width width of the viewport rectangle. Not used.
* \param height height of the viewport rectangle. Not used.
*
* \sa glViewport().
*
* Fires the vertices and updates the window.
*/
static void radeonViewport( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height )
{
@ -807,18 +1027,41 @@ static void radeonViewport( GLcontext *ctx, GLint x, GLint y,
radeonUpdateWindow( ctx );
}
/**
* \brief Specify the depth range.
*
* \param ctx GL context.
* \param nearval near clipping plane coordinate. Not used.
* \param farval far clipping plane coordinate. Not used.
*
* \sa glDepthRange().
*
* Just calls radeonUpdateWindow().
*/
static void radeonDepthRange( GLcontext *ctx, GLclampd nearval,
GLclampd farval )
{
radeonUpdateWindow( ctx );
}
/*@}*/
/* =============================================================
* Miscellaneous
/***************************************************************
* \name Miscellaneous
*/
/*@{*/
/**
* \brief Specify the clear value of the color buffers.
*
* \param ctx GL context.
* \param color red, green, blue and alpha values used when clering the color buffers.
*
* \sa glClearColor().
*
* Stores the clear color value in the driver state.
*/
static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -832,8 +1075,6 @@ static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
}
static GLuint radeon_rop_tab[] = {
RADEON_ROP_CLEAR,
RADEON_ROP_AND,
@ -853,6 +1094,17 @@ static GLuint radeon_rop_tab[] = {
RADEON_ROP_SET,
};
/**
* \brief Specify a logical pixel operation for color rendering.
*
* \param ctx GL context.
* \param opcode logical operation.
*
* \sa glLogicOp().
*
* Calculates the new value of RADEON_MSK_RB3D_ROPCNTL and informs of the state
* change.
*/
static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -864,7 +1116,6 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = radeon_rop_tab[rop];
}
void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode )
{
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
@ -899,7 +1150,14 @@ void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode )
radeonRecalcScissorRects( rmesa );
}
/**
* \brief Specify which color buffers to be drawn into.
*
* \param ctx GL context.
* \param mode which color buffers to be drawn into.
*
* \sa glDrawBuffer().
*/
static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -970,11 +1228,25 @@ static void radeonReadBuffer( GLcontext *ctx, GLenum mode )
{
}
/*@}*/
/* =============================================================
* State enable/disable
/***************************************************************
* \name State enable/disable
*/
/*@{*/
/**
* \brief Enable or disable a GL capability.
*
* \param cap GL capability.
* \param state whether to enable or disable the capability.
*
* \sa glEnable() and glDisable().
*
* Changes the apropriate registers and state variables, informing of the state
* change if necessary.
*/
static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -1274,13 +1546,24 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
}
}
/* =============================================================
* Deferred state management - matrices, textures, other?
/*@}*/
/***************************************************************
* \name Deferred state management - matrices, textures, other?
*/
/*@{*/
/**
* \brief Upload a transformation matrix.
*
* \param rmesa Radeon driver context.
* \param src source transformation matrix.
* \param idx index of the transformation matrix to upload.
*
* Transposes and updates the matrix in the driver context and informs of the
* state change.
*/
void radeonUploadMatrix( radeonContextPtr rmesa, GLfloat *src, int idx )
{
float *dest = ((float *)RADEON_DB_STATE( mat[idx] ))+MAT_ELT_0;
@ -1297,6 +1580,11 @@ void radeonUploadMatrix( radeonContextPtr rmesa, GLfloat *src, int idx )
RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
}
/**
* \brief Upload a transposed transformation matrix.
*
* Same as radeonUploadMatrix() but without the need to transpose.
*/
void radeonUploadMatrixTranspose( radeonContextPtr rmesa, GLfloat *src,
int idx )
{
@ -1306,9 +1594,6 @@ void radeonUploadMatrixTranspose( radeonContextPtr rmesa, GLfloat *src,
}
void radeonValidateState( GLcontext *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@ -1378,7 +1663,13 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
/* Initialize the driver's state functions.
/**
* \brief Initialize the driver's state functions.
*
* \param ctx GL context.
*
* Called by radeonCreateContext() to fill the driver's state functions
* with those living in this file.
*/
void radeonInitStateFuncs( GLcontext *ctx )
{
@ -1423,3 +1714,5 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.Viewport = radeonViewport;
}
/*@}*/

View file

@ -1,39 +1,41 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.h,v 1.3 2002/09/16 18:05:20 eich Exp $ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
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@valinux.com>
* Gareth Hughes <gareth@valinux.com>
/**
* \file radeon_state.h
*
* \authors Kevin E. Martin <martin@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*
*/
/*
*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
* 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.
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.h,v 1.3 2002/09/16 18:05:20 eich Exp $ */
#ifndef __RADEON_STATE_H__
#define __RADEON_STATE_H__
@ -56,6 +58,7 @@ extern void radeonPrintDirty( radeonContextPtr rmesa,
extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) do { \
if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
__FUNCTION__, bit, mode ); \

View file

@ -1,4 +1,11 @@
/* $XFree86$ */
/**
* \file radeon_state_init.c
* \brief State initialization.
*
* \author Gareth Hughes <gareth@valinux.com>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Copyright 2000, 2001 VA Linux Systems Inc., Fremont, California.
*
@ -22,12 +29,10 @@
* 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:
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
*/
/* $XFree86$ */
#include "glheader.h"
#include "imports.h"
#include "mmath.h"
@ -50,10 +55,10 @@
#include "radeon_tex.h"
#include "radeon_vtxfmt.h"
/* =============================================================
* State initialization
*/
/**
* \brief Print the dirty context state info.
*/
void radeonPrintDirty( radeonContextPtr rmesa, const char *msg )
{
struct radeon_state_atom *l;
@ -99,12 +104,19 @@ static int cmdscl( int offset, int stride, int count )
return h.i;
}
/**
* \brief Utility macro for state checking functions definition.
*/
#define CHECK( NM, FLAG ) \
static GLboolean check_##NM( GLcontext *ctx ) \
{ \
return FLAG; \
}
/**
* \brief Utility macro for TCL state checking functions definition.
*/
#define TCL_CHECK( NM, FLAG ) \
static GLboolean check_##NM( GLcontext *ctx ) \
{ \
@ -140,7 +152,8 @@ TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled )
/* Initialize the context's hardware state.
/**
* \brief Initialize the context's hardware state.
*/
void radeonInitState( radeonContextPtr rmesa )
{

View file

@ -1,37 +1,38 @@
/* $XFree86$ */
/**************************************************************************
Copyright 2003 ATI Technologies Inc., Ontario, Canada, and
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
on 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
ATI, TUNGSTEN GRAPHICS 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.
**************************************************************************/
/**
* \file radeon_subset_bitmap.c
*
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Copyright 2003 ATI Technologies Inc., Ontario, Canada, and
* 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
* on 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
* ATI, TUNGSTEN GRAPHICS 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.
*
*/
/* $XFree86$ */
#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
@ -45,7 +46,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_state.h"
#include "radeon_subset.h"
/* Cope with depth operations by drawing individual pixels as points???
/**
* \brief Cope with depth operations by drawing individual pixels as points
*/
void
radeonPointsBitmap( GLcontext *ctx, GLint px, GLint py,

View file

@ -1,38 +1,39 @@
/* $XFree86$ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
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
on 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
ATI, TUNGSTEN GRAPHICS 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.
**************************************************************************/
/**
* \file radeon_subset_readpix.c
*
* \author Keith Whitwell <keith@tungstengraphics.com>
* \author Brian Paul <brian@tungstengraphics.com>
*/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Brian Paul <brian@tungstengraphics.com>
* Copyright 2003 ATI Technologies Inc., Ontario, Canada, and
* 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
* on 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
* ATI, TUNGSTEN GRAPHICS 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.
*
*/
/* $XFree86$ */
#include "glheader.h"
#include "mtypes.h"
#include "colormac.h"
@ -88,10 +89,11 @@ static void ReadRGBASpan( const GLcontext *ctx,
/*
* Optimized glReadPixels for particular pixel formats:
* GL_UNSIGNED_BYTE, GL_RGBA
* when pixel scaling, biasing and mapping are disabled.
/**
* \brief Optimized glReadPixels
*
* For particular pixel formats GL_UNSIGNED_BYTE, GL_RGBA when pixel scaling,
* biasing and mapping are disabled.
*/
void radeonReadPixels( GLcontext *ctx,
GLint x, GLint y,

View file

@ -1,4 +1,6 @@
/* $Id: radeon_subset_select.c,v 1.1.2.1 2003/02/07 20:22:17 keithw Exp $ */
/**
* \file radeon_subset_select.c
*/
/*
* Mesa 3-D graphics library
@ -24,6 +26,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* $Id: radeon_subset_select.c,v 1.1.2.2 2003/02/16 20:48:12 jrfonseca Exp $ */
#include "glheader.h"
#include "imports.h"
@ -54,11 +58,12 @@ static struct {
/**********************************************************************/
/***** Vertex Transformation and Clipping *****/
/** \name Vertex Transformation and Clipping */
/**********************************************************************/
/*@{*/
/*
* Transform a point (column vector) by a matrix: Q = M * P
/**
* \brief Transform a point (column vector) by a matrix: Q = M * P
*/
#define TRANSFORM_POINT( Q, M, P ) \
Q.x = M[0] * P.x + M[4] * P.y + M[8] * P.z + M[12] * P.w; \
@ -66,8 +71,8 @@ static struct {
Q.z = M[2] * P.x + M[6] * P.y + M[10] * P.z + M[14] * P.w; \
Q.w = M[3] * P.x + M[7] * P.y + M[11] * P.z + M[15] * P.w;
/*
* clip coord to window coord mapping
/**
* \brief Clip coord to window coord mapping
*/
#define MAP_POINT( Q, P, VP ) \
Q.x = (GLfloat) (((P.x / P.w) + 1.0) * VP.Width / 2.0 + VP.X); \
@ -76,15 +81,15 @@ static struct {
Q.w = (GLfloat) P.w;
/*
* Linear interpolation:
/**
* \brief Linear interpolation:
*/
#define INTERPOLATE(T, A, B) ((A) + ((B) - (A)) * (T))
/*
* Interpolate vertex position, color, texcoords, etc.
/**
* \brief Interpolate vertex position, color, texcoords, etc.
*/
static void
interpolate_vertex(GLfloat t, const vertex *v0, const vertex *v1,
@ -112,7 +117,9 @@ interpolate_vertex(GLfloat t, const vertex *v0, const vertex *v1,
/* clip bit codes */
/*
* Clip bit codes
*/
#define CLIP_LEFT 1
#define CLIP_RIGHT 2
#define CLIP_BOTTOM 4
@ -121,10 +128,10 @@ interpolate_vertex(GLfloat t, const vertex *v0, const vertex *v1,
#define CLIP_FAR 32
/*
* Apply view volume clip testing to a point.
* Return: 0 - visible
* non-zero - clip code mask (or of above CLIP_ bits)
/**
* \brief Apply view volume clip testing to a point.
*
* \return zero if visible, or the clip code mask (binary OR of above CLIP_* bits)
*/
static GLuint
clip_point(const vertex *v)
@ -140,12 +147,16 @@ clip_point(const vertex *v)
}
/*
* Apply clipping to a line segment.
* Input: v0, v1 - incoming vertices
* Output: v0out, v1out - result/clipped vertices
* Return: GL_TRUE: visible
* GL_FALSE: totally clipped
/**
* \brief Apply clipping to a line segment.
*
* \param v0in input start vertice
* \param v1in input end vertice
* \param v0new output start vertice
* \param v1new output end vertice
*
* \return GL_TRUE if the line segment is visible, ot GL_FALS if it is totally
* clipped.
*/
static GLboolean
clip_line(const vertex *v0in, const vertex *v1in,
@ -169,7 +180,7 @@ clip_line(const vertex *v0in, const vertex *v1in,
v1 = *v1in;
/*
/**
* We use 6 instances of this code to clip agains the 6 planes.
* For each plane, we define the OUTSIDE and COMPUTE_INTERSECTION
* macros apprpriately.
@ -266,12 +277,14 @@ clip_line(const vertex *v0in, const vertex *v1in,
/*
* Apply clipping to a polygon.
* Input: vIn - array of input vertices
* inCount - number of input vertices
* Output: vOut - new vertices
* Return: number of vertices in vOut
/**
* \brief Apply clipping to a polygon.
*
* \param vIn array of input vertices.
* \param inCount number of input vertices
* \param vOut array of output vertices.
*
* \return number of vertices in /p vOut.
*/
static GLuint
clip_polygon(const vertex *vIn, unsigned int inCount, vertex *vOut)
@ -417,11 +430,14 @@ clip_polygon(const vertex *vIn, unsigned int inCount, vertex *vOut)
return result;
}
/*@}*/
/**********************************************************************/
/***** Selection *****/
/** \name Selection */
/**********************************************************************/
/*@{*/
static void
@ -689,7 +705,8 @@ static void radeon_select_Vertex3fv(const GLfloat * v)
}
/* Color
/*
* Color
*/
static void radeon_select_Color4f( GLfloat r, GLfloat g,
GLfloat b, GLfloat a )
@ -717,7 +734,8 @@ static void radeon_select_Color3fv( const GLfloat *v )
radeon_select_Color4f( v[0], v[1], v[2], 1.0 );
}
/* TexCoord
/*
* TexCoord
*/
static __inline__ void radeon_select_TexCoord2f( GLfloat s, GLfloat t )
{
@ -733,7 +751,8 @@ static void radeon_select_TexCoord2fv( const GLfloat *v )
}
/* Begin/End
/*
* Begin/End
*/
static void radeon_select_Begin(GLenum mode)
{
@ -776,7 +795,8 @@ static void radeon_select_End(void)
ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
}
/* Nothing much to do here, as we don't buffer anything:
/*
* Nothing much to do here, as we don't buffer anything:
*/
static void radeonSelectFlushVertices( GLcontext *ctx, GLuint flags )
{
@ -823,3 +843,5 @@ void radeonInitSelect( GLcontext *ctx )
{
ctx->Driver.RenderMode = radeonRenderMode;
}
/*@}*/

View file

@ -1,4 +1,10 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.6 2002/09/16 18:05:20 eich Exp $ */
/**
* \file radeon_subset_tex.c
*
* \author Gareth Hughes <gareth@valinux.com>
* \author Brian Paul <brianp@valinux.com>
*/
/*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
* VA Linux Systems Inc., Fremont, California.
@ -23,12 +29,10 @@
* 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:
* Gareth Hughes <gareth@valinux.com>
* Brian Paul <brianp@valinux.com>
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.6 2002/09/16 18:05:20 eich Exp $ */
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
@ -48,7 +52,11 @@
#include <stdio.h>
/* Destroy hardware state associated with texture `t'.
/**
* \brief Destroy hardware state associated with a texture.
*
* \param rmesa device context data.
* \param t texture object to be destroyed.
*/
void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
{
@ -73,7 +81,8 @@ void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
}
/* Keep track of swapped out texture objects.
/**
* \brief Keep track of swapped out texture objects.
*/
static void radeonSwapOutTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
{
@ -88,7 +97,8 @@ static void radeonSwapOutTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
/* Texture space has been invalidated.
/**
* Texture space has been invalidated.
*/
void radeonAgeTextures( radeonContextPtr rmesa, int heap )
{
@ -101,9 +111,10 @@ void radeonAgeTextures( radeonContextPtr rmesa, int heap )
}
/* =============================================================
* Texture image conversions
/***************************************************************
* \name Texture image conversions
*/
/*@{*/
/* Upload the texture image associated with texture `t' at level `level'
* at the address relative to `start'.
@ -146,9 +157,12 @@ static void radeonUploadSubImage( radeonContextPtr rmesa,
}
}
/* Upload the texture images associated with texture `t'. This might
* require removing our own and/or other client's texture objects to
/**
* \brief Upload texture images.
*
* This might require removing our own and/or other client's texture objects to
* make room for these images.
*
*/
static void radeonSetTexImages( radeonContextPtr rmesa,
struct gl_texture_object *tObj )
@ -319,11 +333,13 @@ static void radeonSetTexImages( radeonContextPtr rmesa,
t->dirty_images = 0;
}
/*@}*/
/* ================================================================
* Texture combine functions
/******************************************************************
* \name Texture combine functions
*/
/*@{*/
#define RADEON_DISABLE 0
#define RADEON_REPLACE 1
@ -439,12 +455,13 @@ static GLuint radeon_alpha_combine[][RADEON_MAX_COMBFUNC] =
};
/*@}*/
/* ================================================================
* Texture unit state management
/******************************************************************
* \name Texture unit state management
*/
/*@{*/
static void radeonUpdateTextureEnv( GLcontext *ctx, int unit )
{
@ -845,3 +862,5 @@ void radeonInitTextureFuncs( GLcontext *ctx )
radeonInitTextureObjects( ctx );
}
/*@}*/

View file

@ -1,37 +1,38 @@
/* $XFree86$ */
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
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
on 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
ATI, TUNGSTEN GRAPHICS 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.
**************************************************************************/
/**
* \file radeon_subset_vtx.c
*
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*
* Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
* 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
* on 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
* ATI, TUNGSTEN GRAPHICS 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.
*
*/
/* $XFree86$ */
#include "glheader.h"
#include "imports.h"
#include "api_noop.h"
@ -774,7 +775,8 @@ void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
fprintf(stderr, "Warning: hit nonexistant fallback path!\n");
}
/* Called by radeonPointsBitmap to disable tcl.
/**
* Called by radeonPointsBitmap to disable TCL.
*/
void radeonSubsetVtxEnableTCL( radeonContextPtr rmesa, GLboolean flag )
{