aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-05 14:42:08 -0600
committerBrian Paul <[email protected]>2009-10-05 14:42:08 -0600
commit55770d09c18c4d33403abb97dfef4f897efbbe2a (patch)
tree3f3cb2ea42c511c11e134c2d414367df82268cea /src/mesa
parentf00da2a3ff59c1a7104ac25a1c6eba5a6050ad68 (diff)
parent79892e7976fbb91ae426f5868d5f453e977c1f17 (diff)
Merge branch 'mesa_7_6_branch'
Conflicts: src/gallium/auxiliary/util/u_cpu_detect.c
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c60
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c15
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c20
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c13
-rw-r--r--src/mesa/drivers/x11/fakeglx.c4
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/dlist.c6
-rw-r--r--src/mesa/main/mipmap.c19
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/shader/prog_optimize.c4
-rw-r--r--src/mesa/shader/slang/slang_link.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c13
15 files changed, 101 insertions, 75 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index d49d95768db..934f7aa1873 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -984,41 +984,35 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
- /* The drawbuffer won't always be updated by _mesa_make_current:
- */
- if (intel->ctx.DrawBuffer == &intel_fb->Base) {
-
- if (intel->driReadDrawable != driReadPriv)
- intel->driReadDrawable = driReadPriv;
-
- if (intel->driDrawable != driDrawPriv) {
- if (driDrawPriv->swap_interval == (unsigned)-1) {
- int i;
-
- driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
- ? driGetDefaultVBlankFlags(&intel->optionCache)
- : VBLANK_FLAG_NO_IRQ;
-
- /* Prevent error printf if one crtc is disabled, this will
- * be properly calculated in intelWindowMoved() next.
- */
- driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv);
-
- (*psp->systemTime->getUST) (&intel_fb->swap_ust);
- driDrawableInitVBlank(driDrawPriv);
- intel_fb->vbl_waited = driDrawPriv->vblSeq;
-
- for (i = 0; i < 2; i++) {
- if (intel_fb->color_rb[i])
- intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
- }
- }
- intel->driDrawable = driDrawPriv;
- intelWindowMoved(intel);
- }
+ intel->driReadDrawable = driReadPriv;
+
+ if (intel->driDrawable != driDrawPriv) {
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ int i;
+
+ driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
+ ? driGetDefaultVBlankFlags(&intel->optionCache)
+ : VBLANK_FLAG_NO_IRQ;
- intel_draw_buffer(&intel->ctx, &intel_fb->Base);
+ /* Prevent error printf if one crtc is disabled, this will
+ * be properly calculated in intelWindowMoved() next.
+ */
+ driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv);
+
+ (*psp->systemTime->getUST) (&intel_fb->swap_ust);
+ driDrawableInitVBlank(driDrawPriv);
+ intel_fb->vbl_waited = driDrawPriv->vblSeq;
+
+ for (i = 0; i < 2; i++) {
+ if (intel_fb->color_rb[i])
+ intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
+ }
+ }
+ intel->driDrawable = driDrawPriv;
+ intelWindowMoved(intel);
}
+
+ intel_draw_buffer(&intel->ctx, &intel_fb->Base);
}
else {
_mesa_make_current(NULL, NULL, NULL);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 44a8695286f..47075001801 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -226,14 +226,14 @@ do_blit_readpixels(GLcontext * ctx,
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
+ 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);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t rect;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 8f467e65144..f3e312420dd 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -135,7 +135,7 @@ do_copy_texsubimage(struct intel_context *intel,
if (ctx->ReadBuffer->Name == 0) {
/* reading from a window, adjust x, y */
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ const __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
y = dPriv->y + (dPriv->h - (y + height));
x += dPriv->x;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 76852e315c1..d28e96d9d98 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1578,13 +1578,6 @@ static void r200ClearStencil( GLcontext *ctx, GLint s )
* Window position and viewport transformation
*/
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-
/**
* Called when window size or position changes or viewport or depth range
* state is changed. We update the hardware viewport state here.
@@ -1609,9 +1602,9 @@ void r200UpdateWindow( GLcontext *ctx )
}
float_ui32_type sx = { v[MAT_SX] };
- float_ui32_type tx = { v[MAT_TX] + xoffset + SUBPIXEL_X };
+ float_ui32_type tx = { v[MAT_TX] + xoffset };
float_ui32_type sy = { v[MAT_SY] * y_scale };
- float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias + SUBPIXEL_Y };
+ float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias };
float_ui32_type sz = { v[MAT_SZ] * depthScale };
float_ui32_type tz = { v[MAT_TZ] * depthScale };
@@ -1680,8 +1673,8 @@ void r200UpdateViewportOffset( GLcontext *ctx )
float_ui32_type tx;
float_ui32_type ty;
- tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X;
- ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
+ tx.f = v[MAT_TX] + xoffset;
+ ty.f = (- v[MAT_TY]) + yoffset;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 )
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 6fcf209af66..2c2b16aa98d 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -376,11 +376,21 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
if (screen->chip_family >= CHIP_FAMILY_RV515) {
ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
- ctx->Const.FragmentProgram.MaxNativeParameters = R500_PFS_NUM_CONST_REGS;
- ctx->Const.FragmentProgram.MaxNativeAluInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeTexInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeTexIndirections = R500_PFS_MAX_INST;
+
+ /* The hardware limits are higher than this,
+ * but the non-KMS DRM interface artificially limits us
+ * to this many instructions.
+ *
+ * We could of course work around it in the KMS path,
+ * but it would be a mess, so it seems wiser
+ * to leave it as is. Going forward, the Gallium driver
+ * will not be subject to these limitations.
+ */
+ ctx->Const.FragmentProgram.MaxNativeParameters = 255;
+ ctx->Const.FragmentProgram.MaxNativeAluInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeTexInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeTexIndirections = 255;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
} else {
ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 0bdc90b4a84..70c92528943 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -239,6 +239,19 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
rewriteFog(&compiler, fp);
r3xx_compile_fragment_program(&compiler);
+
+ if (compiler.is_r500) {
+ /* We need to support the non-KMS DRM interface, which
+ * artificially limits the number of instructions and
+ * constants which are available to us.
+ *
+ * See also the comment in r300_context.c where we
+ * set the MAX_NATIVE_xxx values.
+ */
+ if (fp->code.code.r500.inst_end >= 255 || fp->code.constants.Count > 255)
+ rc_error(&compiler.Base, "Program is too big (upgrade to r300g to avoid this limitation).\n");
+ }
+
fp->error = compiler.Base.Error;
fp->InputsRead = compiler.Base.Program.InputsRead;
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index eb7c4f6417c..6449dc88b0d 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1197,10 +1197,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
if (!fbConfig)
return NULL;
parselist++;
- if (*parselist == GLX_RGBA_BIT) {
+ if (*parselist & GLX_RGBA_BIT) {
rgb_flag = GL_TRUE;
}
- else if (*parselist == GLX_COLOR_INDEX_BIT) {
+ else if (*parselist & GLX_COLOR_INDEX_BIT) {
rgb_flag = GL_FALSE;
}
else if (*parselist == 0) {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 11b1d244538..ae91bf5f385 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -860,6 +860,7 @@ _mesa_initialize_context(GLcontext *ctx,
_mesa_free_shared_state(ctx, ctx->Shared);
if (ctx->Exec)
_mesa_free(ctx->Exec);
+ return GL_FALSE;
}
#if FEATURE_dispatch
_mesa_init_exec_table(ctx->Exec);
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 6354ed74748..95c1b9015bd 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1961,6 +1961,9 @@ save_Fogiv(GLenum pname, const GLint *params)
case GL_FOG_END:
case GL_FOG_INDEX:
p[0] = (GLfloat) *params;
+ p[1] = 0.0f;
+ p[2] = 0.0f;
+ p[3] = 0.0f;
break;
case GL_FOG_COLOR:
p[0] = INT_TO_FLOAT(params[0]);
@@ -2249,6 +2252,9 @@ save_LightModeliv(GLenum pname, const GLint *params)
case GL_LIGHT_MODEL_TWO_SIDE:
case GL_LIGHT_MODEL_COLOR_CONTROL:
fparam[0] = (GLfloat) params[0];
+ fparam[1] = 0.0F;
+ fparam[2] = 0.0F;
+ fparam[3] = 0.0F;
break;
default:
/* Error will be caught later in gl_LightModelfv */
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 3dca09d9f28..c3928fa513f 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1501,8 +1501,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
GLuint comps;
ASSERT(texObj);
- /* XXX choose cube map face here??? */
- srcImage = texObj->Image[0][texObj->BaseLevel];
+ srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
ASSERT(srcImage);
maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
@@ -1510,7 +1509,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
/* Find convertFormat - the format that do_row() will process */
if (srcImage->IsCompressed) {
- /* setup for compressed textures */
+ /* setup for compressed textures - need to allocate temporary
+ * image buffers to hold uncompressed images.
+ */
GLuint row;
GLint components, size;
GLchan *dst;
@@ -1587,11 +1588,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
&dstWidth, &dstHeight, &dstDepth);
if (!nextLevel) {
/* all done */
- if (srcImage->IsCompressed) {
- _mesa_free((void *) srcData);
- _mesa_free(dstData);
- }
- return;
+ break;
}
/* get dest gl_texture_image */
@@ -1682,6 +1679,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
}
} /* loop over mipmap levels */
+
+ if (srcImage->IsCompressed) {
+ /* free uncompressed image buffers */
+ _mesa_free((void *) srcData);
+ _mesa_free(dstData);
+ }
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index f8ce811eb29..8fd5eaa2661 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -859,7 +859,7 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj)
for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
if (texObj == unit->CurrentTex[tex]) {
_mesa_reference_texobj(&unit->CurrentTex[tex],
- ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]);
+ ctx->Shared->DefaultTex[tex]);
ASSERT(unit->CurrentTex[tex]);
break;
}
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index be903106a08..9d937488e37 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -217,6 +217,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
if (inst->SrcReg[j].RelAddr) {
if (dbg)
_mesa_printf("abort remove dead code (indirect temp)\n");
+ _mesa_free(removeInst);
return;
}
@@ -232,6 +233,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
if (inst->DstReg.RelAddr) {
if (dbg)
_mesa_printf("abort remove dead code (indirect temp)\n");
+ _mesa_free(removeInst);
return;
}
@@ -422,6 +424,8 @@ _mesa_remove_extra_moves(struct gl_program *prog)
/* now remove the instructions which aren't needed */
rem = remove_instructions(prog, removeInst);
+ _mesa_free(removeInst);
+
if (dbg) {
_mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem);
/*_mesa_print_program(prog);*/
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 8f2b40d5dfb..71038d2d94e 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -670,6 +670,7 @@ get_main_shader(GLcontext *ctx,
!shader->Main ||
shader->UnresolvedRefs) {
link_error(shProg, "Unresolved symbols");
+ _mesa_free_shader(ctx, shader);
return NULL;
}
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 91fc9f98f7c..4a64472fa14 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -599,15 +599,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* viewport state: viewport matching window dims */
{
- const float width = (float) ctx->DrawBuffer->Width;
- const float height = (float) ctx->DrawBuffer->Height;
+ const float w = (float) ctx->DrawBuffer->Width;
+ const float h = (float) ctx->DrawBuffer->Height;
struct pipe_viewport_state vp;
- vp.scale[0] = 0.5f * width;
- vp.scale[1] = -0.5f * height;
+ vp.scale[0] = 0.5f * w;
+ vp.scale[1] = -0.5f * h;
vp.scale[2] = 1.0f;
vp.scale[3] = 1.0f;
- vp.translate[0] = 0.5f * width;
- vp.translate[1] = 0.5f * height;
+ vp.translate[0] = 0.5f * w;
+ vp.translate[1] = 0.5f * h;
vp.translate[2] = 0.0f;
vp.translate[3] = 0.0f;
cso_set_viewport(cso, &vp);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index a0495209013..57a2a3db5bb 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -165,12 +165,12 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
strb->texture,
0, 0, 0,
surface_usage );
-
- assert(strb->surface->texture);
- assert(strb->surface->format);
- assert(strb->surface->width == width);
- assert(strb->surface->height == height);
-
+ if (strb->surface) {
+ assert(strb->surface->texture);
+ assert(strb->surface->format);
+ assert(strb->surface->width == width);
+ assert(strb->surface->height == height);
+ }
return strb->surface != NULL;
}
@@ -298,6 +298,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
default:
_mesa_problem(NULL,
"Unexpected format in st_new_renderbuffer_fb");
+ _mesa_free(strb);
return NULL;
}