summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-01-31 05:36:33 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-01-31 05:36:33 +0000
commitbee9964b29b2428ee75e2d1efc0e1d2c2518a417 (patch)
treefd733f886743b31f2ac2727e57f05d1a0918a977 /src/mesa/drivers/dri/intel
parent36a0819ff4ede1af91dcf909106cf20659856384 (diff)
parent12eb32e34244db9923cacaaed9ba951b7ac274a4 (diff)
Merge remote branch 'origin/master' into lp-binning
Conflicts: Makefile src/gallium/auxiliary/util/u_surface.c src/gallium/drivers/llvmpipe/lp_flush.c src/gallium/drivers/llvmpipe/lp_setup.c src/gallium/drivers/llvmpipe/lp_state_derived.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/gallium/drivers/llvmpipe/lp_state_surface.c src/gallium/drivers/llvmpipe/lp_tex_cache.c src/gallium/drivers/llvmpipe/lp_texture.c src/gallium/drivers/llvmpipe/lp_tile_cache.c src/mesa/state_tracker/st_cb_condrender.c
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c41
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c300
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c56
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.h6
-rw-r--r--src/mesa/drivers/dri/intel/intel_clear.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h40
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c140
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c137
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c172
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c41
-rw-r--r--src/mesa/drivers/dri/intel/intel_state.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_format.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c2
22 files changed, 285 insertions, 699 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 3a4b21a844..ae0f8a16f9 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -32,44 +32,6 @@
#include "intel_bufmgr.h"
#include "intel_buffers.h"
-/* Relocations in kernel space:
- * - pass dma buffer seperately
- * - memory manager knows how to patch
- * - pass list of dependent buffers
- * - pass relocation list
- *
- * Either:
- * - get back an offset for buffer to fire
- * - memory manager knows how to fire buffer
- *
- * Really want the buffer to be AGP and pinned.
- *
- */
-
-/* Cliprect fence: The highest fence protecting a dma buffer
- * containing explicit cliprect information. Like the old drawable
- * lock but irq-driven. X server must wait for this fence to expire
- * before changing cliprects [and then doing sw rendering?]. For
- * other dma buffers, the scheduler will grab current cliprect info
- * and mix into buffer. X server must hold the lock while changing
- * cliprects??? Make per-drawable. Need cliprects in shared memory
- * -- beats storing them with every cmd buffer in the queue.
- *
- * ==> X server must wait for this fence to expire before touching the
- * framebuffer with new cliprects.
- *
- * ==> Cliprect-dependent buffers associated with a
- * cliprect-timestamp. All of the buffers associated with a timestamp
- * must go to hardware before any buffer with a newer timestamp.
- *
- * ==> Dma should be queued per-drawable for correct X/GL
- * synchronization. Or can fences be used for this?
- *
- * Applies to: Blit operations, metaops, X server operations -- X
- * server automatically waits on its own dma to complete before
- * modifying cliprects ???
- */
-
void
intel_batchbuffer_reset(struct intel_batchbuffer *batch)
{
@@ -167,7 +129,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
struct intel_context *intel = batch->intel;
GLuint used = batch->ptr - batch->map;
- if (intel->first_post_swapbuffers_batch == NULL) {
+ if (!intel->using_dri2_swapbuffers &&
+ intel->first_post_swapbuffers_batch == NULL) {
intel->first_post_swapbuffers_batch = intel->batch->buf;
drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
}
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 55bee0084c..31d4f3d421 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -38,7 +38,6 @@
#include "intel_reg.h"
#include "intel_regions.h"
#include "intel_batchbuffer.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
@@ -103,7 +102,7 @@ intelEmitCopyBlit(struct intel_context *intel,
return GL_FALSE;
}
- /* do space/cliprects check before going any further */
+ /* do space check before going any further */
do {
aper_array[0] = intel->batch->buf;
aper_array[1] = dst_buffer;
@@ -213,10 +212,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
struct intel_context *intel = intel_context(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
GLuint clear_depth;
- GLbitfield skipBuffers = 0;
- unsigned int num_cliprects;
- struct drm_clip_rect *cliprects;
- int x_off, y_off;
+ GLboolean all;
+ GLint cx, cy, cw, ch;
BATCH_LOCALS;
/*
@@ -230,183 +227,134 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
}
- /* If clearing both depth and stencil, skip BUFFER_BIT_STENCIL in
- * the loop below.
- */
- if ((mask & BUFFER_BIT_DEPTH) && (mask & BUFFER_BIT_STENCIL)) {
- skipBuffers = BUFFER_BIT_STENCIL;
- }
-
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects) {
- GLint cx, cy, cw, ch;
- drm_clip_rect_t clear;
- int i;
-
- /* Get clear bounds after locking */
- cx = fb->_Xmin;
+ cx = fb->_Xmin;
+ if (fb->Name == 0)
+ cy = ctx->DrawBuffer->Height - fb->_Ymax;
+ else
cy = fb->_Ymin;
- cw = fb->_Xmax - cx;
- ch = fb->_Ymax - cy;
-
- if (fb->Name == 0) {
- /* clearing a window */
-
- /* flip top to bottom */
- clear.x1 = cx + x_off;
- clear.y1 = intel->driDrawable->y + intel->driDrawable->h - cy - ch;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
- }
- else {
- /* clearing FBO */
- assert(num_cliprects == 1);
- assert(cliprects == &intel->fboRect);
- clear.x1 = cx;
- clear.y1 = cy;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
- /* no change to mask */
+ cw = fb->_Xmax - fb->_Xmin;
+ ch = fb->_Ymax - fb->_Ymin;
+
+ if (cw == 0 || ch == 0)
+ return;
+
+ GLuint buf;
+ all = (cw == fb->Width && ch == fb->Height);
+
+ /* Loop over all renderbuffers */
+ for (buf = 0; buf < BUFFER_COUNT && mask; buf++) {
+ const GLbitfield bufBit = 1 << buf;
+ struct intel_renderbuffer *irb;
+ drm_intel_bo *write_buffer;
+ int x1, y1, x2, y2;
+ uint32_t clear_val;
+ uint32_t BR13, CMD;
+ int pitch, cpp;
+
+ if (!(mask & bufBit))
+ continue;
+
+ /* OK, clear this renderbuffer */
+ irb = intel_get_renderbuffer(fb, buf);
+ write_buffer = intel_region_buffer(intel, irb->region,
+ all ? INTEL_WRITE_FULL :
+ INTEL_WRITE_PART);
+ x1 = cx + irb->region->draw_x;
+ y1 = cy + irb->region->draw_y;
+ x2 = cx + cw + irb->region->draw_x;
+ y2 = cy + ch + irb->region->draw_y;
+
+ pitch = irb->region->pitch;
+ cpp = irb->region->cpp;
+
+ DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n",
+ __FUNCTION__,
+ irb->region->buffer, (pitch * cpp),
+ x1, y1, x2 - x1, y2 - y1);
+
+ BR13 = 0xf0 << 16;
+ CMD = XY_COLOR_BLT_CMD;
+
+ /* Setup the blit command */
+ if (cpp == 4) {
+ BR13 |= BR13_8888;
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
+ if (mask & BUFFER_BIT_DEPTH)
+ CMD |= XY_BLT_WRITE_RGB;
+ if (mask & BUFFER_BIT_STENCIL)
+ CMD |= XY_BLT_WRITE_ALPHA;
+ } else {
+ /* clearing RGBA */
+ CMD |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
+ }
+ } else {
+ ASSERT(cpp == 2);
+ BR13 |= BR13_565;
}
- for (i = 0; i < num_cliprects; i++) {
- const drm_clip_rect_t *box = &cliprects[i];
- drm_clip_rect_t b;
- GLuint buf;
- GLuint clearMask = mask; /* use copy, since we modify it below */
- GLboolean all = (cw == fb->Width && ch == fb->Height);
-
- if (!all) {
- intel_intersect_cliprects(&b, &clear, box);
- }
- else {
- b = *box;
- }
-
- if (b.x1 >= b.x2 || b.y1 >= b.y2)
- continue;
-
- if (0)
- _mesa_printf("clear %d,%d..%d,%d, mask %x\n",
- b.x1, b.y1, b.x2, b.y2, mask);
-
- /* Loop over all renderbuffers */
- for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
- const GLbitfield bufBit = 1 << buf;
- if ((clearMask & bufBit) && !(bufBit & skipBuffers)) {
- /* OK, clear this renderbuffer */
- struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, buf);
- dri_bo *write_buffer =
- intel_region_buffer(intel, irb->region,
- all ? INTEL_WRITE_FULL :
- INTEL_WRITE_PART);
- int x1 = b.x1 + irb->region->draw_x;
- int y1 = b.y1 + irb->region->draw_y;
- int x2 = b.x2 + irb->region->draw_x;
- int y2 = b.y2 + irb->region->draw_y;
-
- GLuint clearVal;
- GLint pitch, cpp;
- GLuint BR13, CMD;
-
- pitch = irb->region->pitch;
- cpp = irb->region->cpp;
-
- DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n",
- __FUNCTION__,
- irb->region->buffer, (pitch * cpp),
- x1, y1, x2 - x1, y2 - y1);
-
- BR13 = 0xf0 << 16;
- CMD = XY_COLOR_BLT_CMD;
-
- /* Setup the blit command */
- if (cpp == 4) {
- BR13 |= BR13_8888;
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- if (clearMask & BUFFER_BIT_DEPTH)
- CMD |= XY_BLT_WRITE_RGB;
- if (clearMask & BUFFER_BIT_STENCIL)
- CMD |= XY_BLT_WRITE_ALPHA;
- }
- else {
- /* clearing RGBA */
- CMD |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
- }
- }
- else {
- ASSERT(cpp == 2);
- BR13 |= BR13_565;
- }
-
- assert(irb->region->tiling != I915_TILING_Y);
+ assert(irb->region->tiling != I915_TILING_Y);
#ifndef I915
- if (irb->region->tiling != I915_TILING_NONE) {
- CMD |= XY_DST_TILED;
- pitch /= 4;
- }
+ if (irb->region->tiling != I915_TILING_NONE) {
+ CMD |= XY_DST_TILED;
+ pitch /= 4;
+ }
#endif
- BR13 |= (pitch * cpp);
-
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- clearVal = clear_depth;
- }
- else {
- uint8_t clear[4];
- GLclampf *color = ctx->Color.ClearColor;
-
- CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
-
- switch (irb->Base.Format) {
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_XRGB8888:
- clearVal = PACK_COLOR_8888(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- case MESA_FORMAT_RGB565:
- clearVal = PACK_COLOR_565(clear[0], clear[1], clear[2]);
- break;
- case MESA_FORMAT_ARGB4444:
- clearVal = PACK_COLOR_4444(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- case MESA_FORMAT_ARGB1555:
- clearVal = PACK_COLOR_1555(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- default:
- _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
- irb->Base.Format);
- clearVal = 0;
- }
- }
-
- /*
- _mesa_debug(ctx, "hardware blit clear buf %d rb id %d\n",
- buf, irb->Base.Name);
- */
-
- assert(x1 < x2);
- assert(y1 < y2);
-
- BEGIN_BATCH(6);
- OUT_BATCH(CMD);
- OUT_BATCH(BR13);
- OUT_BATCH((y1 << 16) | x1);
- OUT_BATCH((y2 << 16) | x2);
- OUT_RELOC(write_buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- 0);
- OUT_BATCH(clearVal);
- ADVANCE_BATCH();
- clearMask &= ~bufBit; /* turn off bit, for faster loop exit */
- }
- }
+ BR13 |= (pitch * cpp);
+
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
+ clear_val = clear_depth;
+ } else {
+ uint8_t clear[4];
+ GLclampf *color = ctx->Color.ClearColor;
+
+ CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
+
+ switch (irb->Base.Format) {
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ clear_val = PACK_COLOR_8888(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_RGB565:
+ clear_val = PACK_COLOR_565(clear[0], clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_ARGB4444:
+ clear_val = PACK_COLOR_4444(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_ARGB1555:
+ clear_val = PACK_COLOR_1555(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ default:
+ _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
+ irb->Base.Format);
+ clear_val = 0;
+ }
}
+
+ assert(x1 < x2);
+ assert(y1 < y2);
+
+ BEGIN_BATCH(6);
+ OUT_BATCH(CMD);
+ OUT_BATCH(BR13);
+ OUT_BATCH((y1 << 16) | x1);
+ OUT_BATCH((y2 << 16) | x2);
+ OUT_RELOC(write_buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ OUT_BATCH(clear_val);
+ ADVANCE_BATCH();
+
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL)
+ mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
+ else
+ mask &= ~bufBit; /* turn off bit, for faster loop exit */
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 7c4b79f743..2f03e45005 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -28,45 +28,7 @@
#include "intel_context.h"
#include "intel_buffers.h"
#include "intel_fbo.h"
-#include "intel_regions.h"
-#include "intel_batchbuffer.h"
#include "main/framebuffer.h"
-#include "drirenderbuffer.h"
-
-
-/**
- * XXX move this into a new dri/common/cliprects.c file.
- */
-GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dst,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b)
-{
- GLint bx = b->x1;
- GLint by = b->y1;
- GLint bw = b->x2 - bx;
- GLint bh = b->y2 - by;
-
- if (bx < a->x1)
- bw -= a->x1 - bx, bx = a->x1;
- if (by < a->y1)
- bh -= a->y1 - by, by = a->y1;
- if (bx + bw > a->x2)
- bw = a->x2 - bx;
- if (by + bh > a->y2)
- bh = a->y2 - by;
- if (bw <= 0)
- return GL_FALSE;
- if (bh <= 0)
- return GL_FALSE;
-
- dst->x1 = bx;
- dst->y1 = by;
- dst->x2 = bx + bw;
- dst->y2 = by + bh;
-
- return GL_TRUE;
-}
/**
* Return pointer to current color drawing region, or NULL.
@@ -96,24 +58,6 @@ intel_readbuf_region(struct intel_context *intel)
return NULL;
}
-void
-intel_get_cliprects(struct intel_context *intel,
- struct drm_clip_rect **cliprects,
- unsigned int *num_cliprects,
- int *x_off, int *y_off)
-{
- intel->fboRect.x1 = 0;
- intel->fboRect.y1 = 0;
- intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
- intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;
-
- *cliprects = &intel->fboRect;
- *num_cliprects = 1;
- *x_off = 0;
- *y_off = 0;
-}
-
-
/**
* Check if we're about to draw into the front color buffer.
* If so, set the intel->front_buffer_dirty field to true.
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h
index d7800f2ca2..abb86aade6 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.h
+++ b/src/mesa/drivers/dri/intel/intel_buffers.h
@@ -35,12 +35,6 @@
struct intel_context;
struct intel_framebuffer;
-
-extern GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dest,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b);
-
extern struct intel_region *intel_readbuf_region(struct intel_context *intel);
extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c
index 956f2339ff..ca78681538 100644
--- a/src/mesa/drivers/dri/intel/intel_clear.c
+++ b/src/mesa/drivers/dri/intel/intel_clear.c
@@ -33,12 +33,9 @@
#include "intel_context.h"
#include "intel_blit.h"
-#include "intel_chipset.h"
#include "intel_clear.h"
#include "intel_fbo.h"
-#include "intel_pixel.h"
#include "intel_regions.h"
-#include "intel_batchbuffer.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 3f6634c65a..0adee6131e 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -28,7 +28,6 @@
#include "main/glheader.h"
#include "main/context.h"
-#include "main/arrayobj.h"
#include "main/extensions.h"
#include "main/framebuffer.h"
#include "main/imports.h"
@@ -52,13 +51,11 @@
#include "intel_regions.h"
#include "intel_buffer_objects.h"
#include "intel_fbo.h"
-#include "intel_decode.h"
#include "intel_bufmgr.h"
#include "intel_screen.h"
#include "drirenderbuffer.h"
#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
#ifndef INTEL_DEBUG
@@ -522,7 +519,8 @@ intel_glFlush(GLcontext *ctx)
* and getting our hands on that doesn't seem worth it, so we just us the
* first batch we emitted after the last swap.
*/
- if (intel->first_post_swapbuffers_batch != NULL) {
+ if (!intel->using_dri2_swapbuffers &&
+ intel->first_post_swapbuffers_batch != NULL) {
drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch);
drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
intel->first_post_swapbuffers_batch = NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 07207bfbec..36abef470a 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -107,7 +107,6 @@ struct intel_context
void (*finish_batch) (struct intel_context * intel);
void (*new_batch) (struct intel_context * intel);
void (*emit_invarient_state) (struct intel_context * intel);
- void (*note_fence) (struct intel_context *intel, GLuint fence);
void (*update_texture_state) (struct intel_context * intel);
void (*render_start) (struct intel_context * intel);
@@ -125,40 +124,6 @@ struct intel_context
void (*invalidate_state) (struct intel_context *intel,
GLuint new_state);
-
- /* Metaops:
- */
- void (*install_meta_state) (struct intel_context * intel);
- void (*leave_meta_state) (struct intel_context * intel);
-
- void (*meta_draw_region) (struct intel_context * intel,
- struct intel_region * draw_region,
- struct intel_region * depth_region);
-
- void (*meta_color_mask) (struct intel_context * intel, GLboolean);
-
- void (*meta_stencil_replace) (struct intel_context * intel,
- GLuint mask, GLuint clear);
-
- void (*meta_depth_replace) (struct intel_context * intel);
-
- void (*meta_texture_blend_replace) (struct intel_context * intel);
-
- void (*meta_no_stencil_write) (struct intel_context * intel);
- void (*meta_no_depth_write) (struct intel_context * intel);
- void (*meta_no_texture) (struct intel_context * intel);
-
- void (*meta_import_pixel_state) (struct intel_context * intel);
- void (*meta_frame_buffer_texture) (struct intel_context *intel,
- GLint xoff, GLint yoff);
-
- GLboolean(*meta_tex_rect_source) (struct intel_context * intel,
- dri_bo * buffer,
- GLuint offset,
- GLuint pitch,
- GLuint height,
- GLenum format, GLenum type);
-
void (*assert_not_dirty) (struct intel_context *intel);
void (*debug_batch)(struct intel_context *intel);
@@ -187,6 +152,7 @@ struct intel_context
struct intel_batchbuffer *batch;
drm_intel_bo *first_post_swapbuffers_batch;
GLboolean no_batch_wrap;
+ GLboolean using_dri2_swapbuffers;
struct
{
@@ -273,10 +239,6 @@ struct intel_context
GLboolean use_texture_tiling;
GLboolean use_early_z;
- drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
-
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
int driFd;
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 5ac5ce10af..84c8d013e3 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -48,6 +48,7 @@
#define need_GL_EXT_blend_func_separate
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_cull_vertex
+#define need_GL_EXT_draw_buffers2
#define need_GL_EXT_fog_coord
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_framebuffer_blit
@@ -154,12 +155,14 @@ static const struct dri_extension brw_extensions[] = {
{ "GL_ARB_fragment_program_shadow", NULL },
{ "GL_ARB_fragment_shader", NULL },
{ "GL_ARB_framebuffer_object", GL_ARB_framebuffer_object_functions},
+ { "GL_ARB_half_float_vertex", NULL },
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
{ "GL_ARB_point_sprite", NULL },
{ "GL_ARB_seamless_cube_map", NULL },
{ "GL_ARB_shadow", NULL },
{ "GL_MESA_texture_signed_rgba", NULL },
{ "GL_ARB_texture_non_power_of_two", NULL },
+ { "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions },
{ "GL_EXT_shadow_funcs", NULL },
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
{ "GL_EXT_texture_sRGB", NULL },
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 82e4150c6a..cb5a341050 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -29,7 +29,6 @@
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
#include "intel_tex_layout.h"
-#include "intel_chipset.h"
#ifndef I915
#include "brw_state.h"
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index 5142f3dcd9..cb088e4032 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -29,14 +29,7 @@
#include "main/state.h"
#include "main/bufferobj.h"
#include "main/context.h"
-#include "main/enable.h"
-#include "main/matrix.h"
-#include "main/texstate.h"
-#include "main/varray.h"
-#include "main/viewport.h"
#include "swrast/swrast.h"
-#include "shader/arbprogram.h"
-#include "shader/program.h"
#include "intel_context.h"
#include "intel_pixel.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 85e5ad2cdd..1e517650b7 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -37,7 +37,6 @@
#include "main/polygon.h"
#include "main/state.h"
#include "main/teximage.h"
-#include "main/texenv.h"
#include "main/texobj.h"
#include "main/texstate.h"
#include "main/texparam.h"
@@ -46,7 +45,6 @@
#include "main/enable.h"
#include "main/viewport.h"
#include "shader/arbprogram.h"
-#include "glapi/dispatch.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
@@ -54,7 +52,6 @@
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_regions.h"
-#include "intel_buffer_objects.h"
#include "intel_buffers.h"
#include "intel_pixel.h"
#include "intel_reg.h"
@@ -106,7 +103,7 @@ static void set_bit( GLubyte *dest, GLuint bit )
}
/* Extract a rectangle's worth of data from the bitmap. Called
- * per-cliprect.
+ * per chunk of HW-sized bitmap.
*/
static GLuint get_bitmap_rect(GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
@@ -191,11 +188,12 @@ do_blit_bitmap( GLcontext *ctx,
GLfloat tmpColor[4];
GLubyte ubcolor[4];
GLuint color;
- unsigned int num_cliprects;
- drm_clip_rect_t *cliprects;
- int x_off, y_off;
GLsizei bitmap_width = width;
GLsizei bitmap_height = height;
+ GLint px, py;
+ GLuint stipple[32];
+ GLint orig_dstx = dstx;
+ GLint orig_dsty = dsty;
/* Update draw buffer bounds */
_mesa_update_state(ctx);
@@ -236,90 +234,60 @@ do_blit_bitmap( GLcontext *ctx,
if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F))
return GL_FALSE;
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects != 0) {
- GLuint i;
- GLint orig_dstx = dstx;
- GLint orig_dsty = dsty;
-
- /* Clip to buffer bounds and scissor. */
- if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
- fb->_Xmax, fb->_Ymax,
- &dstx, &dsty, &width, &height))
- goto out;
-
- dstx = x_off + dstx;
- dsty = y_off + y_flip(fb, dsty, height);
-
- for (i = 0; i < num_cliprects; i++) {
- int box_x, box_y, box_w, box_h;
- GLint px, py;
- GLuint stipple[32];
-
- box_x = dstx;
- box_y = dsty;
- box_w = width;
- box_h = height;
-
- /* Clip to drawable cliprect */
- if (!_mesa_clip_to_region(cliprects[i].x1,
- cliprects[i].y1,
- cliprects[i].x2,
- cliprects[i].y2,
- &box_x, &box_y, &box_w, &box_h))
- continue;
+ /* Clip to buffer bounds and scissor. */
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
+ goto out;
+
+ dsty = y_flip(fb, dsty, height);
#define DY 32
#define DX 32
- /* Then, finally, chop it all into chunks that can be
- * digested by hardware:
+ /* Chop it all into chunks that can be digested by hardware: */
+ for (py = 0; py < height; py += DY) {
+ for (px = 0; px < width; px += DX) {
+ int h = MIN2(DY, height - py);
+ int w = MIN2(DX, width - px);
+ GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8;
+ GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY;
+
+ assert(sz <= sizeof(stipple));
+ memset(stipple, 0, sz);
+
+ /* May need to adjust this when padding has been introduced in
+ * sz above:
+ *
+ * Have to translate destination coordinates back into source
+ * coordinates.
*/
- 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;
- GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
- ctx->Color.LogicOp : GL_COPY;
-
- assert(sz <= sizeof(stipple));
- memset(stipple, 0, sz);
-
- /* May need to adjust this when padding has been introduced in
- * sz above:
- *
- * Have to translate destination coordinates back into source
- * coordinates.
- */
- if (get_bitmap_rect(bitmap_width, bitmap_height, unpack,
- bitmap,
- -orig_dstx + (box_x + px - x_off),
- -orig_dsty + y_flip(fb,
- box_y + py - y_off, h),
- w, h,
- (GLubyte *)stipple,
- 8,
- fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
- continue;
-
- if (!intelEmitImmediateColorExpandBlit(intel,
- dst->cpp,
- (GLubyte *)stipple,
- sz,
- color,
- dst->pitch,
- dst->buffer,
- 0,
- dst->tiling,
- box_x + px,
- box_y + py,
- w, h,
- logic_op)) {
- return GL_FALSE;
- }
- }
- }
+ if (get_bitmap_rect(bitmap_width, bitmap_height, unpack,
+ bitmap,
+ -orig_dstx + (dstx + px),
+ -orig_dsty + y_flip(fb, dsty + py, h),
+ w, h,
+ (GLubyte *)stipple,
+ 8,
+ fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
+ continue;
+
+ if (!intelEmitImmediateColorExpandBlit(intel,
+ dst->cpp,
+ (GLubyte *)stipple,
+ sz,
+ color,
+ dst->pitch,
+ dst->buffer,
+ 0,
+ dst->tiling,
+ dstx + px,
+ dsty + py,
+ w, h,
+ logic_op)) {
+ return GL_FALSE;
+ }
}
}
out:
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index e002516cdd..87c293d8b0 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -112,9 +112,10 @@ do_blit_copypixels(GLcontext * ctx,
struct intel_region *src = copypix_src_region(intel, type);
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_framebuffer *read_fb = ctx->ReadBuffer;
- unsigned int num_cliprects;
- drm_clip_rect_t *cliprects;
- int x_off, y_off;
+ GLint orig_dstx;
+ GLint orig_dsty;
+ GLint orig_srcx;
+ GLint orig_srcy;
if (type == GL_DEPTH || type == GL_STENCIL) {
if (INTEL_DEBUG & DEBUG_FALLBACKS)
@@ -135,94 +136,56 @@ do_blit_copypixels(GLcontext * ctx,
if (!src || !dst)
return GL_FALSE;
-
-
intelFlush(&intel->ctx);
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects != 0) {
- GLint delta_x;
- GLint delta_y;
- GLint orig_dstx;
- GLint orig_dsty;
- GLint orig_srcx;
- GLint orig_srcy;
- GLuint i;
-
- /* XXX: We fail to handle different inversion between read and draw framebuffer. */
-
- /* Clip to destination buffer. */
- orig_dstx = dstx;
- orig_dsty = dsty;
- if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
- fb->_Xmax, fb->_Ymax,
- &dstx, &dsty, &width, &height))
- goto out;
- /* Adjust src coords for our post-clipped destination origin */
- srcx += dstx - orig_dstx;
- srcy += dsty - orig_dsty;
-
- /* Clip to source buffer. */
- orig_srcx = srcx;
- orig_srcy = srcy;
- if (!_mesa_clip_to_region(0, 0,
- read_fb->Width, read_fb->Height,
- &srcx, &srcy, &width, &height))
- goto out;
- /* Adjust dst coords for our post-clipped source origin */
- dstx += srcx - orig_srcx;
- dsty += srcy - orig_srcy;
-
- /* Convert from GL to hardware coordinates:
- */
- if (fb->Name == 0) {
- /* copypixels to a system framebuffer */
- dstx = x_off + dstx;
- dsty = y_off + (fb->Height - dsty - height);
- } else {
- /* copypixels to a user framebuffer object */
- dstx = x_off + dstx;
- dsty = y_off + dsty;
- }
-
- /* Flip source Y if it's a system framebuffer. */
- if (read_fb->Name == 0) {
- srcx = intel->driReadDrawable->x + srcx;
- srcy = intel->driReadDrawable->y + (fb->Height - srcy - height);
- }
-
- delta_x = srcx - dstx;
- delta_y = srcy - dsty;
- /* Could do slightly more clipping: Eg, take the intersection of
- * the destination cliprects and the read drawable cliprects
- *
- * This code will not overwrite other windows, but will
- * introduce garbage when copying from obscured window regions.
- */
- for (i = 0; i < num_cliprects; i++) {
- GLint clip_x = dstx;
- GLint clip_y = dsty;
- GLint clip_w = width;
- GLint clip_h = height;
-
- if (!_mesa_clip_to_region(cliprects[i].x1, cliprects[i].y1,
- cliprects[i].x2, cliprects[i].y2,
- &clip_x, &clip_y, &clip_w, &clip_h))
- continue;
-
- if (!intel_region_copy(intel,
- dst, 0, clip_x, clip_y,
- src, 0, clip_x + delta_x, clip_y + delta_y,
- clip_w, clip_h,
- ctx->Color.ColorLogicOpEnabled ?
- ctx->Color.LogicOp : GL_COPY)) {
- DBG("%s: blit failure\n", __FUNCTION__);
- return GL_FALSE;
- }
- }
+ /* XXX: We fail to handle different inversion between read and draw framebuffer. */
+
+ /* Clip to destination buffer. */
+ orig_dstx = dstx;
+ orig_dsty = dsty;
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
+ goto out;
+ /* Adjust src coords for our post-clipped destination origin */
+ srcx += dstx - orig_dstx;
+ srcy += dsty - orig_dsty;
+
+ /* Clip to source buffer. */
+ orig_srcx = srcx;
+ orig_srcy = srcy;
+ if (!_mesa_clip_to_region(0, 0,
+ read_fb->Width, read_fb->Height,
+ &srcx, &srcy, &width, &height))
+ goto out;
+ /* Adjust dst coords for our post-clipped source origin */
+ dstx += srcx - orig_srcx;
+ dsty += srcy - orig_srcy;
+
+ /* Convert from GL to hardware coordinates: */
+ if (fb->Name == 0) {
+ /* copypixels to a system framebuffer */
+ dsty = fb->Height - dsty - height;
+ } else {
+ /* copypixels to a user framebuffer object */
+ dsty = dsty;
}
-out:
+ /* Flip source Y if it's a system framebuffer. */
+ if (read_fb->Name == 0)
+ srcy = fb->Height - srcy - height;
+
+ if (!intel_region_copy(intel,
+ dst, 0, dstx, dsty,
+ src, 0, srcx, srcy,
+ width, height,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY)) {
+ DBG("%s: blit failure\n", __FUNCTION__);
+ return GL_FALSE;
+ }
+
+out:
intel_check_front_buffer_rendering(intel);
DBG("%s: success\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index b870e9315e..10177228bd 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -46,10 +46,6 @@
#include "drivers/common/meta.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_buffers.h"
-#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_fbo.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 9c0fdc6067..a98e8e16c2 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -36,7 +36,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_regions.h"
@@ -65,99 +64,6 @@
* any case.
*/
-
-static GLboolean
-do_texture_readpixels(GLcontext * ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- struct intel_region *dest_region)
-{
-#if 0
- struct intel_context *intel = intel_context(ctx);
- intelScreenPrivate *screen = intel->intelScreen;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- __DRIdrawable *dPriv = intel->driDrawable;
- int textureFormat;
- GLenum glTextureFormat;
- int destFormat, depthFormat, destPitch;
- drm_clip_rect_t tmp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (ctx->_ImageTransferState ||
- pack->SwapBytes || pack->LsbFirst || !pack->Invert) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel));
-
- if (!intel->vtbl.meta_render_dest(intel, dest_region, type, format)) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: couldn't set dest %s/%s\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(type),
- _mesa_lookup_enum_by_nr(format));
- return GL_FALSE;
- }
-
- if (intel->driDrawable->numClipRects) {
- intel->vtbl.install_meta_state(intel);
- intel->vtbl.meta_no_depth_write(intel);
- intel->vtbl.meta_no_stencil_write(intel);
-
- if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
- SET_STATE(i830, state);
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- /* Set the frontbuffer up as a large rectangular texture.
- */
- intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat);
-
-
- intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat);
-
-
- /* Set the 3d engine to draw into the destination region:
- */
-
- intel->vtbl.meta_draw_region(intel, dest_region);
- intel->vtbl.meta_draw_format(intel, destFormat, depthFormat); /* ?? */
-
-
- /* Draw a single quad, no cliprects:
- */
- intel->vtbl.meta_disable_cliprects(intel);
-
- intel->vtbl.draw_quad(intel,
- 0, width, 0, height,
- 0x00ff00ff, x, x + width, y, y + height);
-
- intel->vtbl.leave_meta_state(intel);
- }
-
- intel_region_wait_fence(ctx, dest_region); /* required by GL */
- return GL_TRUE;
-#endif
-
- return GL_FALSE;
-}
-
-
-
-
static GLboolean
do_blit_readpixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
@@ -169,6 +75,9 @@ do_blit_readpixels(GLcontext * ctx,
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
+ drm_intel_bo *dst_buffer;
+ GLboolean all;
+ GLint dst_x, dst_y;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
@@ -209,56 +118,42 @@ do_blit_readpixels(GLcontext * ctx,
return GL_FALSE;
}
else {
- rowLength = -rowLength;
+ if (ctx->ReadBuffer->Name == 0)
+ rowLength = -rowLength;
}
dst_offset = (GLintptr) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
+ if (!_mesa_clip_copytexsubimage(ctx,
+ &dst_x, &dst_y,
+ &x, &y,
+ &width, &height)) {
+ return GL_TRUE;
+ }
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects are correct.
- */
- intelFlush(&intel->ctx);
-
- if (intel->driReadDrawable->numClipRects) {
- GLboolean all = (width * height * src->cpp == dst->Base.Size &&
- x == 0 && dst_offset == 0);
-
- dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
- all ? INTEL_WRITE_FULL :
- INTEL_WRITE_PART);
- __DRIdrawable *dPriv = intel->driReadDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t src_rect;
- int i;
-
- src_rect.x1 = dPriv->x + x;
- src_rect.y1 = dPriv->y + dPriv->h - (y + height);
- src_rect.x2 = src_rect.x1 + width;
- src_rect.y2 = src_rect.y1 + height;
+ all = (width * height * src->cpp == dst->Base.Size &&
+ x == 0 && dst_offset == 0);
+ dst_x = 0;
+ dst_y = 0;
+ dst_buffer = intel_bufferobj_buffer(intel, dst,
+ all ? INTEL_WRITE_FULL :
+ INTEL_WRITE_PART);
- for (i = 0; i < nbox; i++) {
- if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
- continue;
+ if (ctx->ReadBuffer->Name == 0)
+ y = ctx->ReadBuffer->Height - (y + height);
- if (!intelEmitCopyBlit(intel,
- src->cpp,
- src->pitch, src->buffer, 0, src->tiling,
- rowLength, dst_buffer, dst_offset, GL_FALSE,
- rect.x1,
- rect.y1,
- rect.x1 - src_rect.x1,
- rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1,
- GL_COPY)) {
- return GL_FALSE;
- }
- }
+ if (!intelEmitCopyBlit(intel,
+ src->cpp,
+ src->pitch, src->buffer, 0, src->tiling,
+ rowLength, dst_buffer, dst_offset, GL_FALSE,
+ x, y,
+ dst_x, dst_y,
+ width, height,
+ GL_COPY)) {
+ return GL_FALSE;
}
if (INTEL_DEBUG & DEBUG_PIXEL)
@@ -282,15 +177,6 @@ intelReadPixels(GLcontext * ctx,
(ctx, x, y, width, height, format, type, pack, pixels))
return;
-#ifdef I915
- if (do_texture_readpixels
- (ctx, x, y, width, height, format, type, pack, pixels))
- return;
-#else
- (void)do_blit_readpixels;
- (void)do_texture_readpixels;
-#endif
-
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 61aefa01b8..301c3df17c 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -48,7 +48,6 @@
#include "intel_buffer_objects.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_REGION
@@ -443,6 +442,7 @@ intel_region_attach_pbo(struct intel_context *intel,
region->pbo->region = region;
dri_bo_reference(buffer);
region->buffer = buffer;
+ region->tiling = I915_TILING_NONE;
}
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index e240957197..e8cc202f88 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -37,15 +37,11 @@
#include "intel_buffers.h"
#include "intel_bufmgr.h"
#include "intel_chipset.h"
-#include "intel_extensions.h"
#include "intel_fbo.h"
-#include "intel_regions.h"
#include "intel_screen.h"
-#include "intel_span.h"
#include "intel_tex.h"
#include "i915_drm.h"
-#include "i830_dri.h"
#define DRI_CONF_TEXTURE_TILING(def) \
DRI_CONF_OPT_BEGIN(texture_tiling, bool, def) \
@@ -128,8 +124,14 @@ intelDRI2Flush(__DRIdrawable *drawable)
static void
intelDRI2FlushInvalidate(__DRIdrawable *drawable)
{
+ struct intel_context *intel = drawable->driContextPriv->driverPrivate;
+
+ intel->using_dri2_swapbuffers = GL_TRUE;
+
intelDRI2Flush(drawable);
drawable->validBuffers = GL_FALSE;
+
+ intel_update_renderbuffers(intel->driContext, drawable);
}
static const struct __DRI2flushExtensionRec intelFlushExtension = {
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 605734d8e5..d925cb9997 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -259,36 +259,20 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define DBG 0
#define LOCAL_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1; \
const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
- unsigned int num_cliprects; \
- struct drm_clip_rect *cliprects; \
- int x_off, y_off; \
+ int minx = 0, miny = 0; \
+ int maxx = ctx->DrawBuffer->Width; \
+ int maxy = ctx->DrawBuffer->Height; \
int pitch = irb->region->pitch * irb->region->cpp; \
void *buf = irb->region->buffer->virtual; \
GLuint p; \
(void) p; \
(void)buf; (void)pitch; /* unused for non-gttmap. */ \
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
-/* XXX FBO: this is identical to the macro in spantmp2.h except we get
- * the cliprect info from the context, not the driDrawable.
- * Move this into spantmp2.h someday.
- */
-#define HW_CLIPLOOP() \
- do { \
- int _nc = num_cliprects; \
- while ( _nc-- ) { \
- int minx = cliprects[_nc].x1 - x_off; \
- int miny = cliprects[_nc].y1 - y_off; \
- int maxx = cliprects[_nc].x2 - x_off; \
- int maxy = cliprects[_nc].y2 - y_off;
-
-#if 0
- }}
-#endif
+#define HW_CLIPLOOP()
+#define HW_ENDCLIPLOOP()
#define Y_FLIP(_y) ((_y) * yScale + yBias)
@@ -297,9 +281,9 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define HW_UNLOCK()
/* Convenience macros to avoid typing the swizzle argument over and over */
-#define NO_TILE(_X, _Y) no_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
-#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
-#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
+#define NO_TILE(_X, _Y) no_tile_swizzle(irb, (_X), (_Y))
+#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X), (_Y))
+#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X), (_Y))
/* r5g6b5 color span and pixel functions */
#define INTEL_PIXEL_FMT GL_RGB
@@ -342,18 +326,15 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#include "intel_spantmp.h"
#define LOCAL_DEPTH_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1; \
const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
- unsigned int num_cliprects; \
- struct drm_clip_rect *cliprects; \
- int x_off, y_off; \
+ int minx = 0, miny = 0; \
+ int maxx = ctx->DrawBuffer->Width; \
+ int maxy = ctx->DrawBuffer->Height; \
int pitch = irb->region->pitch * irb->region->cpp; \
void *buf = irb->region->buffer->virtual; \
(void)buf; (void)pitch; /* unused for non-gttmap. */ \
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
-
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c
index aefae53eb2..c5ef909dbf 100644
--- a/src/mesa/drivers/dri/intel/intel_state.c
+++ b/src/mesa/drivers/dri/intel/intel_state.c
@@ -35,8 +35,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_regions.h"
-#include "swrast/swrast.h"
int
intel_translate_shadow_compare_func(GLenum func)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index d8e71093c4..d67451cf8e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -36,7 +36,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
@@ -114,8 +113,6 @@ do_copy_texsubimage(struct intel_context *intel,
drm_intel_bo *dst_bo = intel_region_buffer(intel,
intelImage->mt->region,
INTEL_WRITE_PART);
- const GLint orig_x = x;
- const GLint orig_y = y;
GLuint image_x, image_y;
GLshort src_pitch;
@@ -125,9 +122,6 @@ do_copy_texsubimage(struct intel_context *intel,
intelImage->face,
0,
&image_x, &image_y);
- /* Update dst for clipped src. Need to also clip the source rect. */
- dstx += x - orig_x;
- dsty += y - orig_y;
/* Can't blit to tiled buffers with non-tile-aligned offset. */
if (intelImage->mt->region->tiling == I915_TILING_Y) {
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
index a7c6c45ffe..7be5231eae 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -1,6 +1,5 @@
#include "intel_context.h"
#include "intel_tex.h"
-#include "intel_chipset.h"
#include "main/enums.h"
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6f41eafd0e..a56e085b90 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -7,7 +7,6 @@
#include "main/convolve.h"
#include "main/context.h"
#include "main/formats.h"
-#include "main/image.h"
#include "main/texcompress.h"
#include "main/texstore.h"
#include "main/texgetimage.h"
@@ -241,7 +240,8 @@ try_pbo_upload(struct intel_context *intel,
if (!intelEmitCopyBlit(intel,
intelImage->mt->cpp,
src_stride, src_buffer, src_offset, GL_FALSE,
- dst_stride, dst_buffer, 0, GL_FALSE,
+ dst_stride, dst_buffer, 0,
+ intelImage->mt->region->tiling,
0, 0, dst_x, dst_y, width, height,
GL_COPY)) {
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index c9a24ac398..ed5c5d896b 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -2,10 +2,8 @@
#include "main/macros.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_TEXTURE