X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fr200%2Fr200_ioctl.h;h=5ed1555f6a324a11378216ec974a66b75929ff43;hb=0985e786cdd08bf900db889b69783be4bc467e5b;hp=067919460381048a5daa0f780ad722b64f75371f;hpb=ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0;p=mesa.git diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 06791946038..5ed1555f6a3 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -36,8 +35,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R200_IOCTL_H__ #define __R200_IOCTL_H__ -#ifdef GLX_DIRECT_RENDERING - #include "simple_list.h" #include "radeon_dri.h" #include "r200_lock.h" @@ -88,17 +85,12 @@ extern void r200AllocDmaRegion( r200ContextPtr rmesa, int bytes, int alignment ); -extern void r200AllocDmaRegionVerts( r200ContextPtr rmesa, - struct r200_dma_region *region, - int numverts, - int vertsize, - int alignment ); - extern void r200ReleaseDmaRegion( r200ContextPtr rmesa, struct r200_dma_region *region, const char *caller ); -extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable ); +extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable, + const drm_clip_rect_t *rect); extern void r200PageFlip( const __DRIdrawablePrivate *drawable ); extern void r200Flush( GLcontext *ctx ); extern void r200Finish( GLcontext *ctx ); @@ -106,16 +98,19 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForVBlank( r200ContextPtr rmesa ); extern void r200InitIoctlFuncs( struct dd_function_table *functions ); -extern void *r200AllocateMemoryMESA( GLsizei size, GLfloat readfreq, +extern void *r200AllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority ); -extern void r200FreeMemoryMESA( GLvoid *pointer ); -extern GLuint r200GetMemoryOffsetMESA( const GLvoid *pointer ); +extern void r200FreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLvoid *pointer ); +extern GLuint r200GetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer ); + extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, GLint size ); extern GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer ); +void r200SetUpAtomList( r200ContextPtr rmesa ); + /* ================================================================ * Helper macros: */ @@ -134,7 +129,8 @@ do { \ #define R200_STATECHANGE( rmesa, ATOM ) \ do { \ R200_NEWPRIM( rmesa ); \ - move_to_head( &(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \ + rmesa->hw.ATOM.dirty = GL_TRUE; \ + rmesa->hw.is_dirty = GL_TRUE; \ } while (0) #define R200_DB_STATE( ATOM ) \ @@ -148,7 +144,8 @@ static __inline int R200_DB_STATECHANGE( if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size*4)) { int *tmp; R200_NEWPRIM( rmesa ); - move_to_head( &(rmesa->hw.dirty), atom ); + atom->dirty = GL_TRUE; + rmesa->hw.is_dirty = GL_TRUE; tmp = atom->cmd; atom->cmd = atom->lastcmd; atom->lastcmd = tmp; @@ -168,6 +165,31 @@ do { \ } \ } while (0) +/* Command lengths. Note that any time you ensure ELTS_BUFSZ or VBUF_BUFSZ + * are available, you will also be adding an rmesa->state.max_state_size because + * r200EmitState is called from within r200EmitVbufPrim and r200FlushElts. + */ +#define AOS_BUFSZ(nr) ((3 + ((nr / 2) * 3) + ((nr & 1) * 2)) * sizeof(int)) +#define VERT_AOS_BUFSZ (5 * sizeof(int)) +#define ELTS_BUFSZ(nr) (12 + nr * 2) +#define VBUF_BUFSZ (3 * sizeof(int)) + +/* Ensure that a minimum amount of space is available in the command buffer. + * This is used to ensure atomicity of state updates with the rendering requests + * that rely on them. + * + * An alternative would be to implement a "soft lock" such that when the buffer + * wraps at an inopportune time, we grab the lock, flush the current buffer, + * and hang on to the lock until the critical section is finished and we flush + * the buffer again and unlock. + */ +static __inline void r200EnsureCmdBufSpace( r200ContextPtr rmesa, int bytes ) +{ + if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ) + r200FlushCmdBuf( rmesa, __FUNCTION__ ); + assert( bytes <= R200_CMD_BUF_SZ ); +} + /* Alloc space in the command buffer */ static __inline char *r200AllocCmdBuf( r200ContextPtr rmesa, @@ -184,8 +206,4 @@ static __inline char *r200AllocCmdBuf( r200ContextPtr rmesa, return head; } - - - -#endif #endif /* __R200_IOCTL_H__ */