diff options
Diffstat (limited to 'src/mesa')
88 files changed, 417 insertions, 996 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 27eb186abed..e0b641b921e 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -29,11 +29,11 @@ default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs # Helper libraries used by many drivers: # Make archive of core mesa object files -libmesa.a: $(MESA_OBJECTS) asm_subdirs +libmesa.a: $(MESA_OBJECTS) @ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS) # Make archive of gl* API dispatcher functions only -libglapi.a: $(GLAPI_OBJECTS) asm_subdirs +libglapi.a: $(GLAPI_OBJECTS) @ $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS) @@ -113,7 +113,7 @@ install-osmesa: default $(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)* \ $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) -install-dri: +install-dri: default cd drivers/dri && $(MAKE) install diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c index 665731c327a..a364ada1f19 100644 --- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c +++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c @@ -102,7 +102,7 @@ typedef struct { static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; static unsigned int global_ref = 0; -static inline int directfbgl_init( void ) +static INLINE int directfbgl_init( void ) { pthread_mutexattr_t attr; int ret; @@ -118,7 +118,7 @@ static inline int directfbgl_init( void ) return ret; } -static inline void directfbgl_finish( void ) +static INLINE void directfbgl_finish( void ) { if (--global_ref == 0) pthread_mutex_destroy( &global_lock ); diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 203479e3267..f126d084064 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -53,6 +53,7 @@ #include <drm.h> #include <drm_sarea.h> #include <xf86drm.h> +#include "glheader.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" #include "GL/internal/dri_sarea.h" diff --git a/src/mesa/drivers/dri/common/memops.h b/src/mesa/drivers/dri/common/memops.h index 4952d788e81..9cd1d8ec3fa 100644 --- a/src/mesa/drivers/dri/common/memops.h +++ b/src/mesa/drivers/dri/common/memops.h @@ -4,7 +4,7 @@ * memset an area in I/O space * We need to be careful about this on some archs */ -static __inline__ void drimemsetio(void* address, int c, int size) +static INLINE void drimemsetio(void* address, int c, int size) { #if defined(__powerpc__) || defined(__ia64__) int i; diff --git a/src/mesa/drivers/dri/common/mmio.h b/src/mesa/drivers/dri/common/mmio.h index 2b7b4123e5a..89871aab59e 100644 --- a/src/mesa/drivers/dri/common/mmio.h +++ b/src/mesa/drivers/dri/common/mmio.h @@ -37,7 +37,7 @@ #if defined( __powerpc__ ) -static __inline__ u_int32_t +static INLINE u_int32_t read_MMIO_LE32( volatile void * base, unsigned long offset ) { u_int32_t val; @@ -50,7 +50,7 @@ read_MMIO_LE32( volatile void * base, unsigned long offset ) #else -static __inline__ u_int32_t +static INLINE u_int32_t read_MMIO_LE32( volatile void * base, unsigned long offset ) { volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset); diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index 8602d47cf97..f6ae75520c5 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -63,6 +63,12 @@ extern char *program_invocation_name, *program_invocation_short_name; #elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) # include <stdlib.h> # define GET_PROGRAM_NAME() getprogname() +#elif defined(__sun) +/* Solaris has getexecname() which returns the full path - return just + the basename to match BSD getprogname() */ +# include <stdlib.h> +# include <libgen.h> +# define GET_PROGRAM_NAME() basename(getexecname()) #endif #if !defined(GET_PROGRAM_NAME) diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.c b/src/mesa/drivers/dri/ffb/ffb_clear.c index e8dfcbe2543..2aa58360361 100644 --- a/src/mesa/drivers/dri/ffb/ffb_clear.c +++ b/src/mesa/drivers/dri/ffb/ffb_clear.c @@ -79,7 +79,7 @@ struct ff_fixups { /* Compute fixups of non-page aligned areas after a page fill. * Return the number of fixups needed. */ -static __inline__ int +static INLINE int CreatorComputePageFillFixups(struct ff_fixups *fixups, int x, int y, int w, int h, int paligned_x, int paligned_y, diff --git a/src/mesa/drivers/dri/ffb/ffb_linetmp.h b/src/mesa/drivers/dri/ffb/ffb_linetmp.h index 0951513ca12..aea84f5f23f 100644 --- a/src/mesa/drivers/dri/ffb/ffb_linetmp.h +++ b/src/mesa/drivers/dri/ffb/ffb_linetmp.h @@ -1,6 +1,6 @@ /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */ -static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, +static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1 ) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/ffb/ffb_pointtmp.h b/src/mesa/drivers/dri/ffb/ffb_pointtmp.h index 310c95d89bd..c483e205dd1 100644 --- a/src/mesa/drivers/dri/ffb/ffb_pointtmp.h +++ b/src/mesa/drivers/dri/ffb/ffb_pointtmp.h @@ -1,6 +1,6 @@ /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */ -static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) +static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); ffb_fbcPtr ffb = fmesa->regs; diff --git a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c index 9c1b770fbd1..df0096b18fa 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c +++ b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c @@ -42,10 +42,6 @@ #include "ffb_vtxfmt.h" -#ifndef __GNUC__ -#define __inline /**/ -#endif - #define TNL_VERTEX ffbTnlVertex #define INTERP_RGBA(t, out, a, b) \ @@ -60,7 +56,7 @@ do { \ /* Color functions: */ -static __inline void ffb_recalc_base_color(GLcontext *ctx) +static INLINE void ffb_recalc_base_color(GLcontext *ctx) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); struct gl_light *light; diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h index f0ab1c4f05c..ef7119c2101 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.h +++ b/src/mesa/drivers/dri/gamma/gamma_context.h @@ -384,7 +384,7 @@ struct gamma_context { int TextureCount; }; -static __inline GLuint gammaPackColor( GLuint cpp, +static INLINE GLuint gammaPackColor( GLuint cpp, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c index a8fba499a5a..2bc579c3f90 100644 --- a/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/src/mesa/drivers/dri/gamma/gamma_render.c @@ -129,13 +129,13 @@ static const GLuint hw_prim[GL_POLYGON+1] = { B_PrimType_Polygon }; -static __inline void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim ) +static INLINE void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim ) { CHECK_DMA_BUFFER(gmesa, 1); WRITE(gmesa->buf, Begin, gmesa->Begin | hw_prim[prim]); } -static __inline void gammaEndPrimitive( gammaContextPtr gmesa ) +static INLINE void gammaEndPrimitive( gammaContextPtr gmesa ) { GLcontext *ctx = gmesa->glCtx; diff --git a/src/mesa/drivers/dri/i810/i810ioctl.h b/src/mesa/drivers/dri/i810/i810ioctl.h index 61399ee7b72..eda15adfb6c 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.h +++ b/src/mesa/drivers/dri/i810/i810ioctl.h @@ -34,7 +34,7 @@ do { \ } \ } while (0) -static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes ) +static INLINE GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes ) { if (imesa->vertex_low + bytes > imesa->vertex_high) i810FlushPrimsGetBuffer( imesa ); diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 185c098b5e1..4b3cb873b8c 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -27,7 +27,7 @@ #include "tnl/t_pipeline.h" -static __inline__ GLuint i810PackColor(GLuint format, +static INLINE GLuint i810PackColor(GLuint format, GLubyte r, GLubyte g, GLubyte b, GLubyte a) { diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index 08900cc67d8..9c24fcd8f57 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -64,7 +64,7 @@ void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t) /* From linux kernel i386 header files, copes with odd sizes better * than COPY_DWORDS would: */ -static __inline__ void * __memcpy(void * to, const void * from, size_t n) +static INLINE void * __memcpy(void * to, const void * from, size_t n) { int d0, d1, d2; __asm__ __volatile__( diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index 2c4ee06633d..f6dd7a4d223 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -75,7 +75,7 @@ do { \ } while (0) #endif -static __inline__ void i810_draw_triangle( i810ContextPtr imesa, +static INLINE void i810_draw_triangle( i810ContextPtr imesa, i810VertexPtr v0, i810VertexPtr v1, i810VertexPtr v2 ) @@ -90,7 +90,7 @@ static __inline__ void i810_draw_triangle( i810ContextPtr imesa, } -static __inline__ void i810_draw_quad( i810ContextPtr imesa, +static INLINE void i810_draw_quad( i810ContextPtr imesa, i810VertexPtr v0, i810VertexPtr v1, i810VertexPtr v2, @@ -109,7 +109,7 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa, } -static __inline__ void i810_draw_point( i810ContextPtr imesa, +static INLINE void i810_draw_point( i810ContextPtr imesa, i810VertexPtr tmp ) { GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, @@ -133,7 +133,7 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa, } -static __inline__ void i810_draw_line( i810ContextPtr imesa, +static INLINE void i810_draw_line( i810ContextPtr imesa, i810VertexPtr v0, i810VertexPtr v1 ) { diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index ccba34d2293..fd77980ebf8 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -27,7 +27,11 @@ DRIVER_SOURCES = \ intel_tex_validate.c \ intel_tex_format.c \ intel_tex.c \ + intel_pixel.c \ + intel_pixel_bitmap.c \ intel_pixel_copy.c \ + intel_pixel_draw.c \ + intel_pixel_read.c \ intel_buffers.c \ intel_blit.c \ i915_tex.c \ @@ -43,9 +47,6 @@ DRIVER_SOURCES = \ intel_context.c \ intel_decode.c \ intel_ioctl.c \ - intel_pixel.c \ - intel_pixel_draw.c \ - intel_pixel_read.c \ intel_screen.c \ intel_span.c \ intel_state.c \ diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 66f1566f16b..4c7a742b982 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -52,7 +52,6 @@ static void i830InitDriverFunctions(struct dd_function_table *functions) { intelInitDriverFunctions(functions); - intelInitPixelFuncs(functions); i830InitStateFuncs(functions); i830InitTextureFuncs(functions); } diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 1128f497dbd..46326cf1dc1 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -94,7 +94,6 @@ static void i915InitDriverFunctions(struct dd_function_table *functions) { intelInitDriverFunctions(functions); - intelInitPixelFuncs(functions); i915InitStateFunctions(functions); i915InitTextureFuncs(functions); i915InitFragProgFuncs(functions); diff --git a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c index 066d5b1fd4f..9085c7b0397 100644..120000 --- a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c @@ -1,349 +1 @@ -/************************************************************************** - * - * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, 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 portionsalloc - * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "glheader.h" -#include "enums.h" -#include "image.h" -#include "colormac.h" -#include "mtypes.h" -#include "macros.h" -#include "bufferobj.h" -#include "swrast/swrast.h" - -#include "intel_screen.h" -#include "intel_context.h" -#include "intel_ioctl.h" -#include "intel_batchbuffer.h" -#include "intel_blit.h" -#include "intel_regions.h" -#include "intel_buffer_objects.h" - - - -#define FILE_DEBUG_FLAG DEBUG_PIXEL - - -/* Unlike the other intel_pixel_* functions, the expectation here is - * that the incoming data is not in a PBO. With the XY_TEXT blit - * method, there's no benefit haveing it in a PBO, but we could - * implement a path based on XY_MONO_SRC_COPY_BLIT which might benefit - * PBO bitmaps. I think they are probably pretty rare though - I - * wonder if Xgl uses them? - */ -static const GLubyte *map_pbo( GLcontext *ctx, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap ) -{ - GLubyte *buf; - - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); - return NULL; - } - - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return NULL; - } - - return ADD_POINTERS(buf, bitmap); -} - -static GLboolean test_bit( const GLubyte *src, - GLuint bit ) -{ - return (src[bit/8] & (1<<(bit % 8))) ? 1 : 0; -} - -static void set_bit( GLubyte *dest, - GLuint bit ) -{ - dest[bit/8] |= 1 << (bit % 8); -} - -static int align(int x, int align) -{ - return (x + align - 1) & ~(align - 1); -} - -/* Extract a rectangle's worth of data from the bitmap. Called - * per-cliprect. - */ -static GLuint get_bitmap_rect(GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap, - GLuint x, GLuint y, - GLuint w, GLuint h, - GLubyte *dest, - GLuint row_align, - GLboolean invert) -{ - GLuint src_offset = (x + unpack->SkipPixels) & 0x7; - GLuint mask = unpack->LsbFirst ? 0 : 7; - GLuint bit = 0; - GLint row, col; - GLint first, last; - GLint incr; - GLuint count = 0; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s %d,%d %dx%d bitmap %dx%d skip %d src_offset %d mask %d\n", - __FUNCTION__, x,y,w,h,width,height,unpack->SkipPixels, src_offset, mask); - - if (invert) { - first = h-1; - last = 0; - incr = -1; - } - else { - first = 0; - last = h-1; - incr = 1; - } - - /* Require that dest be pre-zero'd. - */ - for (row = first; row != (last+incr); row += incr) { - const GLubyte *rowsrc = _mesa_image_address2d(unpack, bitmap, - width, height, - GL_COLOR_INDEX, GL_BITMAP, - y + row, x); - - for (col = 0; col < w; col++, bit++) { - if (test_bit(rowsrc, (col + src_offset) ^ mask)) { - set_bit(dest, bit ^ 7); - count++; - } - } - - if (row_align) - bit = (bit + row_align - 1) & ~(row_align - 1); - } - - return count; -} - - - - -/* - * Render a bitmap. - */ -static GLboolean -do_blit_bitmap( GLcontext *ctx, - GLint dstx, GLint dsty, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap ) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_region *dst = intel_drawbuf_region(intel); - - union { - GLuint ui; - GLubyte ub[4]; - } color; - - - if (unpack->BufferObj->Name) { - bitmap = map_pbo(ctx, width, height, unpack, bitmap); - if (bitmap == NULL) - return GL_TRUE; /* even though this is an error, we're done */ - } - - UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], ctx->Current.RasterColor[2]); - UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], ctx->Current.RasterColor[1]); - UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], ctx->Current.RasterColor[0]); - UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], ctx->Current.RasterColor[3]); - - /* Does zoom apply to bitmaps? - */ - if (!intel_check_blit_fragment_ops(ctx) || - ctx->Pixel.ZoomX != 1.0F || - ctx->Pixel.ZoomY != 1.0F) - return GL_FALSE; - - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - drm_clip_rect_t *box = dPriv->pClipRects; - drm_clip_rect_t dest_rect; - GLint nbox = dPriv->numClipRects; - GLint srcx = 0, srcy = 0; - GLint orig_screen_x1, orig_screen_y2; - GLuint i; - - - orig_screen_x1 = dPriv->x + dstx; - orig_screen_y2 = dPriv->y + (dPriv->h - dsty); - - /* Do scissoring in GL coordinates: - */ -x if (ctx->Scissor.Enabled) - { - GLint x = ctx->Scissor.X; - GLint y = ctx->Scissor.Y; - GLuint w = ctx->Scissor.Width; - GLuint h = ctx->Scissor.Height; - - if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height)) - goto out; - } - - /* Convert from GL to hardware coordinates: - */ - dsty = dPriv->y + (dPriv->h - dsty - height); - dstx = dPriv->x + dstx; - - dest_rect.x1 = dstx; - dest_rect.y1 = dsty; - dest_rect.x2 = dstx + width; - dest_rect.y2 = dsty + height; - - for (i = 0; i < nbox; i++) { - drm_clip_rect_t rect; - int box_w, box_h; - GLint px, py; - GLuint stipple[32]; - - if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i])) - continue; - - /* Now go back to GL coordinates to figure out what subset of - * the bitmap we are uploading for this cliprect: - */ - box_w = rect.x2 - rect.x1; - box_h = rect.y2 - rect.y1; - srcx = rect.x1 - orig_screen_x1; - srcy = orig_screen_y2 - rect.y2; - - -#define DY 32 -#define DX 32 - - /* Then, finally, chop it all into chunks that can be - * digested by hardware: - */ - for (py = 0; py < box_h; py += DY) { - for (px = 0; px < box_w; px += DX) { - int h = MIN2(DY, box_h - py); - int w = MIN2(DX, box_w - px); - GLuint sz = align(align(w,8) * h, 64)/8; - - assert(sz <= sizeof(stipple)); - memset(stipple, 0, sz); - - /* May need to adjust this when padding has been introduced in - * sz above: - */ - if (get_bitmap_rect(width, height, unpack, - bitmap, - srcx + px, srcy + py, w, h, - (GLubyte *)stipple, - 8, - GL_TRUE) == 0) - continue; - - /* - */ - intelEmitImmediateColorExpandBlit( intel, - dst->cpp, - (GLubyte *)stipple, - sz, - color.ui, - dst->pitch, - dst->buffer, - 0, - dst->tiled, - rect.x1 + px, - rect.y2 - (py + h), - w, h); - } - } - } - out: - intel_batchbuffer_flush(intel->batch); - } - UNLOCK_HARDWARE(intel); - - - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } - - return GL_TRUE; -} - - - - - -/* There are a large number of possible ways to implement bitmap on - * this hardware, most of them have some sort of drawback. Here are a - * few that spring to mind: - * - * Blit: - * - XY_MONO_SRC_BLT_CMD - * - use XY_SETUP_CLIP_BLT for cliprect clipping. - * - XY_TEXT_BLT - * - XY_TEXT_IMMEDIATE_BLT - * - blit per cliprect, subject to maximum immediate data size. - * - XY_COLOR_BLT - * - per pixel or run of pixels - * - XY_PIXEL_BLT - * - good for sparse bitmaps - * - * 3D engine: - * - Point per pixel - * - Translate bitmap to an alpha texture and render as a quad - * - Chop bitmap up into 32x32 squares and render w/polygon stipple. - */ -void -intelBitmap(GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte * pixels) -{ - if (do_blit_bitmap(ctx, x, y, width, height, - unpack, pixels)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); - - _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); -} +../intel/intel_pixel_bitmap.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index c15418df062..8fa205e79ff 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -18,6 +18,7 @@ DRIVER_SOURCES = \ intel_regions.c \ intel_screen.c \ intel_span.c \ + intel_pixel.c \ intel_pixel_copy.c \ intel_pixel_bitmap.c \ intel_state.c \ diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 1601f6dd248..33f1bba085b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -65,14 +65,6 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) { intelInitDriverFunctions( functions ); - /* CopyPixels can be accelerated even with the current memory - * manager: - */ - if (!getenv("INTEL_NO_BLIT")) { - functions->CopyPixels = intelCopyPixels; - functions->Bitmap = intelBitmap; - } - brwInitFragProgFuncs( functions ); brwInitProgFuncs( functions ); } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index bef425f2da1..32e05542e0d 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -685,7 +685,7 @@ void brw_upload_constant_buffer_state(struct brw_context *brw); * Inline conversion functions. These are better-typed than the * macros used previously: */ -static inline struct brw_context * +static INLINE struct brw_context * brw_context( GLcontext *ctx ) { return (struct brw_context *)ctx; diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index c138d15fe82..207b8b7ca38 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -110,7 +110,7 @@ struct brw_compile { -static __inline int type_sz( GLuint type ) +static INLINE int type_sz( GLuint type ) { switch( type ) { case BRW_REGISTER_TYPE_UD: @@ -129,7 +129,7 @@ static __inline int type_sz( GLuint type ) } } -static __inline struct brw_reg brw_reg( GLuint file, +static INLINE struct brw_reg brw_reg( GLuint file, GLuint nr, GLuint subnr, GLuint type, @@ -166,7 +166,7 @@ static __inline struct brw_reg brw_reg( GLuint file, return reg; } -static __inline struct brw_reg brw_vec16_reg( GLuint file, +static INLINE struct brw_reg brw_vec16_reg( GLuint file, GLuint nr, GLuint subnr ) { @@ -181,7 +181,7 @@ static __inline struct brw_reg brw_vec16_reg( GLuint file, WRITEMASK_XYZW); } -static __inline struct brw_reg brw_vec8_reg( GLuint file, +static INLINE struct brw_reg brw_vec8_reg( GLuint file, GLuint nr, GLuint subnr ) { @@ -197,7 +197,7 @@ static __inline struct brw_reg brw_vec8_reg( GLuint file, } -static __inline struct brw_reg brw_vec4_reg( GLuint file, +static INLINE struct brw_reg brw_vec4_reg( GLuint file, GLuint nr, GLuint subnr ) { @@ -213,7 +213,7 @@ static __inline struct brw_reg brw_vec4_reg( GLuint file, } -static __inline struct brw_reg brw_vec2_reg( GLuint file, +static INLINE struct brw_reg brw_vec2_reg( GLuint file, GLuint nr, GLuint subnr ) { @@ -228,7 +228,7 @@ static __inline struct brw_reg brw_vec2_reg( GLuint file, WRITEMASK_XY); } -static __inline struct brw_reg brw_vec1_reg( GLuint file, +static INLINE struct brw_reg brw_vec1_reg( GLuint file, GLuint nr, GLuint subnr ) { @@ -244,14 +244,14 @@ static __inline struct brw_reg brw_vec1_reg( GLuint file, } -static __inline struct brw_reg retype( struct brw_reg reg, +static INLINE struct brw_reg retype( struct brw_reg reg, GLuint type ) { reg.type = type; return reg; } -static __inline struct brw_reg suboffset( struct brw_reg reg, +static INLINE struct brw_reg suboffset( struct brw_reg reg, GLuint delta ) { reg.subnr += delta * type_sz(reg.type); @@ -259,7 +259,7 @@ static __inline struct brw_reg suboffset( struct brw_reg reg, } -static __inline struct brw_reg offset( struct brw_reg reg, +static INLINE struct brw_reg offset( struct brw_reg reg, GLuint delta ) { reg.nr += delta; @@ -267,7 +267,7 @@ static __inline struct brw_reg offset( struct brw_reg reg, } -static __inline struct brw_reg byte_offset( struct brw_reg reg, +static INLINE struct brw_reg byte_offset( struct brw_reg reg, GLuint bytes ) { GLuint newoffset = reg.nr * REG_SIZE + reg.subnr + bytes; @@ -277,28 +277,28 @@ static __inline struct brw_reg byte_offset( struct brw_reg reg, } -static __inline struct brw_reg brw_uw16_reg( GLuint file, +static INLINE struct brw_reg brw_uw16_reg( GLuint file, GLuint nr, GLuint subnr ) { return suboffset(retype(brw_vec16_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); } -static __inline struct brw_reg brw_uw8_reg( GLuint file, +static INLINE struct brw_reg brw_uw8_reg( GLuint file, GLuint nr, GLuint subnr ) { return suboffset(retype(brw_vec8_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); } -static __inline struct brw_reg brw_uw1_reg( GLuint file, +static INLINE struct brw_reg brw_uw1_reg( GLuint file, GLuint nr, GLuint subnr ) { return suboffset(retype(brw_vec1_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); } -static __inline struct brw_reg brw_imm_reg( GLuint type ) +static INLINE struct brw_reg brw_imm_reg( GLuint type ) { return brw_reg( BRW_IMMEDIATE_VALUE, 0, @@ -311,35 +311,35 @@ static __inline struct brw_reg brw_imm_reg( GLuint type ) 0); } -static __inline struct brw_reg brw_imm_f( GLfloat f ) +static INLINE struct brw_reg brw_imm_f( GLfloat f ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_F); imm.dw1.f = f; return imm; } -static __inline struct brw_reg brw_imm_d( GLint d ) +static INLINE struct brw_reg brw_imm_d( GLint d ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_D); imm.dw1.d = d; return imm; } -static __inline struct brw_reg brw_imm_ud( GLuint ud ) +static INLINE struct brw_reg brw_imm_ud( GLuint ud ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UD); imm.dw1.ud = ud; return imm; } -static __inline struct brw_reg brw_imm_uw( GLushort uw ) +static INLINE struct brw_reg brw_imm_uw( GLushort uw ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UW); imm.dw1.ud = uw | (uw << 16); return imm; } -static __inline struct brw_reg brw_imm_w( GLshort w ) +static INLINE struct brw_reg brw_imm_w( GLshort w ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_W); imm.dw1.d = w | (w << 16); @@ -352,7 +352,7 @@ static __inline struct brw_reg brw_imm_w( GLshort w ) /* Vector of eight signed half-byte values: */ -static __inline struct brw_reg brw_imm_v( GLuint v ) +static INLINE struct brw_reg brw_imm_v( GLuint v ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_V); imm.vstride = BRW_VERTICAL_STRIDE_0; @@ -364,7 +364,7 @@ static __inline struct brw_reg brw_imm_v( GLuint v ) /* Vector of four 8-bit float values: */ -static __inline struct brw_reg brw_imm_vf( GLuint v ) +static INLINE struct brw_reg brw_imm_vf( GLuint v ) { struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_VF); imm.vstride = BRW_VERTICAL_STRIDE_0; @@ -378,7 +378,7 @@ static __inline struct brw_reg brw_imm_vf( GLuint v ) #define VF_ONE 0x30 #define VF_NEG (1<<7) -static __inline struct brw_reg brw_imm_vf4( GLuint v0, +static INLINE struct brw_reg brw_imm_vf4( GLuint v0, GLuint v1, GLuint v2, GLuint v3) @@ -395,51 +395,51 @@ static __inline struct brw_reg brw_imm_vf4( GLuint v0, } -static __inline struct brw_reg brw_address( struct brw_reg reg ) +static INLINE struct brw_reg brw_address( struct brw_reg reg ) { return brw_imm_uw(reg.nr * REG_SIZE + reg.subnr); } -static __inline struct brw_reg brw_vec1_grf( GLuint nr, +static INLINE struct brw_reg brw_vec1_grf( GLuint nr, GLuint subnr ) { return brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); } -static __inline struct brw_reg brw_vec8_grf( GLuint nr, +static INLINE struct brw_reg brw_vec8_grf( GLuint nr, GLuint subnr ) { return brw_vec8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); } -static __inline struct brw_reg brw_vec4_grf( GLuint nr, +static INLINE struct brw_reg brw_vec4_grf( GLuint nr, GLuint subnr ) { return brw_vec4_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); } -static __inline struct brw_reg brw_vec2_grf( GLuint nr, +static INLINE struct brw_reg brw_vec2_grf( GLuint nr, GLuint subnr ) { return brw_vec2_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); } -static __inline struct brw_reg brw_uw8_grf( GLuint nr, +static INLINE struct brw_reg brw_uw8_grf( GLuint nr, GLuint subnr ) { return brw_uw8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); } -static __inline struct brw_reg brw_null_reg( void ) +static INLINE struct brw_reg brw_null_reg( void ) { return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_NULL, 0); } -static __inline struct brw_reg brw_address_reg( GLuint subnr ) +static INLINE struct brw_reg brw_address_reg( GLuint subnr ) { return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_ADDRESS, @@ -450,7 +450,7 @@ static __inline struct brw_reg brw_address_reg( GLuint subnr ) * aren't xyzw. This goes against the convention for other scalar * regs: */ -static __inline struct brw_reg brw_ip_reg( void ) +static INLINE struct brw_reg brw_ip_reg( void ) { return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_IP, @@ -463,7 +463,7 @@ static __inline struct brw_reg brw_ip_reg( void ) WRITEMASK_XYZW); /* NOTE! */ } -static __inline struct brw_reg brw_acc_reg( void ) +static INLINE struct brw_reg brw_acc_reg( void ) { return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_ACCUMULATOR, @@ -471,7 +471,7 @@ static __inline struct brw_reg brw_acc_reg( void ) } -static __inline struct brw_reg brw_flag_reg( void ) +static INLINE struct brw_reg brw_flag_reg( void ) { return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_FLAG, @@ -479,14 +479,14 @@ static __inline struct brw_reg brw_flag_reg( void ) } -static __inline struct brw_reg brw_mask_reg( GLuint subnr ) +static INLINE struct brw_reg brw_mask_reg( GLuint subnr ) { return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_MASK, subnr); } -static __inline struct brw_reg brw_message_reg( GLuint nr ) +static INLINE struct brw_reg brw_message_reg( GLuint nr ) { return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, nr, @@ -499,7 +499,7 @@ static __inline struct brw_reg brw_message_reg( GLuint nr ) /* This is almost always called with a numeric constant argument, so * make things easy to evaluate at compile time: */ -static __inline GLuint cvt( GLuint val ) +static INLINE GLuint cvt( GLuint val ) { switch (val) { case 0: return 0; @@ -513,7 +513,7 @@ static __inline GLuint cvt( GLuint val ) return 0; } -static __inline struct brw_reg stride( struct brw_reg reg, +static INLINE struct brw_reg stride( struct brw_reg reg, GLuint vstride, GLuint width, GLuint hstride ) @@ -525,43 +525,43 @@ static __inline struct brw_reg stride( struct brw_reg reg, return reg; } -static __inline struct brw_reg vec16( struct brw_reg reg ) +static INLINE struct brw_reg vec16( struct brw_reg reg ) { return stride(reg, 16,16,1); } -static __inline struct brw_reg vec8( struct brw_reg reg ) +static INLINE struct brw_reg vec8( struct brw_reg reg ) { return stride(reg, 8,8,1); } -static __inline struct brw_reg vec4( struct brw_reg reg ) +static INLINE struct brw_reg vec4( struct brw_reg reg ) { return stride(reg, 4,4,1); } -static __inline struct brw_reg vec2( struct brw_reg reg ) +static INLINE struct brw_reg vec2( struct brw_reg reg ) { return stride(reg, 2,2,1); } -static __inline struct brw_reg vec1( struct brw_reg reg ) +static INLINE struct brw_reg vec1( struct brw_reg reg ) { return stride(reg, 0,1,0); } -static __inline struct brw_reg get_element( struct brw_reg reg, GLuint elt ) +static INLINE struct brw_reg get_element( struct brw_reg reg, GLuint elt ) { return vec1(suboffset(reg, elt)); } -static __inline struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt ) +static INLINE struct brw_reg get_element_ud( struct brw_reg reg, GLuint elt ) { return vec1(suboffset(retype(reg, BRW_REGISTER_TYPE_UD), elt)); } -static __inline struct brw_reg brw_swizzle( struct brw_reg reg, +static INLINE struct brw_reg brw_swizzle( struct brw_reg reg, GLuint x, GLuint y, GLuint z, @@ -575,33 +575,33 @@ static __inline struct brw_reg brw_swizzle( struct brw_reg reg, } -static __inline struct brw_reg brw_swizzle1( struct brw_reg reg, +static INLINE struct brw_reg brw_swizzle1( struct brw_reg reg, GLuint x ) { return brw_swizzle(reg, x, x, x, x); } -static __inline struct brw_reg brw_writemask( struct brw_reg reg, +static INLINE struct brw_reg brw_writemask( struct brw_reg reg, GLuint mask ) { reg.dw1.bits.writemask &= mask; return reg; } -static __inline struct brw_reg brw_set_writemask( struct brw_reg reg, +static INLINE struct brw_reg brw_set_writemask( struct brw_reg reg, GLuint mask ) { reg.dw1.bits.writemask = mask; return reg; } -static __inline struct brw_reg negate( struct brw_reg reg ) +static INLINE struct brw_reg negate( struct brw_reg reg ) { reg.negate ^= 1; return reg; } -static __inline struct brw_reg brw_abs( struct brw_reg reg ) +static INLINE struct brw_reg brw_abs( struct brw_reg reg ) { reg.abs = 1; return reg; @@ -609,7 +609,7 @@ static __inline struct brw_reg brw_abs( struct brw_reg reg ) /*********************************************************************** */ -static __inline struct brw_reg brw_vec4_indirect( GLuint subnr, +static INLINE struct brw_reg brw_vec4_indirect( GLuint subnr, GLint offset ) { struct brw_reg reg = brw_vec4_grf(0, 0); @@ -619,7 +619,7 @@ static __inline struct brw_reg brw_vec4_indirect( GLuint subnr, return reg; } -static __inline struct brw_reg brw_vec1_indirect( GLuint subnr, +static INLINE struct brw_reg brw_vec1_indirect( GLuint subnr, GLint offset ) { struct brw_reg reg = brw_vec1_grf(0, 0); @@ -629,48 +629,48 @@ static __inline struct brw_reg brw_vec1_indirect( GLuint subnr, return reg; } -static __inline struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_4f(struct brw_indirect ptr, GLint offset) { return brw_vec4_indirect(ptr.addr_subnr, ptr.addr_offset + offset); } -static __inline struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_1f(struct brw_indirect ptr, GLint offset) { return brw_vec1_indirect(ptr.addr_subnr, ptr.addr_offset + offset); } -static __inline struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_4b(struct brw_indirect ptr, GLint offset) { return retype(deref_4f(ptr, offset), BRW_REGISTER_TYPE_B); } -static __inline struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset) { return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW); } -static __inline struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset) { return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_D); } -static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset) +static INLINE struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset) { return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD); } -static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr) +static INLINE struct brw_reg get_addr_reg(struct brw_indirect ptr) { return brw_address_reg(ptr.addr_subnr); } -static __inline struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset ) +static INLINE struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, GLint offset ) { ptr.addr_offset += offset; return ptr; } -static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset ) +static INLINE struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset ) { struct brw_indirect ptr; ptr.addr_subnr = addr_subnr; @@ -679,7 +679,7 @@ static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offse return ptr; } -static __inline struct brw_instruction *current_insn( struct brw_compile *p) +static INLINE struct brw_instruction *current_insn( struct brw_compile *p) { return &p->store[p->nr_insn]; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 4cda55914ce..ba9168b6efc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -39,7 +39,7 @@ /* Not quite sure how correct this is - need to understand horiz * vs. vertical strides a little better. */ -static __inline struct brw_reg sechalf( struct brw_reg reg ) +static INLINE struct brw_reg sechalf( struct brw_reg reg ) { if (reg.vstride) reg.nr++; diff --git a/src/mesa/drivers/dri/i965/intel_pixel.c b/src/mesa/drivers/dri/i965/intel_pixel.c new file mode 120000 index 00000000000..d733c5e8745 --- /dev/null +++ b/src/mesa/drivers/dri/i965/intel_pixel.c @@ -0,0 +1 @@ +../intel/intel_pixel.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c index 2f9c621dae7..ee433605904 100644..120000 --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c @@ -1,346 +1 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "glheader.h" -#include "enums.h" -#include "image.h" -#include "mtypes.h" -#include "macros.h" -#include "state.h" -#include "swrast/swrast.h" - -#include "intel_screen.h" -#include "intel_context.h" -#include "intel_ioctl.h" -#include "intel_batchbuffer.h" -#include "intel_blit.h" -#include "intel_regions.h" -#include "intel_buffers.h" -#include "intel_pixel.h" - -#define FILE_DEBUG_FLAG DEBUG_PIXEL - -static struct intel_region * -copypix_src_region(struct intel_context *intel, GLenum type) -{ - switch (type) { - case GL_COLOR: - return intel_readbuf_region(intel); - case GL_DEPTH: - /* Don't think this is really possible execpt at 16bpp, when we have no stencil. - */ - if (intel->depth_region && intel->depth_region->cpp == 2) - return intel->depth_region; - case GL_STENCIL: - /* Don't think this is really possible. - */ - break; - case GL_DEPTH_STENCIL_EXT: - /* Does it matter whether it is stencil/depth or depth/stencil? - */ - return intel->depth_region; - default: - break; - } - - return NULL; -} - - - - -/** - * Check if any fragment operations are in effect which might effect - * glDraw/CopyPixels. - */ -GLboolean -intel_check_blit_fragment_ops(GLcontext * ctx) -{ - if (ctx->NewState) - _mesa_update_state(ctx); - - return !(ctx->_ImageTransferState || - ctx->RenderMode != GL_RENDER || - ctx->Color.AlphaEnabled || - ctx->Depth.Test || - ctx->Fog.Enabled || - ctx->Stencil.Enabled || - !ctx->Color.ColorMask[0] || - !ctx->Color.ColorMask[1] || - !ctx->Color.ColorMask[2] || - !ctx->Color.ColorMask[3] || /* can do this! */ - ctx->Texture._EnabledUnits || - ctx->FragmentProgram._Enabled || - ctx->Color.BlendEnabled); -} - -/* Doesn't work for overlapping regions. Could do a double copy or - * just fallback. - */ -static GLboolean -do_texture_copypixels(GLcontext * ctx, - GLint srcx, GLint srcy, - GLsizei width, GLsizei height, - GLint dstx, GLint dsty, GLenum type) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_region *dst = intel_drawbuf_region(intel); - struct intel_region *src = copypix_src_region(intel, type); - GLenum src_format; - GLenum src_type; - - DBG("%s %d,%d %dx%d --> %d,%d\n", __FUNCTION__, - srcx, srcy, width, height, dstx, dsty); - - if (!src || !dst || type != GL_COLOR || - ctx->_ImageTransferState || - ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F || - ctx->RenderMode != GL_RENDER || - ctx->Texture._EnabledUnits || - ctx->FragmentProgram._Enabled || - src != dst ) - return GL_FALSE; - - /* Can't handle overlapping regions. Don't have sufficient control - * over rasterization to pull it off in-place. Punt on these for - * now. - * - * XXX: do a copy to a temporary. - */ - if (src->buffer == dst->buffer) { - drm_clip_rect_t srcbox; - drm_clip_rect_t dstbox; - drm_clip_rect_t tmp; - - srcbox.x1 = srcx; - srcbox.y1 = srcy; - srcbox.x2 = srcx + width - 1; - srcbox.y2 = srcy + height - 1; - - dstbox.x1 = dstx; - dstbox.y1 = dsty; - dstbox.x2 = dstx + width - 1; - dstbox.y2 = dsty + height - 1; - - DBG("src %d,%d %d,%d\n", srcbox.x1, srcbox.y1, srcbox.x2, srcbox.y2); - DBG("dst %d,%d %d,%d (%dx%d) (%f,%f)\n", dstbox.x1, dstbox.y1, dstbox.x2, dstbox.y2, - width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - - if (intel_intersect_cliprects(&tmp, &srcbox, &dstbox)) { - DBG("%s: regions overlap\n", __FUNCTION__); - return GL_FALSE; - } - } - - intelFlush(&intel->ctx); - - intel->vtbl.install_meta_state(intel); - - /* Is this true? Also will need to turn depth testing on according - * to state: - */ - intel->vtbl.meta_no_stencil_write(intel); - intel->vtbl.meta_no_depth_write(intel); - - /* Set the 3d engine to draw into the destination region: - */ - intel->vtbl.meta_draw_region(intel, dst, intel->depth_region); - - intel->vtbl.meta_import_pixel_state(intel); - - if (src->cpp == 2) { - src_format = GL_RGB; - src_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - src_format = GL_BGRA; - src_type = GL_UNSIGNED_BYTE; - } - - /* Set the frontbuffer up as a large rectangular texture. - */ - intel->vtbl.meta_frame_buffer_texture( intel, srcx - dstx, srcy - dsty ); - - intel->vtbl.meta_texture_blend_replace(intel); - - if (intel->driDrawable->numClipRects) - intel->vtbl.meta_draw_quad( intel, - dstx, dstx + width, - dsty, dsty + height, - ctx->Current.RasterPos[ 2 ], - 0, 0.0, 0.0, 0.0, 0.0 ); - - intel->vtbl.leave_meta_state( intel ); - - DBG("%s: success\n", __FUNCTION__); - return GL_TRUE; -} - -/** - * CopyPixels with the blitter. Don't support zooming, pixel transfer, etc. - */ -static GLboolean -do_blit_copypixels(GLcontext * ctx, - GLint srcx, GLint srcy, - GLsizei width, GLsizei height, - GLint dstx, GLint dsty, GLenum type) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_region *dst = intel_drawbuf_region(intel); - struct intel_region *src = copypix_src_region(intel, type); - - /* Copypixels can be more than a straight copy. Ensure all the - * extra operations are disabled: - */ - if (!intel_check_blit_fragment_ops(ctx) || - ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F) - return GL_FALSE; - - if (!src || !dst) - return GL_FALSE; - - - - intelFlush(&intel->ctx); - -/* intel->vtbl.render_start(intel); */ -/* intel->vtbl.emit_state(intel); */ - - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - __DRIdrawablePrivate *dReadPriv = intel->driReadDrawable; - drm_clip_rect_t *box = dPriv->pClipRects; - drm_clip_rect_t dest_rect; - GLint nbox = dPriv->numClipRects; - GLint delta_x = 0; - GLint delta_y = 0; - GLuint i; - - /* Do scissoring in GL coordinates: - */ - if (ctx->Scissor.Enabled) - { - GLint x = ctx->Scissor.X; - GLint y = ctx->Scissor.Y; - GLuint w = ctx->Scissor.Width; - GLuint h = ctx->Scissor.Height; - GLint dx = dstx - srcx; - GLint dy = dsty - srcy; - - if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height)) - goto out; - - srcx = dstx - dx; - srcy = dsty - dy; - } - - /* Convert from GL to hardware coordinates: - */ - dsty = dPriv->h - dsty - height; - srcy = dPriv->h - srcy - height; - dstx += dPriv->x; - dsty += dPriv->y; - srcx += dReadPriv->x; - srcy += dReadPriv->y; - - /* Clip against the source region. This is the only source - * clipping we do. Dst is clipped with cliprects below. - */ - { - delta_x = srcx - dstx; - delta_y = srcy - dsty; - - if (!_mesa_clip_to_region(0, 0, src->pitch, src->height, - &srcx, &srcy, &width, &height)) - goto out; - - dstx = srcx - delta_x; - dsty = srcy - delta_y; - } - - dest_rect.x1 = dstx; - dest_rect.y1 = dsty; - dest_rect.x2 = dstx + width; - dest_rect.y2 = dsty + height; - -/* intel->vtbl.emit_flush(intel, 0); */ - - /* Could do slightly more clipping: Eg, take the intersection of - * the existing set of cliprects and those cliprects translated - * by delta_x, delta_y: - * - * This code will not overwrite other windows, but will - * introduce garbage when copying from obscured window regions. - */ - for (i = 0; i < nbox; i++) { - drm_clip_rect_t rect; - - if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i])) - continue; - - - intelEmitCopyBlit(intel, - dst->cpp, - src->pitch, src->buffer, 0, src->tiled, - dst->pitch, dst->buffer, 0, dst->tiled, - rect.x1 + delta_x, - rect.y1 + delta_y, /* srcx, srcy */ - rect.x1, rect.y1, /* dstx, dsty */ - rect.x2 - rect.x1, rect.y2 - rect.y1, - ctx->Color.ColorLogicOpEnabled ? - ctx->Color.LogicOp : GL_COPY); - } - - out: - intel_batchbuffer_flush(intel->batch); - } - UNLOCK_HARDWARE(intel); - return GL_TRUE; -} - -void -intelCopyPixels(GLcontext * ctx, - GLint srcx, GLint srcy, - GLsizei width, GLsizei height, - GLint destx, GLint desty, GLenum type) -{ - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); - - if (do_blit_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) - return; - - if (do_texture_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("fallback to _swrast_CopyPixels\n"); - - _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type); -} +../intel/intel_pixel_copy.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index f1f21e7dfea..80d11a01b7c 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -586,9 +586,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, dst_pitch *= cpp; - if (dst_tiled) - dst_pitch /= 4; - DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d, %d bytes %d dwords\n", __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h, src_size, dwords); @@ -602,8 +599,12 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, opcode = XY_SETUP_BLT_CMD; if (cpp == 4) opcode |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; - if (dst_tiled) +#ifndef I915 + if (dst_tiled) { opcode |= XY_DST_TILED; + dst_pitch /= 4; + } +#endif br13 = dst_pitch | (translate_raster_op(logic_op) << 16) | (1 << 29); if (cpp == 2) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 16ddbeea9e5..6d7d6811ac7 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -534,6 +534,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) intelInitTextureFuncs(functions); intelInitStateFuncs(functions); intelInitBufferFuncs(functions); + intelInitPixelFuncs(functions); } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index c314b6e2187..f1116d27479 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -331,7 +331,7 @@ do { \ * XXX Put this in src/mesa/main/imports.h ??? */ #if defined(i386) || defined(__i386__) -static inline void * __memcpy(void * to, const void * from, size_t n) +static INLINE void * __memcpy(void * to, const void * from, size_t n) { int d0, d1, d2; __asm__ __volatile__( diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 9018e3daef4..6417866b201 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -33,32 +33,97 @@ #include "intel_pixel.h" #include "intel_regions.h" +#define FILE_DEBUG_FLAG DEBUG_PIXEL + +static GLenum +effective_func(GLenum func, GLboolean src_alpha_is_one) +{ + if (src_alpha_is_one) { + if (func == GL_SRC_ALPHA) + return GL_ONE; + if (func == GL_ONE_MINUS_SRC_ALPHA) + return GL_ZERO; + } + + return func; +} /** * Check if any fragment operations are in effect which might effect * glDraw/CopyPixels. */ GLboolean -intel_check_blit_fragment_ops(GLcontext * ctx) +intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one) { if (ctx->NewState) _mesa_update_state(ctx); - /* XXX Note: Scissor could be done with the blitter: - */ - return !(ctx->_ImageTransferState || - ctx->Color.AlphaEnabled || - ctx->Depth.Test || - ctx->Fog.Enabled || - ctx->Scissor.Enabled || - ctx->Stencil.Enabled || - !ctx->Color.ColorMask[0] || - !ctx->Color.ColorMask[1] || - !ctx->Color.ColorMask[2] || - !ctx->Color.ColorMask[3] || - ctx->Texture._EnabledUnits || - ctx->FragmentProgram._Enabled || - ctx->Color.BlendEnabled); + if (ctx->FragmentProgram._Enabled) { + DBG("fallback due to fragment program\n"); + return GL_FALSE; + } + + if (ctx->Color.BlendEnabled && + (effective_func(ctx->Color.BlendSrcRGB, src_alpha_is_one) != GL_ONE || + effective_func(ctx->Color.BlendDstRGB, src_alpha_is_one) != GL_ZERO || + ctx->Color.BlendEquationRGB != GL_FUNC_ADD || + effective_func(ctx->Color.BlendSrcA, src_alpha_is_one) != GL_ONE || + effective_func(ctx->Color.BlendDstA, src_alpha_is_one) != GL_ZERO || + ctx->Color.BlendEquationA != GL_FUNC_ADD)) { + DBG("fallback due to blend\n"); + return GL_FALSE; + } + + if (ctx->Texture._EnabledUnits) { + DBG("fallback due to texturing\n"); + return GL_FALSE; + } + + if (!(ctx->Color.ColorMask[0] && + ctx->Color.ColorMask[1] && + ctx->Color.ColorMask[2] && + ctx->Color.ColorMask[3])) { + DBG("fallback due to color masking\n"); + return GL_FALSE; + } + + if (ctx->Color.AlphaEnabled) { + DBG("fallback due to alpha\n"); + return GL_FALSE; + } + + if (ctx->Depth.Test) { + DBG("fallback due to depth test\n"); + return GL_FALSE; + } + + if (ctx->Fog.Enabled) { + DBG("fallback due to fog\n"); + return GL_FALSE; + } + + if (ctx->_ImageTransferState) { + DBG("fallback due to image transfer\n"); + return GL_FALSE; + } + + if (ctx->Stencil.Enabled) { + DBG("fallback due to image stencil\n"); + return GL_FALSE; + } + + if (ctx->Scissor.Enabled) { + /* XXX Note: Scissor could be done with the blitter */ + DBG("fallback due to image scissor\n"); + return GL_FALSE; + } + + if (ctx->RenderMode != GL_RENDER) { + DBG("fallback due to render mode\n"); + return GL_FALSE; + } + + return GL_TRUE; } @@ -113,8 +178,12 @@ void intelInitPixelFuncs(struct dd_function_table *functions) { functions->Accum = _swrast_Accum; - functions->Bitmap = _swrast_Bitmap; - functions->CopyPixels = intelCopyPixels; - functions->ReadPixels = intelReadPixels; - functions->DrawPixels = intelDrawPixels; + if (!getenv("INTEL_NO_BLIT")) { + functions->Bitmap = intelBitmap; + functions->CopyPixels = intelCopyPixels; +#ifdef I915 + functions->ReadPixels = intelReadPixels; + functions->DrawPixels = intelDrawPixels; +#endif + } } diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index ea2319a01f5..9c899b954c3 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -32,7 +32,8 @@ void intelInitPixelFuncs(struct dd_function_table *functions); -GLboolean intel_check_blit_fragment_ops(GLcontext * ctx); +GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, + GLboolean src_alpha_is_one); GLboolean intel_check_meta_tex_fragment_ops(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 4cb68655f2b..81238acfe4e 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -194,7 +194,7 @@ do_blit_bitmap( GLcontext *ctx, /* Does zoom apply to bitmaps? */ - if (!intel_check_blit_fragment_ops(ctx) || + if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F) || ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F) return GL_FALSE; diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index c453097e55e..45f72bac522 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -40,7 +40,6 @@ #include "intel_buffers.h" #include "intel_blit.h" #include "intel_regions.h" -#include "intel_tris.h" #include "intel_pixel.h" #define FILE_DEBUG_FLAG DEBUG_PIXEL @@ -99,6 +98,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx) ctx->Color.BlendEnabled); } +#ifdef I915 /* Doesn't work for overlapping regions. Could do a double copy or * just fallback. */ @@ -236,9 +236,7 @@ do_texture_copypixels(GLcontext * ctx, DBG("%s: success\n", __FUNCTION__); return GL_TRUE; } - - - +#endif /* I915 */ /** @@ -272,8 +270,8 @@ do_blit_copypixels(GLcontext * ctx, if (intel->driDrawable->numClipRects) { __DRIdrawablePrivate *dPriv = intel->driDrawable; + __DRIdrawablePrivate *dReadPriv = intel->driReadDrawable; drm_clip_rect_t *box = dPriv->pClipRects; - drm_clip_rect_t dest_rect; GLint nbox = dPriv->numClipRects; GLint delta_x = 0; GLint delta_y = 0; @@ -303,8 +301,8 @@ do_blit_copypixels(GLcontext * ctx, srcy = dPriv->h - srcy - height; dstx += dPriv->x; dsty += dPriv->y; - srcx += dPriv->x; - srcy += dPriv->y; + srcx += dReadPriv->x; + srcy += dReadPriv->y; /* Clip against the source region. This is the only source * clipping we do. Dst is clipped with cliprects below. @@ -321,11 +319,6 @@ do_blit_copypixels(GLcontext * ctx, dsty = srcy - delta_y; } - dest_rect.x1 = dstx; - dest_rect.y1 = dsty; - dest_rect.x2 = dstx + width; - dest_rect.y2 = dsty + height; - /* Could do slightly more clipping: Eg, take the intersection of * the existing set of cliprects and those cliprects translated * by delta_x, delta_y: @@ -334,19 +327,21 @@ do_blit_copypixels(GLcontext * ctx, * introduce garbage when copying from obscured window regions. */ for (i = 0; i < nbox; i++) { - drm_clip_rect_t rect; + GLint clip_x = dstx; + GLint clip_y = dsty; + GLint clip_w = width; + GLint clip_h = height; - if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i])) + if (!_mesa_clip_to_region(box[i].x1, box[i].y1, box[i].x2, box[i].y2, + &clip_x, &clip_y, &clip_w, &clip_h)) continue; - - intelEmitCopyBlit(intel, dst->cpp, + intelEmitCopyBlit(intel, dst->cpp, src->pitch, src->buffer, 0, src->tiled, dst->pitch, dst->buffer, 0, dst->tiled, - rect.x1 + delta_x, - rect.y1 + delta_y, /* srcx, srcy */ - rect.x1, rect.y1, /* dstx, dsty */ - rect.x2 - rect.x1, rect.y2 - rect.y1, + clip_x + delta_x, clip_y + delta_y, /* srcx, srcy */ + clip_x, clip_y, /* dstx, dsty */ + clip_w, clip_h, ctx->Color.ColorLogicOpEnabled ? ctx->Color.LogicOp : GL_COPY); } @@ -373,8 +368,10 @@ intelCopyPixels(GLcontext * ctx, if (do_blit_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) return; +#ifdef I915 if (do_texture_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) return; +#endif DBG("fallback to _swrast_CopyPixels\n"); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 28cd4f0ba68..569e992b5e2 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -253,7 +253,7 @@ do_blit_drawpixels(GLcontext * ctx, return GL_FALSE; } - if (!intel_check_blit_fragment_ops(ctx)) { + if (!intel_check_blit_fragment_ops(ctx, GL_FALSE)) { if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s - bad GL fragment state for blitter\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.h b/src/mesa/drivers/dri/mach64/mach64_ioctl.h index c28bf31c49f..3e5faff4e62 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.h +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.h @@ -44,7 +44,7 @@ extern void mach64FlushVerticesLocked( mach64ContextPtr mmesa ); extern void mach64FlushDMALocked( mach64ContextPtr mmesa ); extern void mach64UploadHwStateLocked( mach64ContextPtr mmesa ); -static __inline void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes ) +static INLINE void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes ) { CARD32 *head; @@ -60,7 +60,7 @@ static __inline void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes ) return head; } -static __inline void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes ) +static INLINE void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes ) { CARD32 *head; diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.h b/src/mesa/drivers/dri/mach64/mach64_tex.h index f6cf1cf8020..933cfbbab4a 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.h +++ b/src/mesa/drivers/dri/mach64/mach64_tex.h @@ -72,9 +72,9 @@ extern void mach64InitTextureFuncs( struct dd_function_table *functions ); #define MACH64PACKCOLOR4444(r, g, b, a) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -static __inline__ GLuint mach64PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static INLINE GLuint mach64PackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 369f6104428..5ce348f34da 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -113,7 +113,7 @@ do { \ #define COPY_VERTEX_OOA( vb, vertsize, v, n ) DO_COPY_VERTEX( vb, vertsize, v, n, 1 ) -static __inline void mach64_draw_quad( mach64ContextPtr mmesa, +static INLINE void mach64_draw_quad( mach64ContextPtr mmesa, mach64VertexPtr v0, mach64VertexPtr v1, mach64VertexPtr v2, @@ -419,7 +419,7 @@ static __inline void mach64_draw_quad( mach64ContextPtr mmesa, #endif } -static __inline void mach64_draw_triangle( mach64ContextPtr mmesa, +static INLINE void mach64_draw_triangle( mach64ContextPtr mmesa, mach64VertexPtr v0, mach64VertexPtr v1, mach64VertexPtr v2 ) @@ -666,7 +666,7 @@ static __inline void mach64_draw_triangle( mach64ContextPtr mmesa, #endif } -static __inline void mach64_draw_line( mach64ContextPtr mmesa, +static INLINE void mach64_draw_line( mach64ContextPtr mmesa, mach64VertexPtr v0, mach64VertexPtr v1 ) { @@ -955,7 +955,7 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa, #endif } -static __inline void mach64_draw_point( mach64ContextPtr mmesa, +static INLINE void mach64_draw_point( mach64ContextPtr mmesa, mach64VertexPtr v0 ) { #if MACH64_NATIVE_VTXFMT diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 2681976fc2b..55d823810b6 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -329,9 +329,9 @@ extern int MGA_DEBUG; #define DEBUG_VERBOSE_TEXTURE 0x08 #define DEBUG_VERBOSE_FALLBACK 0x10 -static __inline__ GLuint mgaPackColor(GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a) +static INLINE GLuint mgaPackColor(GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a) { switch (cpp) { case 2: diff --git a/src/mesa/drivers/dri/mga/mgaioctl.h b/src/mesa/drivers/dri/mga/mgaioctl.h index 0ea0ba1acd4..3a377234e46 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.h +++ b/src/mesa/drivers/dri/mga/mgaioctl.h @@ -62,7 +62,7 @@ void mgaInitIoctlFuncs( struct dd_function_table *functions ); extern drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ); -static __inline +static INLINE GLuint *mgaAllocDmaLow( mgaContextPtr mmesa, int bytes ) { GLuint *head; diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index 91b413ae760..9f270d7d6c9 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -67,7 +67,7 @@ do { \ } while (0) #endif -static void __inline__ mga_draw_triangle( mgaContextPtr mmesa, +static void INLINE mga_draw_triangle( mgaContextPtr mmesa, mgaVertexPtr v0, mgaVertexPtr v1, mgaVertexPtr v2 ) @@ -82,7 +82,7 @@ static void __inline__ mga_draw_triangle( mgaContextPtr mmesa, } -static void __inline__ mga_draw_quad( mgaContextPtr mmesa, +static void INLINE mga_draw_quad( mgaContextPtr mmesa, mgaVertexPtr v0, mgaVertexPtr v1, mgaVertexPtr v2, @@ -101,7 +101,7 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa, } -static __inline__ void mga_draw_point( mgaContextPtr mmesa, +static INLINE void mga_draw_point( mgaContextPtr mmesa, mgaVertexPtr tmp ) { const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size, @@ -160,7 +160,7 @@ static __inline__ void mga_draw_point( mgaContextPtr mmesa, } -static __inline__ void mga_draw_line( mgaContextPtr mmesa, +static INLINE void mga_draw_line( mgaContextPtr mmesa, mgaVertexPtr v0, mgaVertexPtr v1 ) { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader.h b/src/mesa/drivers/dri/nouveau/nouveau_shader.h index 7125a2ae821..636bcaa72b2 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader.h @@ -396,21 +396,21 @@ struct _nvsFunc { int (*GetLoopIncrement) (nvsFunc *); }; -static inline nvsRegister +static INLINE nvsRegister nvsNegate(nvsRegister reg) { reg.negate = !reg.negate; return reg; } -static inline nvsRegister +static INLINE nvsRegister nvsAbs(nvsRegister reg) { reg.abs = 1; return reg; } -static inline nvsRegister +static INLINE nvsRegister nvsSwizzle(nvsRegister reg, nvsSwzComp x, nvsSwzComp y, nvsSwzComp z, nvsSwzComp w) { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index e2f9fb869a1..1eb6069e34c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -38,9 +38,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mtypes.h" #include "colormac.h" -static __inline__ GLuint nouveauPackColor(GLuint format, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a) +static INLINE GLuint nouveauPackColor(GLuint format, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a) { switch (format) { case 2: diff --git a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c index cb072e0bdbc..1b73d0be6fb 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c @@ -53,7 +53,7 @@ static void nv04RenderPrimitive( GLcontext *ctx, GLenum prim ); static void nv04ResetLineStipple( GLcontext *ctx ); -static inline void nv04_2triangles(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2,nouveauVertex* v3,nouveauVertex* v4,nouveauVertex* v5) +static INLINE void nv04_2triangles(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2,nouveauVertex* v3,nouveauVertex* v4,nouveauVertex* v5) { BEGIN_RING_SIZE(NvSub3D,NV04_DX5_TEXTURED_TRIANGLE_TLVERTEX_SX(0xA),49); OUT_RINGp(v0,8); @@ -65,7 +65,7 @@ static inline void nv04_2triangles(struct nouveau_context *nmesa,nouveauVertex* OUT_RING(0xFEDCBA); } -static inline void nv04_1triangle(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2) +static INLINE void nv04_1triangle(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2) { BEGIN_RING_SIZE(NvSub3D,NV04_DX5_TEXTURED_TRIANGLE_TLVERTEX_SX(0xD),25); OUT_RINGp(v0,8); @@ -74,7 +74,7 @@ static inline void nv04_1triangle(struct nouveau_context *nmesa,nouveauVertex* v OUT_RING(0xFED); } -static inline void nv04_1quad(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2,nouveauVertex* v3) +static INLINE void nv04_1quad(struct nouveau_context *nmesa,nouveauVertex* v0,nouveauVertex* v1,nouveauVertex* v2,nouveauVertex* v3) { BEGIN_RING_SIZE(NvSub3D,NV04_DX5_TEXTURED_TRIANGLE_TLVERTEX_SX(0xC),33); OUT_RINGp(v0,8); @@ -84,17 +84,17 @@ static inline void nv04_1quad(struct nouveau_context *nmesa,nouveauVertex* v0,no OUT_RING(0xFECEDC); } -static inline void nv04_render_points(GLcontext *ctx,GLuint first,GLuint last) +static INLINE void nv04_render_points(GLcontext *ctx,GLuint first,GLuint last) { WARN_ONCE("Unimplemented\n"); } -static inline void nv04_render_line(GLcontext *ctx,GLuint v1,GLuint v2) +static INLINE void nv04_render_line(GLcontext *ctx,GLuint v1,GLuint v2) { WARN_ONCE("Unimplemented\n"); } -static inline void nv04_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) +static INLINE void nv04_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLubyte *vertptr = (GLubyte *)nmesa->verts; @@ -107,7 +107,7 @@ static inline void nv04_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuin ); } -static inline void nv04_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) +static INLINE void nv04_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLubyte *vertptr = (GLubyte *)nmesa->verts; @@ -465,7 +465,7 @@ static void nv04ChooseRenderState(GLcontext *ctx) -static inline void nv04OutputVertexFormat(struct nouveau_context* nmesa) +static INLINE void nv04OutputVertexFormat(struct nouveau_context* nmesa) { GLcontext* ctx=nmesa->glCtx; DECLARE_RENDERINPUTS(index); diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 42b3d666fb9..a55d597ab42 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -100,7 +100,7 @@ static const int default_attr_size[8]={3,3,3,4,3,1,4,4}; #endif -static inline void nv10StartPrimitive(struct nouveau_context* nmesa,GLuint primitive,GLuint size) +static INLINE void nv10StartPrimitive(struct nouveau_context* nmesa,GLuint primitive,GLuint size) { if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); @@ -131,7 +131,7 @@ void nv10FinishPrimitive(struct nouveau_context *nmesa) } -static inline void nv10ExtendPrimitive(struct nouveau_context* nmesa, int size) +static INLINE void nv10ExtendPrimitive(struct nouveau_context* nmesa, int size) { /* make sure there's enough room. if not, wait */ if (RING_AVAILABLE()<size) @@ -144,7 +144,7 @@ static inline void nv10ExtendPrimitive(struct nouveau_context* nmesa, int size) /* Render unclipped begin/end objects */ /**********************************************************************/ -static inline void nv10_render_generic_primitive_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) +static INLINE void nv10_render_generic_primitive_verts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLfloat *vertptr = (GLfloat *)nmesa->verts; @@ -230,7 +230,7 @@ static void (*nv10_render_tab_verts[GL_POLYGON+2])(GLcontext *, }; -static inline void nv10_render_generic_primitive_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) +static INLINE void nv10_render_generic_primitive_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLfloat *vertptr = (GLfloat *)nmesa->verts; @@ -332,7 +332,7 @@ do { \ nmesa->vertex_attr_count++; \ } while (0) -static inline void nv10_render_point(GLcontext *ctx, GLfloat *vertptr) +static INLINE void nv10_render_point(GLcontext *ctx, GLfloat *vertptr) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLuint vertsize = nmesa->vertex_size; @@ -344,7 +344,7 @@ static inline void nv10_render_point(GLcontext *ctx, GLfloat *vertptr) nv10FinishPrimitive(nmesa); } -static inline void nv10_render_points(GLcontext *ctx,GLuint first,GLuint last) +static INLINE void nv10_render_points(GLcontext *ctx,GLuint first,GLuint last) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); @@ -364,7 +364,7 @@ static inline void nv10_render_points(GLcontext *ctx,GLuint first,GLuint last) } } -static inline void nv10_render_line(GLcontext *ctx,GLuint v1,GLuint v2) +static INLINE void nv10_render_line(GLcontext *ctx,GLuint v1,GLuint v2) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLfloat *vertptr = (GLfloat *)nmesa->verts; @@ -378,7 +378,7 @@ static inline void nv10_render_line(GLcontext *ctx,GLuint v1,GLuint v2) nv10FinishPrimitive(nmesa); } -static inline void nv10_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) +static INLINE void nv10_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLfloat *vertptr = (GLfloat *)nmesa->verts; @@ -393,7 +393,7 @@ static inline void nv10_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuin nv10FinishPrimitive(nmesa); } -static inline void nv10_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) +static INLINE void nv10_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); GLfloat *vertptr = (GLfloat *)nmesa->verts; @@ -428,7 +428,7 @@ static void nv10ChooseRenderState(GLcontext *ctx) -static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) +static INLINE void nv10OutputVertexFormat(struct nouveau_context* nmesa) { GLcontext* ctx=nmesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.h b/src/mesa/drivers/dri/r128/r128_ioctl.h index 0f9d11fe699..5ed44559a6d 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.h +++ b/src/mesa/drivers/dri/r128/r128_ioctl.h @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. extern drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa ); extern void r128FlushVerticesLocked( r128ContextPtr rmesa ); -static __inline void *r128AllocDmaLow( r128ContextPtr rmesa, int count, +static INLINE void *r128AllocDmaLow( r128ContextPtr rmesa, int count, int vert_size ) { u_int32_t *head; diff --git a/src/mesa/drivers/dri/r128/r128_tex.h b/src/mesa/drivers/dri/r128/r128_tex.h index 54053b8b315..40168f83bc2 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.h +++ b/src/mesa/drivers/dri/r128/r128_tex.h @@ -68,9 +68,9 @@ extern void r128InitTextureFuncs( struct dd_function_table *functions ); #define R128PACKCOLOR4444( r, g, b, a ) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -static __inline__ u_int32_t r128PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static INLINE u_int32_t r128PackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index be73507995b..ee478e7d3c0 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -927,7 +927,7 @@ struct r200_context { #define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx)) -static __inline GLuint r200PackColor( GLuint cpp, +static INLINE GLuint r200PackColor( GLuint cpp, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 4521fbabf1d..31431b7b03d 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -137,7 +137,7 @@ do { \ memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \ rmesa->hw.ATOM.cmd_size * 4) -static __inline int R200_DB_STATECHANGE( +static INLINE int R200_DB_STATECHANGE( r200ContextPtr rmesa, struct r200_state_atom *atom ) { @@ -183,7 +183,7 @@ do { \ * 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 ) +static INLINE void r200EnsureCmdBufSpace( r200ContextPtr rmesa, int bytes ) { if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ) r200FlushCmdBuf( rmesa, __FUNCTION__ ); @@ -192,7 +192,7 @@ static __inline void r200EnsureCmdBufSpace( r200ContextPtr rmesa, int bytes ) /* Alloc space in the command buffer */ -static __inline char *r200AllocCmdBuf( r200ContextPtr rmesa, +static INLINE char *r200AllocCmdBuf( r200ContextPtr rmesa, int bytes, const char *where ) { char * head; diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index db8ceeabe03..46d230767a1 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -382,7 +382,7 @@ r200TryDrawPixels( GLcontext *ctx, GLint pitch = unpack->RowLength ? unpack->RowLength : width; GLuint planemask; GLuint cpp = rmesa->r200Screen->cpp; - GLint size = width * pitch * cpp; + GLint size = height * pitch * cpp; if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 4be03448592..562992fbb5c 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -154,7 +154,7 @@ static GLboolean r200VertexProgUpdateParams(GLcontext *ctx, struct r200_vertex_p return GL_TRUE; } -static __inline unsigned long t_dst_mask(GLuint mask) +static INLINE unsigned long t_dst_mask(GLuint mask) { /* WRITEMASK_* is equivalent to VSF_FLAG_* */ return mask & VSF_FLAG_ALL; @@ -229,7 +229,7 @@ static unsigned long t_src_class(enum register_file file) } } -static __inline unsigned long t_swizzle(GLubyte swizzle) +static INLINE unsigned long t_swizzle(GLubyte swizzle) { /* this is in fact a NOP as the Mesa SWIZZLE_* are all identical to VSF_IN_COMPONENT_* */ return swizzle; diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 8d4d604ba96..d378045b983 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -150,7 +150,7 @@ static void r300PrintStateAtom(r300ContextPtr r300, struct r300_state_atom *stat * The caller must have ensured that there is enough space in the command * buffer. */ -static inline void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty) +static INLINE void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty) { struct r300_state_atom *atom; uint32_t *dest; diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index acb6e38c6df..a8eaa580bd9 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -52,7 +52,7 @@ extern void r300DestroyCmdBuf(r300ContextPtr r300); * * \param dwords The number of dwords we need to be free on the command buffer */ -static inline void r300EnsureCmdBufSpace(r300ContextPtr r300, +static INLINE void r300EnsureCmdBufSpace(r300ContextPtr r300, int dwords, const char *caller) { assert(dwords < r300->cmdbuf.size); @@ -68,7 +68,7 @@ static inline void r300EnsureCmdBufSpace(r300ContextPtr r300, * causes state reemission after a flush. This is necessary to ensure * correct hardware state after an unlock. */ -static inline uint32_t *r300RawAllocCmdBuf(r300ContextPtr r300, +static INLINE uint32_t *r300RawAllocCmdBuf(r300ContextPtr r300, int dwords, const char *caller) { uint32_t *ptr; @@ -80,7 +80,7 @@ static inline uint32_t *r300RawAllocCmdBuf(r300ContextPtr r300, return ptr; } -static inline uint32_t *r300AllocCmdBuf(r300ContextPtr r300, +static INLINE uint32_t *r300AllocCmdBuf(r300ContextPtr r300, int dwords, const char *caller) { uint32_t *ptr; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 6279a67ab16..285b2ad6fd6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -78,7 +78,7 @@ typedef struct r300_context *r300ContextPtr; /** * This function takes a float and packs it into a uint32_t */ -static inline uint32_t r300PackFloat32(float fl) +static INLINE uint32_t r300PackFloat32(float fl) { union { float fl; @@ -95,7 +95,7 @@ static inline uint32_t r300PackFloat32(float fl) * But it works for most things. I'll fix it later if someone * else with a better clue doesn't */ -static inline uint32_t r300PackFloat24(float f) +static INLINE uint32_t r300PackFloat24(float f) { float mantissa; int exponent; diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index e6a6df8c4c2..5950539cba4 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -50,7 +50,7 @@ #define CP_PACKET3( pkt, n ) \ (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) -static inline uint32_t cmdpacket0(int reg, int count) +static INLINE uint32_t cmdpacket0(int reg, int count) { drm_r300_cmd_header_t cmd; @@ -62,7 +62,7 @@ static inline uint32_t cmdpacket0(int reg, int count) return cmd.u; } -static inline uint32_t cmdvpu(int addr, int count) +static INLINE uint32_t cmdvpu(int addr, int count) { drm_r300_cmd_header_t cmd; @@ -74,7 +74,7 @@ static inline uint32_t cmdvpu(int addr, int count) return cmd.u; } -static inline uint32_t cmdr500fp(int addr, int count, int type, int clamp) +static INLINE uint32_t cmdr500fp(int addr, int count, int type, int clamp) { drm_r300_cmd_header_t cmd; @@ -88,7 +88,7 @@ static inline uint32_t cmdr500fp(int addr, int count, int type, int clamp) return cmd.u; } -static inline uint32_t cmdpacket3(int packet) +static INLINE uint32_t cmdpacket3(int packet) { drm_r300_cmd_header_t cmd; @@ -98,7 +98,7 @@ static inline uint32_t cmdpacket3(int packet) return cmd.u; } -static inline uint32_t cmdcpdelay(unsigned short count) +static INLINE uint32_t cmdcpdelay(unsigned short count) { drm_r300_cmd_header_t cmd; @@ -108,7 +108,7 @@ static inline uint32_t cmdcpdelay(unsigned short count) return cmd.u; } -static inline uint32_t cmdwait(unsigned char flags) +static INLINE uint32_t cmdwait(unsigned char flags) { drm_r300_cmd_header_t cmd; @@ -118,7 +118,7 @@ static inline uint32_t cmdwait(unsigned char flags) return cmd.u; } -static inline uint32_t cmdpacify(void) +static INLINE uint32_t cmdpacify(void) { drm_r300_cmd_header_t cmd; @@ -218,7 +218,7 @@ static inline uint32_t cmdpacify(void) /** * Must be sent to switch to 2d commands */ -void static inline end_3d(r300ContextPtr rmesa) +void static INLINE end_3d(r300ContextPtr rmesa) { drm_radeon_cmd_header_t *cmd = NULL; @@ -227,7 +227,7 @@ void static inline end_3d(r300ContextPtr rmesa) cmd[0].header.cmd_type = R300_CMD_END3D; } -void static inline cp_delay(r300ContextPtr rmesa, unsigned short count) +void static INLINE cp_delay(r300ContextPtr rmesa, unsigned short count) { drm_radeon_cmd_header_t *cmd = NULL; @@ -236,7 +236,7 @@ void static inline cp_delay(r300ContextPtr rmesa, unsigned short count) cmd[0].i = cmdcpdelay(count); } -void static inline cp_wait(r300ContextPtr rmesa, unsigned char flags) +void static INLINE cp_wait(r300ContextPtr rmesa, unsigned char flags) { drm_radeon_cmd_header_t *cmd = NULL; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c index 9ba29feb40b..d72b92832c9 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c @@ -584,7 +584,7 @@ static GLuint emit_const4fv(struct r300_pfs_compile_state *cs, return reg; } -static inline GLuint negate(GLuint r) +static INLINE GLuint negate(GLuint r) { REG_NEGS(r); REG_NEGV(r); @@ -594,13 +594,13 @@ static inline GLuint negate(GLuint r) /* Hack, to prevent clobbering sources used multiple times when * emulating non-native instructions */ -static inline GLuint keep(GLuint r) +static INLINE GLuint keep(GLuint r) { REG_SET_NO_USE(r, GL_TRUE); return r; } -static inline GLuint absolute(GLuint r) +static INLINE GLuint absolute(GLuint r) { REG_ABS(r); return r; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 55d3d55e900..b1284647da1 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1853,7 +1853,7 @@ static void r500SetupRSUnit(GLcontext * ctx) if(_nc>_p->vpu.count)_p->vpu.count=_nc;\ }while(0) -static inline void r300SetupVertexProgramFragment(r300ContextPtr r300, int dest, struct r300_vertex_shader_fragment *vsf) +static INLINE void r300SetupVertexProgramFragment(r300ContextPtr r300, int dest, struct r300_vertex_shader_fragment *vsf) { int i; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 861f0427cf5..c4e325e6a76 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -186,7 +186,7 @@ static unsigned long t_src_class(enum register_file file) } } -static inline unsigned long t_swizzle(GLubyte swizzle) +static INLINE unsigned long t_swizzle(GLubyte swizzle) { /* this is in fact a NOP as the Mesa SWIZZLE_* are all identical to VSF_IN_COMPONENT_* */ return swizzle; diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c index e1ad342690b..3dc72af87ab 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c @@ -201,7 +201,7 @@ static const GLfloat LIT[] = {127.999999, 127.999999, -127.999999}; -static inline GLuint make_rgb_swizzle(struct prog_src_register src) { +static INLINE GLuint make_rgb_swizzle(struct prog_src_register src) { GLuint swiz = 0x0; GLuint temp; /* This could be optimized, but it should be plenty fast already. */ @@ -217,7 +217,7 @@ static inline GLuint make_rgb_swizzle(struct prog_src_register src) { return swiz; } -static inline GLuint make_rgba_swizzle(GLuint src) { +static INLINE GLuint make_rgba_swizzle(GLuint src) { GLuint swiz = 0x0; GLuint temp; int i; @@ -230,7 +230,7 @@ static inline GLuint make_rgba_swizzle(GLuint src) { return swiz; } -static inline GLuint make_alpha_swizzle(struct prog_src_register src) { +static INLINE GLuint make_alpha_swizzle(struct prog_src_register src) { GLuint swiz = GET_SWZ(src.Swizzle, 3); if (swiz == 5) swiz++; @@ -241,14 +241,14 @@ static inline GLuint make_alpha_swizzle(struct prog_src_register src) { return swiz; } -static inline GLuint make_sop_swizzle(struct prog_src_register src) { +static INLINE GLuint make_sop_swizzle(struct prog_src_register src) { GLuint swiz = GET_SWZ(src.Swizzle, 0); if (swiz == 5) swiz++; return swiz; } -static inline GLuint make_strq_swizzle(struct prog_src_register src) { +static INLINE GLuint make_strq_swizzle(struct prog_src_register src) { GLuint swiz = 0x0, temp = 0x0; int i; for (i = 0; i < 4; i++) { diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 2821ecc0c08..55a73eab209 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -106,6 +106,7 @@ #define PCI_CHIP_RV410_564F 0x564F #define PCI_CHIP_RV410_5652 0x5652 #define PCI_CHIP_RV410_5653 0x5653 +#define PCI_CHIP_RV410_5657 0x5657 #define PCI_CHIP_RS300_5834 0x5834 #define PCI_CHIP_RS300_5835 0x5835 #define PCI_CHIP_RS480_5954 0x5954 @@ -127,7 +128,6 @@ #define PCI_CHIP_RV370_5B63 0x5B63 #define PCI_CHIP_RV370_5B64 0x5B64 #define PCI_CHIP_RV370_5B65 0x5B65 -#define PCI_CHIP_RV370_5657 0x5657 #define PCI_CHIP_RV280_5C61 0x5C61 #define PCI_CHIP_RV280_5C63 0x5C63 #define PCI_CHIP_R430_5D48 0x5D48 diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index b4ffde5d540..7c45c37b03e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -705,9 +705,9 @@ struct radeon_context { #define RADEON_CONTEXT(ctx) ((radeonContextPtr)(ctx->DriverCtx)) -static __inline GLuint radeonPackColor(GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a) +static INLINE GLuint radeonPackColor(GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a) { switch (cpp) { case 2: diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index b8d68eec867..b3c287fb2bf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -124,7 +124,7 @@ do { \ memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \ rmesa->hw.ATOM.cmd_size * 4) -static __inline int RADEON_DB_STATECHANGE( +static INLINE int RADEON_DB_STATECHANGE( radeonContextPtr rmesa, struct radeon_state_atom *atom ) { @@ -177,7 +177,7 @@ do { \ * and hang on to the lock until the critical section is finished and we flush * the buffer again and unlock. */ -static __inline void radeonEnsureCmdBufSpace( radeonContextPtr rmesa, +static INLINE void radeonEnsureCmdBufSpace( radeonContextPtr rmesa, int bytes ) { if (rmesa->store.cmd_used + bytes > RADEON_CMD_BUF_SZ) @@ -187,7 +187,7 @@ static __inline void radeonEnsureCmdBufSpace( radeonContextPtr rmesa, /* Alloc space in the command buffer */ -static __inline char *radeonAllocCmdBuf( radeonContextPtr rmesa, +static INLINE char *radeonAllocCmdBuf( radeonContextPtr rmesa, int bytes, const char *where ) { if (rmesa->store.cmd_used + bytes > RADEON_CMD_BUF_SZ) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 08568a407ed..b647cffa0e7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -599,7 +599,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RV370_5B63: case PCI_CHIP_RV370_5B64: case PCI_CHIP_RV370_5B65: - case PCI_CHIP_RV370_5657: case PCI_CHIP_RV380_3150: case PCI_CHIP_RV380_3152: case PCI_CHIP_RV380_3154: @@ -656,6 +655,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RV410_564F: case PCI_CHIP_RV410_5652: case PCI_CHIP_RV410_5653: + case PCI_CHIP_RV410_5657: case PCI_CHIP_RV410_5E48: case PCI_CHIP_RV410_5E4A: case PCI_CHIP_RV410_5E4B: diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h index 6f527f3a834..ed698103fff 100644 --- a/src/mesa/drivers/dri/s3v/s3v_context.h +++ b/src/mesa/drivers/dri/s3v/s3v_context.h @@ -419,9 +419,9 @@ struct s3v_context { #define S3VIRGEPACKCOLOR4444( r, g, b, a ) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -static __inline GLuint s3vPackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static INLINE GLuint s3vPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { unsigned int ret; DEBUG(("cpp = %i, r=0x%x, g=0x%x, b=0x%x, a=0x%x\n", cpp, r, g, b, a)); diff --git a/src/mesa/drivers/dri/s3v/s3v_macros.h b/src/mesa/drivers/dri/s3v/s3v_macros.h index 3bc871b7eaf..7e9b4529df4 100644 --- a/src/mesa/drivers/dri/s3v/s3v_macros.h +++ b/src/mesa/drivers/dri/s3v/s3v_macros.h @@ -19,6 +19,7 @@ #include <stdio.h> #endif +#undef DEBUG #if GENERIC_DEBUG #define DEBUG(str) printf str #else diff --git a/src/mesa/drivers/dri/s3v/s3v_render.c b/src/mesa/drivers/dri/s3v/s3v_render.c index 6b86e0e6049..fa3f85e52b3 100644 --- a/src/mesa/drivers/dri/s3v/s3v_render.c +++ b/src/mesa/drivers/dri/s3v/s3v_render.c @@ -66,7 +66,7 @@ static const GLuint hw_prim[GL_POLYGON+1] = { PrimType_Polygon }; -static __inline void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim ) +static INLINE void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim ) { __DRIdrawablePrivate *dPriv = vmesa->driDrawable; @@ -110,7 +110,7 @@ static __inline void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim ) vmesa->restore_primitive = _hw_prim; } -static __inline void s3vEndPrimitive( s3vContextPtr vmesa ) +static INLINE void s3vEndPrimitive( s3vContextPtr vmesa ) { /* GLcontext *ctx = vmesa->glCtx; */ DEBUG(("s3vEndPrimitive\n")); diff --git a/src/mesa/drivers/dri/savage/savageioctl.h b/src/mesa/drivers/dri/savage/savageioctl.h index c7ff0017fde..50dce848a27 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.h +++ b/src/mesa/drivers/dri/savage/savageioctl.h @@ -64,19 +64,19 @@ void savageSwapBuffers( __DRIdrawablePrivate *dPriv ); extern void savageGetDMABuffer( savageContextPtr imesa ); -static __inline +static INLINE void savageReleaseIndexedVerts( savageContextPtr imesa ) { imesa->firstElt = -1; } -static __inline +static INLINE GLboolean savageHaveIndexedVerts( savageContextPtr imesa ) { return (imesa->firstElt != -1); } -static __inline +static INLINE u_int32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words ) { struct savage_vtxbuf_t *buffer = imesa->vtxBuf; @@ -115,7 +115,7 @@ u_int32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words ) return head; } -static __inline +static INLINE u_int32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n ) { u_int32_t *ret; @@ -131,7 +131,7 @@ u_int32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n ) * - Actually allocate entries for the indices in the command buffer. * (This allocation must succeed without wrapping the cmd buffer!) */ -static __inline +static INLINE void savageFlushElts( savageContextPtr imesa ) { if (imesa->elts.cmd) { @@ -148,7 +148,7 @@ void savageFlushElts( savageContextPtr imesa ) /* Allocate a command buffer entry with <bytes> bytes of arguments: * - implies savageFlushElts */ -static __inline +static INLINE drm_savage_cmd_header_t *savageAllocCmdBuf( savageContextPtr imesa, GLuint bytes ) { drm_savage_cmd_header_t *ret; @@ -171,7 +171,7 @@ drm_savage_cmd_header_t *savageAllocCmdBuf( savageContextPtr imesa, GLuint bytes * incomplete indexed drawing command yet * - increments the number of elts. Final allocation is done in savageFlushElts */ -static __inline +static INLINE u_int16_t *savageAllocElts( savageContextPtr imesa, GLuint n ) { u_int16_t *ret; diff --git a/src/mesa/drivers/dri/savage/savagespan.h b/src/mesa/drivers/dri/savage/savagespan.h index f6a312e820e..53a7f8b97c8 100644 --- a/src/mesa/drivers/dri/savage/savagespan.h +++ b/src/mesa/drivers/dri/savage/savagespan.h @@ -55,7 +55,7 @@ savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis, * * Note that there is no encoding for numbers < 2^-16. */ -static __inline GLuint savageEncodeFloat16( GLdouble x ) +static INLINE GLuint savageEncodeFloat16( GLdouble x ) { GLint r = (GLint)(x * 0x10000000); GLint exp = 0; @@ -67,7 +67,7 @@ static __inline GLuint savageEncodeFloat16( GLdouble x ) } return exp > 0xf ? 0xffff : (r - 0x1000) | (exp << 12); } -static __inline GLdouble savageDecodeFloat16( GLuint x ) +static INLINE GLdouble savageDecodeFloat16( GLuint x ) { static const GLdouble pow2[16] = { 1.0/(1<<28), 1.0/(1<<27), 1.0/(1<<26), 1.0/(1<<25), @@ -92,7 +92,7 @@ static __inline GLdouble savageDecodeFloat16( GLuint x ) * * Details analogous to the 16-bit format. */ -static __inline GLuint savageEncodeFloat24( GLdouble x ) +static INLINE GLuint savageEncodeFloat24( GLdouble x ) { int64_t r = (int64_t)(x * ((int64_t)1 << (19+32))); GLint exp = 0; @@ -105,7 +105,7 @@ static __inline GLuint savageEncodeFloat24( GLdouble x ) return exp > 0x1f ? 0xffffff : (r - 0x80000) | (exp << 19); } #define _1 (int64_t)1 -static __inline GLdouble savageDecodeFloat24( GLuint x ) +static INLINE GLdouble savageDecodeFloat24( GLuint x ) { static const GLdouble pow2[32] = { 1.0/(_1<<51), 1.0/(_1<<50), 1.0/(_1<<49), 1.0/(_1<<48), diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 7c36b133a91..c5ef47f2580 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -76,7 +76,7 @@ static void savageBlendFunc_s4(GLcontext *); static void savageBlendFunc_s3d(GLcontext *); -static __inline__ GLuint savagePackColor(GLuint format, +static INLINE GLuint savagePackColor(GLuint format, GLubyte r, GLubyte g, GLubyte b, GLubyte a) { diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 1dcfee291f5..9b81756eb94 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -101,7 +101,7 @@ static const savageTileInfo tileInfo_s3d_s4[5] = { * \param w width in bytes */ #define SUBTILE_FUNC(w,h) \ -static __inline GLubyte *savageUploadSubtile_##w##x##h \ +static INLINE GLubyte *savageUploadSubtile_##w##x##h \ (GLubyte *dest, GLubyte *src, GLuint srcStride) \ { \ GLuint y; \ diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 4ce2f60b4f3..c67045c8b57 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -95,7 +95,7 @@ do { \ } while (0) #endif -static void __inline__ savage_draw_triangle (savageContextPtr imesa, +static void INLINE savage_draw_triangle (savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1, savageVertexPtr v2) { @@ -108,7 +108,7 @@ static void __inline__ savage_draw_triangle (savageContextPtr imesa, EMIT_VERT (j, vb, vertsize, 0, v2); } -static void __inline__ savage_draw_quad (savageContextPtr imesa, +static void INLINE savage_draw_quad (savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1, savageVertexPtr v2, @@ -125,7 +125,7 @@ static void __inline__ savage_draw_quad (savageContextPtr imesa, EMIT_VERT (j, vb, vertsize, 0, v3); } -static __inline__ void savage_draw_point (savageContextPtr imesa, +static INLINE void savage_draw_point (savageContextPtr imesa, savageVertexPtr tmp) { GLuint vertsize = imesa->HwVertexSize; u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); @@ -161,7 +161,7 @@ static __inline__ void savage_draw_point (savageContextPtr imesa, EMIT_VERT (j, vb, vertsize, 2, tmp); } -static __inline__ void savage_draw_line (savageContextPtr imesa, +static INLINE void savage_draw_line (savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1 ) { GLuint vertsize = imesa->HwVertexSize; @@ -219,7 +219,7 @@ do { \ tmp.f[vertex_size-1] *= rhw; \ } while (0) -static void __inline__ savage_ptex_tri (savageContextPtr imesa, +static void INLINE savage_ptex_tri (savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1, savageVertexPtr v2) { @@ -233,7 +233,7 @@ static void __inline__ savage_ptex_tri (savageContextPtr imesa, PTEX_VERTEX (j, tmp, vertsize, 0, v2); EMIT_VERT (j, vb, vertsize, 0, &tmp); } -static __inline__ void savage_ptex_line (savageContextPtr imesa, +static INLINE void savage_ptex_line (savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1 ) { GLuint vertsize = imesa->HwVertexSize; @@ -281,7 +281,7 @@ static __inline__ void savage_ptex_line (savageContextPtr imesa, EMIT_VERT (j, vb, vertsize, 2, &tmp1); } -static __inline__ void savage_ptex_point (savageContextPtr imesa, +static INLINE void savage_ptex_point (savageContextPtr imesa, savageVertexPtr v0) { GLuint vertsize = imesa->HwVertexSize; u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); @@ -934,7 +934,7 @@ do { \ #define SAVAGE_EMIT_ST1 0x0300 -static __inline__ GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -997,7 +997,7 @@ static __inline__ GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) } -static __inline__ GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_tris.h b/src/mesa/drivers/dri/sis/sis_tris.h index 5e07acc2118..250949a83ce 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.h +++ b/src/mesa/drivers/dri/sis/sis_tris.h @@ -48,7 +48,7 @@ do { \ sisFlushPrims(smesa); \ } while (0) -static __inline GLuint *sisAllocDmaLow(sisContextPtr smesa, int bytes) +static INLINE GLuint *sisAllocDmaLow(sisContextPtr smesa, int bytes) { GLuint *start; diff --git a/src/mesa/drivers/dri/sis/sis_tritmp.h b/src/mesa/drivers/dri/sis/sis_tritmp.h index e670a5bf760..f75e17318fc 100644 --- a/src/mesa/drivers/dri/sis/sis_tritmp.h +++ b/src/mesa/drivers/dri/sis/sis_tritmp.h @@ -234,7 +234,7 @@ static void TAG(sis6326_draw_point_mmio)(sisContextPtr smesa, char *verts) } #endif -static __inline void TAG(sis_vert_init)( void ) +static INLINE void TAG(sis_vert_init)( void ) { sis_tri_func_mmio[SIS_STATES] = TAG(sis_draw_tri_mmio); sis_line_func_mmio[SIS_STATES] = TAG(sis_draw_line_mmio); diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index a3e3922f128..a614823aa04 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -92,19 +92,19 @@ struct swrast_renderbuffer { GLuint pitch; }; -static inline __DRIcontext * +static INLINE __DRIcontext * swrast_context(GLcontext *ctx) { return (__DRIcontext *) ctx; } -static inline __DRIdrawable * +static INLINE __DRIdrawable * swrast_drawable(GLframebuffer *fb) { return (__DRIdrawable *) fb; } -static inline struct swrast_renderbuffer * +static INLINE struct swrast_renderbuffer * swrast_renderbuffer(struct gl_renderbuffer *rb) { return (struct swrast_renderbuffer *) rb; diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h index e7a9c86d7de..187a240ea2f 100644 --- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -36,7 +36,7 @@ #ifndef _SWRAST_SPANTEMP_ONCE #define _SWRAST_SPANTEMP_ONCE -static inline void +static INLINE void PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) { __DRIcontext *ctx = swrast_context(glCtx); @@ -50,7 +50,7 @@ PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) } -static inline void +static INLINE void GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) { __DRIcontext *ctx = swrast_context(glCtx); @@ -62,7 +62,7 @@ GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) read->loaderPrivate); } -static inline void +static INLINE void PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx); @@ -75,7 +75,7 @@ PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) draw->loaderPrivate); } -static inline void +static INLINE void GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index 89a7a9d6c4e..dc8ece59399 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -984,9 +984,9 @@ FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); #define TDFXPACKCOLOR4444( r, g, b, a ) \ ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4)) -static __inline__ GrColor_t tdfxPackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static INLINE GrColor_t tdfxPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h index 1d3ca84400d..82b53df884b 100644 --- a/src/mesa/drivers/dri/trident/trident_context.h +++ b/src/mesa/drivers/dri/trident/trident_context.h @@ -54,14 +54,14 @@ #undef TAG /* these require that base be dword-aligned */ -static inline void MMIO_OUT32(unsigned char *base, unsigned int offset, +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) +static INLINE unsigned int MMIO_IN32(unsigned char *base, unsigned int offset) { unsigned int *addr = (unsigned int *)(base + offset); return *addr; diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c index 5303bd422ed..cc2e52ab279 100644 --- a/src/mesa/drivers/dri/trident/trident_state.c +++ b/src/mesa/drivers/dri/trident/trident_state.c @@ -51,9 +51,9 @@ #define TRIDENTPACKCOLOR4444(r, g, b, a) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -static __inline__ GLuint tridentPackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static INLINE GLuint tridentPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index d9b4f2d112a..ed7001d48df 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -123,7 +123,7 @@ static const GLubyte *viaGetString(GLcontext *ctx, GLenum name) * * \returns A pixel width that meets the alignment requirements. */ -static __inline__ unsigned +static INLINE unsigned buffer_align( unsigned width ) { return (width + 0x0f) & ~0x0f; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index 44fc439c9fd..14a833a97d0 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -58,7 +58,7 @@ void viaEmitBreadcrumb( struct via_context *vmesa ); void viaWrapPrimitive( struct via_context *vmesa ); -static __inline__ GLuint *viaAllocDma(struct via_context *vmesa, int bytes) +static INLINE GLuint *viaAllocDma(struct via_context *vmesa, int bytes) { if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { viaFlushDma(vmesa); @@ -72,7 +72,7 @@ static __inline__ GLuint *viaAllocDma(struct via_context *vmesa, int bytes) } -static GLuint __inline__ *viaExtendPrimitive(struct via_context *vmesa, int bytes) +static GLuint INLINE *viaExtendPrimitive(struct via_context *vmesa, int bytes) { if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { viaWrapPrimitive(vmesa); diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index d2c528923fd..645c58aa401 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -511,9 +511,9 @@ void viaEmitState(struct via_context *vmesa) } -static __inline__ GLuint viaPackColor(GLuint bpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a) +static INLINE GLuint viaPackColor(GLuint bpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a) { switch (bpp) { case 16: diff --git a/src/mesa/drivers/svga/svgamesa24.c b/src/mesa/drivers/svga/svgamesa24.c index dd15bf38db2..794c24c6259 100644 --- a/src/mesa/drivers/svga/svgamesa24.c +++ b/src/mesa/drivers/svga/svgamesa24.c @@ -40,7 +40,7 @@ #if 0 /* this doesn't compile with GCC on RedHat 6.1 */ -static inline int RGB2BGR24(int c) +static INLINE int RGB2BGR24(int c) { asm("rorw $8, %0\n" "rorl $16, %0\n" diff --git a/src/mesa/drivers/svga/svgamesa32.c b/src/mesa/drivers/svga/svgamesa32.c index 4da18795d8c..be4e51f7789 100644 --- a/src/mesa/drivers/svga/svgamesa32.c +++ b/src/mesa/drivers/svga/svgamesa32.c @@ -40,7 +40,7 @@ #if 0 /* this doesn't compile with GCC on RedHat 6.1 */ -static inline int RGB2BGR32(int c) +static INLINE int RGB2BGR32(int c) { asm("rorw $8, %0\n" "rorl $16, %0\n" diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index ad8f5c5beb3..95c41c3a41e 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -540,7 +540,6 @@ xmesa_renderbuffer(struct gl_renderbuffer *rb) /** * Return pointer to XMesaContext corresponding to a Mesa GLcontext. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaContext XMESA_CONTEXT(GLcontext *ctx) @@ -552,7 +551,6 @@ XMESA_CONTEXT(GLcontext *ctx) /** * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaBuffer XMESA_BUFFER(GLframebuffer *b) diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index c6f81fdd7e6..533e4a2bd8d 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -76,6 +76,30 @@ # include <inttypes.h> #endif +/* For platforms that have the C99 standard uint*_t, + but not the commonly used u_int*_t */ +#if defined(__sun) +# define u_int8_t uint8_t +# define u_int16_t uint16_t +# define u_int32_t uint32_t +# define u_int64_t uint64_t +# define u_intptr_t uintptr_t +#endif + +/* Sun compilers define __i386 instead of the gcc-style __i386__ */ +#ifdef __SUNPRO_C +# if !defined(__i386__) && defined(__i386) +# define __i386__ +# elif !defined(__amd64__) && defined(__amd64) +# define __amd64__ +# elif !defined(__sparc__) && defined(__sparc) +# define __sparc__ +# endif +# if !defined(__volatile) +# define __volatile volatile +# endif +#endif + #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) # define __WIN32__ # define finite _finite @@ -195,6 +219,12 @@ # define INLINE inline #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) # define INLINE __inline +#elif defined(__SUNPRO_C) && defined(__C99FEATURES__) +# define INLINE inline +# define __inline inline +# define __inline__ inline +#elif (__STDC_VERSION__ >= 199901L) /* C99 */ +# define INLINE inline #else # define INLINE #endif @@ -240,12 +270,17 @@ * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. * Don't define it if using a newer Windows compiler. */ -#if defined(__VMS) -# define __FUNCTION__ "VMS$NL:" -#elif __STDC_VERSION__ < 199901L -# if ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \ +#ifndef __FUNCTION__ +# if defined(__VMS) +# define __FUNCTION__ "VMS$NL:" +# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \ (!defined(_MSC_VER) || _MSC_VER < 1300) -# define __FUNCTION__ "<unknown>" +# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) +# define __FUNCTION__ __func__ +# else +# define __FUNCTION__ "<unknown>" +# endif # endif #endif diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 7ee26b423cc..00a18d3f15d 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -165,6 +165,7 @@ typedef union { GLfloat f; GLint i; } fi_type; defined(__mips) || defined(_MIPS_ARCH) || \ defined(__arm__) || \ defined(__sh__) || defined(__m32r__) || \ + (defined(__sun) && defined(_IEEE_754)) || \ (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) #define USE_IEEE #define IEEE_ONE 0x3f800000 diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index a5594ac6232..c9e9db132f1 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1854,8 +1854,19 @@ sample_cube_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; - GLint level = nearest_mipmap_level(tObj, lambda[i]); + GLint level; images = choose_cube_face(tObj, texcoord[i], newCoord); + + /* XXX we actually need to recompute lambda here based on the newCoords. + * But we would need the texcoords of adjacent fragments to compute that + * properly, and we don't have those here. + * For now, do an approximation: subtracting 1 from the chosen mipmap + * level seems to work in some test cases. + * The same adjustment is done in the next few functions. + */ + level = nearest_mipmap_level(tObj, lambda[i]); + level = MAX2(level - 1, 0); + sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]); } } @@ -1873,6 +1884,7 @@ sample_cube_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level = nearest_mipmap_level(tObj, lambda[i]); + level = MAX2(level - 1, 0); /* see comment above */ images = choose_cube_face(tObj, texcoord[i], newCoord); sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]); } @@ -1891,6 +1903,7 @@ sample_cube_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level = linear_mipmap_level(tObj, lambda[i]); + level = MAX2(level - 1, 0); /* see comment above */ images = choose_cube_face(tObj, texcoord[i], newCoord); if (level >= tObj->_MaxLevel) { sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], @@ -1919,6 +1932,7 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level = linear_mipmap_level(tObj, lambda[i]); + level = MAX2(level - 1, 0); /* see comment above */ images = choose_cube_face(tObj, texcoord[i], newCoord); if (level >= tObj->_MaxLevel) { sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index 6c2378f5e8a..2bb890593b1 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -389,7 +389,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) #if DO_QUAD #if DO_FULL_QUAD -static void TAG(quad)( GLcontext *ctx, +static void TAG(quadr)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; @@ -673,7 +673,7 @@ static void TAG(quad)( GLcontext *ctx, } } #else -static void TAG(quad)( GLcontext *ctx, GLuint e0, +static void TAG(quadr)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { if (DO_UNFILLED) { @@ -765,7 +765,7 @@ static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) static void TAG(init)( void ) { #if DO_QUAD - TAB[IND].quad = TAG(quad); + TAB[IND].quad = TAG(quadr); #endif #if DO_TRI TAB[IND].triangle = TAG(triangle); |