aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i915tex
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-07-31 14:37:45 +0100
committerKeith Whitwell <[email protected]>2007-07-31 14:37:45 +0100
commit9273150f9a8394f4ef630a96f0089ad8cad607f5 (patch)
tree6a62bb6a88ebcc0af7682a811ab0c628daadd602 /src/mesa/drivers/dri/i915tex
parent9bc1c92a0b809c6b60d5e4a2c8909f5f98528919 (diff)
parent7aefdd518578687f961bb512a2b408857f0b9824 (diff)
Merge branch 'i915tex_privbuffers' into softpipe_0_1_branch
Conflicts: src/mesa/drivers/dri/i915tex/intel_buffers.c src/mesa/drivers/dri/i915tex/intel_context.c src/mesa/drivers/dri/i915tex/intel_fbo.c src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
Diffstat (limited to 'src/mesa/drivers/dri/i915tex')
-rw-r--r--src/mesa/drivers/dri/i915tex/i830_state.c10
-rw-r--r--src/mesa/drivers/dri/i915tex/i830_vtbl.c25
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_context.h6
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_fragprog.c8
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_state.c46
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_vtbl.c8
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c96
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.h2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c290
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.h4
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.c78
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.h25
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_fbo.c119
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_fbo.h4
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_ioctl.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c25
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_copy.c215
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_draw.c107
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_read.c190
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_render.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_screen.c301
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_screen.h15
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_span.c30
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_state.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_copy.c19
26 files changed, 457 insertions, 1176 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i830_state.c b/src/mesa/drivers/dri/i915tex/i830_state.c
index 3c149e69055..490d6814295 100644
--- a/src/mesa/drivers/dri/i915tex/i830_state.c
+++ b/src/mesa/drivers/dri/i915tex/i830_state.c
@@ -879,7 +879,6 @@ i830Enable(GLcontext * ctx, GLenum cap, GLboolean state)
static void
i830_init_packets(struct i830_context *i830)
{
- intelScreenPrivate *screen = i830->intel.intelScreen;
/* Zero all state */
memset(&i830->state, 0, sizeof(i830->state));
@@ -1033,15 +1032,6 @@ i830_init_packets(struct i830_context *i830)
i830->state.Stipple[I830_STPREG_ST0] = _3DSTATE_STIPPLE;
- i830->state.Buffer[I830_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] = (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(screen->front.pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
-
- i830->state.Buffer[I830_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] = (BUF_3D_ID_DEPTH | BUF_3D_PITCH(screen->depth.pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
i830->state.Buffer[I830_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
#if 0
diff --git a/src/mesa/drivers/dri/i915tex/i830_vtbl.c b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
index e432648ada0..20c6900025e 100644
--- a/src/mesa/drivers/dri/i915tex/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
@@ -61,6 +61,11 @@ do { \
#define TEXBIND_SET(n, x) ((x)<<((n)*4))
static void
+i830_render_prevalidate(struct intel_context *intel)
+{
+}
+
+static void
i830_render_start(struct intel_context *intel)
{
GLcontext *ctx = &intel->ctx;
@@ -597,25 +602,6 @@ i830_set_draw_region(struct intel_context *intel,
i830_state_draw_region(intel, &i830->state, color_region, depth_region);
}
-#if 0
-static void
-i830_update_color_z_regions(intelContextPtr intel,
- const intelRegion * colorRegion,
- const intelRegion * depthRegion)
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
-
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(colorRegion->pitch) |
- BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_CBUFADDR2] = colorRegion->offset;
-
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH | BUF_3D_PITCH(depthRegion->pitch) | BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_DBUFADDR2] = depthRegion->offset;
-}
-#endif
-
/* This isn't really handled at the moment.
*/
@@ -657,5 +643,6 @@ i830InitVtbl(struct i830_context *i830)
i830->intel.vtbl.update_texture_state = i830UpdateTextureState;
i830->intel.vtbl.flush_cmd = i830_flush_cmd;
i830->intel.vtbl.render_start = i830_render_start;
+ i830->intel.vtbl.render_prevalidate = i830_render_prevalidate;
i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty;
}
diff --git a/src/mesa/drivers/dri/i915tex/i915_context.h b/src/mesa/drivers/dri/i915tex/i915_context.h
index d2713e88f96..3a41d66c148 100644
--- a/src/mesa/drivers/dri/i915tex/i915_context.h
+++ b/src/mesa/drivers/dri/i915tex/i915_context.h
@@ -309,12 +309,6 @@ extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
/*======================================================================
- * i915_texprog.c
- */
-extern void i915ValidateTextureProgram(struct i915_context *i915);
-
-
-/*======================================================================
* i915_debug.c
*/
extern void i915_disassemble_program(const GLuint * program, GLuint sz);
diff --git a/src/mesa/drivers/dri/i915tex/i915_fragprog.c b/src/mesa/drivers/dri/i915tex/i915_fragprog.c
index a4b22a0c32c..95ec50490a2 100644
--- a/src/mesa/drivers/dri/i915tex/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915tex/i915_fragprog.c
@@ -320,7 +320,7 @@ upload_program(struct i915_fragment_program *p)
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0);
+ src0, i915_emit_const1f(p, 1.0 / (M_PI)), 0);
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
@@ -329,7 +329,7 @@ upload_program(struct i915_fragment_program *p)
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (M_PI * 2)), 0);
+ tmp, i915_emit_const1f(p, (M_PI)), 0);
/*
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
@@ -642,7 +642,7 @@ upload_program(struct i915_fragment_program *p)
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0);
+ src0, i915_emit_const1f(p, 1.0 / (M_PI)), 0);
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
@@ -651,7 +651,7 @@ upload_program(struct i915_fragment_program *p)
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (M_PI * 2)), 0);
+ tmp, i915_emit_const1f(p, (M_PI)), 0);
/*
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c
index e5d8d279936..1fede6a8d8e 100644
--- a/src/mesa/drivers/dri/i915tex/i915_state.c
+++ b/src/mesa/drivers/dri/i915tex/i915_state.c
@@ -904,42 +904,9 @@ i915_init_packets(struct i915_context *i915)
{
I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- /* color buffer offset/stride */
- i915->state.Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
- i915->state.Buffer[I915_DESTREG_CBUFADDR1] = (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(screen->front.pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
- i915->state.Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
- i915->state.Buffer[I915_DESTREG_DBUFADDR1] = (BUF_3D_ID_DEPTH | BUF_3D_PITCH(screen->depth.pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
i915->state.Buffer[I915_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
-#if 0 /* seems we don't need this */
- switch (screen->fbFormat) {
- case DV_PF_565:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- DITHER_FULL_ALWAYS |
- screen->fbFormat |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- screen->fbFormat |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
-#endif
-
/* scissor */
i915->state.Buffer[I915_DESTREG_SENABLE] =
@@ -950,19 +917,6 @@ i915_init_packets(struct i915_context *i915)
}
-#if 0
- {
- I915_STATECHANGE(i915, I915_UPLOAD_DEFAULTS);
- i915->state.Default[I915_DEFREG_C0] = _3DSTATE_DEFAULT_DIFFUSE;
- i915->state.Default[I915_DEFREG_C1] = 0;
- i915->state.Default[I915_DEFREG_S0] = _3DSTATE_DEFAULT_SPECULAR;
- i915->state.Default[I915_DEFREG_S1] = 0;
- i915->state.Default[I915_DEFREG_Z0] = _3DSTATE_DEFAULT_Z;
- i915->state.Default[I915_DEFREG_Z1] = 0;
- }
-#endif
-
-
/* These will be emitted every at the head of every buffer, unless
* we get hardware contexts working.
*/
diff --git a/src/mesa/drivers/dri/i915tex/i915_vtbl.c b/src/mesa/drivers/dri/i915tex/i915_vtbl.c
index 0e7ca9586e8..cc74ceae180 100644
--- a/src/mesa/drivers/dri/i915tex/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915tex/i915_vtbl.c
@@ -44,13 +44,18 @@
#include "i915_context.h"
static void
-i915_render_start(struct intel_context *intel)
+i915_render_prevalidate(struct intel_context *intel)
{
struct i915_context *i915 = i915_context(&intel->ctx);
i915ValidateFragmentProgram(i915);
}
+static void
+i915_render_start(struct intel_context *intel)
+{
+}
+
static void
i915_reduced_primitive_state(struct intel_context *intel, GLenum rprim)
@@ -548,6 +553,7 @@ i915InitVtbl(struct i915_context *i915)
i915->intel.vtbl.lost_hardware = i915_lost_hardware;
i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;
i915->intel.vtbl.render_start = i915_render_start;
+ i915->intel.vtbl.render_prevalidate = i915_render_prevalidate;
i915->intel.vtbl.set_draw_region = i915_set_draw_region;
i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
i915->intel.vtbl.flush_cmd = i915_flush_cmd;
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index c755eac6b2c..28441f4b835 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -49,7 +49,7 @@
* Used for SwapBuffers().
*/
void
-intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
+intelCopyBuffer(__DRIdrawablePrivate * dPriv,
const drm_clip_rect_t * rect)
{
@@ -78,22 +78,23 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
* should work regardless.
*/
LOCK_HARDWARE(intel);
+ /* if this drawable isn't currently bound the LOCK_HARDWARE done on the
+ current context (which is what intelScreenContext should return) might
+ not get a contended lock and thus cliprects not updated (tests/manywin) */
+ if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel)
+ DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);
- if (intel->revalidateDrawable) {
- __DRIscreenPrivate *sPriv = intel->driScreen;
- if (dPriv) {
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
- }
- }
if (dPriv && dPriv->numClipRects) {
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
const struct intel_region *frontRegion
= intelScreen->front_region;
const struct intel_region *backRegion
- = intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ?
+ = intel_fb->Base._ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ?
intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT) :
intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
+ const int backWidth = intel_fb->Base.Width;
+ const int backHeight = intel_fb->Base.Height;
const int nbox = dPriv->numClipRects;
const drm_clip_rect_t *pbox = dPriv->pClipRects;
const int pitch = frontRegion->pitch;
@@ -106,7 +107,6 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
ASSERT(frontRegion);
ASSERT(backRegion);
-// ASSERT(frontRegion->pitch == backRegion->pitch);
ASSERT(frontRegion->cpp == backRegion->cpp);
DBG("front pitch %d back pitch %d\n",
@@ -134,32 +134,42 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
box = *pbox;
if (rect) {
- if (rect->x1 > box.x1)
- box.x1 = rect->x1;
- if (rect->y1 > box.y1)
- box.y1 = rect->y1;
- if (rect->x2 < box.x2)
- box.x2 = rect->x2;
- if (rect->y2 < box.y2)
- box.y2 = rect->y2;
+ drm_clip_rect_t rrect;
+
+ rrect.x1 = dPriv->x + rect->x1;
+ rrect.y1 = (dPriv->h - rect->y1 - rect->y2) + dPriv->y;
+ rrect.x2 = rect->x2 + rrect.x1;
+ rrect.y2 = rect->y2 + rrect.y1;
+ if (rrect.x1 > box.x1)
+ box.x1 = rrect.x1;
+ if (rrect.y1 > box.y1)
+ box.y1 = rrect.y1;
+ if (rrect.x2 < box.x2)
+ box.x2 = rrect.x2;
+ if (rrect.y2 < box.y2)
+ box.y2 = rrect.y2;
if (box.x1 > box.x2 || box.y1 > box.y2)
continue;
}
+ /* restrict blit to size of actually rendered area */
+ if (box.x2 - box.x1 > backWidth)
+ box.x2 = backWidth + box.x1;
+ if (box.y2 - box.y1 > backHeight)
+ box.y2 = backHeight + box.y1;
+
DBG("box x1 x2 y1 y2 %d %d %d %d\n",
box.x1, box.x2, box.y1, box.y2);
- /* XXX should make sure only the minimum area based on
- old draw buffer and new front clip rects is copied */
sbox.x1 = box.x1 - dPriv->x;
sbox.y1 = box.y1 - dPriv->y;
BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
OUT_BATCH(CMD);
OUT_BATCH(BR13);
- OUT_BATCH((pbox->y1 << 16) | pbox->x1);
- OUT_BATCH((pbox->y2 << 16) | pbox->x2);
+ OUT_BATCH((box.y1 << 16) | box.x1);
+ OUT_BATCH((box.y2 << 16) | box.x2);
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
@@ -179,9 +189,14 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
UNLOCK_HARDWARE(intel);
- if (intel->revalidateDrawable) {
- intel->revalidateDrawable = GL_FALSE;
- intelWindowMoved(intel);
+ /* XXX this is bogus. The context here may not even be bound to this drawable! */
+ if (intel->lastStamp != dPriv->lastStamp) {
+ GET_CURRENT_CONTEXT(currctx);
+ struct intel_context *intelcurrent = intel_context(currctx);
+ if (intelcurrent == intel && intelcurrent->driDrawable == dPriv) {
+ intelWindowMoved(intel);
+ intel->lastStamp = dPriv->lastStamp;
+ }
}
}
@@ -394,8 +409,7 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
if (intel->numClipRects) {
GLint cx, cy, cw, ch;
- drm_clip_rect_t clear;
- int i;
+ drm_clip_rect_t b;
/* Get clear bounds after locking */
cx = fb->_Xmin;
@@ -405,38 +419,26 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
if (fb->Name == 0) {
/* clearing a window */
-
/* flip top to bottom */
- clear.x1 = cx + intel->drawX;
- clear.y1 = intel->driDrawable->y + intel->driDrawable->h - cy - ch;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
+ b.x1 = cx;
+ b.y1 = fb->Height - cy - ch;
+ b.x2 = b.x1 + cw;
+ b.y2 = b.y1 + ch;
}
else {
/* clearing FBO */
- assert(intel->numClipRects == 1);
- assert(intel->pClipRects == &intel->fboRect);
- clear.x1 = cx;
- clear.y1 = cy;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
+ b.x1 = cx;
+ b.y1 = cy;
+ b.x2 = b.x1 + cw;
+ b.y2 = b.y1 + ch;
/* no change to mask */
}
- for (i = 0; i < intel->numClipRects; i++) {
- const drm_clip_rect_t *box = &intel->pClipRects[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;
- }
-
DBG("clear %d,%d..%d,%d, mask %x\n",
b.x1, b.y1, b.x2, b.y2, mask);
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.h b/src/mesa/drivers/dri/i915tex/intel_blit.h
index e7bc280f58a..77686444fa0 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.h
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.h
@@ -32,7 +32,7 @@
#include "intel_ioctl.h"
#include "dri_bufmgr.h"
-extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv,
+extern void intelCopyBuffer(__DRIdrawablePrivate * dpriv,
const drm_clip_rect_t * rect);
extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask);
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 17b4feadf85..72c7b5ae454 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -125,15 +125,14 @@ intel_readbuf_region(struct intel_context *intel)
/**
- * Update the following fields for rendering to a user-created FBO:
+ * Update the following fields for rendering:
* intel->numClipRects
* intel->pClipRects
- * intel->drawX
- * intel->drawY
*/
static void
intelSetRenderbufferClipRects(struct intel_context *intel)
{
+ /* zero-sized buffers might be legal? */
assert(intel->ctx.DrawBuffer->Width > 0);
assert(intel->ctx.DrawBuffer->Height > 0);
intel->fboRect.x1 = 0;
@@ -142,33 +141,8 @@ intelSetRenderbufferClipRects(struct intel_context *intel)
intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;
intel->numClipRects = 1;
intel->pClipRects = &intel->fboRect;
- intel->drawX = 0;
- intel->drawY = 0;
}
-/**
- * As above, but for rendering private front/back buffer of a window.
- * \sa intelSetPrivbufClipRects
- */
-
-static void
-intelSetPrivbufClipRects(struct intel_context *intel)
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- if (!dPriv)
- return;
-
- intel->fakeClipRect.x1 = 0;
- intel->fakeClipRect.y1 = 0;
- intel->fakeClipRect.x2 = dPriv->w;
- intel->fakeClipRect.y2 = dPriv->h;
- intel->numClipRects = 1;
- intel->pClipRects = &intel->fakeClipRect;
- intel->drawX = 0;
- intel->drawY = 0;
-}
-
-
/**
* This will be called whenever the currently bound window is moved/resized.
@@ -183,11 +157,15 @@ intelWindowMoved(struct intel_context *intel)
if (!intel->ctx.DrawBuffer) {
/* when would this happen? -BP */
+ assert(0);
intel->numClipRects = 0;
}
+ /* Update Mesa's notion of window size */
+ driUpdateFramebufferSize(ctx, dPriv);
+ intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */
- if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
+ {
drmI830Sarea *sarea = intel->sarea;
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
.y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
@@ -216,7 +194,7 @@ intelWindowMoved(struct intel_context *intel)
intel_fb->pf_current_page = (intel->sarea->pf_current_page >>
(intel_fb->pf_pipes & 0x2)) & 0x3;
- intel_fb->pf_num_pages = intel->intelScreen->third.handle ? 3 : 2;
+ intel_fb->pf_num_pages = 2 /*intel->intelScreen->third.handle ? 3 : 2*/;
pf_active = pf_pipes && (pf_pipes & intel->sarea->pf_active) == pf_pipes;
@@ -302,14 +280,8 @@ intelWindowMoved(struct intel_context *intel)
intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
}
}
- } else {
- intel_fb->vblank_flags &= ~VBLANK_FLAG_SECONDARY;
}
- /* Update Mesa's notion of window size */
- driUpdateFramebufferSize(ctx, dPriv);
- intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */
-
/* Update hardware scissor */
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
@@ -335,7 +307,6 @@ intelClearWithTris(struct intel_context *intel, GLbitfield mask)
LOCK_HARDWARE(intel);
- /* XXX FBO: was: intel->driDrawable->numClipRects */
if (intel->numClipRects) {
GLint cx, cy, cw, ch;
GLuint buf;
@@ -388,7 +359,8 @@ intelClearWithTris(struct intel_context *intel, GLbitfield mask)
/* XXX: Using INTEL_BATCH_NO_CLIPRECTS here is dangerous as the
* drawing origin may not be correctly emitted.
*/
- intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2, intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0); /* texcoords */
+ intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2,
+ intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0); /* texcoords */
mask &=
~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH);
@@ -427,156 +399,6 @@ intelClearWithTris(struct intel_context *intel, GLbitfield mask)
}
-
-
-/**
- * Copy the window contents named by dPriv to the rotated (or reflected)
- * color buffer.
- * srcBuf is BUFFER_BIT_FRONT_LEFT or BUFFER_BIT_BACK_LEFT to indicate the source.
- */
-void
-intelRotateWindow(struct intel_context *intel,
- __DRIdrawablePrivate * dPriv, GLuint srcBuf)
-{
-
- intelScreenPrivate *screen = intel->intelScreen;
- drm_clip_rect_t fullRect;
- struct intel_framebuffer *intel_fb;
- struct intel_region *src;
- const drm_clip_rect_t *clipRects;
- int numClipRects;
- int i;
- GLenum format, type;
-
- int xOrig, yOrig;
- int origNumClipRects;
- drm_clip_rect_t *origRects;
-
- /*
- * set up hardware state
- */
- intelFlush(&intel->ctx);
-
- LOCK_HARDWARE(intel);
-
- if (!intel->numClipRects) {
- UNLOCK_HARDWARE(intel);
- return;
- }
-
- intel->vtbl.install_meta_state(intel);
-
- intel->vtbl.meta_no_depth_write(intel);
- intel->vtbl.meta_no_stencil_write(intel);
- intel->vtbl.meta_color_mask(intel, GL_FALSE);
-
-
- /* save current drawing origin and cliprects (restored at end) */
- xOrig = intel->drawX;
- yOrig = intel->drawY;
- origNumClipRects = intel->numClipRects;
- origRects = intel->pClipRects;
-
- /*
- * set drawing origin, cliprects for full-screen access to rotated screen
- */
- fullRect.x1 = 0;
- fullRect.y1 = 0;
- fullRect.x2 = screen->rotatedWidth;
- fullRect.y2 = screen->rotatedHeight;
- intel->drawX = 0;
- intel->drawY = 0;
- intel->numClipRects = 1;
- intel->pClipRects = &fullRect;
-
- intel->vtbl.meta_draw_region(intel, screen->rotated_region, NULL); /* ? */
-
- intel_fb = dPriv->driverPrivate;
-
- if ((srcBuf == BUFFER_BIT_BACK_LEFT && !intel_fb->pf_active)) {
- src = intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
- clipRects = dPriv->pBackClipRects;
- numClipRects = dPriv->numBackClipRects;
- }
- else {
- src = intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT);
- clipRects = dPriv->pClipRects;
- numClipRects = dPriv->numClipRects;
- }
-
- if (src->cpp == 4) {
- format = GL_BGRA;
- type = GL_UNSIGNED_BYTE;
- }
- else {
- format = GL_BGR;
- type = GL_UNSIGNED_SHORT_5_6_5_REV;
- }
-
- /* set the whole screen up as a texture to avoid alignment issues */
- intel->vtbl.meta_tex_rect_source(intel,
- src->buffer,
- screen->width,
- screen->height, src->pitch, format, type);
-
- intel->vtbl.meta_texture_blend_replace(intel);
-
- /*
- * loop over the source window's cliprects
- */
- for (i = 0; i < numClipRects; i++) {
- int srcX0 = clipRects[i].x1;
- int srcY0 = clipRects[i].y1;
- int srcX1 = clipRects[i].x2;
- int srcY1 = clipRects[i].y2;
- GLfloat verts[4][2], tex[4][2];
- int j;
-
- /* build vertices for four corners of clip rect */
- verts[0][0] = srcX0;
- verts[0][1] = srcY0;
- verts[1][0] = srcX1;
- verts[1][1] = srcY0;
- verts[2][0] = srcX1;
- verts[2][1] = srcY1;
- verts[3][0] = srcX0;
- verts[3][1] = srcY1;
-
- /* .. and texcoords */
- tex[0][0] = srcX0;
- tex[0][1] = srcY0;
- tex[1][0] = srcX1;
- tex[1][1] = srcY0;
- tex[2][0] = srcX1;
- tex[2][1] = srcY1;
- tex[3][0] = srcX0;
- tex[3][1] = srcY1;
-
- /* transform coords to rotated screen coords */
-
- for (j = 0; j < 4; j++) {
- matrix23TransformCoordf(&screen->rotMatrix,
- &verts[j][0], &verts[j][1]);
- }
-
- /* draw polygon to map source image to dest region */
- intel_meta_draw_poly(intel, 4, verts, 0, 0, tex);
-
- } /* cliprect loop */
-
- intel->vtbl.leave_meta_state(intel);
- intel_batchbuffer_flush(intel->batch);
-
- /* restore original drawing origin and cliprects */
- intel->drawX = xOrig;
- intel->drawY = yOrig;
- intel->numClipRects = origNumClipRects;
- intel->pClipRects = origRects;
-
- UNLOCK_HARDWARE(intel);
-}
-
-
/**
* Called by ctx->Driver.Clear.
*/
@@ -687,7 +509,7 @@ intel_wait_flips(struct intel_context *intel, GLuint batch_flags)
}
}
-
+#if 0
/* Flip the front & back buffers
*/
static GLboolean
@@ -744,37 +566,13 @@ intelPageFlip(const __DRIdrawablePrivate * dPriv)
intel_flip_renderbuffers(intel_fb);
intel_draw_buffer(&intel->ctx, &intel_fb->Base);
+ if (INTEL_DEBUG & DEBUG_IOCTL)
+ fprintf(stderr, "%s: success\n", __FUNCTION__);
+
return GL_TRUE;
}
+#endif
-#if 0
-void
-intelSwapBuffers(__DRIdrawablePrivate * dPriv)
-{
- if (dPriv->driverPrivate) {
- const struct gl_framebuffer *fb
- = (struct gl_framebuffer *) dPriv->driverPrivate;
- if (fb->Visual.doubleBufferMode) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx && ctx->DrawBuffer == fb) {
- _mesa_notifySwapBuffers(ctx); /* flush pending rendering */
- }
- if (intel->doPageFlip) {
- intelPageFlip(dPriv);
- }
- else {
- intelCopyBuffer(dPriv);
- }
- }
- }
- else {
- _mesa_problem(NULL,
- "dPriv has no gl_framebuffer pointer in intelSwapBuffers");
- }
-}
-#else
-/* Trunk version:
- */
static GLboolean
intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
@@ -790,7 +588,6 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
if (!intel_fb->vblank_flags ||
(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) ||
- intelScreen->current_rotation != 0 ||
intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6))
return GL_FALSE;
@@ -852,7 +649,7 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target)
return ret;
}
-
+
void
intelSwapBuffers(__DRIdrawablePrivate * dPriv)
{
@@ -866,25 +663,17 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
intel = intel_context(ctx);
if (ctx->Visual.doubleBufferMode) {
- intelScreenPrivate *screen = intel->intelScreen;
GLboolean missed_target;
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
int64_t ust;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
- if (screen->current_rotation != 0 ||
- !intelScheduleSwap(dPriv, &missed_target)) {
+ if (!intelScheduleSwap(dPriv, &missed_target)) {
driWaitForVBlank(dPriv, &intel_fb->vbl_seq, intel_fb->vblank_flags,
&missed_target);
- if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) {
- intelCopyBuffer(dPriv, NULL);
- }
-
- if (screen->current_rotation != 0) {
- intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
- }
+ intelCopyBuffer(dPriv, NULL);
}
intel_fb->swap_count++;
@@ -902,7 +691,6 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
}
}
-#endif
void
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
@@ -914,17 +702,11 @@ intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
-#if 1
- rect.x1 = x + dPriv->x;
- rect.y1 = (dPriv->h - y - h) + dPriv->y;
- rect.x2 = rect.x1 + w;
- rect.y2 = rect.y1 + h;
-#else
+ /* fixup cliprect (driDrawable may have changed?) later */
rect.x1 = x;
- rect.y1 = dPriv->h - y;
- rect.x2 = rect.x1 + w;
- rect.y2 = rect.y1 + h;
-#endif
+ rect.y1 = y;
+ rect.x2 = w;
+ rect.y2 = h;
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
intelCopyBuffer(dPriv, &rect);
}
@@ -952,7 +734,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
struct intel_context *intel = intel_context(ctx);
struct intel_region *colorRegion, *depthRegion = NULL;
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
- int front = 0; /* drawing to front color buffer? */
if (!fb) {
/* this can happen during the initial context initialization */
@@ -987,33 +768,18 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
/* writing to 0 or 2 or 4 color buffers */
/*_mesa_debug(ctx, "Software rendering\n");*/
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE);
- front = 1; /* might not have back color buffer */
}
else {
/* draw to exactly one color buffer */
/*_mesa_debug(ctx, "Hardware rendering\n");*/
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE);
- if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
- front = 1;
- }
}
/*
* Get the intel_renderbuffer for the colorbuffer we're drawing into.
* And set up cliprects.
*/
- if (fb->Name == 0) {
- intelSetPrivbufClipRects(intel);
- /* drawing to window system buffer */
- if (front) {
- colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
- }
- else {
- colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
- }
- }
- else {
- /* drawing to user-created FBO */
+ {
struct intel_renderbuffer *irb;
intelSetRenderbufferClipRects(intel);
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
@@ -1086,16 +852,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
/**
** Release old regions, reference new regions
**/
-#if 0 /* XXX FBO: this seems to be redundant with i915_state_draw_region() */
- if (intel->draw_region != colorRegion) {
- intel_region_release(&intel->draw_region);
- intel_region_reference(&intel->draw_region, colorRegion);
- }
- if (intel->intelScreen->depth_region != depthRegion) {
- intel_region_release(&intel->intelScreen->depth_region);
- intel_region_reference(&intel->intelScreen->depth_region, depthRegion);
- }
-#endif
intel->vtbl.set_draw_region(intel, colorRegion, depthRegion);
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.h b/src/mesa/drivers/dri/i915tex/intel_buffers.h
index 3b686cb5c18..13d1a15ffbf 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.h
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.h
@@ -52,8 +52,4 @@ extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
extern void intelInitBufferFuncs(struct dd_function_table *functions);
-extern void
-intelRotateWindow(struct intel_context *intel,
- __DRIdrawablePrivate * dPriv, GLuint srcBuf);
-
#endif /* INTEL_BUFFERS_H */
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index 61842da29d9..5ab919ecb60 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -196,6 +196,7 @@ const struct dri_extension card_extensions[] = {
#if 1 /* XXX FBO temporary? */
{"GL_EXT_packed_depth_stencil", NULL},
#endif
+ {"GL_EXT_pixel_buffer_object", NULL},
{"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
{"GL_EXT_stencil_wrap", NULL},
{"GL_EXT_texture_edge_clamp", NULL},
@@ -295,16 +296,14 @@ static void
intelCheckFrontUpdate(GLcontext * ctx)
{
struct intel_context *intel = intel_context(ctx);
+ /* rely on _ColorDrawBufferMask being kept up to date by mesa
+ even for window-fbos. */
+ /* not sure. Might need that for all masks including
+ BUFFER_BIT_FRONT_LEFT maybe? */
if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] ==
BUFFER_BIT_FRONT_LEFT) {
- intelScreenPrivate *screen = intel->intelScreen;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
- if (screen->current_rotation != 0) {
- intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
- }
- else {
- intelCopyBuffer(dPriv, NULL);
- }
+ intelCopyBuffer(dPriv, NULL);
}
}
@@ -377,7 +376,7 @@ intelInitContext(struct intel_context *intel,
if (!havePools)
return GL_FALSE;
-
+
if (!_mesa_initialize_context(&intel->ctx,
mesaVis, shareCtx,
functions, (void *) intel))
@@ -388,10 +387,6 @@ intelInitContext(struct intel_context *intel,
intel->driScreen = sPriv;
intel->sarea = saPriv;
- intel->width = intelScreen->width;
- intel->height = intelScreen->height;
- intel->current_rotation = intelScreen->current_rotation;
-
if (!lockMutexInit) {
lockMutexInit = GL_TRUE;
_glthread_INIT_MUTEX(lockMutex);
@@ -576,6 +571,11 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
GLboolean
intelUnbindContext(__DRIcontextPrivate * driContextPriv)
{
+ struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
+ /* XXX UnbindContext is called AFTER the new context is made current.
+ Hopefully shouldn't be a problem ? */
+ FLUSH_VERTICES((&intel->ctx), 0);
+ intelFlush(&intel->ctx);
return GL_TRUE;
}
@@ -603,43 +603,14 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
is done. Need a per-screen context? */
intel->intelScreen->dummyctxptr = intel;
- /* XXX FBO temporary fix-ups! */
- /* if the renderbuffers don't have regions, init them from the context */
- {
- struct intel_renderbuffer *irbDepth
- = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
- struct intel_renderbuffer *irbStencil
- = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
-
- if (intel_fb->color_rb[0] && !intel_fb->color_rb[0]->region) {
- intel_region_reference(&intel_fb->color_rb[0]->region,
- intel->intelScreen->front_region);
- }
- if (intel_fb->color_rb[1] && !intel_fb->color_rb[1]->region) {
- intel_region_reference(&intel_fb->color_rb[1]->region,
- intel->intelScreen->back_region);
- }
- if (intel_fb->color_rb[2] && !intel_fb->color_rb[2]->region) {
- intel_region_reference(&intel_fb->color_rb[2]->region,
- intel->intelScreen->third_region);
- }
- if (irbDepth && !irbDepth->region) {
- intel_region_reference(&irbDepth->region, intel->intelScreen->depth_region);
- }
- if (irbStencil && !irbStencil->region) {
- intel_region_reference(&irbStencil->region, intel->intelScreen->depth_region);
- }
- }
-
- /* set GLframebuffer size to match window, if needed */
+ /* update GLframebuffer size to match window if needed */
driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
if (driReadPriv != driDrawPriv) {
- driUpdateFramebufferSize(&intel->ctx, driReadPriv);
+ driUpdateFramebufferSize(&intel->ctx, driReadPriv);
}
_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
- intel->intelScreen->dummyctxptr = &intel->ctx;
/* The drawbuffer won't always be updated by _mesa_make_current:
*/
@@ -658,17 +629,21 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
&intel_fb->vbl_seq);
intel_fb->vbl_waited = intel_fb->vbl_seq;
- for (i = 0; i < (intel->intelScreen->third.handle ? 3 : 2); i++) {
+ for (i = 0; i < 2; i++) {
if (intel_fb->color_rb[i])
intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_seq;
}
}
- intel->driDrawable = driDrawPriv;
- intelWindowMoved(intel);
}
+ }
- intel_draw_buffer(&intel->ctx, &intel_fb->Base);
+ if ((intel->driDrawable != driDrawPriv) ||
+ (intel->lastStamp != driDrawPriv->lastStamp)) {
+ intel->driDrawable = driDrawPriv;
+ intelWindowMoved(intel);
+ intel->lastStamp = driDrawPriv->lastStamp;
}
+
}
else {
_mesa_make_current(NULL, NULL, NULL);
@@ -696,12 +671,10 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
* checking must be done *after* this call:
*/
if (dPriv)
- intel->revalidateDrawable = GL_TRUE;
-// DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+ DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
if (sarea->width != intelScreen->width ||
- sarea->height != intelScreen->height ||
- sarea->rotation != intelScreen->current_rotation) {
+ sarea->height != intelScreen->height) {
intelUpdateScreenRotation(sPriv, sarea);
}
@@ -743,8 +716,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
}
-
-/* Lock the hardware and validate our state.
+/* Lock the hardware and validate our state.
*/
void LOCK_HARDWARE( struct intel_context *intel )
{
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h
index 7b97c564a3e..ee5be455333 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.h
+++ b/src/mesa/drivers/dri/i915tex/intel_context.h
@@ -131,6 +131,7 @@ struct intel_context
void (*update_texture_state) (struct intel_context * intel);
void (*render_start) (struct intel_context * intel);
+ void (*render_prevalidate) (struct intel_context * intel);
void (*set_draw_region) (struct intel_context * intel,
struct intel_region * draw_region,
struct intel_region * depth_region);
@@ -234,13 +235,6 @@ struct intel_context
GLuint vertex_size;
GLubyte *verts; /* points to tnl->clipspace.vertex_buf */
-#if 0
- struct intel_region *front_region; /* XXX FBO: obsolete */
- struct intel_region *rotated_region; /* XXX FBO: obsolete */
- struct intel_region *back_region; /* XXX FBO: obsolete */
- struct intel_region *draw_region; /* XXX FBO: rename to color_region */
- struct intel_region *depth_region; /**< currently bound depth/Z region */
-#endif
/* Fallback rasterization functions
*/
@@ -250,13 +244,9 @@ struct intel_context
/* These refer to the current drawing buffer:
*/
- int drawX, drawY; /**< origin of drawing area within region */
GLuint numClipRects; /**< cliprects for drawing */
drm_clip_rect_t *pClipRects;
- drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
- drm_clip_rect_t fakeClipRect; /**< cliprect for priv back/fake front buffers rendering */
-
- int perf_boxes;
+ drm_clip_rect_t fboRect; /**< cliprect for rendering */
GLuint do_usleeps;
int do_irqs;
@@ -273,20 +263,11 @@ struct intel_context
drmI830Sarea *sarea;
GLuint lastStamp;
- GLuint revalidateDrawable;
/**
* Configuration cache
*/
driOptionCache optionCache;
-
- /* Rotation. Need to match that of the
- * current screen.
- */
-
- int width;
- int height;
- int current_rotation;
};
/* These are functions now:
@@ -355,7 +336,7 @@ __memcpy(void *to, const void *from, size_t n)
/* ================================================================
* Debugging:
*/
-#define DO_DEBUG 1
+#define DO_DEBUG 0
#if DO_DEBUG
extern int INTEL_DEBUG;
#else
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c
index 5a93eb7ad19..559788f20a9 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c
@@ -146,6 +146,8 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
ASSERT(irb);
+ DBG("freeing renderbuffer\n");
+
if (irb->PairedStencil || irb->PairedDepth) {
intel_unpair_depth_stencil(ctx, irb);
}
@@ -303,24 +305,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
}
-
-/**
- * Called for each hardware renderbuffer when a _window_ is resized.
- * Just update fields.
- * Not used for user-created renderbuffers!
- */
-static GLboolean
-intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- ASSERT(rb->Name == 0);
- rb->Width = width;
- rb->Height = height;
- rb->_ActualFormat = internalFormat;
-
- return GL_TRUE;
-}
-
static void
intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
@@ -357,127 +341,38 @@ intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
-/**
- * Create a new intel_renderbuffer which corresponds to an on-screen window,
- * not a user-created renderbuffer.
- * \param width the screen width
- * \param height the screen height
- */
struct intel_renderbuffer *
-intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height,
- int offset, int pitch, int cpp, void *map)
+intel_new_renderbuffer_fb(GLuint intFormat)
{
- GET_CURRENT_CONTEXT(ctx);
-
struct intel_renderbuffer *irb;
- const GLuint name = 0;
irb = CALLOC_STRUCT(intel_renderbuffer);
if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
+ _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
return NULL;
}
- _mesa_init_renderbuffer(&irb->Base, name);
+ _mesa_init_renderbuffer(&irb->Base, 0);
irb->Base.ClassID = INTEL_RB_CLASS;
+ irb->Base.InternalFormat = intFormat;
switch (intFormat) {
case GL_RGB5:
- irb->Base._ActualFormat = GL_RGB5;
- irb->Base._BaseFormat = GL_RGBA;
- irb->Base.RedBits = 5;
- irb->Base.GreenBits = 6;
- irb->Base.BlueBits = 5;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 2;
- break;
case GL_RGBA8:
- irb->Base._ActualFormat = GL_RGBA8;
irb->Base._BaseFormat = GL_RGBA;
- irb->Base.RedBits = 8;
- irb->Base.GreenBits = 8;
- irb->Base.BlueBits = 8;
- irb->Base.AlphaBits = 8;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 4;
- break;
- case GL_STENCIL_INDEX8_EXT:
- irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT;
- irb->Base._BaseFormat = GL_STENCIL_INDEX;
- irb->Base.StencilBits = 8;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 1;
break;
case GL_DEPTH_COMPONENT16:
- irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- irb->Base.DepthBits = 16;
- irb->Base.DataType = GL_UNSIGNED_SHORT;
- cpp = 2;
- break;
- case GL_DEPTH_COMPONENT24:
- irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- irb->Base.DepthBits = 24;
- irb->Base.DataType = GL_UNSIGNED_INT;
- cpp = 4;
break;
case GL_DEPTH24_STENCIL8_EXT:
- irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
- irb->Base.DepthBits = 24;
- irb->Base.StencilBits = 8;
- irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- cpp = 4;
break;
default:
_mesa_problem(NULL,
- "Unexpected intFormat in intel_create_renderbuffer");
- return NULL;
- }
-
- irb->Base.InternalFormat = intFormat;
-
- /* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_window_storage;
- irb->Base.GetPointer = intel_get_pointer;
- /* This sets the Get/PutRow/Value functions */
- intel_set_span_functions(&irb->Base);
-
- irb->pfMap = map;
- irb->pfPitch = pitch / cpp; /* in pixels */
-
-#if 00
- irb->region = intel_region_create_static(intel,
- DRM_MM_TT,
- offset, map, cpp, width, height);
-#endif
-
- return irb;
-}
-
-
-/**
- * Create a new renderbuffer which corresponds to an X window buffer
- * (color, depth, stencil, etc) - not a user-created GL renderbuffer.
- * The internal format is set at creation time and does not change.
- */
-struct gl_renderbuffer *
-intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat)
-{
- struct intel_renderbuffer *irb;
-
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
+ "Unexpected intFormat in intel_create_renderbuffer");
return NULL;
}
- _mesa_init_renderbuffer(&irb->Base, 0);
- irb->Base.ClassID = INTEL_RB_CLASS;
- irb->Base.InternalFormat = intFormat;
-
/* intel-specific methods */
irb->Base.Delete = intel_delete_renderbuffer;
irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.h b/src/mesa/drivers/dri/i915tex/intel_fbo.h
index 86c81060845..7dc39675337 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.h
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.h
@@ -91,7 +91,7 @@ struct intel_renderbuffer
struct intel_surface *surface;
};
-
+#if 0
extern struct intel_renderbuffer *intel_create_renderbuffer(GLenum intFormat,
GLsizei width,
GLsizei height,
@@ -99,7 +99,9 @@ extern struct intel_renderbuffer *intel_create_renderbuffer(GLenum intFormat,
int pitch,
int cpp,
void *map);
+#endif
+extern struct intel_renderbuffer *intel_new_renderbuffer_fb(GLuint intFormat);
extern void intel_fbo_init(struct intel_context *intel);
diff --git a/src/mesa/drivers/dri/i915tex/intel_ioctl.c b/src/mesa/drivers/dri/i915tex/intel_ioctl.c
index 3250c6b3a9c..54721c78ab1 100644
--- a/src/mesa/drivers/dri/i915tex/intel_ioctl.c
+++ b/src/mesa/drivers/dri/i915tex/intel_ioctl.c
@@ -116,8 +116,7 @@ intel_batch_ioctl(struct intel_context *intel,
batch.cliprects = intel->pClipRects;
batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
batch.DR1 = 0;
- batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) |
- (((GLuint) intel->drawY) << 16));
+ batch.DR4 = 0; /* still need this ? */
DBG("%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
__FUNCTION__,
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel.c b/src/mesa/drivers/dri/i915tex/intel_pixel.c
index 9018e3daef4..8e61cc81848 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel.c
@@ -44,13 +44,12 @@ intel_check_blit_fragment_ops(GLcontext * ctx)
if (ctx->NewState)
_mesa_update_state(ctx);
- /* XXX Note: Scissor could be done with the blitter:
+ /* XXX Note: Scissor done with 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] ||
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
index 65bf338589e..c205c6a715f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
@@ -195,18 +195,19 @@ do_blit_bitmap( GLcontext *ctx,
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
+ {
+ drm_clip_rect_t box;
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);
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = ctx->DrawBuffer->Width;
+ box.y2 = ctx->DrawBuffer->Height;
+ orig_screen_x1 = dstx;
+ orig_screen_y2 = box->y2 - dsty;
/* Do scissoring in GL coordinates:
*/
@@ -223,21 +224,21 @@ x if (ctx->Scissor.Enabled)
/* Convert from GL to hardware coordinates:
*/
- dsty = dPriv->y + (dPriv->h - dsty - height);
- dstx = dPriv->x + dstx;
+ dsty = box->y2 - dsty - height;
+ dstx = 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++) {
+ for (i = 0; i < 1; i++) {
drm_clip_rect_t rect;
int box_w, box_h;
GLint px, py;
- GLuint stipple[32];
+ GLuint stipple[32];
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
+ if (!intel_intersect_cliprects(&rect, &dest_rect, &box[0]))
continue;
/* Now go back to GL coordinates to figure out what subset of
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
index 9d478283e47..2ecacc3c090 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
@@ -42,21 +42,25 @@
#include "intel_regions.h"
#include "intel_tris.h"
#include "intel_pixel.h"
+#include "intel_fbo.h"
#define FILE_DEBUG_FLAG DEBUG_PIXEL
static struct intel_region *
copypix_src_region(struct intel_context *intel, GLenum type)
{
+ struct intel_renderbuffer *irb;
+
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->intelScreen->depth_region &&
- intel->intelScreen->depth_region->cpp == 2)
- return intel->intelScreen->depth_region;
+ irb = intel_renderbuffer(intel->ctx.ReadBuffer->_DepthBuffer->Wrapped);
+ if (irb && irb->region && irb->region->cpp == 2)
+ return irb->region;
+ break;
case GL_STENCIL:
/* Don't think this is really possible.
*/
@@ -64,7 +68,10 @@ copypix_src_region(struct intel_context *intel, GLenum type)
case GL_DEPTH_STENCIL_EXT:
/* Does it matter whether it is stencil/depth or depth/stencil?
*/
- return intel->intelScreen->depth_region;
+ irb = intel_renderbuffer(intel->ctx.ReadBuffer->_DepthBuffer->Wrapped);
+ if (irb && irb->region)
+ return irb->region;
+ break;
default:
break;
}
@@ -73,33 +80,6 @@ copypix_src_region(struct intel_context *intel, GLenum type)
}
-/**
- * Check if any fragment operations are in effect which might effect
- * glCopyPixels. Differs from intel_check_blit_fragment_ops in that
- * we allow Scissor.
- */
-static GLboolean
-intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
-{
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- /* Could do logicop with the blitter:
- */
- return !(ctx->_ImageTransferState ||
- 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] ||
- ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled ||
- ctx->Color.BlendEnabled);
-}
-
/* Doesn't work for overlapping regions. Could do a double copy or
* just fallback.
*/
@@ -112,6 +92,7 @@ do_texture_copypixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_region *dst = intel_drawbuf_region(intel);
struct intel_region *src = copypix_src_region(intel, type);
+ struct intel_region *depthreg = NULL;
GLenum src_format;
GLenum src_type;
@@ -164,7 +145,11 @@ do_texture_copypixels(GLcontext * ctx,
/* Set the 3d engine to draw into the destination region:
*/
- intel->vtbl.meta_draw_region(intel, dst, intel->intelScreen->depth_region);
+ if (ctx->DrawBuffer->_DepthBuffer &&
+ ctx->DrawBuffer->_DepthBuffer->Wrapped)
+ depthreg = (intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped))->region;
+
+ intel->vtbl.meta_draw_region(intel, dst, depthreg);
intel->vtbl.meta_import_pixel_state(intel);
@@ -191,14 +176,10 @@ do_texture_copypixels(GLcontext * ctx,
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
-
- srcy = dPriv->h - srcy - height; /* convert from gl to hardware coords */
-
- srcx += dPriv->x;
- srcy += dPriv->y;
+ {
+ int dstbufHeight = ctx->DrawBuffer->Height;
+ /* convert from gl to hardware coords */
+ srcy = ctx->ReadBuffer->Height - srcy - height;
/* Clip against the source region. This is the only source
* clipping we do. XXX: Just set the texcord wrap mode to clamp
@@ -209,7 +190,8 @@ do_texture_copypixels(GLcontext * ctx,
GLint orig_x = srcx;
GLint orig_y = srcy;
- if (!_mesa_clip_to_region(0, 0, src->pitch, src->height,
+ if (!_mesa_clip_to_region(0, 0, ctx->ReadBuffer->Width - 1,
+ ctx->ReadBuffer->Height - 1,
&srcx, &srcy, &width, &height))
goto out;
@@ -220,11 +202,11 @@ do_texture_copypixels(GLcontext * ctx,
/* Just use the regular cliprect mechanism... Does this need to
* even hold the lock???
*/
- intel_meta_draw_quad(intel,
- dstx,
- dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (dsty + height * ctx->Pixel.ZoomY),
- dPriv->h - (dsty), 0, /* XXX: what z value? */
+ intel_meta_draw_quad(intel,
+ dstx,
+ dstx + width * ctx->Pixel.ZoomX,
+ dstbufHeight - (dsty + height * ctx->Pixel.ZoomY),
+ dstbufHeight - (dsty), 0, /* XXX: what z value? */
0x00ff00ff,
srcx, srcx + width, srcy, srcy + height);
@@ -252,102 +234,96 @@ do_blit_copypixels(GLcontext * ctx,
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);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ struct gl_framebuffer *fbread = ctx->ReadBuffer;
+ struct intel_renderbuffer *irbread;
+ struct intel_renderbuffer *irbdraw;
+ struct intel_region *dst;
+ struct intel_region *src;
/* Copypixels can be more than a straight copy. Ensure all the
* extra operations are disabled:
*/
- if (!intel_check_copypixel_blit_fragment_ops(ctx) ||
+ 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);
+ if (type == GL_COLOR) {
+ irbread = intel_renderbuffer(fbread->_ColorReadBuffer);
+ irbdraw = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
+ if (!irbread || !irbread->region || !irbdraw || !irbdraw->region)
+ return GL_FALSE;
+ }
+ else if (type == GL_DEPTH) {
+ /* Don't think this is really possible execpt at 16bpp, when we have no stencil.
+ */
+ irbread = intel_renderbuffer(fbread->_DepthBuffer->Wrapped);
+ irbdraw = intel_renderbuffer(fb->_DepthBuffer->Wrapped);
+ if (!irbread || !irbread->region || !irbdraw || !irbdraw->region
+ || !(irbread->region->cpp == 2))
+ return GL_FALSE;
+ }
+ else if (type == GL_DEPTH_STENCIL_EXT) {
+ /* Does it matter whether it is stencil/depth or depth/stencil?
+ */
+ irbread = intel_renderbuffer(fbread->_DepthBuffer->Wrapped);
+ irbdraw = intel_renderbuffer(fb->_DepthBuffer->Wrapped);
+ if (!irbread || !irbread->region || !irbdraw || !irbdraw->region)
+ return GL_FALSE;
+ }
+ else /* GL_STENCIL */ {
+ /* Don't think this is really possible.
+ */
+ return GL_FALSE;
+ }
+ src = irbread->region;
+ dst = irbdraw->region;
- intelFlush(&intel->ctx);
+ {
+ GLint dx = dstx - srcx;
+ GLint dy = dsty - srcy;
- LOCK_HARDWARE(intel);
+ /* Clip against dest, including scissor, in GL coordinates:
+ */
- 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 delta_x = 0;
- GLint delta_y = 0;
- GLuint i;
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax - 1, fb->_Ymax - 1,
+ &dstx, &dsty, &width, &height))
+ goto out;
- /* 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;
- }
+ 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 += dPriv->x;
- srcy += dPriv->y;
+ dsty = fb->Height - dsty - height;
+ srcy = fbread->Height - srcy - height;
- /* Clip against the source region. This is the only source
- * clipping we do. Dst is clipped with cliprects below.
+ /* Clip against the source region:
*/
- {
- delta_x = srcx - dstx;
- delta_y = srcy - dsty;
+ dx = srcx - dstx;
+ dy = srcy - dsty;
- if (!_mesa_clip_to_region(0, 0, src->pitch, src->height,
- &srcx, &srcy, &width, &height))
- goto out;
+ if (!_mesa_clip_to_region(0, 0, irbread->Base.Width - 1,
+ irbread->Base.Height - 1,
+ &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;
-
- /* 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;
+ dstx = srcx - dx;
+ dsty = srcy - dy;
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
- continue;
+ {
- intelEmitCopyBlit(intel, dst->cpp,
- src->pitch, src->buffer, 0,
- dst->pitch, dst->buffer, 0,
- rect.x1 + delta_x,
- rect.y1 + delta_y, /* srcx, srcy */
- rect.x1, rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1, rect.y2 - rect.y1,
+ intelEmitCopyBlit(intel, dst->cpp,
+ src->pitch, src->buffer, 0,
+ dst->pitch, dst->buffer, 0,
+ srcx, srcy,
+ dstx, dsty,
+ width, height,
ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY);
}
@@ -355,7 +331,6 @@ do_blit_copypixels(GLcontext * ctx,
out:
intel_batchbuffer_flush(intel->batch);
}
- UNLOCK_HARDWARE(intel);
DBG("%s: success\n", __FUNCTION__);
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
index e4e57cb3a7e..4139117206e 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
@@ -43,7 +43,7 @@
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
#include "intel_tris.h"
-
+#include "intel_fbo.h"
static GLboolean
@@ -57,6 +57,7 @@ do_texture_drawpixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_region *dst = intel_drawbuf_region(intel);
struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
+ struct intel_region *depthreg = NULL;
GLuint rowLength = unpack->RowLength ? unpack->RowLength : width;
GLuint src_offset;
@@ -112,7 +113,11 @@ do_texture_drawpixels(GLcontext * ctx,
/* Set the 3d engine to draw into the destination region:
*/
- intel->vtbl.meta_draw_region(intel, dst, intel->intelScreen->depth_region);
+ if (ctx->DrawBuffer->_DepthBuffer &&
+ ctx->DrawBuffer->_DepthBuffer->Wrapped)
+ depthreg = (intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped))->region;
+
+ intel->vtbl.meta_draw_region(intel, dst, depthreg);
intel->vtbl.meta_import_pixel_state(intel);
@@ -138,13 +143,14 @@ do_texture_drawpixels(GLcontext * ctx,
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ {
+ int bufHeight = ctx->DrawBuffer->Height;
+
GLint srcx, srcy;
GLint dstx, dsty;
dstx = x;
- dsty = dPriv->h - (y + height);
+ dsty = bufHeight - (y + height);
srcx = 0; /* skiprows/pixels already done */
srcy = 0;
@@ -172,8 +178,8 @@ do_texture_drawpixels(GLcontext * ctx,
*/
intel_meta_draw_quad(intel,
dstx, dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (y + height * ctx->Pixel.ZoomY),
- dPriv->h - (y),
+ bufHeight - (y + height * ctx->Pixel.ZoomY),
+ bufHeight - (y),
-ctx->Current.RasterPos[2] * .5,
0x00ff00ff,
srcx, srcx + width, srcy + height, srcy);
@@ -206,14 +212,16 @@ do_texture_drawpixels(GLcontext * ctx,
*/
static GLboolean
do_blit_drawpixels(GLcontext * ctx,
- GLint x, GLint y,
+ GLint dstx, GLint dsty,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
const GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
- struct intel_region *dest = intel_drawbuf_region(intel);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ struct intel_renderbuffer *irbdraw;
+ struct intel_region *dest;
struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
GLuint src_offset;
GLuint rowLength;
@@ -222,6 +230,32 @@ do_blit_drawpixels(GLcontext * ctx,
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
+ if (type == GL_COLOR) {
+ irbdraw = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
+ if (!irbdraw || !irbdraw->region)
+ return GL_FALSE;
+ }
+ else if (type == GL_DEPTH) {
+ /* Don't think this is really possible execpt at 16bpp, when we have no stencil.
+ */
+ irbdraw = intel_renderbuffer(fb->_DepthBuffer->Wrapped);
+ if (!irbdraw || !irbdraw->region || !(irbdraw->region->cpp == 2))
+ return GL_FALSE;
+ }
+ else if (type == GL_DEPTH_STENCIL_EXT) {
+ /* Does it matter whether it is stencil/depth or depth/stencil?
+ */
+ irbdraw = intel_renderbuffer(fb->_DepthBuffer->Wrapped);
+ if (!irbdraw || !irbdraw->region)
+ return GL_FALSE;
+ }
+ else /* GL_STENCIL */ {
+ /* Don't think this is really possible.
+ */
+ return GL_FALSE;
+ }
+
+ dest = irbdraw->region;
if (!dest) {
if (INTEL_DEBUG & DEBUG_PIXEL)
@@ -275,7 +309,7 @@ do_blit_drawpixels(GLcontext * ctx,
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
return GL_FALSE; /* later */
- y -= height;
+ dsty -= height;
}
else if (ctx->Pixel.ZoomY == 1.0F) {
rowLength = -rowLength;
@@ -289,51 +323,59 @@ do_blit_drawpixels(GLcontext * ctx,
src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
format, type, 0, 0, 0);
+ /* don't need a lock as we have no cliprects ? */
intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t dest_rect;
+ {
+ GLuint srcx = 0;
+ GLuint srcy = 0;
+ GLint dx = dstx;
+ GLint dy = dsty;
+ GLuint height_orig = height;
+
+ /* Do scissoring and clipping in GL coordinates, no need to clip against
+ * pbo src region (note fbo fields include scissor already):
+ */
+ height_orig = height;
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax - 1, fb->_Ymax - 1,
+ &dstx, &dsty, &width, &height))
+ goto out;
+
+ srcx = dstx - dx;
+ srcy = dsty - dy;
+
struct _DriBufferObject *src_buffer =
intel_bufferobj_buffer(intel, src, INTEL_READ);
- int i;
-
- dest_rect.x1 = dPriv->x + x;
- dest_rect.y1 = dPriv->y + dPriv->h - (y + height);
- dest_rect.x2 = dest_rect.x1 + width;
- dest_rect.y2 = dest_rect.y1 + height;
- for (i = 0; i < nbox; i++) {
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
- continue;
+ /* Convert from GL to hardware coordinates:
+ */
+ dsty = fb->Height - dsty - height;
+ srcy = height_orig - srcy - height;
+ {
intelEmitCopyBlit(intel,
dest->cpp,
rowLength,
src_buffer, src_offset,
dest->pitch,
dest->buffer, 0,
- rect.x1 - dest_rect.x1,
- rect.y2 - dest_rect.y2,
- rect.x1,
- rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1,
+ srcx, srcy,
+ dstx, dsty, width, height,
ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY);
}
fence = intel_batchbuffer_flush(intel->batch);
driFenceReference(fence);
}
- UNLOCK_HARDWARE(intel);
if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE);
driFenceUnReference(fence);
}
+ out:
+
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
@@ -371,7 +413,8 @@ intelDrawPixels(GLcontext * ctx,
*/
struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
/* can't just set current frag prog to 0 here as on buffer resize
- we'll get new state checks which will segfault. Remains a hack. */
+ we'll get new state checks which will segfault (actually don't get them
+ with current priv buffers). Remains a hack. */
ctx->FragmentProgram._Current = NULL;
ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE;
ctx->FragmentProgram._Active = GL_FALSE;
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
index 24e49ae0663..76a6959625e 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
@@ -42,6 +42,8 @@
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
+#include "intel_fbo.h"
+#include "intel_tris.h"
/* For many applications, the new ability to pull the source buffers
* back out of the GTT and then do the packing/conversion operations
@@ -54,6 +56,8 @@
* an argument for blit/texture readpixels, or for blitting to a
* temporary and then pulling that back.
*
+ * XXX this is not true for fake frontbuffers...
+
* When the destination is a pbo, however, it's not clear if it is
* ever going to be pulled to main memory (though the access param
* will be a good hint). So it sounds like we do want to be able to
@@ -68,91 +72,105 @@
static GLboolean
do_texture_readpixels(GLcontext * ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint srcx, GLint srcy, 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;
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int textureFormat;
- GLenum glTextureFormat;
- int destFormat, depthFormat, destPitch;
- drm_clip_rect_t tmp;
+ struct intel_region *depthreg = NULL;
+ struct intel_region *src = intel_readbuf_region(intel);
+// struct intel_region *src = copypix_src_region(intel, type);
+ GLenum src_format;
+ GLenum src_type;
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__);
+ if (!src || type != GL_COLOR)
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;
- }
+ intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
+ intel->vtbl.install_meta_state(intel);
- if (intel->driDrawable->numClipRects) {
- intel->vtbl.install_meta_state(intel);
- intel->vtbl.meta_no_depth_write(intel);
- intel->vtbl.meta_no_stencil_write(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);
- if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
- UNLOCK_HARDWARE(intel);
- SET_STATE(i830, state);
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
- return GL_TRUE;
- }
+ /* Set the 3d engine to draw into the destination region:
+ */
+ if (ctx->DrawBuffer->_DepthBuffer &&
+ ctx->DrawBuffer->_DepthBuffer->Wrapped)
+ depthreg = (intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped))->region;
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
+ intel->vtbl.meta_draw_region(intel, dest_region, depthreg);
+ intel->vtbl.meta_import_pixel_state(intel);
- /* Set the frontbuffer up as a large rectangular texture.
- */
- intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat);
+ 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.
+ */
+ if (!intel->vtbl.meta_tex_rect_source(intel, src->buffer, 0,
+ src->pitch,
+ src->height, src_format, src_type)) {
+ intel->vtbl.leave_meta_state(intel);
+ return GL_FALSE;
+ }
- intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat);
+ intel->vtbl.meta_texture_blend_replace(intel);
- /* 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); /* ?? */
+ LOCK_HARDWARE(intel);
+ {
+ int dstbufHeight = height * ctx->Pixel.ZoomY; /* ? */
+ /* convert from gl to hardware coords */
+ srcy = ctx->ReadBuffer->Height - srcy - height;
- /* Draw a single quad, no cliprects:
+ /* Clip against the source region. This is the only source
+ * clipping we do. XXX: Just set the texcord wrap mode to clamp
+ * or similar.
+ *
*/
- intel->vtbl.meta_disable_cliprects(intel);
+ if (0) {
+ if (!_mesa_clip_to_region(0, 0, ctx->ReadBuffer->Width - 1,
+ ctx->ReadBuffer->Height - 1,
+ &srcx, &srcy, &width, &height))
+ goto out;
- intel->vtbl.draw_quad(intel,
- 0, width, 0, height,
- 0x00ff00ff, x, x + width, y, y + height);
+ }
+ /* Just use the regular cliprect mechanism... Does this need to
+ * even hold the lock???
+ */
+ intel_meta_draw_quad(intel,
+ 0,
+ width * ctx->Pixel.ZoomX,
+ dstbufHeight - (height * ctx->Pixel.ZoomY),
+ dstbufHeight, 0, /* XXX: what z value? */
+ 0x00ff00ff,
+ srcx, srcx + width, srcy, srcy + height);
+
+ out:
intel->vtbl.leave_meta_state(intel);
+ intel_batchbuffer_flush(intel->batch);
}
UNLOCK_HARDWARE(intel);
- intel_region_wait_fence(ctx, dest_region); /* required by GL */
+ if (INTEL_DEBUG & DEBUG_PIXEL)
+ _mesa_printf("%s: success\n", __FUNCTION__);
return GL_TRUE;
#endif
@@ -169,7 +187,8 @@ do_blit_readpixels(GLcontext * ctx,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
- struct intel_region *src = intel_readbuf_region(intel);
+ struct intel_renderbuffer *irbread;
+ struct intel_region *src;
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
@@ -178,15 +197,17 @@ do_blit_readpixels(GLcontext * ctx,
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
- if (!src)
+ irbread = intel_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+ if (!irbread || !irbread->region)
return GL_FALSE;
+ src = irbread->region;
if (dst) {
/* XXX This validation should be done by core mesa:
*/
if (!_mesa_validate_pbo_access(2, pack, width, height, 1,
format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels");
return GL_TRUE;
}
}
@@ -206,17 +227,18 @@ do_blit_readpixels(GLcontext * ctx,
return GL_FALSE;
}
- if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s: bad packing params\n", __FUNCTION__);
- return GL_FALSE;
- }
-
if (pack->RowLength > 0)
rowLength = pack->RowLength;
else
rowLength = width;
+ if (((rowLength * src->cpp) % pack->Alignment) ||
+ pack->SwapBytes || pack->LsbFirst) {
+ if (INTEL_DEBUG & DEBUG_PIXEL)
+ _mesa_printf("%s: bad packing params\n", __FUNCTION__);
+ return GL_FALSE;
+ }
+
if (pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
@@ -230,48 +252,35 @@ do_blit_readpixels(GLcontext * ctx,
dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
-
- /* 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);
- LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
+ {
+ GLint srcx = x;
+ GLint srcy = irbread->Base.Height - (y + height);
+ GLint srcwidth = width;
+ GLint srcheight = height;
+
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
struct _DriBufferObject *dst_buffer =
intel_bufferobj_buffer(intel, dst, all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- 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;
+ /* clip to src region */
+ if (_mesa_clip_to_region(0, 0, irbread->Base.Width - 1,
+ irbread->Base.Height - 1,
+ &srcx, &srcy, &srcwidth, &srcheight));
-
- for (i = 0; i < nbox; i++) {
- if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
- continue;
-
+ {
intelEmitCopyBlit(intel,
src->cpp,
src->pitch, src->buffer, 0,
rowLength,
dst_buffer, dst_offset,
- rect.x1,
- rect.y1,
- rect.x1 - src_rect.x1,
- rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1,
+ srcx, srcy,
+ 0, 0,
+ width, height,
GL_COPY);
}
@@ -279,7 +288,6 @@ do_blit_readpixels(GLcontext * ctx,
driFenceReference(fence);
}
- UNLOCK_HARDWARE(intel);
if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
diff --git a/src/mesa/drivers/dri/i915tex/intel_render.c b/src/mesa/drivers/dri/i915tex/intel_render.c
index f9fa55051ea..c8b6d308d96 100644
--- a/src/mesa/drivers/dri/i915tex/intel_render.c
+++ b/src/mesa/drivers/dri/i915tex/intel_render.c
@@ -202,6 +202,8 @@ intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage)
struct vertex_buffer *VB = &tnl->vb;
GLuint i;
+ intel->vtbl.render_prevalidate( intel );
+
/* Don't handle clipping or indexed vertices.
*/
if (intel->RenderIndex != 0 ||
diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c
index 08057a66006..3c0ae854e46 100644
--- a/src/mesa/drivers/dri/i915tex/intel_screen.c
+++ b/src/mesa/drivers/dri/i915tex/intel_screen.c
@@ -88,55 +88,8 @@ intelMapScreenRegions(__DRIscreenPrivate * sPriv)
_mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
}
-#if 0
- if (0)
- _mesa_printf("Back 0x%08x ", intelScreen->back.handle);
- if (drmMap(sPriv->fd,
- intelScreen->back.handle,
- intelScreen->back.size,
- (drmAddress *) & intelScreen->back.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-
- if (intelScreen->third.handle) {
- if (0)
- _mesa_printf("Third 0x%08x ", intelScreen->third.handle);
- if (drmMap(sPriv->fd,
- intelScreen->third.handle,
- intelScreen->third.size,
- (drmAddress *) & intelScreen->third.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
- }
-
- if (0)
- _mesa_printf("Depth 0x%08x ", intelScreen->depth.handle);
- if (drmMap(sPriv->fd,
- intelScreen->depth.handle,
- intelScreen->depth.size,
- (drmAddress *) & intelScreen->depth.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-#endif
-
-#if 0
- _mesa_printf("TEX 0x%08x ", intelScreen->tex.handle);
- if (drmMap(sPriv->fd,
- intelScreen->tex.handle,
- intelScreen->tex.size,
- (drmAddress *) & intelScreen->tex.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-#endif
if (0)
- printf("Mappings: front: %p back: %p third: %p depth: %p tex: %p\n",
- intelScreen->front.map,
- intelScreen->back.map, intelScreen->third.map,
- intelScreen->depth.map, intelScreen->tex.map);
+ printf("Mappings: front: %p\n", intelScreen->front.map);
return GL_TRUE;
}
@@ -161,15 +114,11 @@ intel_recreate_static(intelScreenPrivate *intelScreen,
/* Create intel_region structs to describe the static front,back,depth
- * buffers created by the xserver.
- *
- * Although FBO's mean we now no longer use these as render targets in
- * all circumstances, they won't go away until the back and depth
- * buffers become private, and the front and rotated buffers will
- * remain even then.
+ * buffers created by the xserver.
+ * Only used for real front buffer now.
*
* Note that these don't allocate video memory, just describe
- * allocations alread made by the X server.
+ * allocations already made by the X server.
*/
static void
intel_recreate_static_regions(intelScreenPrivate *intelScreen)
@@ -185,51 +134,6 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
intelScreen->front.pitch / intelScreen->cpp,
intelScreen->height);
- intelScreen->rotated_region =
- intel_recreate_static(intelScreen,
- intelScreen->rotated_region,
- DRM_BO_FLAG_MEM_TT,
- intelScreen->rotated.offset,
- intelScreen->rotated.map,
- intelScreen->cpp,
- intelScreen->rotated.pitch /
- intelScreen->cpp, intelScreen->height);
-
-#if 0
- intelScreen->back_region =
- intel_recreate_static(intelScreen,
- intelScreen->back_region,
- DRM_BO_FLAG_MEM_TT,
- intelScreen->back.offset,
- intelScreen->back.map,
- intelScreen->cpp,
- intelScreen->back.pitch / intelScreen->cpp,
- intelScreen->height);
-
- if (intelScreen->third.handle) {
- intelScreen->third_region =
- intel_recreate_static(intelScreen,
- intelScreen->third_region,
- DRM_BO_FLAG_MEM_TT,
- intelScreen->third.offset,
- intelScreen->third.map,
- intelScreen->cpp,
- intelScreen->third.pitch / intelScreen->cpp,
- intelScreen->height);
- }
-
- /* Still assuming front.cpp == depth.cpp
- */
- intelScreen->depth_region =
- intel_recreate_static(intelScreen,
- intelScreen->depth_region,
- DRM_BO_FLAG_MEM_TT,
- intelScreen->depth.offset,
- intelScreen->depth.map,
- intelScreen->cpp,
- intelScreen->depth.pitch / intelScreen->cpp,
- intelScreen->height);
-#endif
}
/**
@@ -261,32 +165,6 @@ intelUnmapScreenRegions(intelScreenPrivate * intelScreen)
#endif
intelScreen->front.map = NULL;
}
- if (intelScreen->back.map) {
-#if REALLY_UNMAP
- if (drmUnmap(intelScreen->back.map, intelScreen->back.size) != 0)
- printf("drmUnmap back failed!\n");
-#endif
- intelScreen->back.map = NULL;
- }
- if (intelScreen->third.map) {
-#if REALLY_UNMAP
- if (drmUnmap(intelScreen->third.map, intelScreen->third.size) != 0)
- printf("drmUnmap third failed!\n");
-#endif
- intelScreen->third.map = NULL;
- }
- if (intelScreen->depth.map) {
-#if REALLY_UNMAP
- drmUnmap(intelScreen->depth.map, intelScreen->depth.size);
- intelScreen->depth.map = NULL;
-#endif
- }
- if (intelScreen->tex.map) {
-#if REALLY_UNMAP
- drmUnmap(intelScreen->tex.map, intelScreen->tex.size);
- intelScreen->tex.map = NULL;
-#endif
- }
}
@@ -297,17 +175,6 @@ intelPrintDRIInfo(intelScreenPrivate * intelScreen,
fprintf(stderr, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
intelScreen->front.size, intelScreen->front.offset,
intelScreen->front.pitch);
- fprintf(stderr, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->back.size, intelScreen->back.offset,
- intelScreen->back.pitch);
- fprintf(stderr, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->depth.size, intelScreen->depth.offset,
- intelScreen->depth.pitch);
- fprintf(stderr, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->rotated.size, intelScreen->rotated.offset,
- intelScreen->rotated.pitch);
- fprintf(stderr, "*** Texture size: 0x%x offset: 0x%x\n",
- intelScreen->tex.size, intelScreen->tex.offset);
fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem);
}
@@ -355,38 +222,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
intelScreen->front.handle = sarea->front_handle;
intelScreen->front.size = sarea->front_size;
- intelScreen->back.offset = sarea->back_offset;
- intelScreen->back.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->back.handle = sarea->back_handle;
- intelScreen->back.size = sarea->back_size;
-
- if (intelScreen->driScrnPriv->ddxMinor >= 8) {
- intelScreen->third.offset = sarea->third_offset;
- intelScreen->third.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->third.handle = sarea->third_handle;
- intelScreen->third.size = sarea->third_size;
- }
-
- intelScreen->depth.offset = sarea->depth_offset;
- intelScreen->depth.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->depth.handle = sarea->depth_handle;
- intelScreen->depth.size = sarea->depth_size;
-
- intelScreen->tex.offset = sarea->tex_offset;
- intelScreen->logTextureGranularity = sarea->log_tex_granularity;
- intelScreen->tex.handle = sarea->tex_handle;
- intelScreen->tex.size = sarea->tex_size;
-
- intelScreen->rotated.offset = sarea->rotated_offset;
- intelScreen->rotated.pitch = sarea->rotated_pitch * intelScreen->cpp;
- intelScreen->rotated.size = sarea->rotated_size;
- intelScreen->current_rotation = sarea->rotation;
- matrix23Rotate(&intelScreen->rotMatrix,
- sarea->width, sarea->height, sarea->rotation);
- intelScreen->rotatedWidth = sarea->virtualX;
- intelScreen->rotatedHeight = sarea->virtualY;
-
- if (1)
+ if (0)
intelPrintSAREA(sarea);
}
@@ -474,10 +310,8 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
switch (gDRIPriv->bitsPerPixel) {
case 16:
- intelScreen->fbFormat = DV_PF_565;
break;
case 32:
- intelScreen->fbFormat = DV_PF_8888;
break;
default:
exit(1);
@@ -493,23 +327,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
return GL_FALSE;
}
-#if 0
-
- /*
- * FIXME: Remove this code and its references.
- */
-
- intelScreen->tex.offset = gDRIPriv->textureOffset;
- intelScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
- intelScreen->tex.handle = gDRIPriv->textures;
- intelScreen->tex.size = gDRIPriv->textureSize;
-
-#else
- intelScreen->tex.offset = 0;
- intelScreen->logTextureGranularity = 0;
- intelScreen->tex.handle = 0;
- intelScreen->tex.size = 0;
-#endif
intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
@@ -587,7 +404,9 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
__DRIdrawablePrivate * driDrawPriv,
const __GLcontextModes * mesaVis, GLboolean isPixmap)
{
+#if 0
intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private;
+#endif
if (isPixmap) {
return GL_FALSE; /* not implemented */
@@ -604,105 +423,37 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
-#if 0
- /* setup the hardware-based renderbuffers */
- {
- intel_fb->color_rb[0]
- = intel_create_renderbuffer(rgbFormat,
- screen->width, screen->height,
- screen->front.offset,
- screen->front.pitch,
- screen->cpp,
- screen->front.map);
- intel_set_span_functions(&intel_fb->color_rb[0]->Base);
- _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
- &intel_fb->color_rb[0]->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- intel_fb->color_rb[1]
- = intel_create_renderbuffer(rgbFormat,
- screen->width, screen->height,
- screen->back.offset,
- screen->back.pitch,
- screen->cpp,
- screen->back.map);
- intel_set_span_functions(&intel_fb->color_rb[1]->Base);
- _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,
- &intel_fb->color_rb[1]->Base);
-
- if (screen->third.handle) {
- struct gl_renderbuffer *tmp_rb = NULL;
-
- intel_fb->color_rb[2]
- = intel_create_renderbuffer(rgbFormat,
- screen->width, screen->height,
- screen->third.offset,
- screen->third.pitch,
- screen->cpp,
- screen->third.map);
- intel_set_span_functions(&intel_fb->color_rb[2]->Base);
- _mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
- }
- }
- if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
- /* combined depth/stencil buffer */
- struct intel_renderbuffer *depthStencilRb
- = intel_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT,
- screen->width, screen->height,
- screen->depth.offset,
- screen->depth.pitch,
- screen->cpp, /* 4! */
- screen->depth.map);
- intel_set_span_functions(&depthStencilRb->Base);
- /* note: bind RB to two attachment points */
- _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
- &depthStencilRb->Base);
- _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_STENCIL,
- &depthStencilRb->Base);
- }
- else if (mesaVis->depthBits == 16) {
- /* just 16-bit depth buffer, no hw stencil */
- struct intel_renderbuffer *depthRb
- = intel_create_renderbuffer(GL_DEPTH_COMPONENT16,
- screen->width, screen->height,
- screen->depth.offset,
- screen->depth.pitch,
- screen->cpp, /* 2! */
- screen->depth.map);
- intel_set_span_functions(&depthRb->Base);
- _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
- }
-
-#else
{
/* fake frontbuffer */
/* XXX allocation should only happen in the unusual case
it's actually needed */
intel_fb->color_rb[0]
- = intel_new_renderbuffer_fb(NULL, rgbFormat);
+ = intel_new_renderbuffer_fb(rgbFormat);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
&intel_fb->color_rb[0]->Base);
}
if (mesaVis->doubleBufferMode) {
intel_fb->color_rb[1]
- = intel_new_renderbuffer_fb(NULL, rgbFormat);
+ = intel_new_renderbuffer_fb(rgbFormat);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,
&intel_fb->color_rb[1]->Base);
+#if 0
if (screen->third.handle) {
struct gl_renderbuffer *tmp_rb = NULL;
intel_fb->color_rb[2]
- = intel_new_renderbuffer_fb(NULL, rgbFormat);
+ = intel_new_renderbuffer_fb(rgbFormat);
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
}
+#endif
}
+
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
/* combined depth/stencil buffer */
struct intel_renderbuffer *depthStencilRb
- = intel_new_renderbuffer_fb(NULL, GL_DEPTH24_STENCIL8_EXT);
+ = intel_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT);
/* note: bind RB to two attachment points */
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
&depthStencilRb->Base);
@@ -712,11 +463,10 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
else if (mesaVis->depthBits == 16) {
/* just 16-bit depth buffer, no hw stencil */
struct intel_renderbuffer *depthRb
- = intel_new_renderbuffer_fb(NULL, GL_DEPTH_COMPONENT16);
+ = intel_new_renderbuffer_fb(GL_DEPTH_COMPONENT16);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
}
-#endif
/* now add any/all software-based renderbuffers we may need */
_mesa_add_soft_renderbuffers(&intel_fb->Base,
@@ -942,7 +692,7 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn,
__GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 5, 0 };
+ static const __DRIversion ddx_expected = { 1, 7, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 7, 0 };
@@ -987,18 +737,19 @@ struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)
* context at screen creation. For now just use the current context.
*/
-/* GET_CURRENT_CONTEXT(ctx);
+ GET_CURRENT_CONTEXT(ctx);
if (ctx == NULL) {
- _mesa_problem(NULL, "No current context in intelScreenContext\n");
- return NULL;
+/* _mesa_problem(NULL, "No current context in intelScreenContext\n");
+ return NULL; */
+ /* need a context for the first time makecurrent is called (for hw lock
+ when allocating priv buffers) */
+ if (intelScreen->dummyctxptr == NULL) {
+ _mesa_problem(NULL, "No current context in intelScreenContext\n");
+ return NULL;
+ }
+ return intelScreen->dummyctxptr;
}
return intel_context(ctx);
-*/
- if (intelScreen->dummyctxptr == NULL) {
- _mesa_problem(NULL, "No current context in intelScreenContext\n");
- return NULL;
- }
- return intelScreen->dummyctxptr;
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.h b/src/mesa/drivers/dri/i915tex/intel_screen.h
index 783ee35524b..8e4e0b9c12f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_screen.h
+++ b/src/mesa/drivers/dri/i915tex/intel_screen.h
@@ -50,17 +50,8 @@ typedef struct
typedef struct
{
intelRegion front;
- intelRegion back;
- intelRegion third;
- intelRegion rotated;
- intelRegion depth;
- intelRegion tex;
struct intel_region *front_region;
- struct intel_region *back_region;
- struct intel_region *third_region;
- struct intel_region *depth_region;
- struct intel_region *rotated_region;
int deviceID;
int width;
@@ -68,10 +59,6 @@ typedef struct
int mem; /* unused */
int cpp; /* for front and back buffers */
-/* int bitsPerPixel; */
- int fbFormat; /* XXX FBO: this is obsolete - remove after i830 updates */
-
- int logTextureGranularity;
__DRIscreenPrivate *driScrnPriv;
unsigned int sarea_priv_offset;
@@ -83,8 +70,6 @@ typedef struct
struct matrix23 rotMatrix;
- int current_rotation; /* 0, 90, 180 or 270 */
- int rotatedWidth, rotatedHeight;
/**
* Configuration cache with default values for all contexts
diff --git a/src/mesa/drivers/dri/i915tex/intel_span.c b/src/mesa/drivers/dri/i915tex/intel_span.c
index ab0874e4fd6..5a978d9ce26 100644
--- a/src/mesa/drivers/dri/i915tex/intel_span.c
+++ b/src/mesa/drivers/dri/i915tex/intel_span.c
@@ -47,30 +47,25 @@
#define DBG 0
#define LOCAL_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = irb->RenderToTexture ? 1 : -1; \
const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- GLubyte *buf = (GLubyte *) irb->pfMap \
- + (intel->drawY * irb->pfPitch + intel->drawX) * irb->region->cpp;\
+ GLubyte *buf = (GLubyte *) irb->pfMap; \
GLuint p; \
assert(irb->pfMap);\
(void) p;
-/* 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.
+/* There is just a single cliploop!
*/
#define HW_CLIPLOOP() \
do { \
- int _nc = intel->numClipRects; \
- while ( _nc-- ) { \
- int minx = intel->pClipRects[_nc].x1 - intel->drawX; \
- int miny = intel->pClipRects[_nc].y1 - intel->drawY; \
- int maxx = intel->pClipRects[_nc].x2 - intel->drawX; \
- int maxy = intel->pClipRects[_nc].y2 - intel->drawY;
-
+ int minx = 0; \
+ int miny = 0; \
+ int maxx = irb->Base.Width - 1; \
+ int maxy = irb->Base.Height - 1;
+#define HW_ENDCLIPLOOP() \
+ } while (0)
#define Y_FLIP(_y) ((_y) * yScale + yBias)
@@ -101,14 +96,11 @@
#define LOCAL_DEPTH_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLuint pitch = irb->pfPitch/***XXX region->pitch*/; /* in pixels */ \
const GLint yScale = irb->RenderToTexture ? 1 : -1; \
const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- char *buf = (char *) irb->pfMap/*XXX use region->map*/ + \
- (intel->drawY * pitch + intel->drawX) * irb->region->cpp;
-
+ char *buf = (char *) irb->pfMap/*XXX use region->map*/ ;
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -267,7 +259,7 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
/* depth buffer (Note wrapper!) */
if (ctx->DrawBuffer->_DepthBuffer) {
irb = intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped);
- if (irb && irb->region && irb->Base.Name != 0) {
+ if (irb && irb->region) {
if (map) {
intel_region_map(intel->intelScreen, irb->region);
irb->pfMap = irb->region->map;
@@ -284,7 +276,7 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
/* stencil buffer (Note wrapper!) */
if (ctx->DrawBuffer->_StencilBuffer) {
irb = intel_renderbuffer(ctx->DrawBuffer->_StencilBuffer->Wrapped);
- if (irb && irb->region && irb->Base.Name != 0) {
+ if (irb && irb->region) {
if (map) {
intel_region_map(intel->intelScreen, irb->region);
irb->pfMap = irb->region->map;
diff --git a/src/mesa/drivers/dri/i915tex/intel_state.c b/src/mesa/drivers/dri/i915tex/intel_state.c
index b2773990e4b..5c5f2c6de5c 100644
--- a/src/mesa/drivers/dri/i915tex/intel_state.c
+++ b/src/mesa/drivers/dri/i915tex/intel_state.c
@@ -194,7 +194,7 @@ intelClearColor(GLcontext * ctx, const GLfloat color[4])
* Update the viewport transformation matrix. Depends on:
* - viewport pos/size
* - depthrange
- * - window pos/size or FBO size
+ * - window size or FBO size
*/
static void
intelCalcViewport(GLcontext * ctx)
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
index b85a25642a2..8d7f8f9d91b 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
@@ -101,6 +101,7 @@ do_copy_texsubimage(struct intel_context *intel,
}
intelFlush(ctx);
+ /* XXX still need the lock ? */
LOCK_HARDWARE(intel);
{
GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
@@ -117,21 +118,11 @@ do_copy_texsubimage(struct intel_context *intel,
dstx += x - orig_x;
dsty += y - orig_y;
- if (ctx->ReadBuffer->Name == 0) {
- /* reading from a window, adjust x, y */
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- GLuint window_y;
- /* window_y = position of window on screen if y=0=bottom */
- window_y = intel->intelScreen->height - (dPriv->y + dPriv->h);
- y = window_y + y;
- x += dPriv->x;
+ if (!(ctx->ReadBuffer->Name == 0)) {
+ /* XXX this looks bogus ? */
+ /* FBO: invert Y */
+ y = ctx->ReadBuffer->Height - y - 1;
}
- else {
- /* reading from a FBO */
- /* invert Y */
- y = ctx->ReadBuffer->Height - y - 1;
- }
-
/* A bit of fiddling to get the blitter to work with -ve
* pitches. But we get a nice inverted blit this way, so it's