summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c24
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_point.c4
-rw-r--r--src/gallium/auxiliary/tgsi/Makefile1
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c22
-rw-r--r--src/gallium/auxiliary/util/u_math.h6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_pipe_state.c6
-rw-r--r--src/gallium/drivers/trace/README2
-rw-r--r--src/gallium/winsys/xlib/xm_winsys.c17
9 files changed, 60 insertions, 26 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index f22ba40824d..b1ccfc0374a 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -765,12 +765,30 @@ void cso_restore_vertex_shader(struct cso_context *ctx)
}
+/**
+ * Copy framebuffer state from src to dst with refcounting of surfaces.
+ */
+static void
+copy_framebuffer_state(struct pipe_framebuffer_state *dst,
+ const struct pipe_framebuffer_state *src)
+{
+ uint i;
+
+ dst->width = src->width;
+ dst->height = src->height;
+ dst->num_cbufs = src->num_cbufs;
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
+ }
+ pipe_surface_reference(&dst->zsbuf, src->zsbuf);
+}
+
enum pipe_error cso_set_framebuffer(struct cso_context *ctx,
const struct pipe_framebuffer_state *fb)
{
if (memcmp(&ctx->fb, fb, sizeof(*fb)) != 0) {
- ctx->fb = *fb;
+ copy_framebuffer_state(&ctx->fb, fb);
ctx->pipe->set_framebuffer_state(ctx->pipe, fb);
}
return PIPE_OK;
@@ -778,13 +796,13 @@ enum pipe_error cso_set_framebuffer(struct cso_context *ctx,
void cso_save_framebuffer(struct cso_context *ctx)
{
- ctx->fb_saved = ctx->fb;
+ copy_framebuffer_state(&ctx->fb_saved, &ctx->fb);
}
void cso_restore_framebuffer(struct cso_context *ctx)
{
if (memcmp(&ctx->fb, &ctx->fb_saved, sizeof(ctx->fb))) {
- ctx->fb = ctx->fb_saved;
+ copy_framebuffer_state(&ctx->fb, &ctx->fb_saved);
ctx->pipe->set_framebuffer_state(ctx->pipe, &ctx->fb);
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 4f1326053df..e1af9e56a24 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -222,8 +222,8 @@ static void widepoint_first_point( struct draw_stage *stage,
/* find fragment shader PointCoord/Fog input */
wide->point_coord_fs_input = 0; /* XXX fix this! */
- /* setup extra vp output */
- draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_FOG;
+ /* setup extra vp output (point coord implemented as a texcoord) */
+ draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
draw->extra_vp_outputs.semantic_index = 0;
draw->extra_vp_outputs.slot = draw->vs.num_vs_outputs;
}
diff --git a/src/gallium/auxiliary/tgsi/Makefile b/src/gallium/auxiliary/tgsi/Makefile
index 806a2bd4c52..c5d2082087c 100644
--- a/src/gallium/auxiliary/tgsi/Makefile
+++ b/src/gallium/auxiliary/tgsi/Makefile
@@ -4,6 +4,7 @@ include $(TOP)/configs/current
LIBNAME = tgsi
C_SOURCES = \
+ tgsi_sanity.c \
tgsi_build.c \
tgsi_dump.c \
tgsi_exec.c \
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index a4899cd4c2d..68c7a6b7f58 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -69,7 +69,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, "COS" },
{ 1, 1, 0, 0, "DDX" },
{ 1, 1, 0, 0, "DDY" },
- { 0, 1, 0, 0, "KILP" },
+ { 0, 0, 0, 0, "KILP" },
{ 1, 1, 0, 0, "PK2H" },
{ 1, 1, 0, 0, "PK2US" },
{ 1, 1, 0, 0, "PK4B" },
@@ -146,7 +146,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 0, 1, 0, 0, "CALLNZ" },
{ 0, 1, 0, 0, "IFC" },
{ 0, 1, 0, 0, "BREAKC" },
- { 0, 0, 0, 0, "KIL" },
+ { 0, 1, 0, 0, "KIL" },
{ 0, 0, 0, 0, "END" },
{ 1, 1, 0, 0, "SWZ" }
};
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index c6590272969..11659247c0c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -152,6 +152,12 @@ check_register_usage(
{
if (!check_file_name( ctx, file ))
return FALSE;
+
+ if (index < 0 || index > MAX_REGISTERS) {
+ report_error( ctx, "%s[%i]: Invalid index %s", file_names[file], index, name );
+ return FALSE;
+ }
+
if (indirect_access) {
if (!is_any_register_declared( ctx, file ))
report_error( ctx, "%s: Undeclared %s register", file_names[file], name );
@@ -174,12 +180,10 @@ iter_instruction(
const struct tgsi_opcode_info *info;
uint i;
- /* There must be no other instructions after END.
- */
- if (ctx->index_of_END != ~0) {
- report_error( ctx, "Unexpected instruction after END" );
- }
- else if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
+ if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
+ if (ctx->index_of_END != ~0) {
+ report_error( ctx, "Too many END instructions" );
+ }
ctx->index_of_END = ctx->num_instructions;
}
@@ -301,10 +305,10 @@ epilog(
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
uint file;
- /* There must be an END instruction at the end.
+ /* There must be an END instruction somewhere.
*/
- if (ctx->index_of_END == ~0 || ctx->index_of_END != ctx->num_instructions - 1) {
- report_error( ctx, "Expected END at end of instruction sequence" );
+ if (ctx->index_of_END == ~0) {
+ report_error( ctx, "Missing END instruction" );
}
/* Check if all declared registers were used.
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 9b4ca393714..0b10622ee75 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -272,8 +272,10 @@ util_fast_log2(float val)
static INLINE float
util_fast_pow(float x, float y)
{
- /* XXX this test may need adjustment */
- if (y >= 3.0 && -0.02f <= x && x <= 0.02f)
+ /* XXX these tests may need adjustment */
+ if (y >= 3.0f && (-0.02f <= x && x <= 0.02f))
+ return 0.0f;
+ if (y >= 50.0f && (-0.9f <= x && x <= 0.9f))
return 0.0f;
return util_fast_exp2(util_fast_log2(x) * y);
}
diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
index e04cf5f274a..475c6ef0ce6 100644
--- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c
+++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
@@ -48,8 +48,9 @@ cell_create_blend_state(struct pipe_context *pipe,
struct cell_blend_state *cb = MALLOC(sizeof(struct cell_blend_state));
(void) memcpy(cb, blend, sizeof(*blend));
+#if 0
cell_generate_alpha_blend(cb);
-
+#endif
return cb;
}
@@ -100,8 +101,9 @@ cell_create_depth_stencil_alpha_state(struct pipe_context *pipe,
MALLOC(sizeof(struct cell_depth_stencil_alpha_state));
(void) memcpy(cdsa, depth_stencil, sizeof(*depth_stencil));
+#if 0
cell_generate_depth_stencil_test(cdsa);
-
+#endif
return cdsa;
}
diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README
index e7a2f12b022..f0e1cd596d3 100644
--- a/src/gallium/drivers/trace/README
+++ b/src/gallium/drivers/trace/README
@@ -10,7 +10,7 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls.
To build, invoke scons on the top dir as
- scons statetrackers=mesa drivers=softpipe,i915simple,trace winsys=xlib
+ scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
= Usage =
diff --git a/src/gallium/winsys/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c
index 2acbc94fc8d..3334af175bc 100644
--- a/src/gallium/winsys/xlib/xm_winsys.c
+++ b/src/gallium/winsys/xlib/xm_winsys.c
@@ -349,19 +349,26 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
if (x + w > surf->width)
w = surf->width - x;
- offset *= 4 * TILE_SIZE * TILE_SIZE;
-
- twiddle_tile((uint *) ((char *) xm_buf->data + offset),
- tmpTile);
- ximage->data = (char*) tmpTile;
+ /* offset in pixels */
+ offset *= TILE_SIZE * TILE_SIZE;
if (XSHM_ENABLED(xm_buf)) {
+ ximage->data = (char *) xm_buf->data + 4 * offset;
+ /* make copy of tile data */
+ memcpy(tmpTile, (uint *) ximage->data, sizeof(tmpTile));
+ /* twiddle from temp to ximage in shared memory */
+ twiddle_tile(tmpTile, (uint *) ximage->data);
+ /* display image in shared memory */
#if defined(USE_XSHM) && !defined(XFree86Server)
XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
ximage, 0, 0, x, y, w, h, False);
#endif
}
else {
+ /* twiddel from ximage buffer to temp tile */
+ twiddle_tile((uint *) xm_buf->data + offset, tmpTile);
+ /* display temp tile data */
+ ximage->data = (char *) tmpTile;
XPutImage(b->xm_visual->display, b->drawable, b->gc,
ximage, 0, 0, x, y, w, h);
}