diff options
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_batchbuffer.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_batchbuffer.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_blit.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_chipset.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_clear.c | 44 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_extensions.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_copy.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_read.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 92 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_copy.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 40 |
15 files changed, 99 insertions, 213 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 9b39823917..4b498f8c5b 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -44,7 +44,9 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch) batch->buf = drm_intel_bo_alloc(intel->bufmgr, "batchbuffer", intel->maxBatchSize, 4096); - batch->map = batch->buffer; + drm_intel_gem_bo_map_gtt(batch->buf); + batch->map = batch->buf->virtual; + batch->size = intel->maxBatchSize; batch->ptr = batch->map; batch->reserved_space = BATCH_RESERVED; @@ -58,7 +60,6 @@ intel_batchbuffer_alloc(struct intel_context *intel) struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1); batch->intel = intel; - batch->buffer = malloc(intel->maxBatchSize); intel_batchbuffer_reset(batch); return batch; @@ -67,8 +68,11 @@ intel_batchbuffer_alloc(struct intel_context *intel) void intel_batchbuffer_free(struct intel_batchbuffer *batch) { - free (batch->buffer); - drm_intel_bo_unreference(batch->buf); + if (batch->map) { + drm_intel_gem_bo_unmap_gtt(batch->buf); + batch->map = NULL; + } + dri_bo_unreference(batch->buf); batch->buf = NULL; free(batch); } @@ -84,13 +88,7 @@ do_flush_locked(struct intel_batchbuffer *batch, GLuint used) int ret = 0; int x_off = 0, y_off = 0; - drm_intel_bo_subdata(batch->buf, 0, used, batch->buffer); - if (batch->state_batch_offset != batch->size) { - drm_intel_bo_subdata(batch->buf, - batch->state_batch_offset, - batch->size - batch->state_batch_offset, - batch->buffer + batch->state_batch_offset); - } + drm_intel_gem_bo_unmap_gtt(batch->buf); batch->ptr = NULL; @@ -99,7 +97,7 @@ do_flush_locked(struct intel_batchbuffer *batch, GLuint used) (x_off & 0xffff) | (y_off << 16)); } - if (INTEL_DEBUG & DEBUG_BATCH) { + if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) { drm_intel_bo_map(batch->buf, GL_FALSE); intel_decode(batch->buf->virtual, used / 4, batch->buf->offset, intel->intelScreen->deviceID, GL_TRUE); @@ -130,7 +128,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, if (used == 0) return; - if (INTEL_DEBUG & DEBUG_BATCH) + if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) fprintf(stderr, "%s:%d: Batchbuffer flush with %db used\n", file, line, used); @@ -174,7 +172,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, do_flush_locked(batch, used); - if (INTEL_DEBUG & DEBUG_SYNC) { + if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) { fprintf(stderr, "waiting for idle\n"); drm_intel_bo_map(batch->buf, GL_TRUE); drm_intel_bo_unmap(batch->buf); diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index ae53f45511..428c027c2f 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -17,8 +17,6 @@ struct intel_batchbuffer drm_intel_bo *buf; - GLubyte *buffer; - GLubyte *map; GLubyte *ptr; diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index a74e21720f..c2917e9b07 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -483,8 +483,11 @@ intel_emit_linear_blit(struct intel_context *intel, /* Blits are in a different ringbuffer so we don't use them. */ assert(intel->gen < 6); - /* The pitch is a signed value. */ - pitch = MIN2(size, (1 << 15) - 1); + /* The pitch given to the GPU must be DWORD aligned, and + * we want width to match pitch. Max width is (1 << 15 - 1), + * rounding that down to the nearest DWORD is 1 << 15 - 4 + */ + pitch = MIN2(size, (1 << 15) - 4); height = size / pitch; ok = intelEmitCopyBlit(intel, 1, pitch, src_bo, src_offset, I915_TILING_NONE, @@ -499,6 +502,7 @@ intel_emit_linear_blit(struct intel_context *intel, dst_offset += pitch * height; size -= pitch * height; assert (size < (1 << 15)); + assert ((size & 3) == 0); /* Pitch must be DWORD aligned */ if (size != 0) { ok = intelEmitCopyBlit(intel, 1, size, src_bo, src_offset, I915_TILING_NONE, diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index 1e7ceed32a..4fecdbed20 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -67,6 +67,7 @@ #define PCI_CHIP_G45_G 0x2E22 #define PCI_CHIP_G41_G 0x2E32 #define PCI_CHIP_B43_G 0x2E42 +#define PCI_CHIP_B43_G1 0x2E92 #define PCI_CHIP_ILD_G 0x0042 #define PCI_CHIP_ILM_G 0x0046 @@ -93,7 +94,8 @@ devid == PCI_CHIP_Q45_G || \ devid == PCI_CHIP_G45_G || \ devid == PCI_CHIP_G41_G || \ - devid == PCI_CHIP_B43_G) + devid == PCI_CHIP_B43_G || \ + devid == PCI_CHIP_B43_G1) #define IS_GM45(devid) (devid == PCI_CHIP_GM45_GM) #define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid)) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index d7814635b7..fa451f0045 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -58,6 +58,21 @@ static const char *buffer_names[] = { [BUFFER_COLOR7] = "color7", }; +static void +debug_mask(const char *name, GLbitfield mask) +{ + GLuint i; + + if (unlikely(INTEL_DEBUG & DEBUG_BLIT)) { + DBG("%s clear:", name); + for (i = 0; i < BUFFER_COUNT; i++) { + if (mask & (1 << i)) + DBG(" %s", buffer_names[i]); + } + DBG("\n"); + } +} + /** * Called by ctx->Driver.Clear. */ @@ -70,7 +85,6 @@ intelClear(struct gl_context *ctx, GLbitfield mask) GLbitfield blit_mask = 0; GLbitfield swrast_mask = 0; struct gl_framebuffer *fb = ctx->DrawBuffer; - GLuint i; if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) { intel->front_buffer_dirty = GL_TRUE; @@ -162,39 +176,17 @@ intelClear(struct gl_context *ctx, GLbitfield mask) } if (blit_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("blit clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (blit_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } + debug_mask("blit", blit_mask); intelClearWithBlit(ctx, blit_mask); } if (tri_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("tri clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (tri_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } - + debug_mask("tri", tri_mask); _mesa_meta_Clear(&intel->ctx, tri_mask); } if (swrast_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("swrast clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (swrast_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } + debug_mask("swrast", swrast_mask); _swrast_Clear(ctx, swrast_mask); } } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 7ace50bde9..152cdcaf37 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -155,6 +155,7 @@ intelGetString(struct gl_context * ctx, GLenum name) chipset = "Intel(R) G41"; break; case PCI_CHIP_B43_G: + case PCI_CHIP_B43_G1: chipset = "Intel(R) B43"; break; case PCI_CHIP_ILD_G: @@ -249,7 +250,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) * thus ignore the invalidate. */ drawable->lastStamp = drawable->dri2.stamp; - if (INTEL_DEBUG & DEBUG_DRI) + if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); screen = intel->intelScreen->driScrnPriv; @@ -378,14 +379,14 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (rb->region && rb->region->name == buffers[i].name) continue; - if (INTEL_DEBUG & DEBUG_DRI) + if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "attaching buffer %d, at %d, cpp %d, pitch %d\n", buffers[i].name, buffers[i].attachment, buffers[i].cpp, buffers[i].pitch); if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) { - if (INTEL_DEBUG & DEBUG_DRI) + if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "(reusing depth buffer as stencil)\n"); intel_region_reference(®ion, depth_region); } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 46d10d74ba..9d5139c000 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -98,6 +98,16 @@ extern void intelFallback(struct intel_context *intel, GLbitfield bit, #define INTEL_MAX_FIXUP 64 +#ifndef likely +#ifdef __GNUC__ +#define likely(expr) (__builtin_expect(expr, 1)) +#define unlikely(expr) (__builtin_expect(expr, 0)) +#else +#define likely(expr) (expr) +#define unlikely(expr) (expr) +#endif +#endif + struct intel_sync_object { struct gl_sync_object Base; @@ -180,9 +190,6 @@ struct intel_context } prim; GLuint stats_wm; - GLboolean locked; - char *prevLockFile; - int prevLockLine; /* Offsets of fields within the current vertex: */ @@ -359,10 +366,15 @@ extern int INTEL_DEBUG; #define DEBUG_CLIP 0x8000000 #define DBG(...) do { \ - if (INTEL_DEBUG & FILE_DEBUG_FLAG) \ + if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG)) \ printf(__VA_ARGS__); \ } while(0) +#define fallback_debug(...) do { \ + if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) \ + printf(__VA_ARGS__); \ +} while(0) + #define PCI_CHIP_845_G 0x2562 #define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_I855_GM 0x3582 diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 974045730b..556a4195bd 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -55,6 +55,7 @@ #define need_GL_EXT_point_parameters #define need_GL_EXT_provoking_vertex #define need_GL_EXT_secondary_color +#define need_GL_EXT_separate_shader_objects #define need_GL_EXT_stencil_two_side #define need_GL_EXT_timer_query #define need_GL_APPLE_vertex_array_object @@ -114,6 +115,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_packed_depth_stencil", NULL }, { "GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, + { "GL_EXT_separate_shader_objects", GL_EXT_separate_shader_objects_functions }, { "GL_EXT_stencil_wrap", NULL }, { "GL_EXT_texture_edge_clamp", NULL }, { "GL_EXT_texture_env_combine", NULL }, diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 60583ef4c0..d5c35775ce 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -147,10 +147,9 @@ intel_check_blit_format(struct intel_region * region, return GL_TRUE; } - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: bad format for blit (cpp %d, type %s format %s)\n", - __FUNCTION__, region->cpp, - _mesa_lookup_enum_by_nr(type), _mesa_lookup_enum_by_nr(format)); + DBG("%s: bad format for blit (cpp %d, type %s format %s)\n", + __FUNCTION__, region->cpp, + _mesa_lookup_enum_by_nr(type), _mesa_lookup_enum_by_nr(format)); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 63fb4b37b1..e7356a6da0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -113,9 +113,8 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, GLint incr; GLuint count = 0; - if (INTEL_DEBUG & DEBUG_PIXEL) - 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); + DBG("%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; @@ -285,7 +284,7 @@ do_blit_bitmap( struct gl_context *ctx, } out: - if (INTEL_DEBUG & DEBUG_SYNC) + if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) intel_batchbuffer_flush(intel->batch); if (_mesa_is_bufferobj(unpack->BufferObj)) { @@ -299,6 +298,7 @@ out: 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: diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index c6b36ed429..a7ca780e94 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -119,8 +119,7 @@ do_blit_copypixels(struct gl_context * ctx, GLboolean flip = GL_FALSE; if (type == GL_DEPTH || type == GL_STENCIL) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glCopyPixels() fallback: GL_DEPTH || GL_STENCIL\n"); + fallback_debug("glCopyPixels() fallback: GL_DEPTH || GL_STENCIL\n"); return GL_FALSE; } @@ -203,8 +202,7 @@ intelCopyPixels(struct gl_context * ctx, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type) { - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); + DBG("%s\n", __FUNCTION__); if (do_blit_copypixels(ctx, srcx, srcy, width, height, destx, desty, type)) return; diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index b249f9a5a0..54da29236d 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -42,6 +42,8 @@ #include "intel_pixel.h" #include "intel_buffer_objects.h" +#define FILE_DEBUG_FLAG DEBUG_PIXEL + /* For many applications, the new ability to pull the source buffers * back out of the GTT and then do the packing/conversion operations * in software will be as much of an improvement as trying to get the @@ -79,8 +81,7 @@ do_blit_readpixels(struct gl_context * ctx, GLboolean all; GLint dst_x, dst_y; - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s\n", __FUNCTION__); + DBG("%s\n", __FUNCTION__); if (!src) return GL_FALSE; @@ -88,22 +89,19 @@ do_blit_readpixels(struct gl_context * ctx, if (!_mesa_is_bufferobj(pack->BufferObj)) { /* PBO only for now: */ - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s - not PBO\n", __FUNCTION__); + DBG("%s - not PBO\n", __FUNCTION__); return GL_FALSE; } if (ctx->_ImageTransferState || !intel_check_blit_format(src, format, type)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s - bad format for blit\n", __FUNCTION__); + DBG("%s - bad format for blit\n", __FUNCTION__); return GL_FALSE; } if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) { - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s: bad packing params\n", __FUNCTION__); + DBG("%s: bad packing params\n", __FUNCTION__); return GL_FALSE; } @@ -113,8 +111,7 @@ do_blit_readpixels(struct gl_context * ctx, rowLength = width; if (pack->Invert) { - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__); + DBG("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__); return GL_FALSE; } else { @@ -158,8 +155,7 @@ do_blit_readpixels(struct gl_context * ctx, return GL_FALSE; } - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s - DONE\n", __FUNCTION__); + DBG("%s - DONE\n", __FUNCTION__); return GL_TRUE; } @@ -173,8 +169,7 @@ intelReadPixels(struct gl_context * ctx, struct intel_context *intel = intel_context(ctx); GLboolean dirty; - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); + DBG("%s\n", __FUNCTION__); intel_flush(ctx); @@ -188,8 +183,7 @@ intelReadPixels(struct gl_context * ctx, (ctx, x, y, width, height, format, type, pack, pixels)) return; - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s: fallback to swrast\n", __FUNCTION__); + fallback_debug("%s: fallback to swrast\n", __FUNCTION__); /* Update Mesa state before calling down into _swrast_ReadPixels, as * the spans code requires the computed buffer states to be up to date, diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 3d9a2549db..2c21ea0576 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -61,88 +61,6 @@ intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texI } } - -/* The system memcpy (at least on ubuntu 5.10) has problems copying - * to agp (writecombined) memory from a source which isn't 64-byte - * aligned - there is a 4x performance falloff. - * - * The x86 __memcpy is immune to this but is slightly slower - * (10%-ish) than the system memcpy. - * - * The sse_memcpy seems to have a slight cliff at 64/32 bytes, but - * isn't much faster than x86_memcpy for agp copies. - * - * TODO: switch dynamically. - */ -static void * -do_memcpy(void *dest, const void *src, size_t n) -{ - if ((((unsigned long) src) & 63) || (((unsigned long) dest) & 63)) { - return __memcpy(dest, src, n); - } - else - return memcpy(dest, src, n); -} - - -#if DO_DEBUG && !defined(__ia64__) - -#ifndef __x86_64__ -static unsigned -fastrdtsc(void) -{ - unsigned eax; - __asm__ volatile ("\t" - "pushl %%ebx\n\t" - "cpuid\n\t" ".byte 0x0f, 0x31\n\t" - "popl %%ebx\n":"=a" (eax) - :"0"(0) - :"ecx", "edx", "cc"); - - return eax; -} -#else -static unsigned -fastrdtsc(void) -{ - unsigned eax; - __asm__ volatile ("\t" "cpuid\n\t" ".byte 0x0f, 0x31\n\t":"=a" (eax) - :"0"(0) - :"ecx", "edx", "ebx", "cc"); - - return eax; -} -#endif - -static unsigned -time_diff(unsigned t, unsigned t2) -{ - return ((t < t2) ? t2 - t : 0xFFFFFFFFU - (t - t2 - 1)); -} - - -static void * -timed_memcpy(void *dest, const void *src, size_t n) -{ - void *ret; - unsigned t1, t2; - double rate; - - if ((((unsigned) src) & 63) || (((unsigned) dest) & 63)) - printf("Warning - non-aligned texture copy!\n"); - - t1 = fastrdtsc(); - ret = do_memcpy(dest, src, n); - t2 = fastrdtsc(); - - rate = time_diff(t1, t2); - rate /= (double) n; - printf("timed_memcpy: %u %u --> %f clocks/byte\n", t1, t2, rate); - return ret; -} -#endif /* DO_DEBUG */ - - /** * Called via ctx->Driver.GenerateMipmap() * This is basically a wrapper for _mesa_meta_GenerateMipmap() which checks @@ -158,8 +76,7 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target, struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + fallback_debug("%s - fallback to swrast\n", __FUNCTION__); intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); _mesa_generate_mipmap(ctx, target, texObj); @@ -203,11 +120,4 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->NewTextureImage = intelNewTextureImage; functions->DeleteTexture = intelDeleteTextureObject; functions->FreeTexImageData = intelFreeTextureImageData; - -#if DO_DEBUG && !defined(__ia64__) - if (INTEL_DEBUG & DEBUG_BUFMGR) - functions->TextureMemCpy = timed_memcpy; - else -#endif - functions->TextureMemCpy = do_memcpy; } diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 2d046fd52d..87b31bf078 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -30,7 +30,6 @@ #include "main/image.h" #include "main/teximage.h" #include "main/texstate.h" -#include "main/mipmap.h" #include "drivers/common/meta.h" @@ -105,16 +104,15 @@ do_copy_texsubimage(struct intel_context *intel, const struct intel_region *src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src || !src->buffer) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) + if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) fprintf(stderr, "%s fail %p %p (0x%08x)\n", __FUNCTION__, intelImage->mt, src, internalFormat); return GL_FALSE; } if (intelImage->mt->cpp != src->cpp) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s fail %d vs %d cpp\n", - __FUNCTION__, intelImage->mt->cpp, src->cpp); + fallback_debug("%s fail %d vs %d cpp\n", + __FUNCTION__, intelImage->mt->cpp, src->cpp); return GL_FALSE; } @@ -212,8 +210,7 @@ intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level, return; fail: - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + fallback_debug("%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y, width, border); } @@ -261,8 +258,7 @@ intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level, return; fail: - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + fallback_debug("%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y, width, height, border); } @@ -287,8 +283,7 @@ intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), internalFormat, xoffset, 0, x, y, width, 1)) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + fallback_debug("%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width); } } @@ -314,8 +309,7 @@ intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, internalFormat, xoffset, yoffset, x, y, width, height)) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + fallback_debug("%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexSubImage2D(ctx, target, level, xoffset, yoffset, x, y, width, height); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 35f3d7d382..41cdbfd2cb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -66,7 +66,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, GLuint width = intelImage->base.Width; GLuint height = intelImage->base.Height; GLuint depth = intelImage->base.Depth; - GLuint l2width, l2height, l2depth; GLuint i, comp_byte = 0; GLuint texelBytes; @@ -114,10 +113,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, lastLevel = firstLevel; } else { - l2width = logbase2(width); - l2height = logbase2(height); - l2depth = logbase2(depth); - lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); + lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth)); } assert(!intelObj->mt); @@ -347,21 +343,6 @@ intelTexImage(struct gl_context * ctx, texImage->Data = NULL; } - /* If this is the only texture image in the tree, could call - * bmBufferData with NULL data to free the old block and avoid - * waiting on any outstanding fences. - */ - if (intelObj->mt && - intelObj->mt->first_level == level && - intelObj->mt->last_level == level && - intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB && - !intel_miptree_match_image(intelObj->mt, &intelImage->base)) { - - DBG("release it\n"); - intel_miptree_release(intel, &intelObj->mt); - assert(!intelObj->mt); - } - if (!intelObj->mt) { guess_and_alloc_mipmap_tree(intel, intelObj, intelImage, pixels == NULL); if (!intelObj->mt) { @@ -701,6 +682,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_object *texObj; struct gl_texture_image *texImage; int level = 0, internalFormat; + gl_format texFormat; texObj = _mesa_get_current_tex_object(ctx, target); intelObj = intel_texture_object(texObj); @@ -719,10 +701,14 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->region == NULL) return; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { internalFormat = GL_RGB; - else + texFormat = MESA_FORMAT_XRGB8888; + } + else { internalFormat = GL_RGBA; + texFormat = MESA_FORMAT_ARGB8888; + } mt = intel_miptree_create_for_region(intel, target, internalFormat, @@ -743,16 +729,13 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intel_miptree_release(intel, &intelObj->mt); intelObj->mt = mt; + _mesa_init_teximage_fields(&intel->ctx, target, texImage, rb->region->width, rb->region->height, 1, - 0, internalFormat); + 0, internalFormat, texFormat); intelImage->face = target_to_face(target); intelImage->level = level; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) - texImage->TexFormat = MESA_FORMAT_XRGB8888; - else - texImage->TexFormat = MESA_FORMAT_ARGB8888; texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); @@ -808,11 +791,10 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, intelObj->mt = mt; _mesa_init_teximage_fields(&intel->ctx, target, texImage, image->region->width, image->region->height, 1, - 0, image->internal_format); + 0, image->internal_format, image->format); intelImage->face = target_to_face(target); intelImage->level = 0; - texImage->TexFormat = image->format; texImage->RowStride = image->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); |