aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_clear.c6
-rw-r--r--src/gallium/drivers/cell/ppu/cell_gen_fp.c2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c26
-rw-r--r--src/gallium/drivers/i915/i915_surface.c21
-rw-r--r--src/gallium/drivers/i915/i915_texture.c125
-rw-r--r--src/gallium/drivers/identity/id_context.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_arit.c11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_debug.c13
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_clear.c5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_debug.h71
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c26
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state.h9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_derived.c12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c117
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c59
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_cache.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c48
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_cache.c11
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h52
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c16
-rw-r--r--src/gallium/drivers/nv04/nv04_state.h1
-rw-r--r--src/gallium/drivers/nv04/nv04_surface_2d.c21
-rw-r--r--src/gallium/drivers/nv04/nv04_transfer.c11
-rw-r--r--src/gallium/drivers/nv10/nv10_miptree.c13
-rw-r--r--src/gallium/drivers/nv10/nv10_state.h1
-rw-r--r--src/gallium/drivers/nv10/nv10_transfer.c11
-rw-r--r--src/gallium/drivers/nv20/nv20_miptree.c12
-rw-r--r--src/gallium/drivers/nv20/nv20_state.h1
-rw-r--r--src/gallium/drivers/nv20/nv20_transfer.c11
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c3
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c13
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c10
-rw-r--r--src/gallium/drivers/nv30/nv30_transfer.c11
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c3
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h1
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c16
-rw-r--r--src/gallium/drivers/nv40/nv40_state.h1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c10
-rw-r--r--src/gallium/drivers/nv40/nv40_transfer.c11
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h14
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c43
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c512
-rw-r--r--src/gallium/drivers/nv50/nv50_program.h2
-rw-r--r--src/gallium/drivers/nv50/nv50_query.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c21
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c64
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c52
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_tex.c91
-rw-r--r--src/gallium/drivers/nv50/nv50_texture.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_transfer.c87
-rw-r--r--src/gallium/drivers/r300/Makefile4
-rw-r--r--src/gallium/drivers/r300/SConscript2
-rw-r--r--src/gallium/drivers/r300/r300_blit.c130
-rw-r--r--src/gallium/drivers/r300/r300_blit.h (renamed from src/gallium/drivers/r300/r300_clear.h)22
-rw-r--r--src/gallium/drivers/r300/r300_clear.c38
-rw-r--r--src/gallium/drivers/r300/r300_context.c13
-rw-r--r--src/gallium/drivers/r300/r300_context.h16
-rw-r--r--src/gallium/drivers/r300/r300_cs.h11
-rw-r--r--src/gallium/drivers/r300/r300_emit.c146
-rw-r--r--src/gallium/drivers/r300/r300_reg.h6
-rw-r--r--src/gallium/drivers/r300/r300_render.c31
-rw-r--r--src/gallium/drivers/r300/r300_screen.c17
-rw-r--r--src/gallium/drivers/r300/r300_state.c74
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c60
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c19
-rw-r--r--src/gallium/drivers/r300/r300_texture.c12
-rw-r--r--src/gallium/drivers/r300/r300_vs.c31
-rw-r--r--src/gallium/drivers/r300/r300_vs.h4
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h2
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.c7
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c33
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c8
-rw-r--r--src/gallium/drivers/softpipe/sp_winsys.h4
-rw-r--r--src/gallium/drivers/svga/include/svga_escape.h89
-rw-r--r--src/gallium/drivers/svga/include/svga_overlay.h201
-rw-r--r--src/gallium/drivers/svga/svga_pipe_clear.c6
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c5
-rw-r--r--src/gallium/drivers/svga/svga_screen_buffer.c3
-rw-r--r--src/gallium/drivers/svga/svga_screen_cache.c9
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.c74
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.h12
-rw-r--r--src/gallium/drivers/svga/svga_state_constants.c3
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_dump.c1160
-rwxr-xr-xsrc/gallium/drivers/svga/svgadump/svga_dump.py31
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader_dump.c230
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c24
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.h3
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c13
-rw-r--r--src/gallium/drivers/trace/tr_screen.c3
97 files changed, 2688 insertions, 1593 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c
index 79ad687ea94..3a3f968a492 100644
--- a/src/gallium/drivers/cell/ppu/cell_clear.c
+++ b/src/gallium/drivers/cell/ppu/cell_clear.c
@@ -59,9 +59,9 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
if (buffers & PIPE_CLEAR_COLOR) {
uint surfIndex = 0;
- uint clearValue;
+ union util_color uc;
- util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue);
+ util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &uc);
/* Build a CLEAR command and place it in the current batch buffer */
STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
@@ -70,7 +70,7 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
cell_batch_alloc16(cell, sizeof(*clr));
clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
clr->surface = surfIndex;
- clr->value = clearValue;
+ clr->value = uc.ui;
}
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c
index 1895a7940c4..1d8a11a4ac9 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c
@@ -995,7 +995,7 @@ static boolean
emit_inequality(struct codegen *gen, const struct tgsi_full_instruction *inst)
{
int ch, s1_reg[4], s2_reg[4], d_reg[4], one_reg;
- bool complement = FALSE;
+ boolean complement = FALSE;
one_reg = get_const_one_reg(gen);
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index 605d53a9486..bc2e625f54b 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -67,14 +67,11 @@ cell_texture_layout(struct cell_texture *ct)
w_tile = align(width, TILE_SIZE);
h_tile = align(height, TILE_SIZE);
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w_tile);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h_tile);
-
- ct->stride[level] = pt->nblocksx[level] * pt->block.size;
+ ct->stride[level] = pf_get_stride(pt->format, w_tile);
ct->level_offset[level] = ct->buffer_size;
- size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size;
+ size = ct->stride[level] * pf_get_nblocksy(pt->format, h_tile);
if (pt->target == PIPE_TEXTURE_CUBE)
size *= 6;
else
@@ -285,10 +282,12 @@ cell_get_tex_surface(struct pipe_screen *screen,
ps->zslice = zslice;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset += face * pt->nblocksy[level] * ct->stride[level];
+ unsigned h_tile = align(ps->height, TILE_SIZE);
+ ps->offset += face * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset += zslice * pt->nblocksy[level] * ct->stride[level];
+ unsigned h_tile = align(ps->height, TILE_SIZE);
+ ps->offset += zslice * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
}
else {
assert(face == 0);
@@ -329,14 +328,10 @@ cell_get_tex_transfer(struct pipe_screen *screen,
if (ctrans) {
struct pipe_transfer *pt = &ctrans->base;
pipe_texture_reference(&pt->texture, texture);
- pt->format = texture->format;
- pt->block = texture->block;
pt->x = x;
pt->y = y;
pt->width = w;
pt->height = h;
- pt->nblocksx = texture->nblocksx[level];
- pt->nblocksy = texture->nblocksy[level];
pt->stride = ct->stride[level];
pt->usage = usage;
pt->face = face;
@@ -346,10 +341,12 @@ cell_get_tex_transfer(struct pipe_screen *screen,
ctrans->offset = ct->level_offset[level];
if (texture->target == PIPE_TEXTURE_CUBE) {
- ctrans->offset += face * pt->nblocksy * pt->stride;
+ unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
+ ctrans->offset += face * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
- ctrans->offset += zslice * pt->nblocksy * pt->stride;
+ unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
+ ctrans->offset += zslice * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
}
else {
assert(face == 0);
@@ -402,7 +399,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
* Create a buffer of ordinary memory for the linear texture.
* This is the memory that the user will read/write.
*/
- size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size;
+ size = pf_get_stride(pt->format, align(texWidth, TILE_SIZE)) *
+ pf_get_nblocksy(pt->format, align(texHeight, TILE_SIZE));
ctrans->map = align_malloc(size, 16);
if (!ctrans->map)
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c
index ab8331f3e64..24e1024aaa3 100644
--- a/src/gallium/drivers/i915/i915_surface.c
+++ b/src/gallium/drivers/i915/i915_surface.c
@@ -48,17 +48,19 @@ i915_surface_copy(struct pipe_context *pipe,
{
struct i915_texture *dst_tex = (struct i915_texture *)dst->texture;
struct i915_texture *src_tex = (struct i915_texture *)src->texture;
+ struct pipe_texture *dpt = &dst_tex->base;
+ struct pipe_texture *spt = &src_tex->base;
assert( dst != src );
- assert( dst_tex->base.block.size == src_tex->base.block.size );
- assert( dst_tex->base.block.width == src_tex->base.block.height );
- assert( dst_tex->base.block.height == src_tex->base.block.height );
- assert( dst_tex->base.block.width == 1 );
- assert( dst_tex->base.block.height == 1 );
+ assert( pf_get_blocksize(dpt->format) == pf_get_blocksize(spt->format) );
+ assert( pf_get_blockwidth(dpt->format) == pf_get_blockwidth(spt->format) );
+ assert( pf_get_blockheight(dpt->format) == pf_get_blockheight(spt->format) );
+ assert( pf_get_blockwidth(dpt->format) == 1 );
+ assert( pf_get_blockheight(dpt->format) == 1 );
i915_copy_blit( i915_context(pipe),
FALSE,
- dst_tex->base.block.size,
+ pf_get_blocksize(dpt->format),
(unsigned short) src_tex->stride, src_tex->buffer, src->offset,
(unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset,
(short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
@@ -72,12 +74,13 @@ i915_surface_fill(struct pipe_context *pipe,
unsigned width, unsigned height, unsigned value)
{
struct i915_texture *tex = (struct i915_texture *)dst->texture;
+ struct pipe_texture *pt = &tex->base;
- assert(tex->base.block.width == 1);
- assert(tex->base.block.height == 1);
+ assert(pf_get_blockwidth(pt->format) == 1);
+ assert(pf_get_blockheight(pt->format) == 1);
i915_fill_blit( i915_context(pipe),
- tex->base.block.size,
+ pf_get_blocksize(pt->format),
(unsigned short) tex->stride,
tex->buffer, dst->offset,
(short) dstx, (short) dsty,
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index c7b86dd4c57..b28b413771d 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -74,6 +74,9 @@ static const int step_offsets[6][2] = {
{-1, 1}
};
+/* XXX really need twice the size if x is already pot?
+ Otherwise just use util_next_power_of_two?
+*/
static unsigned
power_of_two(unsigned x)
{
@@ -83,13 +86,6 @@ power_of_two(unsigned x)
return value;
}
-static unsigned
-round_up(unsigned n, unsigned multiple)
-{
- return (n + multiple - 1) & ~(multiple - 1);
-}
-
-
/*
* More advanced helper funcs
*/
@@ -101,13 +97,8 @@ i915_miptree_set_level_info(struct i915_texture *tex,
unsigned nr_images,
unsigned w, unsigned h, unsigned d)
{
- struct pipe_texture *pt = &tex->base;
-
assert(level < PIPE_MAX_TEXTURE_LEVELS);
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h);
-
tex->nr_images[level] = nr_images;
/*
@@ -138,7 +129,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
assert(img < tex->nr_images[level]);
- tex->image_offset[level][img] = y * tex->stride + x * tex->base.block.size;
+ tex->image_offset[level][img] = y * tex->stride + x * pf_get_blocksize(tex->base.format);
/*
printf("%s level %d img %d pos %d,%d image_offset %x\n",
@@ -160,28 +151,28 @@ i915_scanout_layout(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
- if (pt->last_level > 0 || pt->block.size != 4)
+ if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4)
return FALSE;
i915_miptree_set_level_info(tex, 0, 1,
- tex->base.width0,
- tex->base.height0,
+ pt->width0,
+ pt->height0,
1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
- if (tex->base.width0 >= 240) {
- tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
- tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
+ if (pt->width0 >= 240) {
+ tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
+ tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
tex->hw_tiled = INTEL_TILE_X;
- } else if (tex->base.width0 == 64 && tex->base.height0 == 64) {
- tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
- tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
+ } else if (pt->width0 == 64 && pt->height0 == 64) {
+ tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
+ tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
} else {
return FALSE;
}
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- tex->base.width0, tex->base.height0, pt->block.size,
+ pt->width0, pt->height0, pf_get_blocksize(pt->format),
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
return TRUE;
@@ -195,25 +186,25 @@ i915_display_target_layout(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
- if (pt->last_level > 0 || pt->block.size != 4)
+ if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4)
return FALSE;
/* fallback to normal textures for small textures */
- if (tex->base.width0 < 240)
+ if (pt->width0 < 240)
return FALSE;
i915_miptree_set_level_info(tex, 0, 1,
- tex->base.width0,
- tex->base.height0,
+ pt->width0,
+ pt->height0,
1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
- tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
- tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
+ tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0));
+ tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8);
tex->hw_tiled = INTEL_TILE_X;
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- tex->base.width0, tex->base.height0, pt->block.size,
+ pt->width0, pt->height0, pf_get_blocksize(pt->format),
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
return TRUE;
@@ -226,34 +217,32 @@ i915_miptree_layout_2d(struct i915_texture *tex)
unsigned level;
unsigned width = pt->width0;
unsigned height = pt->height0;
- unsigned nblocksx = pt->nblocksx[0];
- unsigned nblocksy = pt->nblocksy[0];
+ unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0);
/* used for scanouts that need special layouts */
- if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
if (i915_scanout_layout(tex))
return;
/* for shared buffers we use some very like scanout */
- if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
if (i915_display_target_layout(tex))
return;
- tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+ tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
tex->total_nblocksy = 0;
for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_level_info(tex, level, 1, width, height, 1);
i915_miptree_set_image_offset(tex, level, 0, 0, tex->total_nblocksy);
- nblocksy = round_up(MAX2(2, nblocksy), 2);
+ nblocksy = align(MAX2(2, nblocksy), 2);
tex->total_nblocksy += nblocksy;
width = u_minify(width, 1);
height = u_minify(height, 1);
- nblocksx = pf_get_nblocksx(&pt->block, width);
- nblocksy = pf_get_nblocksy(&pt->block, height);
+ nblocksy = pf_get_nblocksy(pt->format, height);
}
}
@@ -266,13 +255,12 @@ i915_miptree_layout_3d(struct i915_texture *tex)
unsigned width = pt->width0;
unsigned height = pt->height0;
unsigned depth = pt->depth0;
- unsigned nblocksx = pt->nblocksx[0];
- unsigned nblocksy = pt->nblocksy[0];
+ unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0);
unsigned stack_nblocksy = 0;
/* Calculate the size of a single slice.
*/
- tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+ tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
/* XXX: hardware expects/requires 9 levels at minimum.
*/
@@ -283,8 +271,7 @@ i915_miptree_layout_3d(struct i915_texture *tex)
width = u_minify(width, 1);
height = u_minify(height, 1);
- nblocksx = pf_get_nblocksx(&pt->block, width);
- nblocksy = pf_get_nblocksy(&pt->block, height);
+ nblocksy = pf_get_nblocksy(pt->format, height);
}
/* Fixup depth image_offsets:
@@ -309,14 +296,14 @@ i915_miptree_layout_cube(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
unsigned width = pt->width0, height = pt->height0;
- const unsigned nblocks = pt->nblocksx[0];
+ const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0);
unsigned level;
unsigned face;
assert(width == height); /* cubemap images are square */
/* double pitch for cube layouts */
- tex->stride = round_up(nblocks * pt->block.size * 2, 4);
+ tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4);
tex->total_nblocksy = nblocks * 4;
for (level = 0; level <= pt->last_level; level++) {
@@ -379,8 +366,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
unsigned y = 0;
unsigned width = pt->width0;
unsigned height = pt->height0;
- unsigned nblocksx = pt->nblocksx[0];
- unsigned nblocksy = pt->nblocksy[0];
+ unsigned nblocksx = pf_get_nblocksx(pt->format, pt->width0);
+ unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0);
/* used for scanouts that need special layouts */
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
@@ -392,7 +379,7 @@ i945_miptree_layout_2d(struct i915_texture *tex)
if (i915_display_target_layout(tex))
return;
- tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+ tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
/* May need to adjust pitch to accomodate the placement of
* the 2nd mipmap level. This occurs when the alignment
@@ -401,11 +388,11 @@ i945_miptree_layout_2d(struct i915_texture *tex)
*/
if (pt->last_level > 0) {
unsigned mip1_nblocksx
- = align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x)
- + pf_get_nblocksx(&pt->block, u_minify(width, 2));
+ = align(pf_get_nblocksx(pt->format, u_minify(width, 1)), align_x)
+ + pf_get_nblocksx(pt->format, u_minify(width, 2));
if (mip1_nblocksx > nblocksx)
- tex->stride = mip1_nblocksx * pt->block.size;
+ tex->stride = mip1_nblocksx * pf_get_blocksize(pt->format);
}
/* Pitch must be a whole number of dwords
@@ -435,8 +422,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
width = u_minify(width, 1);
height = u_minify(height, 1);
- nblocksx = pf_get_nblocksx(&pt->block, width);
- nblocksy = pf_get_nblocksy(&pt->block, height);
+ nblocksx = pf_get_nblocksx(pt->format, width);
+ nblocksy = pf_get_nblocksy(pt->format, height);
}
}
@@ -447,17 +434,16 @@ i945_miptree_layout_3d(struct i915_texture *tex)
unsigned width = pt->width0;
unsigned height = pt->height0;
unsigned depth = pt->depth0;
- unsigned nblocksx = pt->nblocksx[0];
- unsigned nblocksy = pt->nblocksy[0];
+ unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0);
unsigned pack_x_pitch, pack_x_nr;
unsigned pack_y_pitch;
unsigned level;
- tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4);
+ tex->stride = align(pf_get_stride(pt->format, pt->width0), 4);
tex->total_nblocksy = 0;
- pack_y_pitch = MAX2(pt->nblocksy[0], 2);
- pack_x_pitch = tex->stride / pt->block.size;
+ pack_y_pitch = MAX2(nblocksy, 2);
+ pack_x_pitch = tex->stride / pf_get_blocksize(pt->format);
pack_x_nr = 1;
for (level = 0; level <= pt->last_level; level++) {
@@ -482,7 +468,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
if (pack_x_pitch > 4) {
pack_x_pitch >>= 1;
pack_x_nr <<= 1;
- assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride);
+ assert(pack_x_pitch * pack_x_nr * pf_get_blocksize(pt->format) <= tex->stride);
}
if (pack_y_pitch > 2) {
@@ -492,8 +478,7 @@ i945_miptree_layout_3d(struct i915_texture *tex)
width = u_minify(width, 1);
height = u_minify(height, 1);
depth = u_minify(depth, 1);
- nblocksx = pf_get_nblocksx(&pt->block, width);
- nblocksy = pf_get_nblocksy(&pt->block, height);
+ nblocksy = pf_get_nblocksy(pt->format, height);
}
}
@@ -503,7 +488,7 @@ i945_miptree_layout_cube(struct i915_texture *tex)
struct pipe_texture *pt = &tex->base;
unsigned level;
- const unsigned nblocks = pt->nblocksx[0];
+ const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0);
unsigned face;
unsigned width = pt->width0;
unsigned height = pt->height0;
@@ -523,9 +508,9 @@ i945_miptree_layout_cube(struct i915_texture *tex)
* or the final row of 4x4, 2x2 and 1x1 faces below this.
*/
if (nblocks > 32)
- tex->stride = round_up(nblocks * pt->block.size * 2, 4);
+ tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4);
else
- tex->stride = 14 * 8 * pt->block.size;
+ tex->stride = 14 * 8 * pf_get_blocksize(pt->format);
tex->total_nblocksy = nblocks * 4;
@@ -645,9 +630,6 @@ i915_texture_create(struct pipe_screen *screen,
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
- tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0);
- tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0);
-
if (is->is_i945) {
if (!i945_miptree_layout(tex))
goto fail;
@@ -829,14 +811,10 @@ i915_get_tex_transfer(struct pipe_screen *screen,
trans = CALLOC_STRUCT(i915_transfer);
if (trans) {
pipe_texture_reference(&trans->base.texture, texture);
- trans->base.format = trans->base.format;
trans->base.x = x;
trans->base.y = y;
trans->base.width = w;
trans->base.height = h;
- trans->base.block = texture->block;
- trans->base.nblocksx = texture->nblocksx[level];
- trans->base.nblocksy = texture->nblocksy[level];
trans->base.stride = tex->stride;
trans->offset = offset;
trans->base.usage = usage;
@@ -852,6 +830,7 @@ i915_transfer_map(struct pipe_screen *screen,
struct intel_winsys *iws = i915_screen(tex->base.screen)->iws;
char *map;
boolean write = FALSE;
+ enum pipe_format format = tex->base.format;
if (transfer->usage & PIPE_TRANSFER_WRITE)
write = TRUE;
@@ -861,8 +840,8 @@ i915_transfer_map(struct pipe_screen *screen,
return NULL;
return map + i915_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
}
static void
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index 4509c7b1e5c..bedab56f59e 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -742,7 +742,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
id_pipe->base.set_scissor_state = identity_set_scissor_state;
id_pipe->base.set_viewport_state = identity_set_viewport_state;
- id_pipe->base.set_fragment_sampler_textures = identity_set_vertex_sampler_textures;
+ id_pipe->base.set_fragment_sampler_textures = identity_set_fragment_sampler_textures;
id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures;
id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
id_pipe->base.set_vertex_elements = identity_set_vertex_elements;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
index 9c59677a741..eea6b5d6a5c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
@@ -629,7 +629,8 @@ lp_build_abs(struct lp_build_context *bld,
if(type.floating) {
/* Mask out the sign bit */
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long)1 << type.width) - 1);
+ unsigned long absMask = ~(1 << (type.width - 1));
+ LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long) absMask));
a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
a = LLVMBuildAnd(bld->builder, a, mask, "");
a = LLVMBuildBitCast(bld->builder, a, vec_type, "");
@@ -1083,7 +1084,7 @@ lp_build_log(struct lp_build_context *bld,
LLVMValueRef x)
{
/* log(2) */
- LLVMValueRef log2 = lp_build_const_scalar(bld->type, 1.4426950408889634);
+ LLVMValueRef log2 = lp_build_const_scalar(bld->type, 0.69314718055994529);
return lp_build_mul(bld, log2, lp_build_exp2(bld, x));
}
@@ -1095,7 +1096,7 @@ lp_build_log(struct lp_build_context *bld,
/**
* Generate polynomial.
- * Ex: x^2 * coeffs[0] + x * coeffs[1] + coeffs[2].
+ * Ex: coeffs[0] + x * coeffs[1] + x^2 * coeffs[2].
*/
static LLVMValueRef
lp_build_polynomial(struct lp_build_context *bld,
@@ -1285,13 +1286,13 @@ lp_build_log2_approx(struct lp_build_context *bld,
/* mant = (float) mantissa(x) */
mant = LLVMBuildAnd(bld->builder, i, mantmask, "");
mant = LLVMBuildOr(bld->builder, mant, one, "");
- mant = LLVMBuildSIToFP(bld->builder, mant, vec_type, "");
+ mant = LLVMBuildBitCast(bld->builder, mant, vec_type, "");
logmant = lp_build_polynomial(bld, mant, lp_build_log2_polynomial,
Elements(lp_build_log2_polynomial));
/* This effectively increases the polynomial degree by one, but ensures that log2(1) == 0*/
- logmant = LLVMBuildMul(bld->builder, logmant, LLVMBuildMul(bld->builder, mant, bld->one, ""), "");
+ logmant = LLVMBuildMul(bld->builder, logmant, LLVMBuildSub(bld->builder, mant, bld->one, ""), "");
res = LLVMBuildAdd(bld->builder, logmant, logexp, "");
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_debug.c b/src/gallium/drivers/llvmpipe/lp_bld_debug.c
index 59d8f492e60..39dfc51e503 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_debug.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_debug.c
@@ -77,10 +77,10 @@ lp_disassemble(const void* func)
while (ud_disassemble(&ud_obj)) {
#ifdef PIPE_ARCH_X86
- debug_printf("%08lx: ", (unsigned long)ud_insn_off(&ud_obj));
+ debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj));
#endif
#ifdef PIPE_ARCH_X86_64
- debug_printf("%016llx: ", (unsigned long long)ud_insn_off(&ud_obj));
+ debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj));
#endif
#if 0
@@ -115,9 +115,16 @@ lp_disassemble(const void* func)
}
}
- if (ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret)
+ if ((ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) ||
+ ud_obj.mnemonic == UD_Iinvalid)
break;
}
+
+#if 0
+ /* Print GDB command, useful to verify udis86 output */
+ debug_printf("disassemble %p %p\n", func, (void*)(uintptr_t)ud_obj.pc);
+#endif
+
debug_printf("\n");
#else
(void)func;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
index fe2db04d8fa..a67c70ff25a 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
@@ -560,9 +560,9 @@ emit_instruction(
if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) {
- LLVMValueRef *p_floor_log2;
- LLVMValueRef *p_exp;
- LLVMValueRef *p_log2;
+ LLVMValueRef *p_floor_log2 = NULL;
+ LLVMValueRef *p_exp = NULL;
+ LLVMValueRef *p_log2 = NULL;
src0 = emit_fetch( bld, inst, 0, CHAN_X );
src0 = lp_build_abs( &bld->base, src0 );
@@ -763,7 +763,7 @@ emit_instruction(
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
src0 = emit_fetch( bld, inst, 0, chan_index );
tmp0 = lp_build_floor(&bld->base, src0);
- tmp0 = lp_build_sub(&bld->base, tmp0, src0);
+ tmp0 = lp_build_sub(&bld->base, src0, tmp0);
dst0[chan_index] = tmp0;
}
break;
diff --git a/src/gallium/drivers/llvmpipe/lp_clear.c b/src/gallium/drivers/llvmpipe/lp_clear.c
index bdcff94b9bf..08d9f2e2735 100644
--- a/src/gallium/drivers/llvmpipe/lp_clear.c
+++ b/src/gallium/drivers/llvmpipe/lp_clear.c
@@ -50,6 +50,7 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
double depth, unsigned stencil)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
+ union util_color uc;
unsigned cv;
uint i;
@@ -64,8 +65,8 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
struct pipe_surface *ps = llvmpipe->framebuffer.cbufs[i];
- util_pack_color(rgba, ps->format, &cv);
- lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, cv);
+ util_pack_color(rgba, ps->format, &uc);
+ lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, uc.ui);
}
llvmpipe->dirty_render_cache = TRUE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index c081f6de036..679e2442743 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -118,6 +118,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
pipe_texture_reference(&llvmpipe->texture[i], NULL);
}
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
+ lp_destroy_tex_tile_cache(llvmpipe->vertex_tex_cache[i]);
+ pipe_texture_reference(&llvmpipe->vertex_textures[i], NULL);
+ }
+
for (i = 0; i < Elements(llvmpipe->constants); i++) {
if (llvmpipe->constants[i].buffer) {
pipe_buffer_reference(&llvmpipe->constants[i].buffer, NULL);
@@ -145,6 +150,11 @@ llvmpipe_is_texture_referenced( struct pipe_context *pipe,
llvmpipe->framebuffer.zsbuf->texture == texture)
return PIPE_REFERENCED_FOR_WRITE;
}
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
+ if (llvmpipe->vertex_tex_cache[i] &&
+ llvmpipe->vertex_tex_cache[i]->texture == texture)
+ return PIPE_REFERENCED_FOR_READ;
+ }
return PIPE_UNREFERENCED;
}
@@ -181,6 +191,7 @@ llvmpipe_create( struct pipe_screen *screen )
llvmpipe->pipe.create_sampler_state = llvmpipe_create_sampler_state;
llvmpipe->pipe.bind_fragment_sampler_states = llvmpipe_bind_sampler_states;
+ llvmpipe->pipe.bind_vertex_sampler_states = llvmpipe_bind_vertex_sampler_states;
llvmpipe->pipe.delete_sampler_state = llvmpipe_delete_sampler_state;
llvmpipe->pipe.create_depth_stencil_alpha_state = llvmpipe_create_depth_stencil_state;
@@ -206,6 +217,7 @@ llvmpipe_create( struct pipe_screen *screen )
llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple;
llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state;
llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures;
+ llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures;
llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state;
llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers;
@@ -234,13 +246,15 @@ llvmpipe_create( struct pipe_screen *screen )
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
llvmpipe->tex_cache[i] = lp_create_tex_tile_cache( screen );
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++)
+ llvmpipe->vertex_tex_cache[i] = lp_create_tex_tile_cache(screen);
/* vertex shader samplers */
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples;
llvmpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX;
- llvmpipe->tgsi.vert_samplers[i].cache = llvmpipe->tex_cache[i];
+ llvmpipe->tgsi.vert_samplers[i].cache = llvmpipe->vertex_tex_cache[i];
llvmpipe->tgsi.vert_samplers_list[i] = &llvmpipe->tgsi.vert_samplers[i];
}
@@ -260,7 +274,7 @@ llvmpipe_create( struct pipe_screen *screen )
goto fail;
draw_texture_samplers(llvmpipe->draw,
- PIPE_MAX_SAMPLERS,
+ PIPE_MAX_VERTEX_SAMPLERS,
(struct tgsi_sampler **)
llvmpipe->tgsi.vert_samplers_list);
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index 3ad95d0bfc2..cc4d5ad5fd9 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -55,6 +55,7 @@ struct llvmpipe_context {
/** Constant state objects */
const struct pipe_blend_state *blend;
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
const struct pipe_depth_stencil_alpha_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
struct lp_fragment_shader *fs;
@@ -68,12 +69,15 @@ struct llvmpipe_context {
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
unsigned num_samplers;
unsigned num_textures;
+ unsigned num_vertex_samplers;
+ unsigned num_vertex_textures;
unsigned num_vertex_elements;
unsigned num_vertex_buffers;
@@ -136,6 +140,7 @@ struct llvmpipe_context {
unsigned tex_timestamp;
struct llvmpipe_tex_tile_cache *tex_cache[PIPE_MAX_SAMPLERS];
+ struct llvmpipe_tex_tile_cache *vertex_tex_cache[PIPE_MAX_VERTEX_SAMPLERS];
unsigned no_rast : 1;
diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h b/src/gallium/drivers/llvmpipe/lp_debug.h
new file mode 100644
index 00000000000..74b27574942
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -0,0 +1,71 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#ifndef LP_DEBUG_H
+#define LP_DEBUG_H
+
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+
+extern void
+st_print_current(void);
+
+
+#define DEBUG_PIPE 0x1
+#define DEBUG_TGSI 0x2
+#define DEBUG_TEX 0x4
+#define DEBUG_ASM 0x8
+#define DEBUG_SETUP 0x10
+#define DEBUG_RAST 0x20
+#define DEBUG_QUERY 0x40
+#define DEBUG_SCREEN 0x80
+#define DEBUG_JIT 0x100
+
+#ifdef DEBUG
+extern int LP_DEBUG;
+#else
+#define LP_DEBUG 0
+#endif
+
+void st_debug_init( void );
+
+static INLINE void
+LP_DBG( unsigned flag, const char *fmt, ... )
+{
+ if (LP_DEBUG & flag)
+ {
+ va_list args;
+
+ va_start( args, fmt );
+ debug_vprintf( fmt, args );
+ va_end( args );
+ }
+}
+
+
+#endif /* LP_DEBUG_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index a6ecaa0b2be..9b47415f003 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -36,6 +36,24 @@
#include "lp_winsys.h"
#include "lp_jit.h"
#include "lp_screen.h"
+#include "lp_debug.h"
+
+#ifdef DEBUG
+int LP_DEBUG = 0;
+
+static const struct debug_named_value lp_debug_flags[] = {
+ { "pipe", DEBUG_PIPE },
+ { "tgsi", DEBUG_TGSI },
+ { "tex", DEBUG_TEX },
+ { "asm", DEBUG_ASM },
+ { "setup", DEBUG_SETUP },
+ { "rast", DEBUG_RAST },
+ { "query", DEBUG_QUERY },
+ { "screen", DEBUG_SCREEN },
+ { "jit", DEBUG_JIT },
+ {NULL, 0}
+};
+#endif
static const char *
@@ -59,7 +77,9 @@ llvmpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return PIPE_MAX_SAMPLERS;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- return 0;
+ return PIPE_MAX_VERTEX_SAMPLERS;
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS;
case PIPE_CAP_NPOT_TEXTURES:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
@@ -257,6 +277,10 @@ llvmpipe_create_screen(struct llvmpipe_winsys *winsys)
{
struct llvmpipe_screen *screen = CALLOC_STRUCT(llvmpipe_screen);
+#ifdef DEBUG
+ LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
+#endif
+
if (!screen)
return NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index ffcbc9a379f..b4aabd4d7cc 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -166,7 +166,7 @@ shade_quads(struct llvmpipe_context *llvmpipe,
assert((y % 2) == 0);
depth = llvmpipe->zsbuf_map +
y*llvmpipe->zsbuf_transfer->stride +
- 2*x*llvmpipe->zsbuf_transfer->block.size;
+ 2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
}
else
depth = NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h
index 7b26ce61a38..d1c74ab07b5 100644
--- a/src/gallium/drivers/llvmpipe/lp_state.h
+++ b/src/gallium/drivers/llvmpipe/lp_state.h
@@ -126,6 +126,10 @@ void *
llvmpipe_create_sampler_state(struct pipe_context *,
const struct pipe_sampler_state *);
void llvmpipe_bind_sampler_states(struct pipe_context *, unsigned, void **);
+void
+llvmpipe_bind_vertex_sampler_states(struct pipe_context *,
+ unsigned num_samplers,
+ void **samplers);
void llvmpipe_delete_sampler_state(struct pipe_context *, void *);
void *
@@ -172,6 +176,11 @@ void llvmpipe_set_sampler_textures( struct pipe_context *,
unsigned num,
struct pipe_texture ** );
+void
+llvmpipe_set_vertex_sampler_textures(struct pipe_context *,
+ unsigned num_textures,
+ struct pipe_texture **);
+
void llvmpipe_set_viewport_state( struct pipe_context *,
const struct pipe_viewport_state * );
diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index c753b183c0c..e703964aaa8 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c
@@ -198,10 +198,14 @@ update_tgsi_samplers( struct llvmpipe_context *llvmpipe )
unsigned i;
/* vertex shader samplers */
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- llvmpipe->tgsi.vert_samplers[i].sampler = llvmpipe->sampler[i];
- llvmpipe->tgsi.vert_samplers[i].texture = llvmpipe->texture[i];
- llvmpipe->tgsi.frag_samplers[i].base.get_samples = lp_get_samples;
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
+ llvmpipe->tgsi.vert_samplers[i].sampler = llvmpipe->vertex_samplers[i];
+ llvmpipe->tgsi.vert_samplers[i].texture = llvmpipe->vertex_textures[i];
+ llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples;
+ }
+
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
+ lp_tex_tile_cache_validate_texture( llvmpipe->vertex_tex_cache[i] );
}
/* fragment shader samplers */
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index ee0f69b2af9..22683ff8b42 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -87,6 +87,7 @@
#include "lp_state.h"
#include "lp_quad.h"
#include "lp_tex_sample.h"
+#include "lp_debug.h"
static const unsigned char quad_offset_x[4] = {0, 1, 0, 1};
@@ -408,59 +409,58 @@ generate_fragment(struct llvmpipe_context *lp,
unsigned i;
unsigned chan;
-#ifdef DEBUG
- tgsi_dump(shader->base.tokens, 0);
- if(key->depth.enabled) {
- debug_printf("depth.format = %s\n", pf_name(key->zsbuf_format));
- debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE));
- debug_printf("depth.writemask = %u\n", key->depth.writemask);
- }
- if(key->alpha.enabled) {
- debug_printf("alpha.func = %s\n", debug_dump_func(key->alpha.func, TRUE));
- debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value);
- }
- if(key->blend.logicop_enable) {
- debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func);
- }
- else if(key->blend.blend_enable) {
- debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rgb_func, TRUE));
- debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE));
- debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE));
- debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.alpha_func, TRUE));
- debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE));
- debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE));
- }
- debug_printf("blend.colormask = 0x%x\n", key->blend.colormask);
- for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
- if(key->sampler[i].format) {
- debug_printf("sampler[%u] = \n", i);
- debug_printf(" .format = %s\n",
- pf_name(key->sampler[i].format));
- debug_printf(" .target = %s\n",
- debug_dump_tex_target(key->sampler[i].target, TRUE));
- debug_printf(" .pot = %u %u %u\n",
- key->sampler[i].pot_width,
- key->sampler[i].pot_height,
- key->sampler[i].pot_depth);
- debug_printf(" .wrap = %s %s %s\n",
- debug_dump_tex_wrap(key->sampler[i].wrap_s, TRUE),
- debug_dump_tex_wrap(key->sampler[i].wrap_t, TRUE),
- debug_dump_tex_wrap(key->sampler[i].wrap_r, TRUE));
- debug_printf(" .min_img_filter = %s\n",
- debug_dump_tex_filter(key->sampler[i].min_img_filter, TRUE));
- debug_printf(" .min_mip_filter = %s\n",
- debug_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE));
- debug_printf(" .mag_img_filter = %s\n",
- debug_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE));
- if(key->sampler[i].compare_mode)
- debug_printf(" .compare_mode = %s\n", debug_dump_func(key->sampler[i].compare_func, TRUE));
- debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords);
- debug_printf(" .prefilter = %u\n", key->sampler[i].prefilter);
+ if (LP_DEBUG & DEBUG_JIT) {
+ tgsi_dump(shader->base.tokens, 0);
+ if(key->depth.enabled) {
+ debug_printf("depth.format = %s\n", pf_name(key->zsbuf_format));
+ debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE));
+ debug_printf("depth.writemask = %u\n", key->depth.writemask);
+ }
+ if(key->alpha.enabled) {
+ debug_printf("alpha.func = %s\n", debug_dump_func(key->alpha.func, TRUE));
+ debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value);
+ }
+ if(key->blend.logicop_enable) {
+ debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func);
+ }
+ else if(key->blend.blend_enable) {
+ debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rgb_func, TRUE));
+ debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE));
+ debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE));
+ debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.alpha_func, TRUE));
+ debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE));
+ debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE));
+ }
+ debug_printf("blend.colormask = 0x%x\n", key->blend.colormask);
+ for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
+ if(key->sampler[i].format) {
+ debug_printf("sampler[%u] = \n", i);
+ debug_printf(" .format = %s\n",
+ pf_name(key->sampler[i].format));
+ debug_printf(" .target = %s\n",
+ debug_dump_tex_target(key->sampler[i].target, TRUE));
+ debug_printf(" .pot = %u %u %u\n",
+ key->sampler[i].pot_width,
+ key->sampler[i].pot_height,
+ key->sampler[i].pot_depth);
+ debug_printf(" .wrap = %s %s %s\n",
+ debug_dump_tex_wrap(key->sampler[i].wrap_s, TRUE),
+ debug_dump_tex_wrap(key->sampler[i].wrap_t, TRUE),
+ debug_dump_tex_wrap(key->sampler[i].wrap_r, TRUE));
+ debug_printf(" .min_img_filter = %s\n",
+ debug_dump_tex_filter(key->sampler[i].min_img_filter, TRUE));
+ debug_printf(" .min_mip_filter = %s\n",
+ debug_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE));
+ debug_printf(" .mag_img_filter = %s\n",
+ debug_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE));
+ if(key->sampler[i].compare_mode)
+ debug_printf(" .compare_mode = %s\n", debug_dump_func(key->sampler[i].compare_func, TRUE));
+ debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords);
+ debug_printf(" .prefilter = %u\n", key->sampler[i].prefilter);
+ }
}
}
-#endif
-
variant = CALLOC_STRUCT(lp_fragment_shader_variant);
if(!variant)
return NULL;
@@ -599,8 +599,8 @@ generate_fragment(struct llvmpipe_context *lp,
}
lp_build_conv_mask(builder, fs_type, blend_type,
- fs_mask, num_fs,
- &blend_mask, 1);
+ fs_mask, num_fs,
+ &blend_mask, 1);
/*
* Blending.
@@ -631,16 +631,15 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMRunFunctionPassManager(screen->pass, variant->function);
-#ifdef DEBUG
- LLVMDumpValue(variant->function);
- debug_printf("\n");
-#endif
+ if (LP_DEBUG & DEBUG_JIT) {
+ LLVMDumpValue(variant->function);
+ debug_printf("\n");
+ }
variant->jit_function = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, variant->function);
-#ifdef DEBUG
- lp_disassemble(variant->jit_function);
-#endif
+ if (LP_DEBUG & DEBUG_ASM)
+ lp_disassemble(variant->jit_function);
variant->next = shader->variants;
shader->variants = variant;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 8333805a3fd..d382f9ca87e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -78,6 +78,34 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe,
void
+llvmpipe_bind_vertex_sampler_states(struct pipe_context *pipe,
+ unsigned num_samplers,
+ void **samplers)
+{
+ struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
+ unsigned i;
+
+ assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS);
+
+ /* Check for no-op */
+ if (num_samplers == llvmpipe->num_vertex_samplers &&
+ !memcmp(llvmpipe->vertex_samplers, samplers, num_samplers * sizeof(void *)))
+ return;
+
+ draw_flush(llvmpipe->draw);
+
+ for (i = 0; i < num_samplers; ++i)
+ llvmpipe->vertex_samplers[i] = samplers[i];
+ for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
+ llvmpipe->vertex_samplers[i] = NULL;
+
+ llvmpipe->num_vertex_samplers = num_samplers;
+
+ llvmpipe->dirty |= LP_NEW_SAMPLER;
+}
+
+
+void
llvmpipe_set_sampler_textures(struct pipe_context *pipe,
unsigned num, struct pipe_texture **texture)
{
@@ -117,6 +145,37 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe,
void
+llvmpipe_set_vertex_sampler_textures(struct pipe_context *pipe,
+ unsigned num_textures,
+ struct pipe_texture **textures)
+{
+ struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
+ uint i;
+
+ assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS);
+
+ /* Check for no-op */
+ if (num_textures == llvmpipe->num_vertex_textures &&
+ !memcmp(llvmpipe->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) {
+ return;
+ }
+
+ draw_flush(llvmpipe->draw);
+
+ for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
+ struct pipe_texture *tex = i < num_textures ? textures[i] : NULL;
+
+ pipe_texture_reference(&llvmpipe->vertex_textures[i], tex);
+ lp_tex_tile_cache_set_texture(llvmpipe->vertex_tex_cache[i], tex);
+ }
+
+ llvmpipe->num_vertex_textures = num_textures;
+
+ llvmpipe->dirty |= LP_NEW_TEXTURE;
+}
+
+
+void
llvmpipe_delete_sampler_state(struct pipe_context *pipe,
void *sampler)
{
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
index c7c4143bc62..a6d9a2c1acf 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
@@ -155,7 +155,6 @@ lp_tex_tile_cache_validate_texture(struct llvmpipe_tex_tile_cache *tc)
if (lpt->timestamp != tc->timestamp) {
/* texture was modified, invalidate all cached tiles */
uint i;
- debug_printf("INV %d %d\n", tc->timestamp, lpt->timestamp);
for (i = 0; i < NUM_ENTRIES; i++) {
tc->entries[i].addr.bits.invalid = 1;
}
@@ -291,7 +290,7 @@ lp_find_cached_tex_tile(struct llvmpipe_tex_tile_cache *tc,
assert(0);
}
- util_format_read_4ub(tc->tex_trans->format,
+ util_format_read_4ub(tc->tex_trans->texture->format,
(uint8_t *)tile->color, sizeof tile->color[0],
tc->tex_trans_map, tc->tex_trans->stride,
x, y, w, h);
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 9b19cac9729..9e41bc40745 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -50,7 +50,6 @@
/* Simple, maximally packed layout.
*/
-
/* Conventional allocation path for non-display textures:
*/
static boolean
@@ -65,20 +64,15 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
unsigned buffer_size = 0;
- util_format_get_block(lpt->base.format, &lpt->base.block);
-
for (level = 0; level <= pt->last_level; level++) {
unsigned nblocksx, nblocksy;
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
-
/* Allocate storage for whole quads. This is particularly important
* for depth surfaces, which are currently stored in a swizzled format. */
- nblocksx = pf_get_nblocksx(&pt->block, align(width, 2));
- nblocksy = pf_get_nblocksy(&pt->block, align(height, 2));
+ nblocksx = pf_get_nblocksx(pt->format, align(width, 2));
+ nblocksy = pf_get_nblocksy(pt->format, align(height, 2));
- lpt->stride[level] = align(nblocksx*pt->block.size, 16);
+ lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16);
lpt->level_offset[level] = buffer_size;
@@ -102,10 +96,6 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
{
struct llvmpipe_winsys *winsys = screen->winsys;
- util_format_get_block(lpt->base.format, &lpt->base.block);
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
-
lpt->dt = winsys->displaytarget_create(winsys,
lpt->base.format,
lpt->base.width0,
@@ -182,8 +172,6 @@ llvmpipe_texture_blanket(struct pipe_screen * screen,
lpt->base = *base;
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = screen;
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
lpt->stride[0] = stride[0];
pipe_buffer_reference(&lpt->buffer, buffer);
@@ -257,11 +245,17 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
ps->level = level;
ps->zslice = zslice;
+ /* XXX shouldn't that rather be
+ tex_height = align(ps->height, 2);
+ to account for alignment done in llvmpipe_texture_layout ?
+ */
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset += face * pt->nblocksy[level] * lpt->stride[level];
+ unsigned tex_height = ps->height;
+ ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset += zslice * pt->nblocksy[level] * lpt->stride[level];
+ unsigned tex_height = ps->height;
+ ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else {
assert(face == 0);
@@ -302,14 +296,10 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
if (lpt) {
struct pipe_transfer *pt = &lpt->base;
pipe_texture_reference(&pt->texture, texture);
- pt->format = texture->format;
- pt->block = texture->block;
pt->x = x;
pt->y = y;
pt->width = w;
pt->height = h;
- pt->nblocksx = texture->nblocksx[level];
- pt->nblocksy = texture->nblocksy[level];
pt->stride = lptex->stride[level];
pt->usage = usage;
pt->face = face;
@@ -318,11 +308,17 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
lpt->offset = lptex->level_offset[level];
+ /* XXX shouldn't that rather be
+ tex_height = align(u_minify(texture->height0, level), 2)
+ to account for alignment done in llvmpipe_texture_layout ?
+ */
if (texture->target == PIPE_TEXTURE_CUBE) {
- lpt->offset += face * pt->nblocksy * pt->stride;
+ unsigned tex_height = u_minify(texture->height0, level);
+ lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
- lpt->offset += zslice * pt->nblocksy * pt->stride;
+ unsigned tex_height = u_minify(texture->height0, level);
+ lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else {
assert(face == 0);
@@ -354,9 +350,11 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
ubyte *map, *xfer_map;
struct llvmpipe_texture *lpt;
+ enum pipe_format format;
assert(transfer->texture);
lpt = llvmpipe_texture(transfer->texture);
+ format = lpt->base.format;
if(lpt->dt) {
struct llvmpipe_winsys *winsys = screen->winsys;
@@ -381,8 +379,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
}
xfer_map = map + llvmpipe_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
return xfer_map;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
index ec3e002d628..7a1ecf5107b 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
@@ -252,13 +252,13 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc)
case LP_TILE_STATUS_CLEAR:
/* Actually clear the tiles which were flagged as being in a
* clear state. */
- util_fill_rect(tc->transfer_map, &pt->block, pt->stride,
+ util_fill_rect(tc->transfer_map, pt->texture->format, pt->stride,
x, y, w, h,
tc->clear_val);
break;
case LP_TILE_STATUS_DEFINED:
- lp_tile_write_4ub(pt->format,
+ lp_tile_write_4ub(pt->texture->format,
tile->color,
tc->transfer_map, pt->stride,
x, y, w, h);
@@ -291,6 +291,11 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc,
assert(tc->surface);
assert(tc->transfer);
+ if(!tc->transfer_map)
+ lp_tile_cache_map_transfers(tc);
+
+ assert(tc->transfer_map);
+
switch(tile->status) {
case LP_TILE_STATUS_CLEAR:
/* don't get tile from framebuffer, just clear it */
@@ -306,7 +311,7 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc,
y &= ~(TILE_SIZE - 1);
if (!pipe_clip_tile(x, y, &w, &h, tc->transfer))
- lp_tile_read_4ub(pt->format,
+ lp_tile_read_4ub(pt->texture->format,
tile->color,
tc->transfer_map, tc->transfer->stride,
x, y, w, h);
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index b595405357f..9aee9e49566 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -48,13 +48,14 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
struct nouveau_stateobj *so = *pso;
int i;
- if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
+ if (pipe_reference(&(*pso)->reference, &ref->reference)) {
free(so->push);
for (i = 0; i < so->cur_reloc; i++)
nouveau_bo_ref(NULL, &so->reloc[i].bo);
free(so->reloc);
free(so);
}
+ *pso = ref;
}
static INLINE void
@@ -111,20 +112,30 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)
{
struct nouveau_pushbuf *pb = chan->pushbuf;
unsigned nr, i;
+ int ret = 0;
nr = so->cur - so->push;
- if (pb->remaining < nr)
- nouveau_pushbuf_flush(chan, nr);
+ /* This will flush if we need space.
+ * We don't actually need the marker.
+ */
+ if ((ret = nouveau_pushbuf_marker_emit(chan, nr, so->cur_reloc))) {
+ debug_printf("so_emit failed marker emit with error %d\n", ret);
+ return;
+ }
pb->remaining -= nr;
memcpy(pb->cur, so->push, nr * 4);
for (i = 0; i < so->cur_reloc; i++) {
struct nouveau_stateobj_reloc *r = &so->reloc[i];
- nouveau_pushbuf_emit_reloc(chan, pb->cur + r->offset,
+ if ((ret = nouveau_pushbuf_emit_reloc(chan, pb->cur + r->offset,
r->bo, r->data, 0, r->flags,
- r->vor, r->tor);
+ r->vor, r->tor))) {
+ debug_printf("so_emit failed reloc with error %d\n", ret);
+ goto out;
+ }
}
+out:
pb->cur += nr;
}
@@ -133,26 +144,45 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)
{
struct nouveau_pushbuf *pb = chan->pushbuf;
unsigned i;
+ int ret = 0;
if (!so)
return;
i = so->cur_reloc << 1;
- if (pb->remaining < i)
- nouveau_pushbuf_flush(chan, i);
+ /* This will flush if we need space.
+ * We don't actually need the marker.
+ */
+ if ((ret = nouveau_pushbuf_marker_emit(chan, i, i))) {
+ debug_printf("so_emit_reloc_markers failed marker emit with" \
+ "error %d\n", ret);
+ return;
+ }
pb->remaining -= i;
for (i = 0; i < so->cur_reloc; i++) {
struct nouveau_stateobj_reloc *r = &so->reloc[i];
- nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->packet, 0,
+ if ((ret = nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo,
+ r->packet, 0,
(r->flags & (NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART |
NOUVEAU_BO_RDWR)) |
- NOUVEAU_BO_DUMMY, 0, 0);
- nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->data, 0,
+ NOUVEAU_BO_DUMMY, 0, 0))) {
+ debug_printf("so_emit_reloc_markers failed reloc" \
+ "with error %d\n", ret);
+ pb->remaining += ((so->cur_reloc - i) << 1);
+ return;
+ }
+ if ((ret = nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo,
+ r->data, 0,
r->flags | NOUVEAU_BO_DUMMY,
- r->vor, r->tor);
+ r->vor, r->tor))) {
+ debug_printf("so_emit_reloc_markers failed reloc" \
+ "with error %d\n", ret);
+ pb->remaining += ((so->cur_reloc - i) << 1) - 1;
+ return;
+ }
}
}
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 4fd72c82e62..e0a6948aeb4 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -10,28 +10,21 @@ static void
nv04_miptree_layout(struct nv04_miptree *nv04mt)
{
struct pipe_texture *pt = &nv04mt->base;
- uint width = pt->width0, height = pt->height0;
uint offset = 0;
int nr_faces, l;
nr_faces = 1;
for (l = 0; l <= pt->last_level; l++) {
-
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
-
nv04mt->level[l].pitch = pt->width0;
nv04mt->level[l].pitch = (nv04mt->level[l].pitch + 63) & ~63;
-
- width = u_minify(width, 1);
- height = u_minify(height, 1);
}
for (l = 0; l <= pt->last_level; l++) {
-
nv04mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
+ /* XXX guess was obviously missing */
+ nv04mt->level[l].image_offset[0] = offset;
offset += nv04mt->level[l].pitch * u_minify(pt->height0, l);
}
@@ -62,7 +55,7 @@ nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
FREE(mt);
return NULL;
}
-
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -88,6 +81,7 @@ nv04_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
pipe_buffer_reference(&mt->buffer, pb);
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -128,7 +122,7 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.zslice = zslice;
ns->pitch = nv04mt->level[level].pitch;
- ns->base.offset = nv04mt->level[level].image_offset;
+ ns->base.offset = nv04mt->level[level].image_offset[0];
return &ns->base;
}
diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h
index 399f750dbe7..81d1d2ebaa9 100644
--- a/src/gallium/drivers/nv04/nv04_state.h
+++ b/src/gallium/drivers/nv04/nv04_state.h
@@ -31,6 +31,7 @@ struct nv04_rasterizer_state {
struct nv04_miptree {
struct pipe_texture base;
+ struct nouveau_bo *bo;
struct pipe_buffer *buffer;
uint total_size;
diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c
index 8be134b83dd..3020806c5d6 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -133,6 +133,9 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
assert(sub_w == w || util_is_pot(sub_w));
assert(sub_h == h || util_is_pot(sub_h));
+ MARK_RING (chan, 8 + ((w+sub_w)/sub_w)*((h+sub_h)/sub_h)*17, 2 +
+ ((w+sub_w)/sub_w)*((h+sub_h)/sub_h)*2);
+
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1);
OUT_RELOCo(chan, dst_bo,
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -155,10 +158,10 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
sub_w = MIN2(sub_w, w - x);
/* Must be 64-byte aligned */
- assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size) & 63));
+ assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format)) & 63));
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1);
- OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size,
+ OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format),
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
@@ -177,7 +180,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
OUT_RING (chan, src_pitch |
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
- OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * src->texture->block.size,
+ OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * pf_get_blocksize(src->texture->format),
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RING (chan, 0);
}
@@ -198,11 +201,11 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
unsigned dst_offset = dst->offset + dy * dst_pitch +
- dx * dst->texture->block.size;
+ dx * pf_get_blocksize(dst->texture->format);
unsigned src_offset = src->offset + sy * src_pitch +
- sx * src->texture->block.size;
+ sx * pf_get_blocksize(src->texture->format);
- WAIT_RING (chan, 3 + ((h / 2047) + 1) * 9);
+ MARK_RING (chan, 3 + ((h / 2047) + 1) * 9, 2 + ((h / 2047) + 1) * 2);
BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2);
OUT_RELOCo(chan, src_bo,
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
@@ -219,7 +222,7 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR);
OUT_RING (chan, src_pitch);
OUT_RING (chan, dst_pitch);
- OUT_RING (chan, w * src->texture->block.size);
+ OUT_RING (chan, w * pf_get_blocksize(src->texture->format));
OUT_RING (chan, count);
OUT_RING (chan, 0x0101);
OUT_RING (chan, 0);
@@ -250,7 +253,7 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
if (format < 0)
return 1;
- WAIT_RING (chan, 12);
+ MARK_RING (chan, 12, 4);
BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2);
OUT_RELOCo(chan, src_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -315,7 +318,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
gdirect_format = nv04_rect_format(dst->format);
assert(gdirect_format >= 0);
- WAIT_RING (chan, 16);
+ MARK_RING (chan, 16, 4);
BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE, 2);
OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c
index e6456429f4e..d66d6c6346c 100644
--- a/src/gallium/drivers/nv04/nv04_transfer.c
+++ b/src/gallium/drivers/nv04/nv04_transfer.c
@@ -11,7 +11,7 @@
struct nv04_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
- bool direct;
+ boolean direct;
};
static void
@@ -24,9 +24,6 @@ nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
template->width0 = u_minify(pt->width0, level);
template->height0 = u_minify(pt->height0, level);
template->depth0 = 1;
- template->block = pt->block;
- template->nblocksx[0] = pt->nblocksx[level];
- template->nblocksy[0] = pt->nblocksx[level];
template->last_level = 0;
template->nr_samples = pt->nr_samples;
@@ -49,14 +46,10 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
tx->base.x = x;
tx->base.y = y;
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
tx->base.stride = mt->level[level].pitch;
tx->base.usage = usage;
tx->base.face = face;
@@ -158,7 +151,7 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));
return map + ns->base.offset +
- ptx->y * ns->pitch + ptx->x * ptx->block.size;
+ ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
}
static void
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index b2a6c59b749..6a52b6af362 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -11,7 +11,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
{
struct pipe_texture *pt = &nv10mt->base;
boolean swizzled = FALSE;
- uint width = pt->width0, height = pt->height0;
+ uint width = pt->width0;
uint offset = 0;
int nr_faces, l, f;
@@ -22,21 +22,16 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
}
for (l = 0; l <= pt->last_level; l++) {
-
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
-
if (swizzled)
- nv10mt->level[l].pitch = pt->nblocksx[l] * pt->block.size;
+ nv10mt->level[l].pitch = pf_get_stride(pt->format, width);
else
- nv10mt->level[l].pitch = pt->nblocksx[0] * pt->block.size;
+ nv10mt->level[l].pitch = pf_get_stride(pt->format, pt->width0);
nv10mt->level[l].pitch = (nv10mt->level[l].pitch + 63) & ~63;
nv10mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = u_minify(width, 1);
- height = u_minify(height, 1);
}
@@ -72,6 +67,7 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
pipe_buffer_reference(&mt->buffer, pb);
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -95,6 +91,7 @@ nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
FREE(mt);
return NULL;
}
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
diff --git a/src/gallium/drivers/nv10/nv10_state.h b/src/gallium/drivers/nv10/nv10_state.h
index 3a3fd0d4f4f..2524ac02e29 100644
--- a/src/gallium/drivers/nv10/nv10_state.h
+++ b/src/gallium/drivers/nv10/nv10_state.h
@@ -126,6 +126,7 @@ struct nv10_depth_stencil_alpha_state {
struct nv10_miptree {
struct pipe_texture base;
+ struct nouveau_bo *bo;
struct pipe_buffer *buffer;
uint total_size;
diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c
index ec54297ab01..06bb5134173 100644
--- a/src/gallium/drivers/nv10/nv10_transfer.c
+++ b/src/gallium/drivers/nv10/nv10_transfer.c
@@ -11,7 +11,7 @@
struct nv10_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
- bool direct;
+ boolean direct;
};
static void
@@ -24,9 +24,6 @@ nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
template->width0 = u_minify(pt->width0, level);
template->height0 = u_minify(pt->height0, level);
template->depth0 = 1;
- template->block = pt->block;
- template->nblocksx[0] = pt->nblocksx[level];
- template->nblocksy[0] = pt->nblocksx[level];
template->last_level = 0;
template->nr_samples = pt->nr_samples;
@@ -49,14 +46,10 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
tx->base.x = x;
tx->base.y = y;
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
tx->base.stride = mt->level[level].pitch;
tx->base.usage = usage;
tx->base.face = face;
@@ -158,7 +151,7 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));
return map + ns->base.offset +
- ptx->y * ns->pitch + ptx->x * ptx->block.size;
+ ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
}
static void
diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c
index 554e28e47dd..e2e01bd849b 100644
--- a/src/gallium/drivers/nv20/nv20_miptree.c
+++ b/src/gallium/drivers/nv20/nv20_miptree.c
@@ -10,7 +10,7 @@ static void
nv20_miptree_layout(struct nv20_miptree *nv20mt)
{
struct pipe_texture *pt = &nv20mt->base;
- uint width = pt->width0, height = pt->height0;
+ uint width = pt->width0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -26,19 +26,15 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
}
for (l = 0; l <= pt->last_level; l++) {
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
-
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- nv20mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
+ nv20mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
else
- nv20mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
+ nv20mt->level[l].pitch = pf_get_stride(pt->format, width);
nv20mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = u_minify(width, 1);
- height = u_minify(height, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -81,6 +77,7 @@ nv20_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
pipe_buffer_reference(&mt->buffer, pb);
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -136,6 +133,7 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
FREE(mt);
return NULL;
}
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
diff --git a/src/gallium/drivers/nv20/nv20_state.h b/src/gallium/drivers/nv20/nv20_state.h
index 34f402fdcbf..dde41065685 100644
--- a/src/gallium/drivers/nv20/nv20_state.h
+++ b/src/gallium/drivers/nv20/nv20_state.h
@@ -126,6 +126,7 @@ struct nv20_depth_stencil_alpha_state {
struct nv20_miptree {
struct pipe_texture base;
+ struct nouveau_bo *bo;
struct pipe_buffer *buffer;
uint total_size;
diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c
index 87b5c14a3c2..26a73c5143a 100644
--- a/src/gallium/drivers/nv20/nv20_transfer.c
+++ b/src/gallium/drivers/nv20/nv20_transfer.c
@@ -11,7 +11,7 @@
struct nv20_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
- bool direct;
+ boolean direct;
};
static void
@@ -24,9 +24,6 @@ nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
template->width0 = u_minify(pt->width0, level);
template->height0 = u_minify(pt->height0, level);
template->depth0 = 1;
- template->block = pt->block;
- template->nblocksx[0] = pt->nblocksx[level];
- template->nblocksy[0] = pt->nblocksx[level];
template->last_level = 0;
template->nr_samples = pt->nr_samples;
@@ -49,14 +46,10 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
tx->base.x = x;
tx->base.y = y;
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
tx->base.stride = mt->level[level].pitch;
tx->base.usage = usage;
tx->base.face = face;
@@ -158,7 +151,7 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));
return map + ns->base.offset +
- ptx->y * ns->pitch + ptx->x * ptx->block.size;
+ ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
}
static void
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index d8300fd69f6..46a821a48b1 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -58,6 +58,9 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced;
nv30->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
+ screen->base.channel->user_private = nv30;
+ screen->base.channel->flush_notify = nv30_state_flush_notify;
+
nv30_init_query_functions(nv30);
nv30_init_surface_functions(nv30);
nv30_init_state_functions(nv30);
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index 8d49366dfcb..6f44b1c7fe1 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -184,6 +184,7 @@ extern void nv30_fragtex_bind(struct nv30_context *);
/* nv30_state.c and friends */
extern boolean nv30_state_validate(struct nv30_context *nv30);
extern void nv30_state_emit(struct nv30_context *nv30);
+extern void nv30_state_flush_notify(struct nouveau_channel *chan);
extern struct nv30_state_entry nv30_state_rasterizer;
extern struct nv30_state_entry nv30_state_scissor;
extern struct nv30_state_entry nv30_state_stipple;
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index b4c306d1272..920fe64c32f 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -9,7 +9,7 @@ static void
nv30_miptree_layout(struct nv30_miptree *nv30mt)
{
struct pipe_texture *pt = &nv30mt->base;
- uint width = pt->width0, height = pt->height0, depth = pt->depth0;
+ uint width = pt->width0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -28,20 +28,15 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
}
for (l = 0; l <= pt->last_level; l++) {
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
-
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- nv30mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
+ nv30mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
else
- nv30mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
+ nv30mt->level[l].pitch = pf_get_stride(pt->format, width);
nv30mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = u_minify(width, 1);
- height = u_minify(height, 1);
- depth = u_minify(depth, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -120,6 +115,7 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
FREE(mt);
return NULL;
}
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -149,6 +145,7 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
pipe_buffer_reference(&mt->buffer, pb);
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
index e6f23bf1667..e42e872de75 100644
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -72,6 +72,7 @@ struct nv30_fragment_program {
struct nv30_miptree {
struct pipe_texture base;
+ struct nouveau_bo *bo;
struct pipe_buffer *buffer;
uint total_size;
diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c
index 621b8846c8e..ac52d946f02 100644
--- a/src/gallium/drivers/nv30/nv30_state_emit.c
+++ b/src/gallium/drivers/nv30/nv30_state_emit.c
@@ -41,7 +41,7 @@ nv30_state_emit(struct nv30_context *nv30)
struct nouveau_channel *chan = nv30->screen->base.channel;
struct nv30_state *state = &nv30->state;
struct nv30_screen *screen = nv30->screen;
- unsigned i, samplers;
+ unsigned i;
uint64_t states;
if (nv30->pctx_id != screen->cur_pctx) {
@@ -63,6 +63,14 @@ nv30_state_emit(struct nv30_context *nv30)
}
state->dirty = 0;
+}
+
+void
+nv30_state_flush_notify(struct nouveau_channel *chan)
+{
+ struct nv30_context *nv30 = chan->user_private;
+ struct nv30_state *state = &nv30->state;
+ unsigned i, samplers;
so_emit_reloc_markers(chan, state->hw[NV30_STATE_FB]);
for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
index 5e429b4d85c..e29bfbd3efd 100644
--- a/src/gallium/drivers/nv30/nv30_transfer.c
+++ b/src/gallium/drivers/nv30/nv30_transfer.c
@@ -11,7 +11,7 @@
struct nv30_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
- bool direct;
+ boolean direct;
};
static void
@@ -24,9 +24,6 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
template->width0 = u_minify(pt->width0, level);
template->height0 = u_minify(pt->height0, level);
template->depth0 = 1;
- template->block = pt->block;
- template->nblocksx[0] = pt->nblocksx[level];
- template->nblocksy[0] = pt->nblocksx[level];
template->last_level = 0;
template->nr_samples = pt->nr_samples;
@@ -49,14 +46,10 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
tx->base.x = x;
tx->base.y = y;
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
tx->base.stride = mt->level[level].pitch;
tx->base.usage = usage;
tx->base.face = face;
@@ -158,7 +151,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));
return map + ns->base.offset +
- ptx->y * ns->pitch + ptx->x * ptx->block.size;
+ ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
}
static void
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index 7f008274a4e..eb9cce4c786 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -58,6 +58,9 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv40->pipe.is_texture_referenced = nouveau_is_texture_referenced;
nv40->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
+ screen->base.channel->user_private = nv40;
+ screen->base.channel->flush_notify = nv40_state_flush_notify;
+
nv40_init_query_functions(nv40);
nv40_init_surface_functions(nv40);
nv40_init_state_functions(nv40);
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index a3d594167aa..cf33b64a86d 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -204,6 +204,7 @@ extern void nv40_fragtex_bind(struct nv40_context *);
extern boolean nv40_state_validate(struct nv40_context *nv40);
extern boolean nv40_state_validate_swtnl(struct nv40_context *nv40);
extern void nv40_state_emit(struct nv40_context *nv40);
+extern void nv40_state_flush_notify(struct nouveau_channel *chan);
extern struct nv40_state_entry nv40_state_rasterizer;
extern struct nv40_state_entry nv40_state_scissor;
extern struct nv40_state_entry nv40_state_stipple;
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index f73bedff6d8..89ddf373e9e 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -5,11 +5,13 @@
#include "nv40_context.h"
+
+
static void
nv40_miptree_layout(struct nv40_miptree *mt)
{
struct pipe_texture *pt = &mt->base;
- uint width = pt->width0, height = pt->height0, depth = pt->depth0;
+ uint width = pt->width0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -28,20 +30,15 @@ nv40_miptree_layout(struct nv40_miptree *mt)
}
for (l = 0; l <= pt->last_level; l++) {
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
-
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
+ mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
else
- mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
+ mt->level[l].pitch = pf_get_stride(pt->format, width);
mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = u_minify(width, 1);
- height = u_minify(height, 1);
- depth = u_minify(depth, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -114,7 +111,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
FREE(mt);
return NULL;
}
-
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
@@ -143,6 +140,7 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
pipe_buffer_reference(&mt->buffer, pb);
+ mt->bo = nouveau_bo(mt->buffer);
return &mt->base;
}
diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h
index 8a9d8c8fdf6..192074e7471 100644
--- a/src/gallium/drivers/nv40/nv40_state.h
+++ b/src/gallium/drivers/nv40/nv40_state.h
@@ -75,6 +75,7 @@ struct nv40_fragment_program {
struct nv40_miptree {
struct pipe_texture base;
+ struct nouveau_bo *bo;
struct pipe_buffer *buffer;
uint total_size;
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
index 198692965dc..ba0fbcb26a9 100644
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ b/src/gallium/drivers/nv40/nv40_state_emit.c
@@ -57,7 +57,7 @@ nv40_state_emit(struct nv40_context *nv40)
struct nouveau_channel *chan = nv40->screen->base.channel;
struct nv40_state *state = &nv40->state;
struct nv40_screen *screen = nv40->screen;
- unsigned i, samplers;
+ unsigned i;
uint64_t states;
if (nv40->pctx_id != screen->cur_pctx) {
@@ -87,6 +87,14 @@ nv40_state_emit(struct nv40_context *nv40)
}
state->dirty = 0;
+}
+
+void
+nv40_state_flush_notify(struct nouveau_channel *chan)
+{
+ struct nv40_context *nv40 = chan->user_private;
+ struct nv40_state *state = &nv40->state;
+ unsigned i, samplers;
so_emit_reloc_markers(chan, state->hw[NV40_STATE_FB]);
for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c
index 36e253c96f9..ed5be1cf879 100644
--- a/src/gallium/drivers/nv40/nv40_transfer.c
+++ b/src/gallium/drivers/nv40/nv40_transfer.c
@@ -11,7 +11,7 @@
struct nv40_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
- bool direct;
+ boolean direct;
};
static void
@@ -24,9 +24,6 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
template->width0 = u_minify(pt->width0, level);
template->height0 = u_minify(pt->height0, level);
template->depth0 = 1;
- template->block = pt->block;
- template->nblocksx[0] = pt->nblocksx[level];
- template->nblocksy[0] = pt->nblocksx[level];
template->last_level = 0;
template->nr_samples = pt->nr_samples;
@@ -49,14 +46,10 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
tx->base.x = x;
tx->base.y = y;
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
tx->base.stride = mt->level[level].pitch;
tx->base.usage = usage;
tx->base.face = face;
@@ -158,7 +151,7 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));
return map + ns->base.offset +
- ptx->y * ns->pitch + ptx->x * ptx->block.size;
+ ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format);
}
static void
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 4b0f0622953..5578a5838fb 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -65,7 +65,7 @@ struct nv50_rasterizer_stateobj {
};
struct nv50_sampler_stateobj {
- bool normalized;
+ boolean normalized;
unsigned tsc[8];
};
@@ -126,7 +126,7 @@ struct nv50_state {
unsigned viewport_bypass;
struct nouveau_stateobj *tsc_upload;
struct nouveau_stateobj *tic_upload;
- unsigned miptree_nr;
+ unsigned miptree_nr[PIPE_SHADER_TYPES];
struct nouveau_stateobj *vertprog;
struct nouveau_stateobj *fragprog;
struct nouveau_stateobj *programs;
@@ -162,10 +162,10 @@ struct nv50_context {
unsigned vtxbuf_nr;
struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
unsigned vtxelt_nr;
- struct nv50_sampler_stateobj *sampler[PIPE_MAX_SAMPLERS];
- unsigned sampler_nr;
- struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS];
- unsigned miptree_nr;
+ struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ unsigned sampler_nr[PIPE_SHADER_TYPES];
+ struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ unsigned miptree_nr[PIPE_SHADER_TYPES];
uint16_t vbo_fifo;
};
@@ -218,7 +218,7 @@ extern void nv50_state_flush_notify(struct nouveau_channel *chan);
extern void nv50_so_init_sifc(struct nv50_context *nv50,
struct nouveau_stateobj *so,
struct nouveau_bo *bo, unsigned reloc,
- unsigned size);
+ unsigned offset, unsigned size);
/* nv50_tex.c */
extern void nv50_tex_validate(struct nv50_context *);
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 3d58746793f..9e083b662dd 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -55,6 +55,20 @@ get_tile_mode(unsigned ny, unsigned d)
return tile_mode | 0x10;
}
+static INLINE unsigned
+get_zslice_offset(unsigned tile_mode, unsigned z, unsigned pitch, unsigned nb_h)
+{
+ unsigned tile_h = get_tile_height(tile_mode);
+ unsigned tile_d = get_tile_depth(tile_mode);
+
+ /* pitch_2d == to next slice within this volume-tile */
+ /* pitch_3d == size (in bytes) of a volume-tile */
+ unsigned pitch_2d = tile_h * 64;
+ unsigned pitch_3d = tile_d * align(nb_h, tile_h) * pitch;
+
+ return (z % tile_d) * pitch_2d + (z / tile_d) * pitch_3d;
+}
+
static struct pipe_texture *
nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
{
@@ -91,13 +105,11 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
for (l = 0; l <= pt->last_level; l++) {
struct nv50_miptree_level *lvl = &mt->level[l];
-
- pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
+ unsigned nblocksy = pf_get_nblocksy(pt->format, height);
lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
- lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64);
- lvl->tile_mode = get_tile_mode(pt->nblocksy[l], depth);
+ lvl->pitch = align(pf_get_stride(pt->format, width), 64);
+ lvl->tile_mode = get_tile_mode(nblocksy, depth);
width = u_minify(width, 1);
height = u_minify(height, 1);
@@ -118,7 +130,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
unsigned tile_d = get_tile_depth(lvl->tile_mode);
size = lvl->pitch;
- size *= align(pt->nblocksy[l], tile_h);
+ size *= align(pf_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h);
size *= align(u_minify(pt->depth0, l), tile_d);
lvl->image_offset[i] = mt->total_size;
@@ -132,6 +144,8 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
mt->level[0].tile_mode, tile_flags,
&mt->base.bo);
if (ret) {
+ for (l = 0; l < pt->last_level; ++l)
+ FREE(mt->level[l].image_offset);
FREE(mt);
return NULL;
}
@@ -171,6 +185,10 @@ static void
nv50_miptree_destroy(struct pipe_texture *pt)
{
struct nv50_miptree *mt = nv50_miptree(pt);
+ unsigned l;
+
+ for (l = 0; l < pt->last_level; ++l)
+ FREE(mt->level[l].image_offset);
nouveau_bo_ref(NULL, &mt->base.bo);
FREE(mt);
@@ -184,15 +202,10 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
struct nv50_miptree *mt = nv50_miptree(pt);
struct nv50_miptree_level *lvl = &mt->level[level];
struct pipe_surface *ps;
- int img;
+ unsigned img = 0;
if (pt->target == PIPE_TEXTURE_CUBE)
img = face;
- else
- if (pt->target == PIPE_TEXTURE_3D)
- img = zslice;
- else
- img = 0;
ps = CALLOC_STRUCT(pipe_surface);
if (!ps)
@@ -208,6 +221,12 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->zslice = zslice;
ps->offset = lvl->image_offset[img];
+ if (pt->target == PIPE_TEXTURE_3D) {
+ unsigned nb_h = pf_get_nblocksy(pt->format, ps->height);
+ ps->offset += get_zslice_offset(lvl->tile_mode, zslice,
+ lvl->pitch, nb_h);
+ }
+
return ps;
}
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index f0fe7e61684..e496cf4cad8 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -119,7 +119,7 @@ struct nv50_pc {
struct nv50_reg *param;
int param_nr;
struct nv50_reg *immd;
- float *immd_buf;
+ uint32_t *immd_buf;
int immd_nr;
struct nv50_reg **addr;
int addr_nr;
@@ -131,6 +131,9 @@ struct nv50_pc {
struct nv50_reg *r_brdc;
struct nv50_reg *r_dst[4];
+ struct nv50_reg reg_instances[16];
+ unsigned reg_instance_nr;
+
unsigned interp_mode[32];
/* perspective interpolation registers */
struct nv50_reg *iv_p;
@@ -150,6 +153,20 @@ struct nv50_pc {
boolean allow32;
};
+static INLINE struct nv50_reg *
+reg_instance(struct nv50_pc *pc, struct nv50_reg *reg)
+{
+ struct nv50_reg *ri;
+
+ assert(pc->reg_instance_nr < 16);
+ ri = &pc->reg_instances[pc->reg_instance_nr++];
+ if (reg) {
+ *ri = *reg;
+ reg->mod = 0;
+ }
+ return ri;
+}
+
static INLINE void
ctor_reg(struct nv50_reg *reg, unsigned type, int index, int hw)
{
@@ -342,25 +359,34 @@ static void
kill_temp_temp(struct nv50_pc *pc)
{
int i;
-
+
for (i = 0; i < pc->temp_temp_nr; i++)
free_temp(pc, pc->temp_temp[i]);
pc->temp_temp_nr = 0;
}
static int
-ctor_immd(struct nv50_pc *pc, float x, float y, float z, float w)
+ctor_immd_4u32(struct nv50_pc *pc,
+ uint32_t x, uint32_t y, uint32_t z, uint32_t w)
{
- pc->immd_buf = REALLOC(pc->immd_buf, (pc->immd_nr * 4 * sizeof(float)),
- (pc->immd_nr + 1) * 4 * sizeof(float));
+ unsigned size = pc->immd_nr * 4 * sizeof(uint32_t);
+
+ pc->immd_buf = REALLOC(pc->immd_buf, size, size + 4 * sizeof(uint32_t));
+
pc->immd_buf[(pc->immd_nr * 4) + 0] = x;
pc->immd_buf[(pc->immd_nr * 4) + 1] = y;
pc->immd_buf[(pc->immd_nr * 4) + 2] = z;
pc->immd_buf[(pc->immd_nr * 4) + 3] = w;
-
+
return pc->immd_nr++;
}
+static INLINE int
+ctor_immd_4f32(struct nv50_pc *pc, float x, float y, float z, float w)
+{
+ return ctor_immd_4u32(pc, fui(x), fui(y), fui(z), fui(w));
+}
+
static struct nv50_reg *
alloc_immd(struct nv50_pc *pc, float f)
{
@@ -368,11 +394,11 @@ alloc_immd(struct nv50_pc *pc, float f)
unsigned hw;
for (hw = 0; hw < pc->immd_nr * 4; hw++)
- if (pc->immd_buf[hw] == f)
+ if (pc->immd_buf[hw] == fui(f))
break;
if (hw == pc->immd_nr * 4)
- hw = ctor_immd(pc, f, -f, 0.5 * f, 0) * 4;
+ hw = ctor_immd_4f32(pc, f, -f, 0.5 * f, 0) * 4;
ctor_reg(r, P_IMMD, -1, hw);
return r;
@@ -464,22 +490,24 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e)
static INLINE void
set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e)
{
- unsigned val;
- float f = pc->immd_buf[imm->hw];
+ union {
+ float f;
+ uint32_t ui;
+ } u;
+ u.ui = pc->immd_buf[imm->hw];
- if (imm->mod & NV50_MOD_ABS)
- f = fabsf(f);
- val = fui((imm->mod & NV50_MOD_NEG) ? -f : f);
+ u.f = (imm->mod & NV50_MOD_ABS) ? fabsf(u.f) : u.f;
+ u.f = (imm->mod & NV50_MOD_NEG) ? -u.f : u.f;
set_long(pc, e);
- /*XXX: can't be predicated - bits overlap.. catch cases where both
- * are required and avoid them. */
+ /* XXX: can't be predicated - bits overlap; cases where both
+ * are required should be avoided by using pc->allow32 */
set_pred(pc, 0, 0, e);
set_pred_wr(pc, 0, 0, e);
e->inst[1] |= 0x00000002 | 0x00000001;
- e->inst[0] |= (val & 0x3f) << 16;
- e->inst[1] |= (val >> 6) << 2;
+ e->inst[0] |= (u.ui & 0x3f) << 16;
+ e->inst[1] |= (u.ui >> 6) << 2;
}
static INLINE void
@@ -644,7 +672,7 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
if (src->type == P_IMMD || src->type == P_CONST) {
set_long(pc, e);
set_data(pc, src, 0x7f, 9, e);
- e->inst[1] |= 0x20000000; /* src0 const? */
+ e->inst[1] |= 0x20000000; /* mov from c[] */
} else {
if (src->type == P_ATTR) {
set_long(pc, e);
@@ -659,9 +687,9 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
if (is_long(e) && !is_immd(e)) {
e->inst[1] |= 0x04000000; /* 32-bit */
- e->inst[1] |= 0x0000c000; /* "subsubop" 0x3 */
+ e->inst[1] |= 0x0000c000; /* 32-bit c[] load / lane mask 0:1 */
if (!(e->inst[1] & 0x20000000))
- e->inst[1] |= 0x00030000; /* "subsubop" 0xf */
+ e->inst[1] |= 0x00030000; /* lane mask 2:3 */
} else
e->inst[0] |= 0x00008000;
@@ -676,6 +704,17 @@ emit_mov_immdval(struct nv50_pc *pc, struct nv50_reg *dst, float f)
FREE(imm);
}
+static void
+emit_nop(struct nv50_pc *pc)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ e->inst[0] = 0xf0000000;
+ set_long(pc, e);
+ e->inst[1] = 0xe0000000;
+ emit(pc, e);
+}
+
static boolean
check_swap_src_0_1(struct nv50_pc *pc,
struct nv50_reg **s0, struct nv50_reg **s1)
@@ -795,6 +834,33 @@ set_src_2(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e)
}
static void
+emit_mov_from_pred(struct nv50_pc *pc, struct nv50_reg *dst, int pred)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ assert(dst->type == P_TEMP);
+ e->inst[1] = 0x20000000 | (pred << 12);
+ set_long(pc, e);
+ set_dst(pc, dst, e);
+
+ emit(pc, e);
+}
+
+static void
+emit_mov_to_pred(struct nv50_pc *pc, int pred, struct nv50_reg *src)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ e->inst[0] = 0x000001fc;
+ e->inst[1] = 0xa0000008;
+ set_long(pc, e);
+ set_pred_wr(pc, 1, pred, e);
+ set_src_0_restricted(pc, src, e);
+
+ emit(pc, e);
+}
+
+static void
emit_mul(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0,
struct nv50_reg *src1)
{
@@ -898,7 +964,6 @@ static INLINE void
emit_sub(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0,
struct nv50_reg *src1)
{
- assert(src0 != src1);
src1->mod ^= NV50_MOD_NEG;
emit_add(pc, dst, src0, src1);
src1->mod ^= NV50_MOD_NEG;
@@ -967,7 +1032,6 @@ static INLINE void
emit_msb(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0,
struct nv50_reg *src1, struct nv50_reg *src2)
{
- assert(src2 != src0 && src2 != src1);
src2->mod ^= NV50_MOD_NEG;
emit_mad(pc, dst, src0, src1, src2);
src2->mod ^= NV50_MOD_NEG;
@@ -1257,9 +1321,68 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src)
emit(pc, e);
}
+static struct nv50_program_exec *
+emit_branch(struct nv50_pc *pc, int pred, unsigned cc,
+ struct nv50_program_exec **join)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ if (join) {
+ set_long(pc, e);
+ e->inst[0] |= 0xa0000002;
+ emit(pc, e);
+ *join = e;
+ e = exec(pc);
+ }
+
+ set_long(pc, e);
+ e->inst[0] |= 0x10000002;
+ if (pred >= 0)
+ set_pred(pc, cc, pred, e);
+ emit(pc, e);
+ return pc->p->exec_tail;
+}
+
+#define QOP_ADD 0
+#define QOP_SUBR 1
+#define QOP_SUB 2
+#define QOP_MOV_SRC1 3
+
+/* For a quad of threads / top left, top right, bottom left, bottom right
+ * pixels, do a different operation, and take src0 from a specific thread.
+ */
+static void
+emit_quadop(struct nv50_pc *pc, struct nv50_reg *dst, int wp, int lane_src0,
+ struct nv50_reg *src0, struct nv50_reg *src1, ubyte qop)
+{
+ struct nv50_program_exec *e = exec(pc);
+
+ e->inst[0] = 0xc0000000;
+ e->inst[1] = 0x80000000;
+ set_long(pc, e);
+ e->inst[0] |= lane_src0 << 16;
+ set_src_0(pc, src0, e);
+ set_src_2(pc, src1, e);
+
+ if (wp >= 0)
+ set_pred_wr(pc, 1, wp, e);
+
+ if (dst)
+ set_dst(pc, dst, e);
+ else {
+ e->inst[0] |= 0x000001fc;
+ e->inst[1] |= 0x00000008;
+ }
+
+ e->inst[0] |= (qop & 3) << 20;
+ e->inst[1] |= (qop >> 2) << 22;
+
+ emit(pc, e);
+}
+
static void
load_cube_tex_coords(struct nv50_pc *pc, struct nv50_reg *t[4],
- struct nv50_reg **src, boolean proj)
+ struct nv50_reg **src, unsigned arg, boolean proj)
{
int mod[3] = { src[0]->mod, src[1]->mod, src[2]->mod };
@@ -1276,6 +1399,10 @@ load_cube_tex_coords(struct nv50_pc *pc, struct nv50_reg *t[4],
if (proj && 0 /* looks more correct without this */)
emit_mul(pc, t[2], t[2], src[3]);
+ else
+ if (arg == 4) /* there is no textureProj(samplerCubeShadow) */
+ emit_mov(pc, t[3], src[3]);
+
emit_flop(pc, 0, t[2], t[2]);
emit_mul(pc, t[0], src[0], t[2]);
@@ -1284,89 +1411,214 @@ load_cube_tex_coords(struct nv50_pc *pc, struct nv50_reg *t[4],
}
static void
-emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask,
- struct nv50_reg **src, unsigned unit, unsigned type, boolean proj)
+load_proj_tex_coords(struct nv50_pc *pc, struct nv50_reg *t[4],
+ struct nv50_reg **src, unsigned dim, unsigned arg)
{
- struct nv50_reg *t[4];
- struct nv50_program_exec *e;
+ unsigned c, mode;
+
+ if (src[0]->type == P_TEMP && src[0]->rhw != -1) {
+ mode = pc->interp_mode[src[0]->index] | INTERP_PERSPECTIVE;
- unsigned c, mode, dim;
+ t[3]->rhw = src[3]->rhw;
+ emit_interp(pc, t[3], NULL, (mode & INTERP_CENTROID));
+ emit_flop(pc, 0, t[3], t[3]);
+ for (c = 0; c < dim; ++c) {
+ t[c]->rhw = src[c]->rhw;
+ emit_interp(pc, t[c], t[3], mode);
+ }
+ if (arg != dim) { /* depth reference value */
+ t[dim]->rhw = src[2]->rhw;
+ emit_interp(pc, t[dim], t[3], mode);
+ }
+ } else {
+ /* XXX: for some reason the blob sometimes uses MAD
+ * (mad f32 $rX $rY $rZ neg $r63)
+ */
+ emit_flop(pc, 0, t[3], src[3]);
+ for (c = 0; c < dim; ++c)
+ emit_mul(pc, t[c], src[c], t[3]);
+ if (arg != dim) /* depth reference value */
+ emit_mul(pc, t[dim], src[2], t[3]);
+ }
+}
+
+static INLINE void
+get_tex_dim(unsigned type, unsigned *dim, unsigned *arg)
+{
switch (type) {
case TGSI_TEXTURE_1D:
- dim = 1;
+ *arg = *dim = 1;
+ break;
+ case TGSI_TEXTURE_SHADOW1D:
+ *dim = 1;
+ *arg = 2;
break;
case TGSI_TEXTURE_UNKNOWN:
case TGSI_TEXTURE_2D:
- case TGSI_TEXTURE_SHADOW1D: /* XXX: x, z */
case TGSI_TEXTURE_RECT:
- dim = 2;
+ *arg = *dim = 2;
+ break;
+ case TGSI_TEXTURE_SHADOW2D:
+ case TGSI_TEXTURE_SHADOWRECT:
+ *dim = 2;
+ *arg = 3;
break;
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
- case TGSI_TEXTURE_SHADOW2D:
- case TGSI_TEXTURE_SHADOWRECT: /* XXX */
- dim = 3;
+ *dim = *arg = 3;
break;
default:
assert(0);
break;
}
+}
- /* some cards need t[0]'s hw index to be a multiple of 4 */
- alloc_temp4(pc, t, 0);
+/* We shouldn't execute TEXLOD if any of the pixels in a quad have
+ * different LOD values, so branch off groups of equal LOD.
+ */
+static void
+emit_texlod_sequence(struct nv50_pc *pc, struct nv50_reg *tlod,
+ struct nv50_reg *src, struct nv50_program_exec *tex)
+{
+ struct nv50_program_exec *join_at;
+ unsigned i, target = pc->p->exec_size + 7 * 2;
- if (type == TGSI_TEXTURE_CUBE) {
- load_cube_tex_coords(pc, t, src, proj);
- } else
- if (proj) {
- if (src[0]->type == P_TEMP && src[0]->rhw != -1) {
- mode = pc->interp_mode[src[0]->index];
-
- t[3]->rhw = src[3]->rhw;
- emit_interp(pc, t[3], NULL, (mode & INTERP_CENTROID));
- emit_flop(pc, 0, t[3], t[3]);
-
- for (c = 0; c < dim; c++) {
- t[c]->rhw = src[c]->rhw;
- emit_interp(pc, t[c], t[3],
- (mode | INTERP_PERSPECTIVE));
- }
- } else {
- emit_flop(pc, 0, t[3], src[3]);
- for (c = 0; c < dim; c++)
- emit_mul(pc, t[c], src[c], t[3]);
+ /* Subtract lod of each pixel from lod of top left pixel, jump
+ * texlod insn if result is 0, then repeat for 2 other pixels.
+ */
+ emit_quadop(pc, NULL, 0, 0, tlod, tlod, 0x55);
+ emit_branch(pc, 0, 2, &join_at)->param.index = target;
- /* XXX: for some reason the blob sometimes uses MAD:
- * emit_mad(pc, t[c], src[0][c], t[3], t[3])
- * pc->p->exec_tail->inst[1] |= 0x080fc000;
- */
+ for (i = 1; i < 4; ++i) {
+ emit_quadop(pc, NULL, 0, i, tlod, tlod, 0x55);
+ emit_branch(pc, 0, 2, NULL)->param.index = target;
+ }
+
+ emit_mov(pc, tlod, src); /* target */
+ emit(pc, tex); /* texlod */
+
+ join_at->param.index = target + 2 * 2;
+ emit_nop(pc);
+ pc->p->exec_tail->inst[1] |= 2; /* join _after_ tex */
+}
+
+static void
+emit_texbias_sequence(struct nv50_pc *pc, struct nv50_reg *t[4], unsigned arg,
+ struct nv50_program_exec *tex)
+{
+ struct nv50_program_exec *e;
+ struct nv50_reg imm_1248, *t123[4][4], *r_bits = alloc_temp(pc, NULL);
+ int r_pred = 0;
+ unsigned n, c, i, cc[4] = { 0x0a, 0x13, 0x11, 0x10 };
+
+ pc->allow32 = FALSE;
+ ctor_reg(&imm_1248, P_IMMD, -1, ctor_immd_4u32(pc, 1, 2, 4, 8) * 4);
+
+ /* Subtract bias value of thread i from bias values of each thread,
+ * store result in r_pred, and set bit i in r_bits if result was 0.
+ */
+ assert(arg < 4);
+ for (i = 0; i < 4; ++i, ++imm_1248.hw) {
+ emit_quadop(pc, NULL, r_pred, i, t[arg], t[arg], 0x55);
+ emit_mov(pc, r_bits, &imm_1248);
+ set_pred(pc, 2, r_pred, pc->p->exec_tail);
+ }
+ emit_mov_to_pred(pc, r_pred, r_bits);
+
+ /* The lanes of a quad are now grouped by the bit in r_pred they have
+ * set. Put the input values for TEX into a new register set for each
+ * group and execute TEX only for a specific group.
+ * We cannot use the same register set for each group because we need
+ * the derivatives, which are implicitly calculated, to be correct.
+ */
+ for (i = 1; i < 4; ++i) {
+ alloc_temp4(pc, t123[i], 0);
+
+ for (c = 0; c <= arg; ++c)
+ emit_mov(pc, t123[i][c], t[c]);
+
+ *(e = exec(pc)) = *(tex);
+ e->inst[0] &= ~0x01fc;
+ set_dst(pc, t123[i][0], e);
+ set_pred(pc, cc[i], r_pred, e);
+ emit(pc, e);
+ }
+ /* finally TEX on the original regs (where we kept the input) */
+ set_pred(pc, cc[0], r_pred, tex);
+ emit(pc, tex);
+
+ /* put the 3 * n other results into regs for lane 0 */
+ n = popcnt4(((e->inst[0] >> 25) & 0x3) | ((e->inst[1] >> 12) & 0xc));
+ for (i = 1; i < 4; ++i) {
+ for (c = 0; c < n; ++c) {
+ emit_mov(pc, t[c], t123[i][c]);
+ set_pred(pc, cc[i], r_pred, pc->p->exec_tail);
}
- } else {
- for (c = 0; c < dim; c++)
- emit_mov(pc, t[c], src[c]);
+ free_temp4(pc, t123[i]);
}
+ emit_nop(pc);
+ free_temp(pc, r_bits);
+}
+
+static void
+emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask,
+ struct nv50_reg **src, unsigned unit, unsigned type,
+ boolean proj, int bias_lod)
+{
+ struct nv50_reg *t[4];
+ struct nv50_program_exec *e;
+ unsigned c, dim, arg;
+
+ /* t[i] must be within a single 128 bit super-reg */
+ alloc_temp4(pc, t, 0);
+
e = exec(pc);
+ e->inst[0] = 0xf0000000;
set_long(pc, e);
- e->inst[0] |= 0xf0000000;
- e->inst[1] |= 0x00000004;
set_dst(pc, t[0], e);
- e->inst[0] |= (unit << 9);
- if (dim == 2)
- e->inst[0] |= 0x00400000;
- else
- if (dim == 3) {
- e->inst[0] |= 0x00800000;
- if (type == TGSI_TEXTURE_CUBE)
- e->inst[0] |= 0x08000000;
+ /* TIC and TSC binding indices (TSC is ignored as TSC_LINKED = TRUE): */
+ e->inst[0] |= (unit << 9) /* | (unit << 17) */;
+
+ /* live flag (don't set if TEX results affect input to another TEX): */
+ /* e->inst[0] |= 0x00000004; */
+
+ get_tex_dim(type, &dim, &arg);
+
+ if (type == TGSI_TEXTURE_CUBE) {
+ e->inst[0] |= 0x08000000;
+ load_cube_tex_coords(pc, t, src, arg, proj);
+ } else
+ if (proj)
+ load_proj_tex_coords(pc, t, src, dim, arg);
+ else {
+ for (c = 0; c < dim; c++)
+ emit_mov(pc, t[c], src[c]);
+ if (arg != dim) /* depth reference value (always src.z here) */
+ emit_mov(pc, t[dim], src[2]);
}
e->inst[0] |= (mask & 0x3) << 25;
e->inst[1] |= (mask & 0xc) << 12;
- emit(pc, e);
+ if (!bias_lod) {
+ e->inst[0] |= (arg - 1) << 22;
+ emit(pc, e);
+ } else
+ if (bias_lod < 0) {
+ e->inst[0] |= arg << 22;
+ e->inst[1] |= 0x20000000; /* texbias */
+ emit_mov(pc, t[arg], src[3]);
+ emit_texbias_sequence(pc, t, arg, e);
+ } else {
+ e->inst[0] |= arg << 22;
+ e->inst[1] |= 0x40000000; /* texlod */
+ emit_mov(pc, t[arg], src[3]);
+ emit_texlod_sequence(pc, t[arg], src[3], e);
+ }
+
#if 1
c = 0;
if (mask & 1) emit_mov(pc, dst[0], t[c++]);
@@ -1389,38 +1641,6 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask,
}
static void
-emit_branch(struct nv50_pc *pc, int pred, unsigned cc,
- struct nv50_program_exec **join)
-{
- struct nv50_program_exec *e = exec(pc);
-
- if (join) {
- set_long(pc, e);
- e->inst[0] |= 0xa0000002;
- emit(pc, e);
- *join = e;
- e = exec(pc);
- }
-
- set_long(pc, e);
- e->inst[0] |= 0x10000002;
- if (pred >= 0)
- set_pred(pc, cc, pred, e);
- emit(pc, e);
-}
-
-static void
-emit_nop(struct nv50_pc *pc)
-{
- struct nv50_program_exec *e = exec(pc);
-
- e->inst[0] = 0xf0000000;
- set_long(pc, e);
- e->inst[1] = 0xe0000000;
- emit(pc, e);
-}
-
-static void
emit_ddx(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
{
struct nv50_program_exec *e = exec(pc);
@@ -1515,8 +1735,6 @@ convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e)
static boolean
negate_supported(const struct tgsi_full_instruction *insn, int i)
{
- int s;
-
switch (insn->Instruction.Opcode) {
case TGSI_OPCODE_DDY:
case TGSI_OPCODE_DP3:
@@ -1526,29 +1744,14 @@ negate_supported(const struct tgsi_full_instruction *insn, int i)
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_SUB:
case TGSI_OPCODE_MAD:
- break;
+ return TRUE;
case TGSI_OPCODE_POW:
if (i == 1)
- break;
+ return TRUE;
return FALSE;
default:
return FALSE;
}
-
- /* Watch out for possible multiple uses of an nv50_reg, we
- * can't use nv50_reg::neg in these cases.
- */
- for (s = 0; s < insn->Instruction.NumSrcRegs; ++s) {
- if (s == i)
- continue;
- if ((insn->Src[s].Register.Index ==
- insn->Src[i].Register.Index) &&
- (insn->Src[s].Register.File ==
- insn->Src[i].Register.File))
- return FALSE;
- }
-
- return TRUE;
}
/* Return a read mask for source registers deduced from opcode & write mask. */
@@ -1576,9 +1779,13 @@ nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c)
case TGSI_OPCODE_RSQ:
case TGSI_OPCODE_SCS:
return 0x1;
+ case TGSI_OPCODE_IF:
+ return 0x1;
case TGSI_OPCODE_LIT:
return 0xb;
case TGSI_OPCODE_TEX:
+ case TGSI_OPCODE_TXB:
+ case TGSI_OPCODE_TXL:
case TGSI_OPCODE_TXP:
{
const struct tgsi_instruction_texture *tex;
@@ -1587,13 +1794,17 @@ nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c)
tex = &insn->Texture;
mask = 0x7;
- if (insn->Instruction.Opcode == TGSI_OPCODE_TXP)
- mask |= 0x8;
+ if (insn->Instruction.Opcode != TGSI_OPCODE_TEX &&
+ insn->Instruction.Opcode != TGSI_OPCODE_TXD)
+ mask |= 0x8; /* bias, lod or proj */
switch (tex->Texture) {
case TGSI_TEXTURE_1D:
mask &= 0x9;
break;
+ case TGSI_TEXTURE_SHADOW1D:
+ mask &= 0x5;
+ break;
case TGSI_TEXTURE_2D:
mask &= 0xb;
break;
@@ -1676,7 +1887,7 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src,
/* Indicate indirection by setting r->acc < 0 and
* use the index field to select the address reg.
*/
- r = MALLOC_STRUCT(nv50_reg);
+ r = reg_instance(pc, NULL);
swz = tgsi_util_get_src_register_swizzle(
&src->Indirect, 0);
ctor_reg(r, P_CONST,
@@ -1730,6 +1941,8 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src,
break;
}
+ if (r && r->acc >= 0 && r != temp)
+ return reg_instance(pc, r);
return r;
}
@@ -1785,6 +1998,8 @@ nv50_tgsi_dst_revdep(unsigned op, int s, int c)
case TGSI_OPCODE_LIT:
case TGSI_OPCODE_SCS:
case TGSI_OPCODE_TEX:
+ case TGSI_OPCODE_TXB:
+ case TGSI_OPCODE_TXL:
case TGSI_OPCODE_TXP:
/* these take care of dangerous swizzles themselves */
return 0x0;
@@ -2187,11 +2402,19 @@ nv50_program_tx_insn(struct nv50_pc *pc,
break;
case TGSI_OPCODE_TEX:
emit_tex(pc, dst, mask, src[0], unit,
- inst->Texture.Texture, FALSE);
+ inst->Texture.Texture, FALSE, 0);
+ break;
+ case TGSI_OPCODE_TXB:
+ emit_tex(pc, dst, mask, src[0], unit,
+ inst->Texture.Texture, FALSE, -1);
+ break;
+ case TGSI_OPCODE_TXL:
+ emit_tex(pc, dst, mask, src[0], unit,
+ inst->Texture.Texture, FALSE, 1);
break;
case TGSI_OPCODE_TXP:
emit_tex(pc, dst, mask, src[0], unit,
- inst->Texture.Texture, TRUE);
+ inst->Texture.Texture, TRUE, 0);
break;
case TGSI_OPCODE_TRUNC:
for (c = 0; c < 4; c++) {
@@ -2245,20 +2468,9 @@ nv50_program_tx_insn(struct nv50_pc *pc,
}
}
- for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
- for (c = 0; c < 4; c++) {
- if (!src[i][c])
- continue;
- src[i][c]->mod = 0;
- if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD)
- FREE(src[i][c]);
- else
- if (src[i][c]->acc < 0 && src[i][c]->type == P_CONST)
- FREE(src[i][c]); /* indirect constant */
- }
- }
-
kill_temp_temp(pc);
+ pc->reg_instance_nr = 0;
+
return TRUE;
}
@@ -2541,10 +2753,10 @@ nv50_program_tx_prep(struct nv50_pc *pc)
const struct tgsi_full_immediate *imm =
&tp.FullToken.FullImmediate;
- ctor_immd(pc, imm->u[0].Float,
- imm->u[1].Float,
- imm->u[2].Float,
- imm->u[3].Float);
+ ctor_immd_4f32(pc, imm->u[0].Float,
+ imm->u[1].Float,
+ imm->u[2].Float,
+ imm->u[3].Float);
}
break;
case TGSI_TOKEN_TYPE_DECLARATION:
@@ -3024,7 +3236,7 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *p)
}
static void
-nv50_program_upload_data(struct nv50_context *nv50, float *map,
+nv50_program_upload_data(struct nv50_context *nv50, uint32_t *map,
unsigned start, unsigned count, unsigned cbuf)
{
struct nouveau_channel *chan = nv50->screen->base.channel;
@@ -3072,8 +3284,8 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p)
if (p->param_nr) {
unsigned cb;
- float *map = pipe_buffer_map(pscreen, nv50->constbuf[p->type],
- PIPE_BUFFER_USAGE_CPU_READ);
+ uint32_t *map = pipe_buffer_map(pscreen, nv50->constbuf[p->type],
+ PIPE_BUFFER_USAGE_CPU_READ);
if (p->type == PIPE_SHADER_VERTEX)
cb = NV50_CB_PVP;
diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h
index 255c7c737ef..4a90c372ce3 100644
--- a/src/gallium/drivers/nv50/nv50_program.h
+++ b/src/gallium/drivers/nv50/nv50_program.h
@@ -37,7 +37,7 @@ struct nv50_program {
struct nouveau_bo *bo;
- float *immd;
+ uint32_t *immd;
unsigned immd_nr;
unsigned param_nr;
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c
index 5305c93d59a..268c9823f7d 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -93,7 +93,7 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nv50_query *q = nv50_query(pq);
- WAIT_RING (chan, 5);
+ MARK_RING (chan, 5, 2); /* flush on lack of space or relocs */
BEGIN_RING(chan, tesla, NV50TCL_QUERY_ADDRESS_HIGH, 4);
OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index e1b2f11239a..d443ca3ad06 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -76,6 +76,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_Z32_FLOAT:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16G16B16A16_UNORM:
@@ -97,6 +98,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 32;
+ case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
+ return 32;
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return 64;
case PIPE_CAP_NPOT_TEXTURES:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
@@ -122,8 +127,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return 1;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- return 0;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 0;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
@@ -315,6 +318,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
so_method(so, screen->tesla, 0x1400, 1);
so_data (so, 0xf);
+ /* max TIC (bits 4:8) & TSC (ignored) bindings, per program type */
+ so_method(so, screen->tesla, 0x13b4, 1);
+ so_data (so, 0x54);
so_method(so, screen->tesla, 0x13bc, 1);
so_data (so, 0x54);
/* origin is top left (set to 1 for bottom left) */
@@ -387,7 +393,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
so_data (so, 0x00000131 | (NV50_CB_PFP << 12));
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tic);
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, PIPE_SHADER_TYPES*32*32,
+ &screen->tic);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
@@ -398,9 +405,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x000007ff);
+ so_data (so, PIPE_SHADER_TYPES * 32 - 1);
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tsc);
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, PIPE_SHADER_TYPES*32*32,
+ &screen->tsc);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
@@ -411,7 +419,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00000000);
+ so_data (so, 0x00000000); /* ignored if TSC_LINKED (0x1234) = 1 */
/* Vertex array limits - max them out */
@@ -425,6 +433,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
so_data (so, fui(0.0));
so_data (so, fui(1.0));
+ /* no dynamic combination of TIC & TSC entries => only BIND_TIC used */
so_method(so, screen->tesla, 0x1234, 1);
so_data (so, 1);
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 07318f23947..88aef52d08c 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -196,8 +196,9 @@ nv50_sampler_state_create(struct pipe_context *pipe,
}
if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
- tsc[0] |= (1 << 8);
- tsc[0] |= (nvgl_comparison_op(cso->compare_func) & 0x7);
+ /* XXX: must be deactivated for non-shadow textures */
+ tsc[0] |= (1 << 9);
+ tsc[0] |= (nvgl_comparison_op(cso->compare_func) & 0x7) << 10;
}
limit = CLAMP(cso->lod_bias, -16.0, 15.0);
@@ -215,41 +216,66 @@ nv50_sampler_state_create(struct pipe_context *pipe,
return (void *)sso;
}
-static void
-nv50_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
+static INLINE void
+nv50_sampler_state_bind(struct pipe_context *pipe, unsigned type,
+ unsigned nr, void **sampler)
{
struct nv50_context *nv50 = nv50_context(pipe);
- int i;
- nv50->sampler_nr = nr;
- for (i = 0; i < nv50->sampler_nr; i++)
- nv50->sampler[i] = sampler[i];
+ memcpy(nv50->sampler[type], sampler, nr * sizeof(void *));
+ nv50->sampler_nr[type] = nr;
nv50->dirty |= NV50_NEW_SAMPLER;
}
static void
+nv50_vp_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **s)
+{
+ nv50_sampler_state_bind(pipe, PIPE_SHADER_VERTEX, nr, s);
+}
+
+static void
+nv50_fp_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **s)
+{
+ nv50_sampler_state_bind(pipe, PIPE_SHADER_FRAGMENT, nr, s);
+}
+
+static void
nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
{
FREE(hwcso);
}
-static void
-nv50_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **pt)
+static INLINE void
+nv50_set_sampler_texture(struct pipe_context *pipe, unsigned type,
+ unsigned nr, struct pipe_texture **pt)
{
struct nv50_context *nv50 = nv50_context(pipe);
- int i;
+ unsigned i;
for (i = 0; i < nr; i++)
- pipe_texture_reference((void *)&nv50->miptree[i], pt[i]);
- for (i = nr; i < nv50->miptree_nr; i++)
- pipe_texture_reference((void *)&nv50->miptree[i], NULL);
+ pipe_texture_reference((void *)&nv50->miptree[type][i], pt[i]);
+ for (i = nr; i < nv50->miptree_nr[type]; i++)
+ pipe_texture_reference((void *)&nv50->miptree[type][i], NULL);
- nv50->miptree_nr = nr;
+ nv50->miptree_nr[type] = nr;
nv50->dirty |= NV50_NEW_TEXTURE;
}
+static void
+nv50_set_vp_sampler_textures(struct pipe_context *pipe,
+ unsigned nr, struct pipe_texture **pt)
+{
+ nv50_set_sampler_texture(pipe, PIPE_SHADER_VERTEX, nr, pt);
+}
+
+static void
+nv50_set_fp_sampler_textures(struct pipe_context *pipe,
+ unsigned nr, struct pipe_texture **pt)
+{
+ nv50_set_sampler_texture(pipe, PIPE_SHADER_FRAGMENT, nr, pt);
+}
+
static void *
nv50_rasterizer_state_create(struct pipe_context *pipe,
const struct pipe_rasterizer_state *cso)
@@ -648,9 +674,11 @@ nv50_init_state_functions(struct nv50_context *nv50)
nv50->pipe.delete_blend_state = nv50_blend_state_delete;
nv50->pipe.create_sampler_state = nv50_sampler_state_create;
- nv50->pipe.bind_fragment_sampler_states = nv50_sampler_state_bind;
nv50->pipe.delete_sampler_state = nv50_sampler_state_delete;
- nv50->pipe.set_fragment_sampler_textures = nv50_set_sampler_texture;
+ nv50->pipe.bind_fragment_sampler_states = nv50_fp_sampler_state_bind;
+ nv50->pipe.bind_vertex_sampler_states = nv50_vp_sampler_state_bind;
+ nv50->pipe.set_fragment_sampler_textures = nv50_set_fp_sampler_textures;
+ nv50->pipe.set_vertex_sampler_textures = nv50_set_vp_sampler_textures;
nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create;
nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind;
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index c871acaab8d..871e8097b65 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -156,6 +156,30 @@ nv50_state_validate_fb(struct nv50_context *nv50)
}
static void
+nv50_validate_samplers(struct nv50_context *nv50, struct nouveau_stateobj *so,
+ unsigned p)
+{
+ struct nouveau_grobj *eng2d = nv50->screen->eng2d;
+ unsigned i, j, dw = nv50->sampler_nr[p] * 8;
+
+ if (!dw)
+ return;
+ nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM,
+ p * (32 * 8 * 4), dw * 4);
+
+ so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), dw);
+
+ for (i = 0; i < nv50->sampler_nr[p]; ++i) {
+ if (nv50->sampler[p][i])
+ so_datap(so, nv50->sampler[p][i]->tsc, 8);
+ else {
+ for (j = 0; j < 8; ++j) /* you get punished */
+ so_data(so, 0); /* ... for leaving holes */
+ }
+ }
+}
+
+static void
nv50_state_emit(struct nv50_context *nv50)
{
struct nv50_screen *screen = nv50->screen;
@@ -246,7 +270,6 @@ boolean
nv50_state_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_stateobj *so;
unsigned i;
@@ -369,22 +392,16 @@ scissor_uptodate:
viewport_uptodate:
if (nv50->dirty & NV50_NEW_SAMPLER) {
- unsigned i;
+ unsigned nr = 0;
- so = so_new(nv50->sampler_nr * 9 + 23 + 4, 2);
+ for (i = 0; i < PIPE_SHADER_TYPES; ++i)
+ nr += nv50->sampler_nr[i];
- nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM,
- nv50->sampler_nr * 8 * 4);
+ so = so_new(nr * 8 + 24 * PIPE_SHADER_TYPES + 2, 4);
- for (i = 0; i < nv50->sampler_nr; i++) {
- if (!nv50->sampler[i])
- continue;
- so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
- so_datap (so, nv50->sampler[i]->tsc, 8);
- }
+ nv50_validate_samplers(nv50, so, PIPE_SHADER_VERTEX);
+ nv50_validate_samplers(nv50, so, PIPE_SHADER_FRAGMENT);
- so_method(so, tesla, 0x1440, 1); /* sync SIFC */
- so_data (so, 0);
so_method(so, tesla, 0x1334, 1); /* flush TSC */
so_data (so, 0);
@@ -407,10 +424,13 @@ viewport_uptodate:
void nv50_so_init_sifc(struct nv50_context *nv50,
struct nouveau_stateobj *so,
- struct nouveau_bo *bo, unsigned reloc, unsigned size)
+ struct nouveau_bo *bo, unsigned reloc,
+ unsigned offset, unsigned size)
{
struct nouveau_grobj *eng2d = nv50->screen->eng2d;
+ reloc |= NOUVEAU_BO_WR;
+
so_method(so, eng2d, NV50_2D_DST_FORMAT, 2);
so_data (so, NV50_2D_DST_FORMAT_R8_UNORM);
so_data (so, 1);
@@ -418,8 +438,8 @@ void nv50_so_init_sifc(struct nv50_context *nv50,
so_data (so, 262144);
so_data (so, 65536);
so_data (so, 1);
- so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_LOW, 0, 0);
+ so_reloc (so, bo, offset, reloc | NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, bo, offset, reloc | NOUVEAU_BO_LOW, 0, 0);
so_method(so, eng2d, NV50_2D_SIFC_UNK0800, 2);
so_data (so, 0);
so_data (so, NV50_2D_SIFC_FORMAT_R8_UNORM);
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 6bf6f773b0c..79655fc08d5 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -62,6 +62,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst)
return 1;
if (!bo->tile_flags) {
+ MARK_RING (chan, 9, 2); /* flush on lack of space or relocs */
BEGIN_RING(chan, eng2d, mthd, 2);
OUT_RING (chan, format);
OUT_RING (chan, 1);
@@ -72,6 +73,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst)
OUT_RELOCh(chan, bo, ps->offset, flags);
OUT_RELOCl(chan, bo, ps->offset, flags);
} else {
+ MARK_RING (chan, 11, 2); /* flush on lack of space or relocs */
BEGIN_RING(chan, eng2d, mthd, 5);
OUT_RING (chan, format);
OUT_RING (chan, 0);
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 55a601deb8c..c4ca096d6ac 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -70,6 +70,7 @@ static const struct nv50_texture_format nv50_tex_format_list[] =
_(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5),
_MIXED(Z24S8_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8),
+ _MIXED(S8Z24_UNORM, UNORM, UINT, UINT, UINT, C0, C0, C0, ONE, 8_24),
_(R16G16B16A16_SNORM, UNORM, C0, C1, C2, C3, 16_16_16_16),
_(R16G16B16A16_UNORM, SNORM, C0, C1, C2, C3, 16_16_16_16),
@@ -87,7 +88,7 @@ static const struct nv50_texture_format nv50_tex_format_list[] =
static int
nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
- struct nv50_miptree *mt, int unit)
+ struct nv50_miptree *mt, int unit, unsigned p)
{
unsigned i;
uint32_t mode;
@@ -99,7 +100,7 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
if (i == NV50_TEX_FORMAT_LIST_SIZE)
return 1;
- if (nv50->sampler[unit]->normalized)
+ if (nv50->sampler[p][unit]->normalized)
mode = 0x50001000 | (1 << 31);
else {
mode = 0x50001000 | (7 << 14);
@@ -146,48 +147,78 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
return 0;
}
-void
-nv50_tex_validate(struct nv50_context *nv50)
+#ifndef NV50TCL_BIND_TIC
+#define NV50TCL_BIND_TIC(n) (0x1448 + 8 * n)
+#endif
+
+static boolean
+nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so,
+ unsigned p)
{
+ static const unsigned p_remap[PIPE_SHADER_TYPES] = { 0, 2 };
+
struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_stateobj *so;
- unsigned i, unit, push;
-
- push = MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2 + 23 + 6;
- so = so_new(nv50->miptree_nr * 9 + push, nv50->miptree_nr * 2 + 2);
+ unsigned unit, j, p_hw = p_remap[p];
nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM,
- nv50->miptree_nr * 8 * 4);
+ p * (32 * 8 * 4), nv50->miptree_nr[p] * 8 * 4);
- for (i = 0, unit = 0; unit < nv50->miptree_nr; ++unit) {
- struct nv50_miptree *mt = nv50->miptree[unit];
-
- if (!mt)
- continue;
+ for (unit = 0; unit < nv50->miptree_nr[p]; ++unit) {
+ struct nv50_miptree *mt = nv50->miptree[p][unit];
so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
- if (nv50_tex_construct(nv50, so, mt, unit)) {
- NOUVEAU_ERR("failed tex validate\n");
- so_ref(NULL, &so);
- return;
+ if (mt) {
+ if (nv50_tex_construct(nv50, so, mt, unit, p))
+ return FALSE;
+ /* Set TEX insn $t src binding $unit in program type p
+ * to TIC, TSC entry (32 * p + unit), mark valid (1).
+ */
+ so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_data (so, ((32 * p + unit) << 9) | (unit << 1) | 1);
+ } else {
+ for (j = 0; j < 8; ++j)
+ so_data(so, 0);
+ so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_data (so, (unit << 1) | 0);
}
+ }
+
+ for (; unit < nv50->state.miptree_nr[p]; unit++) {
+ /* Make other bindings invalid. */
+ so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_data (so, (unit << 1) | 0);
+ }
+
+ nv50->state.miptree_nr[p] = nv50->miptree_nr[p];
+ return TRUE;
+}
- so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1);
- so_data (so, (i++ << NV50TCL_SET_SAMPLER_TEX_TIC_SHIFT) |
- (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) |
- NV50TCL_SET_SAMPLER_TEX_VALID);
+void
+nv50_tex_validate(struct nv50_context *nv50)
+{
+ struct nouveau_stateobj *so;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ unsigned p, push, nrlc;
+
+ for (nrlc = 0, push = 0, p = 0; p < PIPE_SHADER_TYPES; ++p) {
+ push += MAX2(nv50->miptree_nr[p], nv50->state.miptree_nr[p]);
+ nrlc += nv50->miptree_nr[p];
}
+ push = push * 11 + 23 * PIPE_SHADER_TYPES + 4;
+ nrlc = nrlc * 2 + 2 * PIPE_SHADER_TYPES;
+
+ so = so_new(push, nrlc);
+
+ if (nv50_validate_textures(nv50, so, PIPE_SHADER_VERTEX) == FALSE ||
+ nv50_validate_textures(nv50, so, PIPE_SHADER_FRAGMENT) == FALSE) {
+ so_ref(NULL, &so);
- for (; unit < nv50->state.miptree_nr; unit++) {
- so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1);
- so_data (so,
- (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | 0);
+ NOUVEAU_ERR("failed tex validate\n");
+ return;
}
/* not sure if the following really do what I think: */
- so_method(so, tesla, 0x1440, 1); /* sync SIFC */
- so_data (so, 0);
so_method(so, tesla, 0x1330, 1); /* flush TIC */
so_data (so, 0);
so_method(so, tesla, 0x1338, 1); /* flush texture caches */
@@ -195,6 +226,4 @@ nv50_tex_validate(struct nv50_context *nv50)
so_ref(so, &nv50->state.tic_upload);
so_ref(NULL, &so);
- nv50->state.miptree_nr = nv50->miptree_nr;
}
-
diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h
index d531e611327..b870302019a 100644
--- a/src/gallium/drivers/nv50/nv50_texture.h
+++ b/src/gallium/drivers/nv50/nv50_texture.h
@@ -82,6 +82,7 @@
#define NV50TIC_0_0_FMT_RGTC1 0x00000027
#define NV50TIC_0_0_FMT_RGTC2 0x00000028
#define NV50TIC_0_0_FMT_24_8 0x00000029
+#define NV50TIC_0_0_FMT_8_24 0x0000002a
#define NV50TIC_0_0_FMT_32_DEPTH 0x0000002f
#define NV50TIC_0_0_FMT_32_8 0x00000030
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
index 39d65279fc0..6240a0c757a 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -16,16 +16,19 @@ struct nv50_transfer {
int level_depth;
int level_x;
int level_y;
+ int level_z;
+ unsigned nblocksx;
+ unsigned nblocksy;
};
static void
nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
struct nouveau_bo *src_bo, unsigned src_offset,
int src_pitch, unsigned src_tile_mode,
- int sx, int sy, int sw, int sh, int sd,
+ int sx, int sy, int sz, int sw, int sh, int sd,
struct nouveau_bo *dst_bo, unsigned dst_offset,
int dst_pitch, unsigned dst_tile_mode,
- int dx, int dy, int dw, int dh, int dd,
+ int dx, int dy, int dz, int dw, int dh, int dd,
int cpp, int width, int height,
unsigned src_reloc, unsigned dst_reloc)
{
@@ -54,7 +57,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
OUT_RING (chan, sw * cpp);
OUT_RING (chan, sh);
OUT_RING (chan, sd);
- OUT_RING (chan, 0);
+ OUT_RING (chan, sz); /* copying only 1 zslice per call */
}
if (!dst_bo->tile_flags) {
@@ -73,13 +76,13 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
OUT_RING (chan, dw * cpp);
OUT_RING (chan, dh);
OUT_RING (chan, dd);
- OUT_RING (chan, 0);
+ OUT_RING (chan, dz); /* copying only 1 zslice per call */
}
while (height) {
int line_count = height > 2047 ? 2047 : height;
- WAIT_RING (chan, 15);
+ MARK_RING (chan, 15, 4); /* flush on lack of space or relocs */
BEGIN_RING(chan, m2mf,
NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH, 2);
OUT_RELOCh(chan, src_bo, src_offset, src_reloc);
@@ -116,20 +119,6 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
}
}
-static INLINE unsigned
-get_zslice_offset(unsigned tile_mode, unsigned z, unsigned pitch, unsigned ny)
-{
- unsigned tile_h = get_tile_height(tile_mode);
- unsigned tile_d = get_tile_depth(tile_mode);
-
- /* pitch_2d == to next slice within this volume-tile */
- /* pitch_3d == to next slice in next 2D array of blocks */
- unsigned pitch_2d = tile_h * 64;
- unsigned pitch_3d = tile_d * align(ny, tile_h) * pitch;
-
- return (z % tile_d) * pitch_2d + (z / tile_d) * pitch_3d;
-}
-
static struct pipe_transfer *
nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
@@ -151,20 +140,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&tx->base.texture, pt);
- tx->base.format = pt->format;
+ tx->nblocksx = pf_get_nblocksx(pt->format, u_minify(pt->width0, level));
+ tx->nblocksy = pf_get_nblocksy(pt->format, u_minify(pt->height0, level));
tx->base.width = w;
tx->base.height = h;
- tx->base.block = pt->block;
- if (!pt->nblocksx[level]) {
- tx->base.nblocksx = pf_get_nblocksx(&pt->block,
- u_minify(pt->width0, level));
- tx->base.nblocksy = pf_get_nblocksy(&pt->block,
- u_minify(pt->height0, level));
- } else {
- tx->base.nblocksx = pt->nblocksx[level];
- tx->base.nblocksy = pt->nblocksy[level];
- }
- tx->base.stride = tx->base.nblocksx * pt->block.size;
+ tx->base.stride = tx->nblocksx * pf_get_blocksize(pt->format);
tx->base.usage = usage;
tx->level_pitch = lvl->pitch;
@@ -173,34 +153,30 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
tx->level_depth = u_minify(mt->base.base.depth0, level);
tx->level_offset = lvl->image_offset[image];
tx->level_tiling = lvl->tile_mode;
- tx->level_x = pf_get_nblocksx(&tx->base.block, x);
- tx->level_y = pf_get_nblocksy(&tx->base.block, y);
+ tx->level_z = zslice;
+ tx->level_x = pf_get_nblocksx(pt->format, x);
+ tx->level_y = pf_get_nblocksy(pt->format, y);
ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0,
- tx->base.nblocksy * tx->base.stride, &tx->bo);
+ tx->nblocksy * tx->base.stride, &tx->bo);
if (ret) {
FREE(tx);
return NULL;
}
- if (pt->target == PIPE_TEXTURE_3D)
- tx->level_offset += get_zslice_offset(lvl->tile_mode, zslice,
- lvl->pitch,
- tx->base.nblocksy);
-
if (usage & PIPE_TRANSFER_READ) {
- nx = pf_get_nblocksx(&tx->base.block, tx->base.width);
- ny = pf_get_nblocksy(&tx->base.block, tx->base.height);
+ nx = pf_get_nblocksx(pt->format, tx->base.width);
+ ny = pf_get_nblocksy(pt->format, tx->base.height);
nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset,
tx->level_pitch, tx->level_tiling,
- x, y,
- tx->base.nblocksx, tx->base.nblocksy,
+ x, y, zslice,
+ tx->nblocksx, tx->nblocksy,
tx->level_depth,
tx->bo, 0,
tx->base.stride, tx->bo->tile_mode,
- 0, 0,
- tx->base.nblocksx, tx->base.nblocksy, 1,
- tx->base.block.size, nx, ny,
+ 0, 0, 0,
+ tx->nblocksx, tx->nblocksy, 1,
+ pf_get_blocksize(pt->format), nx, ny,
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART,
NOUVEAU_BO_GART);
}
@@ -213,23 +189,24 @@ nv50_transfer_del(struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
struct nv50_miptree *mt = nv50_miptree(ptx->texture);
+ struct pipe_texture *pt = ptx->texture;
- unsigned nx = pf_get_nblocksx(&tx->base.block, tx->base.width);
- unsigned ny = pf_get_nblocksy(&tx->base.block, tx->base.height);
+ unsigned nx = pf_get_nblocksx(pt->format, tx->base.width);
+ unsigned ny = pf_get_nblocksy(pt->format, tx->base.height);
if (ptx->usage & PIPE_TRANSFER_WRITE) {
- struct pipe_screen *pscreen = ptx->texture->screen;
+ struct pipe_screen *pscreen = pt->screen;
nv50_transfer_rect_m2mf(pscreen, tx->bo, 0,
tx->base.stride, tx->bo->tile_mode,
- 0, 0,
- tx->base.nblocksx, tx->base.nblocksy, 1,
+ 0, 0, 0,
+ tx->nblocksx, tx->nblocksy, 1,
mt->base.bo, tx->level_offset,
tx->level_pitch, tx->level_tiling,
- tx->level_x, tx->level_y,
- tx->base.nblocksx, tx->base.nblocksy,
+ tx->level_x, tx->level_y, tx->level_z,
+ tx->nblocksx, tx->nblocksy,
tx->level_depth,
- tx->base.block.size, nx, ny,
+ pf_get_blocksize(pt->format), nx, ny,
NOUVEAU_BO_GART, NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART);
}
@@ -288,7 +265,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
reloc |= NOUVEAU_BO_WR;
- WAIT_RING (chan, 32);
+ MARK_RING (chan, 32, 2); /* flush on lack of space or relocs */
if (bo->tile_flags) {
BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 5);
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 63ae5c2766a..8cfd4147c20 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -4,8 +4,8 @@ include $(TOP)/configs/current
LIBNAME = r300
C_SOURCES = \
+ r300_blit.c \
r300_chipset.c \
- r300_clear.c \
r300_context.c \
r300_debug.c \
r300_emit.c \
@@ -36,4 +36,4 @@ include ../../Makefile.template
.PHONY : $(COMPILER_ARCHIVE)
$(COMPILER_ARCHIVE):
- cd $(TOP)/src/mesa/drivers/dri/r300/compiler; make
+ $(MAKE) -C $(TOP)/src/mesa/drivers/dri/r300/compiler
diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript
index 97989040d2e..0d2de17be93 100644
--- a/src/gallium/drivers/r300/SConscript
+++ b/src/gallium/drivers/r300/SConscript
@@ -9,8 +9,8 @@ env.Append(CPPPATH = ['#/src/mesa/drivers/dri/r300/compiler', '#/include', '#/sr
r300 = env.ConvenienceLibrary(
target = 'r300',
source = [
+ 'r300_blit.c',
'r300_chipset.c',
- 'r300_clear.c',
'r300_context.c',
'r300_debug.c',
'r300_emit.c',
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
new file mode 100644
index 00000000000..ffe066d5369
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2009 Marek Olšák <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_blit.h"
+#include "r300_context.h"
+
+#include "util/u_rect.h"
+
+static void r300_blitter_save_states(struct r300_context* r300)
+{
+ util_blitter_save_blend(r300->blitter, r300->blend_state);
+ util_blitter_save_depth_stencil_alpha(r300->blitter, r300->dsa_state);
+ util_blitter_save_rasterizer(r300->blitter, r300->rs_state);
+ util_blitter_save_fragment_shader(r300->blitter, r300->fs);
+ util_blitter_save_vertex_shader(r300->blitter, r300->vs);
+}
+
+/* Clear currently bound buffers. */
+void r300_clear(struct pipe_context* pipe,
+ unsigned buffers,
+ const float* rgba,
+ double depth,
+ unsigned stencil)
+{
+ /* XXX Implement fastfill.
+ *
+ * If fastfill is enabled, a few facts should be considered:
+ *
+ * 1) Zbuffer must be micro-tiled and whole microtiles must be
+ * written.
+ *
+ * 2) ZB_DEPTHCLEARVALUE is used to clear a zbuffer and Z Mask must be
+ * equal to 0.
+ *
+ * 3) RB3D_COLOR_CLEAR_VALUE is used to clear a colorbuffer and
+ * RB3D_COLOR_CHANNEL_MASK must be equal to 0.
+ *
+ * 4) ZB_CB_CLEAR can be used to make the ZB units help in clearing
+ * the colorbuffer. The color clear value is supplied through both
+ * RB3D_COLOR_CLEAR_VALUE and ZB_DEPTHCLEARVALUE, and the colorbuffer
+ * must be set in ZB_DEPTHOFFSET and ZB_DEPTHPITCH in addition to
+ * RB3D_COLOROFFSET and RB3D_COLORPITCH. It's obvious that the zbuffer
+ * will not be cleared and multiple render targets cannot be cleared
+ * this way either.
+ *
+ * 5) For 16-bit integer buffering, compression causes a hung with one or
+ * two samples and should not be used.
+ *
+ * 6) Fastfill must not be used if reading of compressed Z data is disabled
+ * and writing of compressed Z data is enabled (RD/WR_COMP_ENABLE),
+ * i.e. it cannot be used to compress the zbuffer.
+ * (what the hell does that mean and how does it fit in clearing
+ * the buffers?)
+ *
+ * - Marek
+ */
+
+ struct r300_context* r300 = r300_context(pipe);
+
+ r300_blitter_save_states(r300);
+
+ util_blitter_clear(r300->blitter,
+ r300->framebuffer_state.width,
+ r300->framebuffer_state.height,
+ r300->framebuffer_state.nr_cbufs,
+ buffers, rgba, depth, stencil);
+}
+
+/* Copy a block of pixels from one surface to another. */
+void r300_surface_copy(struct pipe_context* pipe,
+ struct pipe_surface* dst,
+ unsigned dstx, unsigned dsty,
+ struct pipe_surface* src,
+ unsigned srcx, unsigned srcy,
+ unsigned width, unsigned height)
+{
+ struct r300_context* r300 = r300_context(pipe);
+
+ /* Yeah we have to save all those states to ensure this blitter operation
+ * is really transparent. The states will be restored by the blitter once
+ * copying is done. */
+ r300_blitter_save_states(r300);
+ util_blitter_save_framebuffer(r300->blitter, &r300->framebuffer_state);
+
+ util_blitter_save_fragment_sampler_states(
+ r300->blitter, r300->sampler_count, (void**)r300->sampler_states);
+
+ util_blitter_save_fragment_sampler_textures(
+ r300->blitter, r300->texture_count,
+ (struct pipe_texture**)r300->textures);
+
+ /* Do a copy */
+ util_blitter_copy(r300->blitter,
+ dst, dstx, dsty, src, srcx, srcy, width, height, TRUE);
+}
+
+/* Fill a region of a surface with a constant value. */
+void r300_surface_fill(struct pipe_context* pipe,
+ struct pipe_surface* dst,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height,
+ unsigned value)
+{
+ struct r300_context* r300 = r300_context(pipe);
+
+ r300_blitter_save_states(r300);
+ util_blitter_save_framebuffer(r300->blitter, &r300->framebuffer_state);
+
+ util_blitter_fill(r300->blitter,
+ dst, dstx, dsty, width, height, value);
+}
diff --git a/src/gallium/drivers/r300/r300_clear.h b/src/gallium/drivers/r300/r300_blit.h
index b8fcdf273c7..029e4f98e7d 100644
--- a/src/gallium/drivers/r300/r300_clear.h
+++ b/src/gallium/drivers/r300/r300_blit.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Corbin Simpson <[email protected]>
+ * Copyright 2008 Marek Olšák <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -20,10 +20,11 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#ifndef R300_CLEAR_H
-#define R300_CLEAR_H
+#ifndef R300_BLIT_H
+#define R300_BLIT_H
struct pipe_context;
+struct pipe_surface;
void r300_clear(struct pipe_context* pipe,
unsigned buffers,
@@ -31,4 +32,17 @@ void r300_clear(struct pipe_context* pipe,
double depth,
unsigned stencil);
-#endif /* R300_CLEAR_H */
+void r300_surface_copy(struct pipe_context* pipe,
+ struct pipe_surface* dst,
+ unsigned dstx, unsigned dsty,
+ struct pipe_surface* src,
+ unsigned srcx, unsigned srcy,
+ unsigned width, unsigned height);
+
+void r300_surface_fill(struct pipe_context* pipe,
+ struct pipe_surface* dst,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height,
+ unsigned value);
+
+#endif /* R300_BLIT_H */
diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c
deleted file mode 100644
index 02d6d504fc0..00000000000
--- a/src/gallium/drivers/r300/r300_clear.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <[email protected]>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "r300_clear.h"
-#include "r300_context.h"
-
-#include "util/u_clear.h"
-
-/* Clears currently bound buffers. */
-void r300_clear(struct pipe_context* pipe,
- unsigned buffers,
- const float* rgba,
- double depth,
- unsigned stencil)
-{
- /* XXX we can and should do one clear if both color and zs are set */
- util_clear(pipe, &r300_context(pipe)->framebuffer_state,
- buffers, rgba, depth, stencil);
-}
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 68a17dcb63d..d5c2d63d393 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -28,7 +28,7 @@
#include "util/u_memory.h"
#include "util/u_simple_list.h"
-#include "r300_clear.h"
+#include "r300_blit.h"
#include "r300_context.h"
#include "r300_flush.h"
#include "r300_query.h"
@@ -36,8 +36,8 @@
#include "r300_screen.h"
#include "r300_state_derived.h"
#include "r300_state_invariant.h"
-
-#include "radeon_winsys.h"
+#include "r300_texture.h"
+#include "r300_winsys.h"
static enum pipe_error r300_clear_hash_table(void* key, void* value,
void* data)
@@ -52,6 +52,8 @@ static void r300_destroy_context(struct pipe_context* context)
struct r300_context* r300 = r300_context(context);
struct r300_query* query, * temp;
+ util_blitter_destroy(r300->blitter);
+
util_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table,
NULL);
util_hash_table_destroy(r300->shader_hash_table);
@@ -124,6 +126,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.destroy = r300_destroy_context;
r300->context.clear = r300_clear;
+ r300->context.surface_copy = r300_surface_copy;
+ r300->context.surface_fill = r300_surface_fill;
if (r300screen->caps->has_tcl) {
r300->context.draw_arrays = r300_draw_arrays;
@@ -175,5 +179,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw++;
+
+ r300->blitter = util_blitter_create(&r300->context);
+
return &r300->context;
}
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index dd3f6ac1432..6bd2766730f 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -25,6 +25,8 @@
#include "draw/draw_vertex.h"
+#include "util/u_blitter.h"
+
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
@@ -98,9 +100,17 @@ struct r300_sampler_state {
unsigned min_lod, max_lod;
};
+struct r300_scissor_regs {
+ uint32_t top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */
+ uint32_t bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */
+
+ /* Whether everything is culled by scissoring. */
+ boolean empty_area;
+};
+
struct r300_scissor_state {
- uint32_t scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */
- uint32_t scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */
+ struct r300_scissor_regs framebuffer;
+ struct r300_scissor_regs scissor;
};
struct r300_texture_state {
@@ -240,6 +250,8 @@ struct r300_context {
struct radeon_winsys* winsys;
/* Draw module. Used mostly for SW TCL. */
struct draw_context* draw;
+ /* Accelerated blit support. */
+ struct blitter_context* blitter;
/* Vertex buffer for rendering. */
struct pipe_buffer* vbo;
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 8b100375fdf..d142fee0502 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -55,7 +55,7 @@
int cs_count = 0;
#define CHECK_CS(size) \
- cs_winsys->check_cs(cs_winsys, (size))
+ assert(cs_winsys->check_cs(cs_winsys, (size)))
#define BEGIN_CS(size) do { \
CHECK_CS(size); \
@@ -115,6 +115,15 @@
cs_count -= 3; \
} while (0)
+#define OUT_CS_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \
+ DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, " \
+ "domains (%d, %d, %d)\n", \
+ bo, rd, wd, flags); \
+ assert(bo); \
+ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
+ cs_count -= 2; \
+} while (0)
+
#define END_CS do { \
if (VERY_VERBOSE_CS) { \
DBG(cs_context_copy, DBG_CS, "r300: END_CS in %s (%s:%d)\n", __FUNCTION__, \
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 171859b8e43..52a8388ead3 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Corbin Simpson <[email protected]>
+ * Copyright 2009 Marek Olšák <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -41,9 +42,16 @@ void r300_emit_blend_state(struct r300_context* r300,
CS_LOCALS(r300);
BEGIN_CS(8);
OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3);
- OUT_CS(blend->blend_control);
- OUT_CS(blend->alpha_blend_control);
- OUT_CS(blend->color_channel_mask);
+ if (r300->framebuffer_state.nr_cbufs) {
+ OUT_CS(blend->blend_control);
+ OUT_CS(blend->alpha_blend_control);
+ OUT_CS(blend->color_channel_mask);
+ } else {
+ OUT_CS(0);
+ OUT_CS(0);
+ OUT_CS(0);
+ /* XXX also disable fastfill here once it's supported */
+ }
OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
END_CS;
@@ -277,7 +285,7 @@ void r500_emit_fragment_program_code(struct r300_context* r300,
BEGIN_CS(13 +
((code->inst_end + 1) * 6));
- OUT_CS_REG(R500_US_CONFIG, 0);
+ OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
OUT_CS_REG(R500_US_PIXSIZE, code->max_temp_idx);
OUT_CS_REG(R500_US_CODE_RANGE,
R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(code->inst_end));
@@ -331,7 +339,13 @@ void r300_emit_fb_state(struct r300_context* r300,
int i;
CS_LOCALS(r300);
- BEGIN_CS((10 * fb->nr_cbufs) + (fb->zsbuf ? 10 : 0) + 4);
+ /* Shouldn't fail unless there is a bug in the state tracker. */
+ assert(fb->nr_cbufs <= 4);
+
+ BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) +
+ (fb->zsbuf ? 10 : 0) + 6);
+
+ /* Flush and free renderbuffer caches. */
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
@@ -339,6 +353,10 @@ void r300_emit_fb_state(struct r300_context* r300,
R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
+ /* Set the number of colorbuffers. */
+ OUT_CS_REG(R300_RB3D_CCTL, R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs));
+
+ /* Set up colorbuffers. */
for (i = 0; i < fb->nr_cbufs; i++) {
surf = fb->cbufs[i];
tex = (struct r300_texture*)surf->texture;
@@ -356,6 +374,12 @@ void r300_emit_fb_state(struct r300_context* r300,
r300_translate_out_fmt(surf->format));
}
+ /* Disable unused colorbuffers. */
+ for (; i < 4; i++) {
+ OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), R300_US_OUT_FMT_UNUSED);
+ }
+
+ /* Set up a zbuffer. */
if (fb->zsbuf) {
surf = fb->zsbuf;
tex = (struct r300_texture*)surf->texture;
@@ -383,8 +407,6 @@ static void r300_emit_query_start(struct r300_context *r300)
if (!query)
return;
- /* XXX This will almost certainly not return good results
- * for overlapping queries. */
BEGIN_CS(4);
if (caps->family == CHIP_FAMILY_RV530) {
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
@@ -566,18 +588,28 @@ void r300_emit_rs_block_state(struct r300_context* r300,
END_CS;
}
-void r300_emit_scissor_state(struct r300_context* r300,
- struct r300_scissor_state* scissor)
+static void r300_emit_scissor_regs(struct r300_context* r300,
+ struct r300_scissor_regs* scissor)
{
CS_LOCALS(r300);
BEGIN_CS(3);
OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
- OUT_CS(scissor->scissor_top_left);
- OUT_CS(scissor->scissor_bottom_right);
+ OUT_CS(scissor->top_left);
+ OUT_CS(scissor->bottom_right);
END_CS;
}
+void r300_emit_scissor_state(struct r300_context* r300,
+ struct r300_scissor_state* scissor)
+{
+ if (r300->rs_state->rs.scissor) {
+ r300_emit_scissor_regs(r300, &scissor->scissor);
+ } else {
+ r300_emit_scissor_regs(r300, &scissor->framebuffer);
+ }
+}
+
void r300_emit_texture(struct r300_context* r300,
struct r300_sampler_state* sampler,
struct r300_texture* tex,
@@ -616,50 +648,68 @@ void r300_emit_texture(struct r300_context* r300,
END_CS;
}
-/* XXX I can't read this and that's not good */
-void r300_emit_aos(struct r300_context* r300, unsigned offset)
+static boolean r300_validate_aos(struct r300_context *r300)
{
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->vertex_element;
- CS_LOCALS(r300);
int i;
- unsigned aos_count = r300->vertex_element_count;
+ /* Check if formats and strides are aligned to the size of DWORD. */
+ for (i = 0; i < r300->vertex_element_count; i++) {
+ if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 ||
+ pf_get_blocksize(velem[i].src_format) % 4 != 0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+void r300_emit_aos(struct r300_context* r300, unsigned offset)
+{
+ struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
+ struct pipe_vertex_element *velem = r300->vertex_element;
+ int i;
+ unsigned size1, size2, aos_count = r300->vertex_element_count;
unsigned packet_size = (aos_count * 3 + 1) / 2;
+ CS_LOCALS(r300);
+
+ /* XXX Move this checking to a more approriate place. */
+ if (!r300_validate_aos(r300)) {
+ /* XXX We should fallback using Draw. */
+ assert(0);
+ }
+
BEGIN_CS(2 + packet_size + aos_count * 2);
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
OUT_CS(aos_count);
+
for (i = 0; i < aos_count - 1; i += 2) {
- int buf_num1 = velem[i].vertex_buffer_index;
- int buf_num2 = velem[i+1].vertex_buffer_index;
- assert(vbuf[buf_num1].stride % 4 == 0 && util_format_get_size(velem[i].src_format) % 4 == 0);
- assert(vbuf[buf_num2].stride % 4 == 0 && util_format_get_size(velem[i+1].src_format) % 4 == 0);
- OUT_CS((util_format_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num1].stride << 6) |
- (util_format_get_size(velem[i+1].src_format) << 14) | (vbuf[buf_num2].stride << 22));
- OUT_CS(vbuf[buf_num1].buffer_offset + velem[i].src_offset +
- offset * vbuf[buf_num1].stride);
- OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset +
- offset * vbuf[buf_num2].stride);
+ vb1 = &vbuf[velem[i].vertex_buffer_index];
+ vb2 = &vbuf[velem[i+1].vertex_buffer_index];
+ size1 = util_format_get_size(velem[i].src_format);
+ size2 = util_format_get_size(velem[i+1].src_format);
+
+ OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
+ R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride));
+ OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
+ OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
}
+
if (aos_count & 1) {
- int buf_num = velem[i].vertex_buffer_index;
- assert(vbuf[buf_num].stride % 4 == 0 && util_format_get_size(velem[i].src_format) % 4 == 0);
- OUT_CS((util_format_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6));
- OUT_CS(vbuf[buf_num].buffer_offset + velem[i].src_offset +
- offset * vbuf[buf_num].stride);
+ vb1 = &vbuf[velem[i].vertex_buffer_index];
+ size1 = util_format_get_size(velem[i].src_format);
+
+ OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
+ OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
}
- /* XXX bare CS reloc */
for (i = 0; i < aos_count; i++) {
- cs_winsys->write_cs_reloc(cs_winsys,
- vbuf[velem[i].vertex_buffer_index].buffer,
- RADEON_GEM_DOMAIN_GTT,
- 0,
- 0);
- cs_count -= 2;
+ OUT_CS_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
}
END_CS;
}
+
#if 0
void r300_emit_draw_packet(struct r300_context* r300)
{
@@ -834,10 +884,21 @@ void r300_emit_viewport_state(struct r300_context* r300,
void r300_emit_texture_count(struct r300_context* r300)
{
+ uint32_t tx_enable = 0;
+ int i;
CS_LOCALS(r300);
+ /* Notice that texture_count and sampler_count are just sizes
+ * of the respective arrays. We still have to check for the individual
+ * elements. */
+ for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
+ if (r300->textures[i]) {
+ tx_enable |= 1 << i;
+ }
+ }
+
BEGIN_CS(2);
- OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
+ OUT_CS_REG(R300_TX_ENABLE, tx_enable);
END_CS;
}
@@ -872,10 +933,17 @@ void r300_emit_dirty_state(struct r300_context* r300)
return;
}
+ /* Check size of CS. */
+ /* Make sure we have at least 8*1024 spare dwords. */
+ /* XXX It would be nice to know the number of dwords we really need to
+ * XXX emit. */
+ if (!r300->winsys->check_cs(r300->winsys, 8*1024)) {
+ r300->context.flush(&r300->context, 0, NULL);
+ }
+
/* Clean out BOs. */
r300->winsys->reset_bos(r300->winsys);
- /* XXX check size */
validate:
/* Color buffers... */
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 85b1ea568a3..d8d08fbe264 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -2145,6 +2145,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Unpipelined. */
#define R300_RB3D_CCTL 0x4e00
+# define R300_RB3D_CCTL_NUM_MULTIWRITES(x) (MAX2(((x)-1), 0) << 5)
# define R300_RB3D_CCTL_NUM_MULTIWRITES_1_BUFFER (0 << 5)
# define R300_RB3D_CCTL_NUM_MULTIWRITES_2_BUFFERS (1 << 5)
# define R300_RB3D_CCTL_NUM_MULTIWRITES_3_BUFFERS (2 << 5)
@@ -3293,6 +3294,11 @@ enum {
*/
#define R300_PACKET3_3D_LOAD_VBPNTR 0x00002F00
+# define R300_VBPNTR_SIZE0(x) ((x) >> 2)
+# define R300_VBPNTR_STRIDE0(x) (((x) >> 2) << 8)
+# define R300_VBPNTR_SIZE1(x) (((x) >> 2) << 16)
+# define R300_VBPNTR_STRIDE1(x) (((x) >> 2) << 24)
+
#define R300_PACKET3_INDX_BUFFER 0x00003300
# define R300_INDX_BUFFER_DST_SHIFT 0
# define R300_INDX_BUFFER_SKIP_SHIFT 16
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 4c5fb405c6a..4b210f72db2 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -70,14 +70,21 @@ uint32_t r300_translate_primitive(unsigned prim)
}
}
+static boolean r300_nothing_to_draw(struct r300_context *r300)
+{
+ return r300->rs_state->rs.scissor &&
+ r300->scissor_state->scissor.empty_area;
+}
+
static void r300_emit_draw_arrays(struct r300_context *r300,
unsigned mode,
unsigned count)
{
CS_LOCALS(r300);
- BEGIN_CS(4);
- OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count);
+ BEGIN_CS(6);
+ OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0);
+ OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count - 1);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300_translate_primitive(mode));
@@ -102,7 +109,8 @@ static void r300_emit_draw_elements(struct r300_context *r300,
assert((start * indexSize) % 4 == 0);
assert(offset_dwords == 0);
- BEGIN_CS(10);
+ BEGIN_CS(12);
+ OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, minIndex);
OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
if (indexSize == 4) {
@@ -173,10 +181,15 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
return FALSE;
}
+
if (count > 65535) {
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
@@ -218,6 +231,10 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
@@ -251,6 +268,10 @@ boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
void* buf = pipe_buffer_map(pipe->screen,
r300->vertex_buffer[i].buffer,
@@ -292,6 +313,10 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
void* buf = pipe_buffer_map(pipe->screen,
r300->vertex_buffer[i].buffer,
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 2e7b1423e6c..feb571a23dd 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -220,12 +220,18 @@ static boolean check_tex_format(enum pipe_format format, uint32_t usage,
/* Z buffer or texture */
case PIPE_FORMAT_Z16_UNORM:
+ retval = usage &
+ (PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
+ PIPE_TEXTURE_USAGE_SAMPLER);
+ break;
+
+ /* 24bit Z buffer can only be used as a texture on R500. */
case PIPE_FORMAT_Z24X8_UNORM:
/* Z buffer with stencil or texture */
case PIPE_FORMAT_Z24S8_UNORM:
retval = usage &
(PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
- PIPE_TEXTURE_USAGE_SAMPLER);
+ (is_r500 ? PIPE_TEXTURE_USAGE_SAMPLER : 0));
break;
/* Definitely unsupported formats. */
@@ -312,14 +318,10 @@ r300_get_tex_transfer(struct pipe_screen *screen,
trans = CALLOC_STRUCT(r300_transfer);
if (trans) {
pipe_texture_reference(&trans->transfer.texture, texture);
- trans->transfer.format = texture->format;
trans->transfer.x = x;
trans->transfer.y = y;
trans->transfer.width = w;
trans->transfer.height = h;
- trans->transfer.block = texture->block;
- trans->transfer.nblocksx = texture->nblocksx[level];
- trans->transfer.nblocksy = texture->nblocksy[level];
trans->transfer.stride = r300_texture_get_stride(tex, level);
trans->transfer.usage = usage;
@@ -345,6 +347,7 @@ static void* r300_transfer_map(struct pipe_screen* screen,
{
struct r300_texture* tex = (struct r300_texture*)transfer->texture;
char* map;
+ enum pipe_format format = tex->tex.format;
map = pipe_buffer_map(screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
@@ -354,8 +357,8 @@ static void* r300_transfer_map(struct pipe_screen* screen,
}
return map + r300_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
}
static void r300_transfer_unmap(struct pipe_screen* screen,
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 442af70e143..91cf972edee 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -151,9 +151,10 @@ static void r300_set_blend_color(struct pipe_context* pipe,
const struct pipe_blend_color* color)
{
struct r300_context* r300 = r300_context(pipe);
+ union util_color uc;
- util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM,
- &r300->blend_color_state->blend_color);
+ util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
+ r300->blend_color_state->blend_color = uc.ui;
/* XXX if FP16 blending is enabled, we should use the FP16 format */
r300->blend_color_state->blend_color_red_alpha =
@@ -289,11 +290,37 @@ static void r300_set_edgeflags(struct pipe_context* pipe,
/* XXX and even worse, I have no idea WTF the bitfield is */
}
+static void r300_set_scissor_regs(const struct pipe_scissor_state* state,
+ struct r300_scissor_regs *scissor,
+ boolean is_r500)
+{
+ if (is_r500) {
+ scissor->top_left =
+ (state->minx << R300_SCISSORS_X_SHIFT) |
+ (state->miny << R300_SCISSORS_Y_SHIFT);
+ scissor->bottom_right =
+ ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) |
+ ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT);
+ } else {
+ /* Offset of 1440 in non-R500 chipsets. */
+ scissor->top_left =
+ ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
+ ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
+ scissor->bottom_right =
+ (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
+ (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
+ }
+
+ scissor->empty_area = state->minx >= state->maxx ||
+ state->miny >= state->maxy;
+}
+
static void
r300_set_framebuffer_state(struct pipe_context* pipe,
const struct pipe_framebuffer_state* state)
{
struct r300_context* r300 = r300_context(pipe);
+ struct pipe_scissor_state scissor;
if (r300->draw) {
draw_flush(r300->draw);
@@ -301,7 +328,18 @@ static void
r300->framebuffer_state = *state;
+ scissor.minx = scissor.miny = 0;
+ scissor.maxx = state->width;
+ scissor.maxy = state->height;
+ r300_set_scissor_regs(&scissor, &r300->scissor_state->framebuffer,
+ r300_screen(r300->context.screen)->caps->is_r500);
+
+ /* Don't rely on the order of states being set for the first time. */
+ if (!r300->rs_state || !r300->rs_state->rs.scissor) {
+ r300->dirty_state |= R300_NEW_SCISSOR;
+ }
r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
+ r300->dirty_state |= R300_NEW_BLEND;
}
/* Create fragment shader state. */
@@ -382,8 +420,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
if (state->bypass_vs_clip_and_viewport ||
!r300_screen(pipe->screen)->caps->has_tcl) {
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
- } else {
- rs->rs.bypass_vs_clip_and_viewport = TRUE;
}
rs->point_size = pack_float_16_6x(state->point_size) |
@@ -513,6 +549,7 @@ static void*
struct r300_context* r300 = r300_context(pipe);
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
int lod_bias;
+ union util_color uc;
sampler->filter0 |=
(r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
@@ -534,8 +571,8 @@ static void*
sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
- util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM,
- &sampler->border_color);
+ util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
+ sampler->border_color = uc.ui;
/* R500-specific fixups and optimizations */
if (r300_screen(r300->context.screen)->caps->is_r500) {
@@ -590,8 +627,6 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
return;
}
- r300->context.flush(&r300->context, 0, NULL);
-
for (i = 0; i < count; i++) {
if (r300->textures[i] != (struct r300_texture*)texture[i]) {
pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
@@ -623,24 +658,13 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
- if (r300_screen(r300->context.screen)->caps->is_r500) {
- r300->scissor_state->scissor_top_left =
- (state->minx << R300_SCISSORS_X_SHIFT) |
- (state->miny << R300_SCISSORS_Y_SHIFT);
- r300->scissor_state->scissor_bottom_right =
- ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) |
- ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT);
- } else {
- /* Offset of 1440 in non-R500 chipsets. */
- r300->scissor_state->scissor_top_left =
- ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
- ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
- r300->scissor_state->scissor_bottom_right =
- (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
- (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
- }
+ r300_set_scissor_regs(state, &r300->scissor_state->scissor,
+ r300_screen(r300->context.screen)->caps->is_r500);
- r300->dirty_state |= R300_NEW_SCISSOR;
+ /* Don't rely on the order of states being set for the first time. */
+ if (!r300->rs_state || r300->rs_state->rs.scissor) {
+ r300->dirty_state |= R300_NEW_SCISSOR;
+ }
}
static void r300_set_viewport_state(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index cd969d633bc..29bc701a86e 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -134,6 +134,16 @@ static void r300_vertex_psc(struct r300_context* r300)
uint16_t type, swizzle;
enum pipe_format format;
unsigned i;
+ int identity[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ int* stream_tab;
+
+ /* If TCL is bypassed, map vertex streams to equivalent VS output
+ * locations. */
+ if (r300->rs_state->enable_vte) {
+ stream_tab = identity;
+ } else {
+ stream_tab = r300->vs->stream_loc_notcl;
+ }
/* Vertex shaders have no semantics on their inputs,
* so PSC should just route stuff based on the vertex elements,
@@ -147,10 +157,10 @@ static void r300_vertex_psc(struct r300_context* r300)
format = r300->vertex_element[i].src_format;
type = r300_translate_vertex_data_type(format) |
- (i << R300_DST_VEC_LOC_SHIFT);
+ (stream_tab[i] << R300_DST_VEC_LOC_SHIFT);
swizzle = r300_translate_vertex_data_swizzle(format);
- if (i % 2) {
+ if (i & 1) {
vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
} else {
@@ -159,7 +169,6 @@ static void r300_vertex_psc(struct r300_context* r300)
}
}
-
assert(i <= 15);
/* Set the last vector in the PSC. */
@@ -178,7 +187,7 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300)
uint16_t type, swizzle;
enum pipe_format format;
unsigned i, attrib_count;
- int* vs_output_tab = r300->vs->output_stream_loc_swtcl;
+ int* vs_output_tab = r300->vs->stream_loc_notcl;
/* For each Draw attribute, route it to the fragment shader according
* to the vs_output_tab. */
@@ -462,6 +471,29 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
r300->dirty_state |= R300_NEW_RS_BLOCK;
}
+static boolean r300_dsa_writes_depth_stencil(struct r300_dsa_state* dsa)
+{
+ /* We are interested only in the cases when a new depth or stencil value
+ * can be written and changed. */
+
+ /* We might optionally check for [Z func: never] and inspect the stencil
+ * state in a similar fashion, but it's not terribly important. */
+ return (dsa->z_buffer_control & R300_Z_WRITE_ENABLE) ||
+ (dsa->stencil_ref_mask & R300_STENCILWRITEMASK_MASK) ||
+ ((dsa->z_buffer_control & R500_STENCIL_REFMASK_FRONT_BACK) &&
+ (dsa->stencil_ref_bf & R300_STENCILWRITEMASK_MASK));
+}
+
+static boolean r300_dsa_alpha_test_enabled(struct r300_dsa_state* dsa)
+{
+ /* We are interested only in the cases when alpha testing can kill
+ * a fragment. */
+ uint32_t af = dsa->alpha_function;
+
+ return (af & R300_FG_ALPHA_FUNC_ENABLE) &&
+ (af & R300_FG_ALPHA_FUNC_ALWAYS) != R300_FG_ALPHA_FUNC_ALWAYS;
+}
+
static void r300_update_ztop(struct r300_context* r300)
{
r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE;
@@ -478,19 +510,25 @@ static void r300_update_ztop(struct r300_context* r300)
* The docs claim that for the first three cases, if no ZS writes happen,
* then ZTOP can be used.
*
+ * (3) will never apply since we do not support chroma-keyed operations.
+ * (4) will need to be re-examined (and this comment updated) if/when
+ * Hyper-Z becomes supported.
+ *
* Additionally, the following conditions require disabled ZTOP:
- * ~) Depth writes in fragment shader
- * ~) Outstanding occlusion queries
+ * 5) Depth writes in fragment shader
+ * 6) Outstanding occlusion queries
*
* ~C.
*/
- if (r300->dsa_state->alpha_function) {
- r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
- } else if (r300->fs->info.uses_kill) {
+
+ /* ZS writes */
+ if (r300_dsa_writes_depth_stencil(r300->dsa_state) &&
+ (r300_dsa_alpha_test_enabled(r300->dsa_state) || /* (1) */
+ r300->fs->info.uses_kill)) { /* (2) */
r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
- } else if (r300_fragment_shader_writes_depth(r300->fs)) {
+ } else if (r300_fragment_shader_writes_depth(r300->fs)) { /* (5) */
r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
- } else if (r300->query_current) {
+ } else if (r300->query_current) { /* (6) */
r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
}
}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index 46d1cb39b54..bcd4c030f9c 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -43,7 +43,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
CS_LOCALS(r300);
- BEGIN_CS(24 + (caps->has_tcl ? 2: 0));
+ BEGIN_CS(20 + (caps->has_tcl ? 2: 0));
/*** Graphics Backend (GB) ***/
/* Various GB enables */
@@ -70,9 +70,6 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_REG(R300_US_W_FMT, 0x0);
/*** VAP ***/
- /* Max and min vertex index clamp. */
- OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
- OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xffffff);
/* Sign/normalize control */
OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, R300_SGN_NORM_NO_ZERO);
/* TCL-only stuff */
@@ -84,15 +81,11 @@ void r300_emit_invariant_state(struct r300_context* r300)
END_CS;
/* XXX unsorted stuff from surface_fill */
- BEGIN_CS(56 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0));
- /* Flush PVS. */
- OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+ BEGIN_CS(44 + (caps->has_tcl ? 7 : 0) + (caps->is_r500 ? 4 : 0));
- OUT_CS_REG(R300_SE_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
- R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
- R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
- R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
if (caps->has_tcl) {
+ /*Flushing PVS is required before the VAP_GB registers can be changed*/
+ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0);
OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4);
OUT_CS_32F(1.0);
OUT_CS_32F(1.0);
@@ -123,19 +116,15 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000);
OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C);
OUT_CS_REG(R300_SC_EDGERULE, 0x2DA49525);
- OUT_CS_REG(R300_RB3D_CCTL, 0x00000000);
OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000);
if (caps->is_r500) {
OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000);
OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFFFFFFFF);
}
- OUT_CS_REG(R300_ZB_FORMAT, 0x00000002);
- OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, 0x00000003);
OUT_CS_REG(R300_ZB_BW_CNTL, 0x00000000);
OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
- OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
/* XXX */
OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 5538ec3918d..170483b9bb0 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -106,7 +106,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level)
return 0;
}
- return align(pf_get_stride(&tex->tex.block, u_minify(tex->tex.width0, level)), 32);
+ return align(pf_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32);
}
static void r300_setup_miptree(struct r300_texture* tex)
@@ -116,11 +116,10 @@ static void r300_setup_miptree(struct r300_texture* tex)
int i;
for (i = 0; i <= base->last_level; i++) {
- base->nblocksx[i] = pf_get_nblocksx(&base->block, u_minify(base->width0, i));
- base->nblocksy[i] = pf_get_nblocksy(&base->block, u_minify(base->height0, i));
+ unsigned nblocksy = pf_get_nblocksy(base->format, u_minify(base->height0, i));
stride = r300_texture_get_stride(tex, i);
- layer_size = stride * base->nblocksy[i];
+ layer_size = stride * nblocksy;
if (base->target == PIPE_TEXTURE_CUBE)
size = layer_size * 6;
@@ -130,7 +129,7 @@ static void r300_setup_miptree(struct r300_texture* tex)
tex->offset[i] = align(tex->size, 32);
tex->size = tex->offset[i] + size;
tex->layer_size[i] = layer_size;
- tex->pitch[i] = stride / base->block.size;
+ tex->pitch[i] = stride / pf_get_blocksize(base->format);
debug_printf("r300: Texture miptree: Level %d "
"(%dx%dx%d px, pitch %d bytes)\n",
@@ -246,7 +245,7 @@ static struct pipe_texture*
tex->tex.screen = screen;
tex->stride_override = *stride;
- tex->pitch[0] = *stride / base->block.size;
+ tex->pitch[0] = *stride / pf_get_blocksize(base->format);
r300_setup_flags(tex);
r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500);
@@ -284,7 +283,6 @@ r300_video_surface_create(struct pipe_screen *screen,
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
template.depth0 = 1;
- util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER |
PIPE_TEXTURE_USAGE_RENDER_TARGET;
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index 31248346bc6..fa207c939ca 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -143,35 +143,33 @@ static void r300_shader_vap_output_fmt(
assert(gen_count <= 8);
}
-/* Set VS output stream locations for SWTCL. */
-static void r300_stream_locations_swtcl(
+/* Sets up stream mapping to equivalent VS outputs if TCL is bypassed
+ * or isn't present. */
+static void r300_stream_locations_notcl(
struct r300_shader_semantics* vs_outputs,
- int* output_stream_loc)
+ int* stream_loc)
{
int i, tabi = 0, gen_count;
- /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct.
- * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */
-
/* Position. */
- output_stream_loc[tabi++] = 0;
+ stream_loc[tabi++] = 0;
/* Point size. */
if (vs_outputs->psize != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 1;
+ stream_loc[tabi++] = 1;
}
/* Colors. */
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->color[i] != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 2 + i;
+ stream_loc[tabi++] = 2 + i;
}
}
/* Back-face colors. */
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->bcolor[i] != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 4 + i;
+ stream_loc[tabi++] = 4 + i;
}
}
@@ -180,7 +178,7 @@ static void r300_stream_locations_swtcl(
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
if (vs_outputs->bcolor[i] != ATTR_UNUSED) {
assert(tabi < 16);
- output_stream_loc[tabi++] = 6 + gen_count;
+ stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
}
@@ -188,7 +186,7 @@ static void r300_stream_locations_swtcl(
/* Fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED) {
assert(tabi < 16);
- output_stream_loc[tabi++] = 6 + gen_count;
+ stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
@@ -196,7 +194,7 @@ static void r300_stream_locations_swtcl(
assert(gen_count <= 8);
for (; tabi < 16;) {
- output_stream_loc[tabi++] = -1;
+ stream_loc[tabi++] = -1;
}
}
@@ -254,10 +252,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
/* Initialize. */
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
r300_shader_vap_output_fmt(&vs->outputs, vs->hwfmt);
-
- if (!r300_screen(r300->context.screen)->caps->has_tcl) {
- r300_stream_locations_swtcl(&vs->outputs, vs->output_stream_loc_swtcl);
- }
+ r300_stream_locations_notcl(&vs->outputs, vs->stream_loc_notcl);
/* Setup the compiler */
rc_init(&compiler.Base);
@@ -283,7 +278,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
/* Invoke the compiler */
r3xx_compile_vertex_program(&compiler);
if (compiler.Base.Error) {
- /* XXX Fail gracefully */
+ /* XXX We should fallback using Draw. */
fprintf(stderr, "r300 VP: Compiler error\n");
abort();
}
diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h
index 283dd5a9e83..67e9db5366f 100644
--- a/src/gallium/drivers/r300/r300_vs.h
+++ b/src/gallium/drivers/r300/r300_vs.h
@@ -38,9 +38,11 @@ struct r300_vertex_shader {
struct tgsi_shader_info info;
struct r300_shader_semantics outputs;
- int output_stream_loc_swtcl[16];
uint hwfmt[4];
+ /* Stream locations for SWTCL or if TCL is bypassed. */
+ int stream_loc_notcl[16];
+
/* Has this shader been translated yet? */
boolean translated;
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index f86985841f3..1ae6de70fee 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -35,6 +35,8 @@ extern "C" {
#include "pipe/p_state.h"
#include "pipe/internal/p_winsys_screen.h"
+#include "radeon_winsys.h"
+
struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct radeon_winsys* radeon_winsys);
diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c
index 8fac8e6e05f..f98087deb8c 100644
--- a/src/gallium/drivers/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
@@ -48,6 +48,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
double depth, unsigned stencil)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ union util_color uc;
unsigned cv;
uint i;
@@ -62,12 +63,12 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
- util_pack_color(rgba, ps->format, &cv);
- sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);
+ util_pack_color(rgba, ps->format, &uc);
+ sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui);
#if !TILE_CLEAR_OPTIMIZATION
/* non-cached surface */
- pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
#endif
}
}
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 6bf3df8e6ad..bd3532de4f4 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -149,6 +149,7 @@ softpipe_is_format_supported( struct pipe_screen *screen,
case PIPE_FORMAT_B6UG5SR5S_NORM:
case PIPE_FORMAT_X8UB8UG8SR8S_NORM:
case PIPE_FORMAT_A8B8G8R8_SNORM:
+ case PIPE_FORMAT_NONE:
return FALSE;
default:
return TRUE;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 0f3323ff2f1..9e83410fcd0 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -65,13 +65,11 @@ softpipe_texture_layout(struct pipe_screen *screen,
pt->depth0 = depth;
for (level = 0; level <= pt->last_level; level++) {
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
- spt->stride[level] = pt->nblocksx[level]*pt->block.size;
+ spt->stride[level] = pf_get_stride(pt->format, width);
spt->level_offset[level] = buffer_size;
- buffer_size += (pt->nblocksy[level] *
+ buffer_size += (pf_get_nblocksy(pt->format, height) *
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
spt->stride[level]);
@@ -99,9 +97,6 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
unsigned tex_usage = spt->base.tex_usage;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
-
spt->buffer = screen->surface_buffer_create( screen,
spt->base.width0,
spt->base.height0,
@@ -177,8 +172,6 @@ softpipe_texture_blanket(struct pipe_screen * screen,
spt->base = *base;
pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
spt->stride[0] = stride[0];
pipe_buffer_reference(&spt->buffer, buffer);
@@ -246,10 +239,12 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps->zslice = zslice;
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset += face * pt->nblocksy[level] * spt->stride[level];
+ ps->offset += face * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
+ spt->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset += zslice * pt->nblocksy[level] * spt->stride[level];
+ ps->offset += zslice * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) *
+ spt->stride[level];
}
else {
assert(face == 0);
@@ -304,15 +299,12 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt = CALLOC_STRUCT(softpipe_transfer);
if (spt) {
struct pipe_transfer *pt = &spt->base;
+ int nblocksy = pf_get_nblocksy(texture->format, u_minify(texture->height0, level));
pipe_texture_reference(&pt->texture, texture);
- pt->format = texture->format;
- pt->block = texture->block;
pt->x = x;
pt->y = y;
pt->width = w;
pt->height = h;
- pt->nblocksx = texture->nblocksx[level];
- pt->nblocksy = texture->nblocksy[level];
pt->stride = sptex->stride[level];
pt->usage = usage;
pt->face = face;
@@ -322,10 +314,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt->offset = sptex->level_offset[level];
if (texture->target == PIPE_TEXTURE_CUBE) {
- spt->offset += face * pt->nblocksy * pt->stride;
+ spt->offset += face * nblocksy * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
- spt->offset += zslice * pt->nblocksy * pt->stride;
+ spt->offset += zslice * nblocksy * pt->stride;
}
else {
assert(face == 0);
@@ -363,9 +355,11 @@ softpipe_transfer_map( struct pipe_screen *screen,
{
ubyte *map, *xfer_map;
struct softpipe_texture *spt;
+ enum pipe_format format;
assert(transfer->texture);
spt = softpipe_texture(transfer->texture);
+ format = transfer->texture->format;
map = pipe_buffer_map(screen, spt->buffer, pipe_transfer_buffer_flags(transfer));
if (map == NULL)
@@ -382,8 +376,8 @@ softpipe_transfer_map( struct pipe_screen *screen,
}
xfer_map = map + softpipe_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
return xfer_map;
}
@@ -440,7 +434,6 @@ softpipe_video_surface_create(struct pipe_screen *screen,
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
template.depth0 = 1;
- util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
sp_vsfc->tex = screen->texture_create(screen, &template);
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index cde22600732..49e1ab0ca71 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -285,8 +285,9 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
uint x, y;
uint numCleared = 0;
+ assert(pt->texture);
/* clear the scratch tile to the clear value */
- clear_tile(&tc->tile, pt->format, tc->clear_val);
+ clear_tile(&tc->tile, pt->texture->format, tc->clear_val);
/* push the tile to all positions marked as clear */
for (y = 0; y < h; y += TILE_SIZE) {
@@ -373,6 +374,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (addr.value != tile->addr.value) {
+ assert(pt->texture);
if (tile->addr.bits.invalid == 0) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
@@ -396,10 +398,10 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (is_clear_flag_set(tc->clear_flags, addr)) {
/* don't get tile from framebuffer, just clear it */
if (tc->depth_stencil) {
- clear_tile(tile, pt->format, tc->clear_val);
+ clear_tile(tile, pt->texture->format, tc->clear_val);
}
else {
- clear_tile_rgba(tile, pt->format, tc->clear_color);
+ clear_tile_rgba(tile, pt->texture->format, tc->clear_color);
}
clear_clear_flag(tc->clear_flags, addr);
}
diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h
index 9e571862b75..f203ded29ee 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.h
+++ b/src/gallium/drivers/softpipe/sp_winsys.h
@@ -34,15 +34,17 @@
#ifndef SP_WINSYS_H
#define SP_WINSYS_H
-
#ifdef __cplusplus
extern "C" {
#endif
+#include "pipe/p_defines.h"
struct pipe_screen;
struct pipe_winsys;
struct pipe_context;
+struct pipe_texture;
+struct pipe_buffer;
struct pipe_context *softpipe_create( struct pipe_screen * );
diff --git a/src/gallium/drivers/svga/include/svga_escape.h b/src/gallium/drivers/svga/include/svga_escape.h
new file mode 100644
index 00000000000..7b85e9b8c85
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga_escape.h
@@ -0,0 +1,89 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga_escape.h --
+ *
+ * Definitions for our own (vendor-specific) SVGA Escape commands.
+ */
+
+#ifndef _SVGA_ESCAPE_H_
+#define _SVGA_ESCAPE_H_
+
+
+/*
+ * Namespace IDs for the escape command
+ */
+
+#define SVGA_ESCAPE_NSID_VMWARE 0x00000000
+#define SVGA_ESCAPE_NSID_DEVEL 0xFFFFFFFF
+
+
+/*
+ * Within SVGA_ESCAPE_NSID_VMWARE, we multiplex commands according to
+ * the first DWORD of escape data (after the nsID and size). As a
+ * guideline we're using the high word and low word as a major and
+ * minor command number, respectively.
+ *
+ * Major command number allocation:
+ *
+ * 0000: Reserved
+ * 0001: SVGA_ESCAPE_VMWARE_LOG (svga_binary_logger.h)
+ * 0002: SVGA_ESCAPE_VMWARE_VIDEO (svga_overlay.h)
+ * 0003: SVGA_ESCAPE_VMWARE_HINT (svga_escape.h)
+ */
+
+#define SVGA_ESCAPE_VMWARE_MAJOR_MASK 0xFFFF0000
+
+
+/*
+ * SVGA Hint commands.
+ *
+ * These escapes let the SVGA driver provide optional information to
+ * he host about the state of the guest or guest applications. The
+ * host can use these hints to make user interface or performance
+ * decisions.
+ *
+ * Notes:
+ *
+ * - SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN is deprecated for guests
+ * that use the SVGA Screen Object extension. Instead of sending
+ * this escape, use the SVGA_SCREEN_FULLSCREEN_HINT flag on your
+ * Screen Object.
+ */
+
+#define SVGA_ESCAPE_VMWARE_HINT 0x00030000
+#define SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN 0x00030001 // Deprecated
+
+typedef
+struct {
+ uint32 command;
+ uint32 fullscreen;
+ struct {
+ int32 x, y;
+ } monitorPosition;
+} SVGAEscapeHintFullscreen;
+
+#endif /* _SVGA_ESCAPE_H_ */
diff --git a/src/gallium/drivers/svga/include/svga_overlay.h b/src/gallium/drivers/svga/include/svga_overlay.h
new file mode 100644
index 00000000000..82c1d3ff3e2
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga_overlay.h
@@ -0,0 +1,201 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga_overlay.h --
+ *
+ * Definitions for video-overlay support.
+ */
+
+#ifndef _SVGA_OVERLAY_H_
+#define _SVGA_OVERLAY_H_
+
+#include "svga_reg.h"
+
+/*
+ * Video formats we support
+ */
+
+#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2'
+#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2'
+#define VMWARE_FOURCC_UYVY 0x59565955 // 'U' 'Y' 'V' 'Y'
+
+typedef enum {
+ SVGA_OVERLAY_FORMAT_INVALID = 0,
+ SVGA_OVERLAY_FORMAT_YV12 = VMWARE_FOURCC_YV12,
+ SVGA_OVERLAY_FORMAT_YUY2 = VMWARE_FOURCC_YUY2,
+ SVGA_OVERLAY_FORMAT_UYVY = VMWARE_FOURCC_UYVY,
+} SVGAOverlayFormat;
+
+#define SVGA_VIDEO_COLORKEY_MASK 0x00ffffff
+
+#define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000
+
+#define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x00020001
+ /* FIFO escape layout:
+ * Type, Stream Id, (Register Id, Value) pairs */
+
+#define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x00020002
+ /* FIFO escape layout:
+ * Type, Stream Id */
+
+typedef
+struct SVGAEscapeVideoSetRegs {
+ struct {
+ uint32 cmdType;
+ uint32 streamId;
+ } header;
+
+ // May include zero or more items.
+ struct {
+ uint32 registerId;
+ uint32 value;
+ } items[1];
+} SVGAEscapeVideoSetRegs;
+
+typedef
+struct SVGAEscapeVideoFlush {
+ uint32 cmdType;
+ uint32 streamId;
+} SVGAEscapeVideoFlush;
+
+
+/*
+ * Struct definitions for the video overlay commands built on
+ * SVGAFifoCmdEscape.
+ */
+typedef
+struct {
+ uint32 command;
+ uint32 overlay;
+} SVGAFifoEscapeCmdVideoBase;
+
+typedef
+struct {
+ SVGAFifoEscapeCmdVideoBase videoCmd;
+} SVGAFifoEscapeCmdVideoFlush;
+
+typedef
+struct {
+ SVGAFifoEscapeCmdVideoBase videoCmd;
+ struct {
+ uint32 regId;
+ uint32 value;
+ } items[1];
+} SVGAFifoEscapeCmdVideoSetRegs;
+
+typedef
+struct {
+ SVGAFifoEscapeCmdVideoBase videoCmd;
+ struct {
+ uint32 regId;
+ uint32 value;
+ } items[SVGA_VIDEO_NUM_REGS];
+} SVGAFifoEscapeCmdVideoSetAllRegs;
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * VMwareVideoGetAttributes --
+ *
+ * Computes the size, pitches and offsets for YUV frames.
+ *
+ * Results:
+ * TRUE on success; otherwise FALSE on failure.
+ *
+ * Side effects:
+ * Pitches and offsets for the given YUV frame are put in 'pitches'
+ * and 'offsets' respectively. They are both optional though.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static INLINE Bool
+VMwareVideoGetAttributes(const SVGAOverlayFormat format, // IN
+ uint32 *width, // IN / OUT
+ uint32 *height, // IN / OUT
+ uint32 *size, // OUT
+ uint32 *pitches, // OUT (optional)
+ uint32 *offsets) // OUT (optional)
+{
+ int tmp;
+
+ *width = (*width + 1) & ~1;
+
+ if (offsets) {
+ offsets[0] = 0;
+ }
+
+ switch (format) {
+ case VMWARE_FOURCC_YV12:
+ *height = (*height + 1) & ~1;
+ *size = (*width + 3) & ~3;
+
+ if (pitches) {
+ pitches[0] = *size;
+ }
+
+ *size *= *height;
+
+ if (offsets) {
+ offsets[1] = *size;
+ }
+
+ tmp = ((*width >> 1) + 3) & ~3;
+
+ if (pitches) {
+ pitches[1] = pitches[2] = tmp;
+ }
+
+ tmp *= (*height >> 1);
+ *size += tmp;
+
+ if (offsets) {
+ offsets[2] = *size;
+ }
+
+ *size += tmp;
+ break;
+
+ case VMWARE_FOURCC_YUY2:
+ case VMWARE_FOURCC_UYVY:
+ *size = *width * 2;
+
+ if (pitches) {
+ pitches[0] = *size;
+ }
+
+ *size *= *height;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+#endif // _SVGA_OVERLAY_H_
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
index 6195c3897ed..409b3b41cbc 100644
--- a/src/gallium/drivers/svga/svga_pipe_clear.c
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -46,7 +46,7 @@ try_clear(struct svga_context *svga,
boolean restore_viewport = FALSE;
SVGA3dClearFlag flags = 0;
struct pipe_framebuffer_state *fb = &svga->curr.framebuffer;
- unsigned color = 0;
+ union util_color uc;
ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR);
if (ret)
@@ -54,7 +54,7 @@ try_clear(struct svga_context *svga,
if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) {
flags |= SVGA3D_CLEAR_COLOR;
- util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &color);
+ util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
rect.w = fb->cbufs[0]->width;
rect.h = fb->cbufs[0]->height;
@@ -77,7 +77,7 @@ try_clear(struct svga_context *svga,
return ret;
}
- ret = SVGA3D_ClearRect(svga->swc, flags, color, depth, stencil,
+ ret = SVGA3D_ClearRect(svga->swc, flags, uc.ui, depth, stencil,
rect.x, rect.y, rect.w, rect.h);
if (ret != PIPE_OK)
return ret;
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index b4e57c5d15b..78053e755e2 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -101,6 +101,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
{
struct svga_context *svga = svga_context(pipe);
struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state );
+ union util_color uc;
cso->mipfilter = translate_mip_filter(sampler->min_mip_filter);
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
@@ -121,8 +122,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
ubyte a = float_to_ubyte(sampler->border_color[3]);
util_pack_color_ub( r, g, b, a,
- PIPE_FORMAT_B8G8R8A8_UNORM,
- &cso->bordercolor );
+ PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+ cso->bordercolor = uc.ui;
}
/* No SVGA3D support for:
diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c
index 1f8a8896723..58a1aba464b 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -356,7 +356,8 @@ svga_buffer_upload_flush(struct svga_context *svga,
sbuf->hw.boxes = NULL;
/* Decrement reference count */
- pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL);
+ pipe_reference(&(sbuf->base.reference), NULL);
+ sbuf = NULL;
}
diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
index 8a06383f61e..eff36e0bccb 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -277,6 +277,15 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
while(size < key->size.width)
size <<= 1;
key->size.width = size;
+ /* Since we're reusing buffers we're effectively transforming all
+ * of them into dynamic buffers.
+ *
+ * It would be nice to not cache long lived static buffers. But there
+ * is no way to detect the long lived from short lived ones yet. A
+ * good heuristic would be buffer size.
+ */
+ key->flags &= ~SVGA3D_SURFACE_HINT_STATIC;
+ key->flags |= SVGA3D_SURFACE_HINT_DYNAMIC;
}
handle = svga_screen_cache_lookup(svgascreen, key);
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index b8997961016..ab93dab2239 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -159,7 +159,8 @@ svga_transfer_dma_band(struct svga_transfer *st,
st->base.x + st->base.width,
y + h,
st->base.zslice + 1,
- texture->base.block.size*8/(texture->base.block.width*texture->base.block.height));
+ pf_get_blocksize(texture->base.format)*8/
+ (pf_get_blockwidth(texture->base.format)*pf_get_blockheight(texture->base.format)));
box.x = st->base.x;
box.y = y;
@@ -209,7 +210,8 @@ svga_transfer_dma(struct svga_transfer *st,
}
else {
unsigned y, h, srcy;
- h = st->hw_nblocksy * st->base.block.height;
+ unsigned blockheight = pf_get_blockheight(st->base.texture->format);
+ h = st->hw_nblocksy * blockheight;
srcy = 0;
for(y = 0; y < st->base.height; y += h) {
unsigned offset, length;
@@ -219,11 +221,11 @@ svga_transfer_dma(struct svga_transfer *st,
h = st->base.height - y;
/* Transfer band must be aligned to pixel block boundaries */
- assert(y % st->base.block.height == 0);
- assert(h % st->base.block.height == 0);
+ assert(y % blockheight == 0);
+ assert(h % blockheight == 0);
- offset = y * st->base.stride / st->base.block.height;
- length = h * st->base.stride / st->base.block.height;
+ offset = y * st->base.stride / blockheight;
+ length = h * st->base.stride / blockheight;
sw = (uint8_t *)st->swbuf + offset;
@@ -286,8 +288,6 @@ svga_texture_create(struct pipe_screen *screen,
height = templat->height0;
depth = templat->depth0;
for(level = 0; level <= templat->last_level; ++level) {
- tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width);
- tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height);
width = u_minify(width, 1);
height = u_minify(height, 1);
depth = u_minify(depth, 1);
@@ -526,7 +526,7 @@ svga_texture_view_surface(struct pipe_context *pipe,
{
struct svga_screen *ss = svga_screen(tex->base.screen);
struct svga_winsys_surface *handle;
- int i, j;
+ uint32_t i, j;
unsigned z_offset = 0;
SVGA_DBG(DEBUG_PERF,
@@ -658,13 +658,11 @@ svga_get_tex_surface(struct pipe_screen *screen,
s->real_level = 0;
s->real_zslice = 0;
} else {
- struct svga_winsys_screen *sws = svga_winsys_screen(screen);
-
SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n",
pt, level, face, zslice, s);
memset(&s->key, 0, sizeof s->key);
- sws->surface_reference(sws, &s->handle, tex->handle);
+ s->handle = tex->handle;
s->real_face = face;
s->real_level = level;
s->real_zslice = zslice;
@@ -678,11 +676,14 @@ static void
svga_tex_surface_destroy(struct pipe_surface *surf)
{
struct svga_surface *s = svga_surface(surf);
+ struct svga_texture *t = svga_texture(surf->texture);
struct svga_screen *ss = svga_screen(surf->texture->screen);
- SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle);
- assert(s->key.cachable == 0);
- svga_screen_surface_destroy(ss, &s->key, &s->handle);
+ if(s->handle != t->handle) {
+ SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle);
+ svga_screen_surface_destroy(ss, &s->key, &s->handle);
+ }
+
pipe_texture_reference(&surf->texture, NULL);
FREE(surf);
}
@@ -771,6 +772,8 @@ svga_get_tex_transfer(struct pipe_screen *screen,
struct svga_screen *ss = svga_screen(screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st;
+ unsigned nblocksx = pf_get_nblocksx(texture->format, w);
+ unsigned nblocksy = pf_get_nblocksy(texture->format, h);
/* We can't map texture storage directly */
if (usage & PIPE_TRANSFER_MAP_DIRECTLY)
@@ -780,21 +783,17 @@ svga_get_tex_transfer(struct pipe_screen *screen,
if (!st)
return NULL;
- st->base.format = texture->format;
- st->base.block = texture->block;
st->base.x = x;
st->base.y = y;
st->base.width = w;
st->base.height = h;
- st->base.nblocksx = pf_get_nblocksx(&texture->block, w);
- st->base.nblocksy = pf_get_nblocksy(&texture->block, h);
- st->base.stride = st->base.nblocksx*st->base.block.size;
+ st->base.stride = nblocksx*pf_get_blocksize(texture->format);
st->base.usage = usage;
st->base.face = face;
st->base.level = level;
st->base.zslice = zslice;
- st->hw_nblocksy = st->base.nblocksy;
+ st->hw_nblocksy = nblocksy;
st->hwbuf = svga_winsys_buffer_create(ss,
1,
@@ -810,15 +809,15 @@ svga_get_tex_transfer(struct pipe_screen *screen,
if(!st->hwbuf)
goto no_hwbuf;
- if(st->hw_nblocksy < st->base.nblocksy) {
+ if(st->hw_nblocksy < nblocksy) {
/* We couldn't allocate a hardware buffer big enough for the transfer,
* so allocate regular malloc memory instead */
debug_printf("%s: failed to allocate %u KB of DMA, splitting into %u x %u KB DMA transfers\n",
__FUNCTION__,
- (st->base.nblocksy*st->base.stride + 1023)/1024,
- (st->base.nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy,
+ (nblocksy*st->base.stride + 1023)/1024,
+ (nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy,
(st->hw_nblocksy*st->base.stride + 1023)/1024);
- st->swbuf = MALLOC(st->base.nblocksy*st->base.stride);
+ st->swbuf = MALLOC(nblocksy*st->base.stride);
if(!st->swbuf)
goto no_swbuf;
}
@@ -912,7 +911,6 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
unsigned min_lod, unsigned max_lod)
{
struct svga_screen *ss = svga_screen(pt->screen);
- struct svga_winsys_screen *sws = ss->sws;
struct svga_texture *tex = svga_texture(pt);
struct svga_sampler_view *sv = NULL;
SVGA3dSurfaceFormat format = svga_translate_format(pt->format);
@@ -963,7 +961,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
sv = CALLOC_STRUCT(svga_sampler_view);
pipe_reference_init(&sv->reference, 1);
- sv->texture = tex;
+ pipe_texture_reference(&sv->texture, pt);
sv->min_lod = min_lod;
sv->max_lod = max_lod;
@@ -978,7 +976,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
pt->depth0,
pt->last_level);
sv->key.cachable = 0;
- sws->surface_reference(sws, &sv->handle, tex->handle);
+ sv->handle = tex->handle;
return sv;
}
@@ -1001,7 +999,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
if (!sv->handle) {
assert(0);
sv->key.cachable = 0;
- sws->surface_reference(sws, &sv->handle, tex->handle);
+ sv->handle = tex->handle;
return sv;
}
@@ -1015,14 +1013,14 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
void
svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v)
{
- struct svga_texture *tex = v->texture;
+ struct svga_texture *tex = svga_texture(v->texture);
unsigned numFaces;
unsigned age = 0;
int i, k;
assert(svga);
- if (v->handle == v->texture->handle)
+ if (v->handle == tex->handle)
return;
age = tex->age;
@@ -1050,11 +1048,14 @@ svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *
void
svga_destroy_sampler_view_priv(struct svga_sampler_view *v)
{
- struct svga_screen *ss = svga_screen(v->texture->base.screen);
-
- SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle);
- svga_screen_surface_destroy(ss, &v->key, &v->handle);
+ struct svga_texture *tex = svga_texture(v->texture);
+ if(v->handle != tex->handle) {
+ struct svga_screen *ss = svga_screen(v->texture->screen);
+ SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle);
+ svga_screen_surface_destroy(ss, &v->key, &v->handle);
+ }
+ pipe_texture_reference(&v->texture, NULL);
FREE(v);
}
@@ -1070,8 +1071,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture,
svga_translate_format(texture->format),
stex->handle);
- *stride = pf_get_nblocksx(&texture->block, texture->width0) *
- texture->block.size;
+ *stride = pf_get_stride(texture->format, texture->width0);
return *buffer != NULL;
}
diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h
index 1cc4063e653..89ae24219fd 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.h
+++ b/src/gallium/drivers/svga/svga_screen_texture.h
@@ -61,7 +61,7 @@ struct svga_sampler_view
{
struct pipe_reference reference;
- struct svga_texture *texture;
+ struct pipe_texture *texture;
int min_lod;
int max_lod;
@@ -94,6 +94,13 @@ struct svga_texture
* operation.
*/
struct svga_host_surface_cache_key key;
+
+ /**
+ * Handle for the host side surface.
+ *
+ * This handle is owned by this texture. Views should hold on to a reference
+ * to this texture and never destroy this handle directly.
+ */
struct svga_winsys_surface *handle;
};
@@ -164,8 +171,9 @@ svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_
{
struct svga_sampler_view *old = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &v->reference))
+ if (pipe_reference(&(*ptr)->reference, &v->reference))
svga_destroy_sampler_view_priv(old);
+ *ptr = v;
}
extern void
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index 209ed282450..6b0e511cec1 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -231,7 +231,8 @@ static int emit_vs_consts( struct svga_context *svga,
struct svga_tracked_state svga_hw_vs_parameters =
{
"hw vs params",
- (SVGA_NEW_VS_CONST_BUFFER |
+ (SVGA_NEW_PRESCALE |
+ SVGA_NEW_VS_CONST_BUFFER |
SVGA_NEW_ZERO_STRIDE |
SVGA_NEW_VS_RESULT),
emit_vs_consts
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c
index 910afa25287..e6d4a74e868 100644
--- a/src/gallium/drivers/svga/svgadump/svga_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.c
@@ -42,554 +42,554 @@ dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd)
{
switch((*cmd).identity.type) {
case SVGA3D_DECLTYPE_FLOAT1:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n");
break;
case SVGA3D_DECLTYPE_FLOAT2:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n");
break;
case SVGA3D_DECLTYPE_FLOAT3:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n");
break;
case SVGA3D_DECLTYPE_FLOAT4:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n");
break;
case SVGA3D_DECLTYPE_D3DCOLOR:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n");
break;
case SVGA3D_DECLTYPE_UBYTE4:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n");
break;
case SVGA3D_DECLTYPE_SHORT2:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n");
break;
case SVGA3D_DECLTYPE_SHORT4:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n");
break;
case SVGA3D_DECLTYPE_UBYTE4N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n");
break;
case SVGA3D_DECLTYPE_SHORT2N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n");
break;
case SVGA3D_DECLTYPE_SHORT4N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n");
break;
case SVGA3D_DECLTYPE_USHORT2N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n");
break;
case SVGA3D_DECLTYPE_USHORT4N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n");
break;
case SVGA3D_DECLTYPE_UDEC3:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n");
break;
case SVGA3D_DECLTYPE_DEC3N:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n");
break;
case SVGA3D_DECLTYPE_FLOAT16_2:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n");
break;
case SVGA3D_DECLTYPE_FLOAT16_4:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n");
break;
case SVGA3D_DECLTYPE_MAX:
- debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n");
+ _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type);
+ _debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type);
break;
}
switch((*cmd).identity.method) {
case SVGA3D_DECLMETHOD_DEFAULT:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n");
break;
case SVGA3D_DECLMETHOD_PARTIALU:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n");
break;
case SVGA3D_DECLMETHOD_PARTIALV:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n");
break;
case SVGA3D_DECLMETHOD_CROSSUV:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n");
break;
case SVGA3D_DECLMETHOD_UV:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n");
break;
case SVGA3D_DECLMETHOD_LOOKUP:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n");
break;
case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
- debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n");
+ _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n");
break;
default:
- debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method);
+ _debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method);
break;
}
switch((*cmd).identity.usage) {
case SVGA3D_DECLUSAGE_POSITION:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n");
break;
case SVGA3D_DECLUSAGE_BLENDWEIGHT:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n");
break;
case SVGA3D_DECLUSAGE_BLENDINDICES:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n");
break;
case SVGA3D_DECLUSAGE_NORMAL:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n");
break;
case SVGA3D_DECLUSAGE_PSIZE:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n");
break;
case SVGA3D_DECLUSAGE_TEXCOORD:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n");
break;
case SVGA3D_DECLUSAGE_TANGENT:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n");
break;
case SVGA3D_DECLUSAGE_BINORMAL:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n");
break;
case SVGA3D_DECLUSAGE_TESSFACTOR:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n");
break;
case SVGA3D_DECLUSAGE_POSITIONT:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n");
break;
case SVGA3D_DECLUSAGE_COLOR:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n");
break;
case SVGA3D_DECLUSAGE_FOG:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n");
break;
case SVGA3D_DECLUSAGE_DEPTH:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n");
break;
case SVGA3D_DECLUSAGE_SAMPLE:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n");
break;
case SVGA3D_DECLUSAGE_MAX:
- debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n");
+ _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n");
break;
default:
- debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage);
+ _debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage);
break;
}
- debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex);
- debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId);
- debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset);
- debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride);
- debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first);
- debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last);
+ _debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex);
+ _debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId);
+ _debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset);
+ _debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride);
+ _debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first);
+ _debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last);
}
static void
dump_SVGA3dTextureState(const SVGA3dTextureState *cmd)
{
- debug_printf("\t\t.stage = %u\n", (*cmd).stage);
+ _debug_printf("\t\t.stage = %u\n", (*cmd).stage);
switch((*cmd).name) {
case SVGA3D_TS_INVALID:
- debug_printf("\t\t.name = SVGA3D_TS_INVALID\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_INVALID\n");
break;
case SVGA3D_TS_BIND_TEXTURE:
- debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n");
break;
case SVGA3D_TS_COLOROP:
- debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n");
break;
case SVGA3D_TS_COLORARG1:
- debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n");
break;
case SVGA3D_TS_COLORARG2:
- debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n");
break;
case SVGA3D_TS_ALPHAOP:
- debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n");
break;
case SVGA3D_TS_ALPHAARG1:
- debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n");
break;
case SVGA3D_TS_ALPHAARG2:
- debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n");
break;
case SVGA3D_TS_ADDRESSU:
- debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n");
break;
case SVGA3D_TS_ADDRESSV:
- debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n");
break;
case SVGA3D_TS_MIPFILTER:
- debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n");
break;
case SVGA3D_TS_MAGFILTER:
- debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n");
break;
case SVGA3D_TS_MINFILTER:
- debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n");
break;
case SVGA3D_TS_BORDERCOLOR:
- debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n");
break;
case SVGA3D_TS_TEXCOORDINDEX:
- debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n");
break;
case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
- debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n");
break;
case SVGA3D_TS_TEXCOORDGEN:
- debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n");
break;
case SVGA3D_TS_BUMPENVMAT00:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n");
break;
case SVGA3D_TS_BUMPENVMAT01:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n");
break;
case SVGA3D_TS_BUMPENVMAT10:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n");
break;
case SVGA3D_TS_BUMPENVMAT11:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n");
break;
case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
- debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n");
break;
case SVGA3D_TS_TEXTURE_LOD_BIAS:
- debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n");
break;
case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
- debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n");
break;
case SVGA3D_TS_ADDRESSW:
- debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n");
break;
case SVGA3D_TS_GAMMA:
- debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n");
break;
case SVGA3D_TS_BUMPENVLSCALE:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n");
break;
case SVGA3D_TS_BUMPENVLOFFSET:
- debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n");
break;
case SVGA3D_TS_COLORARG0:
- debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n");
break;
case SVGA3D_TS_ALPHAARG0:
- debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n");
break;
case SVGA3D_TS_MAX:
- debug_printf("\t\t.name = SVGA3D_TS_MAX\n");
+ _debug_printf("\t\t.name = SVGA3D_TS_MAX\n");
break;
default:
- debug_printf("\t\t.name = %i\n", (*cmd).name);
+ _debug_printf("\t\t.name = %i\n", (*cmd).name);
break;
}
- debug_printf("\t\t.value = %u\n", (*cmd).value);
- debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
+ _debug_printf("\t\t.value = %u\n", (*cmd).value);
+ _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
}
static void
dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd)
{
- debug_printf("\t\t.x = %u\n", (*cmd).x);
- debug_printf("\t\t.y = %u\n", (*cmd).y);
- debug_printf("\t\t.z = %u\n", (*cmd).z);
- debug_printf("\t\t.w = %u\n", (*cmd).w);
- debug_printf("\t\t.h = %u\n", (*cmd).h);
- debug_printf("\t\t.d = %u\n", (*cmd).d);
- debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
- debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
- debug_printf("\t\t.srcz = %u\n", (*cmd).srcz);
+ _debug_printf("\t\t.x = %u\n", (*cmd).x);
+ _debug_printf("\t\t.y = %u\n", (*cmd).y);
+ _debug_printf("\t\t.z = %u\n", (*cmd).z);
+ _debug_printf("\t\t.w = %u\n", (*cmd).w);
+ _debug_printf("\t\t.h = %u\n", (*cmd).h);
+ _debug_printf("\t\t.d = %u\n", (*cmd).d);
+ _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
+ _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
+ _debug_printf("\t\t.srcz = %u\n", (*cmd).srcz);
}
static void
dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.index = %u\n", (*cmd).index);
- debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]);
- debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]);
- debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]);
- debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.index = %u\n", (*cmd).index);
+ _debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]);
+ _debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]);
+ _debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]);
+ _debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]);
}
static void
dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_QUERYTYPE_OCCLUSION:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
break;
case SVGA3D_QUERYTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
- debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
- debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
+ _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
+ _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
}
static void
dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_RT_DEPTH:
- debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n");
+ _debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n");
break;
case SVGA3D_RT_STENCIL:
- debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n");
+ _debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n");
break;
default:
- debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0);
+ _debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0);
break;
}
- debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid);
- debug_printf("\t\t.target.face = %u\n", (*cmd).target.face);
- debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap);
+ _debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid);
+ _debug_printf("\t\t.target.face = %u\n", (*cmd).target.face);
+ _debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap);
}
static void
dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
}
static void
dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd)
{
- debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
- debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
- debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
- debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
- debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
- debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
+ _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
+ _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
+ _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
+ _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
+ _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
+ _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
}
static void
dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).face) {
case SVGA3D_FACE_INVALID:
- debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n");
break;
case SVGA3D_FACE_NONE:
- debug_printf("\t\t.face = SVGA3D_FACE_NONE\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_NONE\n");
break;
case SVGA3D_FACE_FRONT:
- debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n");
break;
case SVGA3D_FACE_BACK:
- debug_printf("\t\t.face = SVGA3D_FACE_BACK\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_BACK\n");
break;
case SVGA3D_FACE_FRONT_BACK:
- debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n");
break;
case SVGA3D_FACE_MAX:
- debug_printf("\t\t.face = SVGA3D_FACE_MAX\n");
+ _debug_printf("\t\t.face = SVGA3D_FACE_MAX\n");
break;
default:
- debug_printf("\t\t.face = %i\n", (*cmd).face);
+ _debug_printf("\t\t.face = %i\n", (*cmd).face);
break;
}
- debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]);
- debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]);
- debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]);
- debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]);
- debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]);
- debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]);
- debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]);
- debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]);
- debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]);
- debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]);
- debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]);
- debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]);
- debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]);
- debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]);
- debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]);
- debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]);
- debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess);
+ _debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]);
+ _debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]);
+ _debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]);
+ _debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]);
+ _debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]);
+ _debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]);
+ _debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]);
+ _debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]);
+ _debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]);
+ _debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]);
+ _debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]);
+ _debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]);
+ _debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]);
+ _debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]);
+ _debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]);
+ _debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]);
+ _debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess);
}
static void
dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.index = %u\n", (*cmd).index);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.index = %u\n", (*cmd).index);
switch((*cmd).data.type) {
case SVGA3D_LIGHTTYPE_INVALID:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n");
break;
case SVGA3D_LIGHTTYPE_POINT:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n");
break;
case SVGA3D_LIGHTTYPE_SPOT1:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n");
break;
case SVGA3D_LIGHTTYPE_SPOT2:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n");
break;
case SVGA3D_LIGHTTYPE_DIRECTIONAL:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n");
break;
case SVGA3D_LIGHTTYPE_MAX:
- debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n");
+ _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.data.type = %i\n", (*cmd).data.type);
+ _debug_printf("\t\t.data.type = %i\n", (*cmd).data.type);
break;
}
- debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace);
- debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]);
- debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]);
- debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]);
- debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]);
- debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]);
- debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]);
- debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]);
- debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]);
- debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]);
- debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]);
- debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]);
- debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]);
- debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]);
- debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]);
- debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]);
- debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]);
- debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]);
- debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]);
- debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]);
- debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]);
- debug_printf("\t\t.data.range = %f\n", (*cmd).data.range);
- debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff);
- debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0);
- debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1);
- debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2);
- debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta);
- debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi);
+ _debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace);
+ _debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]);
+ _debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]);
+ _debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]);
+ _debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]);
+ _debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]);
+ _debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]);
+ _debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]);
+ _debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]);
+ _debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]);
+ _debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]);
+ _debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]);
+ _debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]);
+ _debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]);
+ _debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]);
+ _debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]);
+ _debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]);
+ _debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]);
+ _debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]);
+ _debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]);
+ _debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]);
+ _debug_printf("\t\t.data.range = %f\n", (*cmd).data.range);
+ _debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff);
+ _debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0);
+ _debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1);
+ _debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2);
+ _debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta);
+ _debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi);
}
static void
dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
- debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
- debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
- debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
+ _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
+ _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
+ _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
}
static void
dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
- debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
- debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
- debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
+ _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
+ _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
+ _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
}
static void
dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd)
{
- debug_printf("\t\t.x = %u\n", (*cmd).x);
- debug_printf("\t\t.y = %u\n", (*cmd).y);
- debug_printf("\t\t.w = %u\n", (*cmd).w);
- debug_printf("\t\t.h = %u\n", (*cmd).h);
- debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
- debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
+ _debug_printf("\t\t.x = %u\n", (*cmd).x);
+ _debug_printf("\t\t.y = %u\n", (*cmd).y);
+ _debug_printf("\t\t.w = %u\n", (*cmd).w);
+ _debug_printf("\t\t.h = %u\n", (*cmd).h);
+ _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
+ _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
}
static void
dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_SHADERTYPE_COMPILED_DX8:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
break;
case SVGA3D_SHADERTYPE_VS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
break;
case SVGA3D_SHADERTYPE_PS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
break;
case SVGA3D_SHADERTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
- debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+ _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
}
static void
dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_QUERYTYPE_OCCLUSION:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
break;
case SVGA3D_QUERYTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
- debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
- debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
+ _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
+ _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
}
static void
dump_SVGA3dSize(const SVGA3dSize *cmd)
{
- debug_printf("\t\t.width = %u\n", (*cmd).width);
- debug_printf("\t\t.height = %u\n", (*cmd).height);
- debug_printf("\t\t.depth = %u\n", (*cmd).depth);
+ _debug_printf("\t\t.width = %u\n", (*cmd).width);
+ _debug_printf("\t\t.height = %u\n", (*cmd).height);
+ _debug_printf("\t\t.depth = %u\n", (*cmd).depth);
}
static void
dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd)
{
- debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+ _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
}
static void
dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
}
static void
dump_SVGA3dRect(const SVGA3dRect *cmd)
{
- debug_printf("\t\t.x = %u\n", (*cmd).x);
- debug_printf("\t\t.y = %u\n", (*cmd).y);
- debug_printf("\t\t.w = %u\n", (*cmd).w);
- debug_printf("\t\t.h = %u\n", (*cmd).h);
+ _debug_printf("\t\t.x = %u\n", (*cmd).x);
+ _debug_printf("\t\t.y = %u\n", (*cmd).y);
+ _debug_printf("\t\t.w = %u\n", (*cmd).w);
+ _debug_printf("\t\t.h = %u\n", (*cmd).h);
}
static void
dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_QUERYTYPE_OCCLUSION:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
break;
case SVGA3D_QUERYTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
}
@@ -599,336 +599,336 @@ dump_SVGA3dRenderState(const SVGA3dRenderState *cmd)
{
switch((*cmd).state) {
case SVGA3D_RS_INVALID:
- debug_printf("\t\t.state = SVGA3D_RS_INVALID\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_INVALID\n");
break;
case SVGA3D_RS_ZENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n");
break;
case SVGA3D_RS_ZWRITEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n");
break;
case SVGA3D_RS_ALPHATESTENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n");
break;
case SVGA3D_RS_DITHERENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n");
break;
case SVGA3D_RS_BLENDENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n");
break;
case SVGA3D_RS_FOGENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n");
break;
case SVGA3D_RS_SPECULARENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n");
break;
case SVGA3D_RS_STENCILENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n");
break;
case SVGA3D_RS_LIGHTINGENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n");
break;
case SVGA3D_RS_NORMALIZENORMALS:
- debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n");
break;
case SVGA3D_RS_POINTSPRITEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n");
break;
case SVGA3D_RS_POINTSCALEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n");
break;
case SVGA3D_RS_STENCILREF:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n");
break;
case SVGA3D_RS_STENCILMASK:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n");
break;
case SVGA3D_RS_STENCILWRITEMASK:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n");
break;
case SVGA3D_RS_FOGSTART:
- debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n");
break;
case SVGA3D_RS_FOGEND:
- debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n");
break;
case SVGA3D_RS_FOGDENSITY:
- debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n");
break;
case SVGA3D_RS_POINTSIZE:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n");
break;
case SVGA3D_RS_POINTSIZEMIN:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n");
break;
case SVGA3D_RS_POINTSIZEMAX:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n");
break;
case SVGA3D_RS_POINTSCALE_A:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n");
break;
case SVGA3D_RS_POINTSCALE_B:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n");
break;
case SVGA3D_RS_POINTSCALE_C:
- debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n");
break;
case SVGA3D_RS_FOGCOLOR:
- debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n");
break;
case SVGA3D_RS_AMBIENT:
- debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n");
break;
case SVGA3D_RS_CLIPPLANEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n");
break;
case SVGA3D_RS_FOGMODE:
- debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n");
break;
case SVGA3D_RS_FILLMODE:
- debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n");
break;
case SVGA3D_RS_SHADEMODE:
- debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n");
break;
case SVGA3D_RS_LINEPATTERN:
- debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n");
break;
case SVGA3D_RS_SRCBLEND:
- debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n");
break;
case SVGA3D_RS_DSTBLEND:
- debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n");
break;
case SVGA3D_RS_BLENDEQUATION:
- debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n");
break;
case SVGA3D_RS_CULLMODE:
- debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n");
break;
case SVGA3D_RS_ZFUNC:
- debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n");
break;
case SVGA3D_RS_ALPHAFUNC:
- debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n");
break;
case SVGA3D_RS_STENCILFUNC:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n");
break;
case SVGA3D_RS_STENCILFAIL:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n");
break;
case SVGA3D_RS_STENCILZFAIL:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n");
break;
case SVGA3D_RS_STENCILPASS:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n");
break;
case SVGA3D_RS_ALPHAREF:
- debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n");
break;
case SVGA3D_RS_FRONTWINDING:
- debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n");
break;
case SVGA3D_RS_COORDINATETYPE:
- debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n");
break;
case SVGA3D_RS_ZBIAS:
- debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n");
break;
case SVGA3D_RS_RANGEFOGENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n");
break;
case SVGA3D_RS_COLORWRITEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n");
break;
case SVGA3D_RS_VERTEXMATERIALENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n");
break;
case SVGA3D_RS_DIFFUSEMATERIALSOURCE:
- debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n");
break;
case SVGA3D_RS_SPECULARMATERIALSOURCE:
- debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n");
break;
case SVGA3D_RS_AMBIENTMATERIALSOURCE:
- debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n");
break;
case SVGA3D_RS_EMISSIVEMATERIALSOURCE:
- debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n");
break;
case SVGA3D_RS_TEXTUREFACTOR:
- debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n");
break;
case SVGA3D_RS_LOCALVIEWER:
- debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n");
break;
case SVGA3D_RS_SCISSORTESTENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n");
break;
case SVGA3D_RS_BLENDCOLOR:
- debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n");
break;
case SVGA3D_RS_STENCILENABLE2SIDED:
- debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n");
break;
case SVGA3D_RS_CCWSTENCILFUNC:
- debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n");
break;
case SVGA3D_RS_CCWSTENCILFAIL:
- debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n");
break;
case SVGA3D_RS_CCWSTENCILZFAIL:
- debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n");
break;
case SVGA3D_RS_CCWSTENCILPASS:
- debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n");
break;
case SVGA3D_RS_VERTEXBLEND:
- debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n");
break;
case SVGA3D_RS_SLOPESCALEDEPTHBIAS:
- debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n");
break;
case SVGA3D_RS_DEPTHBIAS:
- debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n");
break;
case SVGA3D_RS_OUTPUTGAMMA:
- debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n");
break;
case SVGA3D_RS_ZVISIBLE:
- debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n");
break;
case SVGA3D_RS_LASTPIXEL:
- debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n");
break;
case SVGA3D_RS_CLIPPING:
- debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n");
break;
case SVGA3D_RS_WRAP0:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n");
break;
case SVGA3D_RS_WRAP1:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n");
break;
case SVGA3D_RS_WRAP2:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n");
break;
case SVGA3D_RS_WRAP3:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n");
break;
case SVGA3D_RS_WRAP4:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n");
break;
case SVGA3D_RS_WRAP5:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n");
break;
case SVGA3D_RS_WRAP6:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n");
break;
case SVGA3D_RS_WRAP7:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n");
break;
case SVGA3D_RS_WRAP8:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n");
break;
case SVGA3D_RS_WRAP9:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n");
break;
case SVGA3D_RS_WRAP10:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n");
break;
case SVGA3D_RS_WRAP11:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n");
break;
case SVGA3D_RS_WRAP12:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n");
break;
case SVGA3D_RS_WRAP13:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n");
break;
case SVGA3D_RS_WRAP14:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n");
break;
case SVGA3D_RS_WRAP15:
- debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n");
break;
case SVGA3D_RS_MULTISAMPLEANTIALIAS:
- debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n");
break;
case SVGA3D_RS_MULTISAMPLEMASK:
- debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n");
break;
case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n");
break;
case SVGA3D_RS_TWEENFACTOR:
- debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n");
break;
case SVGA3D_RS_ANTIALIASEDLINEENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n");
break;
case SVGA3D_RS_COLORWRITEENABLE1:
- debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n");
break;
case SVGA3D_RS_COLORWRITEENABLE2:
- debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n");
break;
case SVGA3D_RS_COLORWRITEENABLE3:
- debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n");
break;
case SVGA3D_RS_SEPARATEALPHABLENDENABLE:
- debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n");
break;
case SVGA3D_RS_SRCBLENDALPHA:
- debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n");
break;
case SVGA3D_RS_DSTBLENDALPHA:
- debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n");
break;
case SVGA3D_RS_BLENDEQUATIONALPHA:
- debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n");
break;
case SVGA3D_RS_MAX:
- debug_printf("\t\t.state = SVGA3D_RS_MAX\n");
+ _debug_printf("\t\t.state = SVGA3D_RS_MAX\n");
break;
default:
- debug_printf("\t\t.state = %i\n", (*cmd).state);
+ _debug_printf("\t\t.state = %i\n", (*cmd).state);
break;
}
- debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue);
- debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
+ _debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue);
+ _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
}
static void
dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd)
{
- debug_printf("\t\t.value = %u\n", (*cmd).value);
- debug_printf("\t\t.count = %u\n", (*cmd).count);
- debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData);
- debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData);
+ _debug_printf("\t\t.value = %u\n", (*cmd).value);
+ _debug_printf("\t\t.count = %u\n", (*cmd).count);
+ _debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData);
+ _debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData);
}
static void
dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
switch((*cmd).type) {
case SVGA3D_SHADERTYPE_COMPILED_DX8:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
break;
case SVGA3D_SHADERTYPE_VS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
break;
case SVGA3D_SHADERTYPE_PS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
break;
case SVGA3D_SHADERTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
}
@@ -936,53 +936,53 @@ dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd)
static void
dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.reg = %u\n", (*cmd).reg);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.reg = %u\n", (*cmd).reg);
switch((*cmd).type) {
case SVGA3D_SHADERTYPE_COMPILED_DX8:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
break;
case SVGA3D_SHADERTYPE_VS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
break;
case SVGA3D_SHADERTYPE_PS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
break;
case SVGA3D_SHADERTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
switch((*cmd).ctype) {
case SVGA3D_CONST_TYPE_FLOAT:
- debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n");
- debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]);
- debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]);
- debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]);
- debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]);
+ _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n");
+ _debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]);
+ _debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]);
+ _debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]);
+ _debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]);
break;
case SVGA3D_CONST_TYPE_INT:
- debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n");
- debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
- debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
- debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
- debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n");
+ _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
break;
case SVGA3D_CONST_TYPE_BOOL:
- debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n");
- debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
- debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
- debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
- debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n");
+ _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
break;
default:
- debug_printf("\t\t.ctype = %i\n", (*cmd).ctype);
- debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
- debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
- debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
- debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ _debug_printf("\t\t.ctype = %i\n", (*cmd).ctype);
+ _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
break;
}
}
@@ -990,25 +990,25 @@ dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd)
static void
dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min);
- debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min);
+ _debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max);
}
static void
dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls);
- debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls);
+ _debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges);
}
static void
dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.index = %u\n", (*cmd).index);
- debug_printf("\t\t.enabled = %u\n", (*cmd).enabled);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.index = %u\n", (*cmd).index);
+ _debug_printf("\t\t.enabled = %u\n", (*cmd).enabled);
}
static void
@@ -1016,86 +1016,86 @@ dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd)
{
switch((*cmd).primType) {
case SVGA3D_PRIMITIVE_INVALID:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n");
break;
case SVGA3D_PRIMITIVE_TRIANGLELIST:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n");
break;
case SVGA3D_PRIMITIVE_POINTLIST:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n");
break;
case SVGA3D_PRIMITIVE_LINELIST:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n");
break;
case SVGA3D_PRIMITIVE_LINESTRIP:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n");
break;
case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n");
break;
case SVGA3D_PRIMITIVE_TRIANGLEFAN:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n");
break;
case SVGA3D_PRIMITIVE_MAX:
- debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n");
+ _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n");
break;
default:
- debug_printf("\t\t.primType = %i\n", (*cmd).primType);
+ _debug_printf("\t\t.primType = %i\n", (*cmd).primType);
break;
}
- debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount);
- debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId);
- debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset);
- debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride);
- debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth);
- debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias);
+ _debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount);
+ _debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId);
+ _debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset);
+ _debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride);
+ _debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth);
+ _debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias);
}
static void
dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd)
{
- debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+ _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
}
static void
dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
}
static void
dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd)
{
- debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
- debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
- debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
- debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
- debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
- debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
- debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x);
- debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y);
- debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z);
- debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w);
- debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h);
- debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d);
- debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x);
- debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y);
- debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z);
- debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w);
- debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h);
- debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d);
+ _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
+ _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
+ _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
+ _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
+ _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
+ _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
+ _debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x);
+ _debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y);
+ _debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z);
+ _debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w);
+ _debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h);
+ _debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d);
+ _debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x);
+ _debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y);
+ _debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z);
+ _debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w);
+ _debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h);
+ _debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d);
switch((*cmd).mode) {
case SVGA3D_STRETCH_BLT_POINT:
- debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n");
+ _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n");
break;
case SVGA3D_STRETCH_BLT_LINEAR:
- debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n");
+ _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n");
break;
case SVGA3D_STRETCH_BLT_MAX:
- debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n");
+ _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n");
break;
default:
- debug_printf("\t\t.mode = %i\n", (*cmd).mode);
+ _debug_printf("\t\t.mode = %i\n", (*cmd).mode);
break;
}
}
@@ -1103,21 +1103,21 @@ dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd)
static void
dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd)
{
- debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId);
- debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset);
- debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch);
- debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid);
- debug_printf("\t\t.host.face = %u\n", (*cmd).host.face);
- debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap);
+ _debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId);
+ _debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset);
+ _debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch);
+ _debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid);
+ _debug_printf("\t\t.host.face = %u\n", (*cmd).host.face);
+ _debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap);
switch((*cmd).transfer) {
case SVGA3D_WRITE_HOST_VRAM:
- debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n");
+ _debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n");
break;
case SVGA3D_READ_HOST_VRAM:
- debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n");
+ _debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n");
break;
default:
- debug_printf("\t\t.transfer = %i\n", (*cmd).transfer);
+ _debug_printf("\t\t.transfer = %i\n", (*cmd).transfer);
break;
}
}
@@ -1125,107 +1125,107 @@ dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd)
static void
dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd)
{
- debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize);
- debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset);
- debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard);
- debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized);
+ _debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize);
+ _debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset);
+ _debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard);
+ _debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized);
}
static void
dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).type) {
case SVGA3D_TRANSFORM_INVALID:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n");
break;
case SVGA3D_TRANSFORM_WORLD:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n");
break;
case SVGA3D_TRANSFORM_VIEW:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n");
break;
case SVGA3D_TRANSFORM_PROJECTION:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n");
break;
case SVGA3D_TRANSFORM_TEXTURE0:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n");
break;
case SVGA3D_TRANSFORM_TEXTURE1:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n");
break;
case SVGA3D_TRANSFORM_TEXTURE2:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n");
break;
case SVGA3D_TRANSFORM_TEXTURE3:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n");
break;
case SVGA3D_TRANSFORM_TEXTURE4:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n");
break;
case SVGA3D_TRANSFORM_TEXTURE5:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n");
break;
case SVGA3D_TRANSFORM_TEXTURE6:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n");
break;
case SVGA3D_TRANSFORM_TEXTURE7:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n");
break;
case SVGA3D_TRANSFORM_WORLD1:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n");
break;
case SVGA3D_TRANSFORM_WORLD2:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n");
break;
case SVGA3D_TRANSFORM_WORLD3:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n");
break;
case SVGA3D_TRANSFORM_MAX:
- debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
- debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]);
- debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]);
- debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]);
- debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]);
- debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]);
- debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]);
- debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]);
- debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]);
- debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]);
- debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]);
- debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]);
- debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]);
- debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]);
- debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]);
- debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]);
- debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]);
+ _debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]);
+ _debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]);
+ _debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]);
+ _debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]);
+ _debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]);
+ _debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]);
+ _debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]);
+ _debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]);
+ _debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]);
+ _debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]);
+ _debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]);
+ _debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]);
+ _debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]);
+ _debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]);
+ _debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]);
+ _debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]);
}
static void
dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
- debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.shid = %u\n", (*cmd).shid);
switch((*cmd).type) {
case SVGA3D_SHADERTYPE_COMPILED_DX8:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
break;
case SVGA3D_SHADERTYPE_VS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
break;
case SVGA3D_SHADERTYPE_PS:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
break;
case SVGA3D_SHADERTYPE_MAX:
- debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
break;
default:
- debug_printf("\t\t.type = %i\n", (*cmd).type);
+ _debug_printf("\t\t.type = %i\n", (*cmd).type);
break;
}
}
@@ -1233,187 +1233,213 @@ dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd)
static void
dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
}
static void
dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd)
{
- debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ _debug_printf("\t\t.cid = %u\n", (*cmd).cid);
switch((*cmd).clearFlag) {
case SVGA3D_CLEAR_COLOR:
- debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n");
+ _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n");
break;
case SVGA3D_CLEAR_DEPTH:
- debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n");
+ _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n");
break;
case SVGA3D_CLEAR_STENCIL:
- debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n");
+ _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n");
break;
default:
- debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag);
+ _debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag);
break;
}
- debug_printf("\t\t.color = %u\n", (*cmd).color);
- debug_printf("\t\t.depth = %f\n", (*cmd).depth);
- debug_printf("\t\t.stencil = %u\n", (*cmd).stencil);
+ _debug_printf("\t\t.color = %u\n", (*cmd).color);
+ _debug_printf("\t\t.depth = %f\n", (*cmd).depth);
+ _debug_printf("\t\t.stencil = %u\n", (*cmd).stencil);
}
static void
dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd)
{
- debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+ _debug_printf("\t\t.sid = %u\n", (*cmd).sid);
switch((*cmd).surfaceFlags) {
case SVGA3D_SURFACE_CUBEMAP:
- debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n");
+ _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n");
break;
case SVGA3D_SURFACE_HINT_STATIC:
- debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n");
+ _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n");
break;
case SVGA3D_SURFACE_HINT_DYNAMIC:
- debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n");
+ _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n");
break;
case SVGA3D_SURFACE_HINT_INDEXBUFFER:
- debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n");
+ _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n");
break;
case SVGA3D_SURFACE_HINT_VERTEXBUFFER:
- debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n");
+ _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n");
break;
default:
- debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags);
+ _debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags);
break;
}
switch((*cmd).format) {
case SVGA3D_FORMAT_INVALID:
- debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n");
+ _debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n");
break;
case SVGA3D_X8R8G8B8:
- debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n");
+ _debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n");
break;
case SVGA3D_A8R8G8B8:
- debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n");
+ _debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n");
break;
case SVGA3D_R5G6B5:
- debug_printf("\t\t.format = SVGA3D_R5G6B5\n");
+ _debug_printf("\t\t.format = SVGA3D_R5G6B5\n");
break;
case SVGA3D_X1R5G5B5:
- debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n");
+ _debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n");
break;
case SVGA3D_A1R5G5B5:
- debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n");
+ _debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n");
break;
case SVGA3D_A4R4G4B4:
- debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n");
+ _debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n");
break;
case SVGA3D_Z_D32:
- debug_printf("\t\t.format = SVGA3D_Z_D32\n");
+ _debug_printf("\t\t.format = SVGA3D_Z_D32\n");
break;
case SVGA3D_Z_D16:
- debug_printf("\t\t.format = SVGA3D_Z_D16\n");
+ _debug_printf("\t\t.format = SVGA3D_Z_D16\n");
break;
case SVGA3D_Z_D24S8:
- debug_printf("\t\t.format = SVGA3D_Z_D24S8\n");
+ _debug_printf("\t\t.format = SVGA3D_Z_D24S8\n");
break;
case SVGA3D_Z_D15S1:
- debug_printf("\t\t.format = SVGA3D_Z_D15S1\n");
+ _debug_printf("\t\t.format = SVGA3D_Z_D15S1\n");
break;
case SVGA3D_LUMINANCE8:
- debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n");
+ _debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n");
break;
case SVGA3D_LUMINANCE4_ALPHA4:
- debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n");
+ _debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n");
break;
case SVGA3D_LUMINANCE16:
- debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n");
+ _debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n");
break;
case SVGA3D_LUMINANCE8_ALPHA8:
- debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n");
+ _debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n");
break;
case SVGA3D_DXT1:
- debug_printf("\t\t.format = SVGA3D_DXT1\n");
+ _debug_printf("\t\t.format = SVGA3D_DXT1\n");
break;
case SVGA3D_DXT2:
- debug_printf("\t\t.format = SVGA3D_DXT2\n");
+ _debug_printf("\t\t.format = SVGA3D_DXT2\n");
break;
case SVGA3D_DXT3:
- debug_printf("\t\t.format = SVGA3D_DXT3\n");
+ _debug_printf("\t\t.format = SVGA3D_DXT3\n");
break;
case SVGA3D_DXT4:
- debug_printf("\t\t.format = SVGA3D_DXT4\n");
+ _debug_printf("\t\t.format = SVGA3D_DXT4\n");
break;
case SVGA3D_DXT5:
- debug_printf("\t\t.format = SVGA3D_DXT5\n");
+ _debug_printf("\t\t.format = SVGA3D_DXT5\n");
break;
case SVGA3D_BUMPU8V8:
- debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n");
+ _debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n");
break;
case SVGA3D_BUMPL6V5U5:
- debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n");
+ _debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n");
break;
case SVGA3D_BUMPX8L8V8U8:
- debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n");
break;
case SVGA3D_BUMPL8V8U8:
- debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n");
break;
case SVGA3D_ARGB_S10E5:
- debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n");
+ _debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n");
break;
case SVGA3D_ARGB_S23E8:
- debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n");
+ _debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n");
break;
case SVGA3D_A2R10G10B10:
- debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n");
+ _debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n");
break;
case SVGA3D_V8U8:
- debug_printf("\t\t.format = SVGA3D_V8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_V8U8\n");
break;
case SVGA3D_Q8W8V8U8:
- debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n");
break;
case SVGA3D_CxV8U8:
- debug_printf("\t\t.format = SVGA3D_CxV8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_CxV8U8\n");
break;
case SVGA3D_X8L8V8U8:
- debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n");
+ _debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n");
break;
case SVGA3D_A2W10V10U10:
- debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n");
+ _debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n");
break;
case SVGA3D_ALPHA8:
- debug_printf("\t\t.format = SVGA3D_ALPHA8\n");
+ _debug_printf("\t\t.format = SVGA3D_ALPHA8\n");
break;
case SVGA3D_R_S10E5:
- debug_printf("\t\t.format = SVGA3D_R_S10E5\n");
+ _debug_printf("\t\t.format = SVGA3D_R_S10E5\n");
break;
case SVGA3D_R_S23E8:
- debug_printf("\t\t.format = SVGA3D_R_S23E8\n");
+ _debug_printf("\t\t.format = SVGA3D_R_S23E8\n");
break;
case SVGA3D_RG_S10E5:
- debug_printf("\t\t.format = SVGA3D_RG_S10E5\n");
+ _debug_printf("\t\t.format = SVGA3D_RG_S10E5\n");
break;
case SVGA3D_RG_S23E8:
- debug_printf("\t\t.format = SVGA3D_RG_S23E8\n");
+ _debug_printf("\t\t.format = SVGA3D_RG_S23E8\n");
break;
case SVGA3D_BUFFER:
- debug_printf("\t\t.format = SVGA3D_BUFFER\n");
+ _debug_printf("\t\t.format = SVGA3D_BUFFER\n");
break;
case SVGA3D_Z_D24X8:
- debug_printf("\t\t.format = SVGA3D_Z_D24X8\n");
+ _debug_printf("\t\t.format = SVGA3D_Z_D24X8\n");
break;
case SVGA3D_FORMAT_MAX:
- debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n");
+ _debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n");
break;
default:
- debug_printf("\t\t.format = %i\n", (*cmd).format);
+ _debug_printf("\t\t.format = %i\n", (*cmd).format);
break;
}
- debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels);
- debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels);
- debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels);
- debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels);
- debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels);
- debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels);
+ _debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels);
+ _debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels);
+ _debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels);
+ _debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels);
+ _debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels);
+ _debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels);
+}
+
+static void
+dump_SVGASignedRect(const SVGASignedRect *cmd)
+{
+ _debug_printf("\t\t.left = %i\n", (*cmd).left);
+ _debug_printf("\t\t.top = %i\n", (*cmd).top);
+ _debug_printf("\t\t.right = %i\n", (*cmd).right);
+ _debug_printf("\t\t.bottom = %i\n", (*cmd).bottom);
+}
+
+static void
+dump_SVGA3dCmdBlitSurfaceToScreen(const SVGA3dCmdBlitSurfaceToScreen *cmd)
+{
+ _debug_printf("\t\t.srcImage.sid = %u\n", (*cmd).srcImage.sid);
+ _debug_printf("\t\t.srcImage.face = %u\n", (*cmd).srcImage.face);
+ _debug_printf("\t\t.srcImage.mipmap = %u\n", (*cmd).srcImage.mipmap);
+ _debug_printf("\t\t.srcRect.left = %i\n", (*cmd).srcRect.left);
+ _debug_printf("\t\t.srcRect.top = %i\n", (*cmd).srcRect.top);
+ _debug_printf("\t\t.srcRect.right = %i\n", (*cmd).srcRect.right);
+ _debug_printf("\t\t.srcRect.bottom = %i\n", (*cmd).srcRect.bottom);
+ _debug_printf("\t\t.destScreenId = %u\n", (*cmd).destScreenId);
+ _debug_printf("\t\t.destRect.left = %i\n", (*cmd).destRect.left);
+ _debug_printf("\t\t.destRect.top = %i\n", (*cmd).destRect.top);
+ _debug_printf("\t\t.destRect.right = %i\n", (*cmd).destRect.right);
+ _debug_printf("\t\t.destRect.bottom = %i\n", (*cmd).destRect.bottom);
}
@@ -1438,7 +1464,7 @@ svga_dump_commands(const void *commands, uint32_t size)
switch(cmd_id) {
case SVGA_3D_CMD_SURFACE_DEFINE:
- debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n");
+ _debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n");
{
const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body;
dump_SVGA3dCmdDefineSurface(cmd);
@@ -1450,7 +1476,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SURFACE_DESTROY:
- debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n");
+ _debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n");
{
const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body;
dump_SVGA3dCmdDestroySurface(cmd);
@@ -1458,7 +1484,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SURFACE_COPY:
- debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n");
+ _debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n");
{
const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body;
dump_SVGA3dCmdSurfaceCopy(cmd);
@@ -1470,7 +1496,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SURFACE_STRETCHBLT:
- debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n");
+ _debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n");
{
const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body;
dump_SVGA3dCmdSurfaceStretchBlt(cmd);
@@ -1478,7 +1504,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SURFACE_DMA:
- debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n");
+ _debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n");
{
const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body;
dump_SVGA3dCmdSurfaceDMA(cmd);
@@ -1494,7 +1520,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_CONTEXT_DEFINE:
- debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n");
+ _debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n");
{
const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body;
dump_SVGA3dCmdDefineContext(cmd);
@@ -1502,7 +1528,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_CONTEXT_DESTROY:
- debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n");
+ _debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n");
{
const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body;
dump_SVGA3dCmdDestroyContext(cmd);
@@ -1510,7 +1536,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETTRANSFORM:
- debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n");
+ _debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n");
{
const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body;
dump_SVGA3dCmdSetTransform(cmd);
@@ -1518,7 +1544,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETZRANGE:
- debug_printf("\tSVGA_3D_CMD_SETZRANGE\n");
+ _debug_printf("\tSVGA_3D_CMD_SETZRANGE\n");
{
const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body;
dump_SVGA3dCmdSetZRange(cmd);
@@ -1526,7 +1552,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETRENDERSTATE:
- debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n");
+ _debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n");
{
const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body;
dump_SVGA3dCmdSetRenderState(cmd);
@@ -1538,7 +1564,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETRENDERTARGET:
- debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n");
+ _debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n");
{
const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body;
dump_SVGA3dCmdSetRenderTarget(cmd);
@@ -1546,7 +1572,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETTEXTURESTATE:
- debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n");
+ _debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n");
{
const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body;
dump_SVGA3dCmdSetTextureState(cmd);
@@ -1558,7 +1584,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETMATERIAL:
- debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n");
+ _debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n");
{
const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body;
dump_SVGA3dCmdSetMaterial(cmd);
@@ -1566,7 +1592,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETLIGHTDATA:
- debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n");
+ _debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n");
{
const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body;
dump_SVGA3dCmdSetLightData(cmd);
@@ -1574,7 +1600,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETLIGHTENABLED:
- debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n");
+ _debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n");
{
const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body;
dump_SVGA3dCmdSetLightEnabled(cmd);
@@ -1582,7 +1608,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETVIEWPORT:
- debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n");
+ _debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n");
{
const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body;
dump_SVGA3dCmdSetViewport(cmd);
@@ -1590,7 +1616,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETCLIPPLANE:
- debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n");
+ _debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n");
{
const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body;
dump_SVGA3dCmdSetClipPlane(cmd);
@@ -1598,7 +1624,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_CLEAR:
- debug_printf("\tSVGA_3D_CMD_CLEAR\n");
+ _debug_printf("\tSVGA_3D_CMD_CLEAR\n");
{
const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body;
dump_SVGA3dCmdClear(cmd);
@@ -1610,7 +1636,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_PRESENT:
- debug_printf("\tSVGA_3D_CMD_PRESENT\n");
+ _debug_printf("\tSVGA_3D_CMD_PRESENT\n");
{
const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body;
dump_SVGA3dCmdPresent(cmd);
@@ -1622,7 +1648,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SHADER_DEFINE:
- debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n");
+ _debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n");
{
const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body;
dump_SVGA3dCmdDefineShader(cmd);
@@ -1634,7 +1660,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SHADER_DESTROY:
- debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n");
+ _debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n");
{
const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body;
dump_SVGA3dCmdDestroyShader(cmd);
@@ -1642,7 +1668,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SET_SHADER:
- debug_printf("\tSVGA_3D_CMD_SET_SHADER\n");
+ _debug_printf("\tSVGA_3D_CMD_SET_SHADER\n");
{
const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body;
dump_SVGA3dCmdSetShader(cmd);
@@ -1650,7 +1676,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SET_SHADER_CONST:
- debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n");
+ _debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n");
{
const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body;
dump_SVGA3dCmdSetShaderConst(cmd);
@@ -1658,7 +1684,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_DRAW_PRIMITIVES:
- debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n");
+ _debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n");
{
const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body;
unsigned i, j;
@@ -1679,7 +1705,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_SETSCISSORRECT:
- debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n");
+ _debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n");
{
const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body;
dump_SVGA3dCmdSetScissorRect(cmd);
@@ -1687,7 +1713,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_BEGIN_QUERY:
- debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n");
+ _debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n");
{
const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body;
dump_SVGA3dCmdBeginQuery(cmd);
@@ -1695,7 +1721,7 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_END_QUERY:
- debug_printf("\tSVGA_3D_CMD_END_QUERY\n");
+ _debug_printf("\tSVGA_3D_CMD_END_QUERY\n");
{
const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body;
dump_SVGA3dCmdEndQuery(cmd);
@@ -1703,32 +1729,44 @@ svga_dump_commands(const void *commands, uint32_t size)
}
break;
case SVGA_3D_CMD_WAIT_FOR_QUERY:
- debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n");
+ _debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n");
{
const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body;
dump_SVGA3dCmdWaitForQuery(cmd);
body = (const uint8_t *)&cmd[1];
}
break;
+ case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN:
+ _debug_printf("\tSVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN\n");
+ {
+ const SVGA3dCmdBlitSurfaceToScreen *cmd = (const SVGA3dCmdBlitSurfaceToScreen *)body;
+ dump_SVGA3dCmdBlitSurfaceToScreen(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGASignedRect) <= next) {
+ dump_SVGASignedRect((const SVGASignedRect *)body);
+ body += sizeof(SVGASignedRect);
+ }
+ }
+ break;
default:
- debug_printf("\t0x%08x\n", cmd_id);
+ _debug_printf("\t0x%08x\n", cmd_id);
break;
}
while(body + sizeof(uint32_t) <= next) {
- debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
+ _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
body += sizeof(uint32_t);
}
while(body + sizeof(uint32_t) <= next)
- debug_printf("\t\t0x%02x\n", *body++);
+ _debug_printf("\t\t0x%02x\n", *body++);
}
else if(cmd_id == SVGA_CMD_FENCE) {
- debug_printf("\tSVGA_CMD_FENCE\n");
- debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
+ _debug_printf("\tSVGA_CMD_FENCE\n");
+ _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
next += 2*sizeof(uint32_t);
}
else {
- debug_printf("\t0x%08x\n", cmd_id);
+ _debug_printf("\t0x%08x\n", cmd_id);
next += sizeof(uint32_t);
}
}
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py
index 288e753296e..a1ada29ef84 100755
--- a/src/gallium/drivers/svga/svgadump/svga_dump.py
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.py
@@ -71,14 +71,14 @@ class decl_dumper_t(decl_visitor.decl_visitor_t):
print ' switch(%s) {' % ("(*cmd)" + self._instance,)
for name, value in self.decl.values:
print ' case %s:' % (name,)
- print ' debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name)
+ print ' _debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name)
print ' break;'
print ' default:'
- print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
+ print ' _debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
print ' break;'
print ' }'
else:
- print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
+ print ' _debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
def dump_decl(instance, decl):
@@ -154,7 +154,7 @@ class type_dumper_t(type_visitor.type_visitor_t):
dump_decl(self.instance, decl)
def print_instance(self, format):
- print ' debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance)
+ print ' _debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance)
def dump_type(instance, type_):
@@ -202,6 +202,7 @@ cmds = [
('SVGA_3D_CMD_END_QUERY', 'SVGA3dCmdEndQuery', (), None),
('SVGA_3D_CMD_WAIT_FOR_QUERY', 'SVGA3dCmdWaitForQuery', (), None),
#('SVGA_3D_CMD_PRESENT_READBACK', None, (), None),
+ ('SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN', 'SVGA3dCmdBlitSurfaceToScreen', (), 'SVGASignedRect'),
]
def dump_cmds():
@@ -230,7 +231,7 @@ svga_dump_commands(const void *commands, uint32_t size)
indexes = 'ijklmn'
for id, header, body, footer in cmds:
print ' case %s:' % id
- print ' debug_printf("\\t%s\\n");' % id
+ print ' _debug_printf("\\t%s\\n");' % id
print ' {'
print ' const %s *cmd = (const %s *)body;' % (header, header)
if len(body):
@@ -255,25 +256,25 @@ svga_dump_commands(const void *commands, uint32_t size)
print ' }'
print ' break;'
print ' default:'
- print ' debug_printf("\\t0x%08x\\n", cmd_id);'
+ print ' _debug_printf("\\t0x%08x\\n", cmd_id);'
print ' break;'
print ' }'
print r'''
while(body + sizeof(uint32_t) <= next) {
- debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
+ _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
body += sizeof(uint32_t);
}
while(body + sizeof(uint32_t) <= next)
- debug_printf("\t\t0x%02x\n", *body++);
+ _debug_printf("\t\t0x%02x\n", *body++);
}
else if(cmd_id == SVGA_CMD_FENCE) {
- debug_printf("\tSVGA_CMD_FENCE\n");
- debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
+ _debug_printf("\tSVGA_CMD_FENCE\n");
+ _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
next += 2*sizeof(uint32_t);
}
else {
- debug_printf("\t0x%08x\n", cmd_id);
+ _debug_printf("\t0x%08x\n", cmd_id);
next += sizeof(uint32_t);
}
}
@@ -294,18 +295,18 @@ def main():
print '#include "svga_shader_dump.h"'
print '#include "svga3d_reg.h"'
print
- print '#include "pipe/p_debug.h"'
+ print '#include "util/u_debug.h"'
print '#include "svga_dump.h"'
print
config = parser.config_t(
- include_paths = ['include'],
+ include_paths = ['../../../include', '../include'],
compiler = 'gcc',
)
headers = [
- 'include/svga_types.h',
- 'include/svga3d_reg.h',
+ 'svga_types.h',
+ 'svga3d_reg.h',
]
decls = parser.parse(headers, config, parser.COMPILATION_MODE.ALL_AT_ONCE)
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
index b0e7fdf378a..70e27d86d30 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -50,16 +50,16 @@ static void dump_op( struct sh_op op, const char *mnemonic )
assert( op.is_reg == 0 );
if (op.coissue)
- debug_printf( "+" );
- debug_printf( "%s", mnemonic );
+ _debug_printf( "+" );
+ _debug_printf( "%s", mnemonic );
switch (op.control) {
case 0:
break;
case SVGA3DOPCONT_PROJECT:
- debug_printf( "p" );
+ _debug_printf( "p" );
break;
case SVGA3DOPCONT_BIAS:
- debug_printf( "b" );
+ _debug_printf( "b" );
break;
default:
assert( 0 );
@@ -72,28 +72,28 @@ static void dump_comp_op( struct sh_op op, const char *mnemonic )
assert( op.is_reg == 0 );
if (op.coissue)
- debug_printf( "+" );
- debug_printf( "%s", mnemonic );
+ _debug_printf( "+" );
+ _debug_printf( "%s", mnemonic );
switch (op.control) {
case SVGA3DOPCOMP_RESERVED0:
break;
case SVGA3DOPCOMP_GT:
- debug_printf("_gt");
+ _debug_printf("_gt");
break;
case SVGA3DOPCOMP_EQ:
- debug_printf("_eq");
+ _debug_printf("_eq");
break;
case SVGA3DOPCOMP_GE:
- debug_printf("_ge");
+ _debug_printf("_ge");
break;
case SVGA3DOPCOMP_LT:
- debug_printf("_lt");
+ _debug_printf("_lt");
break;
case SVGA3DOPCOMPC_NE:
- debug_printf("_ne");
+ _debug_printf("_ne");
break;
case SVGA3DOPCOMP_LE:
- debug_printf("_le");
+ _debug_printf("_le");
break;
case SVGA3DOPCOMP_RESERVED1:
default:
@@ -109,93 +109,93 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct
switch (sh_reg_type( reg )) {
case SVGA3DREG_TEMP:
- debug_printf( "r%u", reg.number );
+ _debug_printf( "r%u", reg.number );
break;
case SVGA3DREG_INPUT:
- debug_printf( "v%u", reg.number );
+ _debug_printf( "v%u", reg.number );
break;
case SVGA3DREG_CONST:
if (reg.relative) {
if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP)
- debug_printf( "c[aL+%u]", reg.number );
+ _debug_printf( "c[aL+%u]", reg.number );
else
- debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
+ _debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
}
else
- debug_printf( "c%u", reg.number );
+ _debug_printf( "c%u", reg.number );
break;
case SVGA3DREG_ADDR: /* VS */
/* SVGA3DREG_TEXTURE */ /* PS */
if (di->is_ps)
- debug_printf( "t%u", reg.number );
+ _debug_printf( "t%u", reg.number );
else
- debug_printf( "a%u", reg.number );
+ _debug_printf( "a%u", reg.number );
break;
case SVGA3DREG_RASTOUT:
switch (reg.number) {
case 0 /*POSITION*/:
- debug_printf( "oPos" );
+ _debug_printf( "oPos" );
break;
case 1 /*FOG*/:
- debug_printf( "oFog" );
+ _debug_printf( "oFog" );
break;
case 2 /*POINT_SIZE*/:
- debug_printf( "oPts" );
+ _debug_printf( "oPts" );
break;
default:
assert( 0 );
- debug_printf( "???" );
+ _debug_printf( "???" );
}
break;
case SVGA3DREG_ATTROUT:
assert( reg.number < 2 );
- debug_printf( "oD%u", reg.number );
+ _debug_printf( "oD%u", reg.number );
break;
case SVGA3DREG_TEXCRDOUT:
/* SVGA3DREG_OUTPUT */
- debug_printf( "oT%u", reg.number );
+ _debug_printf( "oT%u", reg.number );
break;
case SVGA3DREG_COLOROUT:
- debug_printf( "oC%u", reg.number );
+ _debug_printf( "oC%u", reg.number );
break;
case SVGA3DREG_DEPTHOUT:
- debug_printf( "oD%u", reg.number );
+ _debug_printf( "oD%u", reg.number );
break;
case SVGA3DREG_SAMPLER:
- debug_printf( "s%u", reg.number );
+ _debug_printf( "s%u", reg.number );
break;
case SVGA3DREG_CONSTBOOL:
assert( !reg.relative );
- debug_printf( "b%u", reg.number );
+ _debug_printf( "b%u", reg.number );
break;
case SVGA3DREG_CONSTINT:
assert( !reg.relative );
- debug_printf( "i%u", reg.number );
+ _debug_printf( "i%u", reg.number );
break;
case SVGA3DREG_LOOP:
assert( reg.number == 0 );
- debug_printf( "aL" );
+ _debug_printf( "aL" );
break;
case SVGA3DREG_MISCTYPE:
switch (reg.number) {
case SVGA3DMISCREG_POSITION:
- debug_printf( "vPos" );
+ _debug_printf( "vPos" );
break;
case SVGA3DMISCREG_FACE:
- debug_printf( "vFace" );
+ _debug_printf( "vFace" );
break;
default:
assert(0);
@@ -204,46 +204,46 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct
break;
case SVGA3DREG_LABEL:
- debug_printf( "l%u", reg.number );
+ _debug_printf( "l%u", reg.number );
break;
case SVGA3DREG_PREDICATE:
- debug_printf( "p%u", reg.number );
+ _debug_printf( "p%u", reg.number );
break;
default:
assert( 0 );
- debug_printf( "???" );
+ _debug_printf( "???" );
}
}
static void dump_cdata( struct sh_cdata cdata )
{
- debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] );
+ _debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] );
}
static void dump_idata( struct sh_idata idata )
{
- debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] );
+ _debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] );
}
static void dump_bdata( boolean bdata )
{
- debug_printf( bdata ? "TRUE" : "FALSE" );
+ _debug_printf( bdata ? "TRUE" : "FALSE" );
}
static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
{
switch (sampleinfo.texture_type) {
case SVGA3DSAMP_2D:
- debug_printf( "_2d" );
+ _debug_printf( "_2d" );
break;
case SVGA3DSAMP_CUBE:
- debug_printf( "_cube" );
+ _debug_printf( "_cube" );
break;
case SVGA3DSAMP_VOLUME:
- debug_printf( "_volume" );
+ _debug_printf( "_volume" );
break;
default:
assert( 0 );
@@ -255,46 +255,46 @@ static void dump_usageinfo( struct vs_semantic semantic )
{
switch (semantic.usage) {
case SVGA3D_DECLUSAGE_POSITION:
- debug_printf("_position" );
+ _debug_printf("_position" );
break;
case SVGA3D_DECLUSAGE_BLENDWEIGHT:
- debug_printf("_blendweight" );
+ _debug_printf("_blendweight" );
break;
case SVGA3D_DECLUSAGE_BLENDINDICES:
- debug_printf("_blendindices" );
+ _debug_printf("_blendindices" );
break;
case SVGA3D_DECLUSAGE_NORMAL:
- debug_printf("_normal" );
+ _debug_printf("_normal" );
break;
case SVGA3D_DECLUSAGE_PSIZE:
- debug_printf("_psize" );
+ _debug_printf("_psize" );
break;
case SVGA3D_DECLUSAGE_TEXCOORD:
- debug_printf("_texcoord");
+ _debug_printf("_texcoord");
break;
case SVGA3D_DECLUSAGE_TANGENT:
- debug_printf("_tangent" );
+ _debug_printf("_tangent" );
break;
case SVGA3D_DECLUSAGE_BINORMAL:
- debug_printf("_binormal" );
+ _debug_printf("_binormal" );
break;
case SVGA3D_DECLUSAGE_TESSFACTOR:
- debug_printf("_tessfactor" );
+ _debug_printf("_tessfactor" );
break;
case SVGA3D_DECLUSAGE_POSITIONT:
- debug_printf("_positiont" );
+ _debug_printf("_positiont" );
break;
case SVGA3D_DECLUSAGE_COLOR:
- debug_printf("_color" );
+ _debug_printf("_color" );
break;
case SVGA3D_DECLUSAGE_FOG:
- debug_printf("_fog" );
+ _debug_printf("_fog" );
break;
case SVGA3D_DECLUSAGE_DEPTH:
- debug_printf("_depth" );
+ _debug_printf("_depth" );
break;
case SVGA3D_DECLUSAGE_SAMPLE:
- debug_printf("_sample");
+ _debug_printf("_sample");
break;
default:
assert( 0 );
@@ -302,7 +302,7 @@ static void dump_usageinfo( struct vs_semantic semantic )
}
if (semantic.usage_index != 0) {
- debug_printf("%d", semantic.usage_index );
+ _debug_printf("%d", semantic.usage_index );
}
}
@@ -316,47 +316,47 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier );
if (dstreg.modifier & SVGA3DDSTMOD_SATURATE)
- debug_printf( "_sat" );
+ _debug_printf( "_sat" );
if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION)
- debug_printf( "_pp" );
+ _debug_printf( "_pp" );
switch (dstreg.shift_scale) {
case 0:
break;
case 1:
- debug_printf( "_x2" );
+ _debug_printf( "_x2" );
break;
case 2:
- debug_printf( "_x4" );
+ _debug_printf( "_x4" );
break;
case 3:
- debug_printf( "_x8" );
+ _debug_printf( "_x8" );
break;
case 13:
- debug_printf( "_d8" );
+ _debug_printf( "_d8" );
break;
case 14:
- debug_printf( "_d4" );
+ _debug_printf( "_d4" );
break;
case 15:
- debug_printf( "_d2" );
+ _debug_printf( "_d2" );
break;
default:
assert( 0 );
}
- debug_printf( " " );
+ _debug_printf( " " );
u.dstreg = dstreg;
dump_reg( u.reg, NULL, di );
if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) {
- debug_printf( "." );
+ _debug_printf( "." );
if (dstreg.write_mask & SVGA3DWRITEMASK_0)
- debug_printf( "x" );
+ _debug_printf( "x" );
if (dstreg.write_mask & SVGA3DWRITEMASK_1)
- debug_printf( "y" );
+ _debug_printf( "y" );
if (dstreg.write_mask & SVGA3DWRITEMASK_2)
- debug_printf( "z" );
+ _debug_printf( "z" );
if (dstreg.write_mask & SVGA3DWRITEMASK_3)
- debug_printf( "w" );
+ _debug_printf( "w" );
}
}
@@ -372,19 +372,19 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
case SVGA3DSRCMOD_BIASNEG:
case SVGA3DSRCMOD_SIGNNEG:
case SVGA3DSRCMOD_X2NEG:
- debug_printf( "-" );
+ _debug_printf( "-" );
break;
case SVGA3DSRCMOD_ABS:
- debug_printf( "|" );
+ _debug_printf( "|" );
break;
case SVGA3DSRCMOD_ABSNEG:
- debug_printf( "-|" );
+ _debug_printf( "-|" );
break;
case SVGA3DSRCMOD_COMP:
- debug_printf( "1-" );
+ _debug_printf( "1-" );
break;
case SVGA3DSRCMOD_NOT:
- debug_printf( "!" );
+ _debug_printf( "!" );
}
u.srcreg = srcreg;
@@ -397,39 +397,39 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
break;
case SVGA3DSRCMOD_ABS:
case SVGA3DSRCMOD_ABSNEG:
- debug_printf( "|" );
+ _debug_printf( "|" );
break;
case SVGA3DSRCMOD_BIAS:
case SVGA3DSRCMOD_BIASNEG:
- debug_printf( "_bias" );
+ _debug_printf( "_bias" );
break;
case SVGA3DSRCMOD_SIGN:
case SVGA3DSRCMOD_SIGNNEG:
- debug_printf( "_bx2" );
+ _debug_printf( "_bx2" );
break;
case SVGA3DSRCMOD_X2:
case SVGA3DSRCMOD_X2NEG:
- debug_printf( "_x2" );
+ _debug_printf( "_x2" );
break;
case SVGA3DSRCMOD_DZ:
- debug_printf( "_dz" );
+ _debug_printf( "_dz" );
break;
case SVGA3DSRCMOD_DW:
- debug_printf( "_dw" );
+ _debug_printf( "_dw" );
break;
default:
assert( 0 );
}
if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) {
- debug_printf( "." );
+ _debug_printf( "." );
if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) {
- debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ _debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
}
else {
- debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_y] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_z] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_w] );
+ _debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ _debug_printf( "%c", "xyzw"[srcreg.swizzle_y] );
+ _debug_printf( "%c", "xyzw"[srcreg.swizzle_z] );
+ _debug_printf( "%c", "xyzw"[srcreg.swizzle_w] );
}
}
}
@@ -447,15 +447,15 @@ svga_shader_dump(
if (do_binary) {
for (i = 0; i < dwords; i++)
- debug_printf(" 0x%08x,\n", assem[i]);
+ _debug_printf(" 0x%08x,\n", assem[i]);
- debug_printf("\n\n");
+ _debug_printf("\n\n");
}
di.version.value = *assem++;
di.is_ps = (di.version.type == SVGA3D_PS_TYPE);
- debug_printf(
+ _debug_printf(
"%s_%u_%u\n",
di.is_ps ? "ps" : "vs",
di.version.major,
@@ -465,7 +465,7 @@ svga_shader_dump(
struct sh_op op = *(struct sh_op *) assem;
if (assem - start >= dwords) {
- debug_printf("... ran off end of buffer\n");
+ _debug_printf("... ran off end of buffer\n");
assert(0);
return;
}
@@ -475,7 +475,7 @@ svga_shader_dump(
{
struct sh_dcl dcl = *(struct sh_dcl *) assem;
- debug_printf( "dcl" );
+ _debug_printf( "dcl" );
if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER)
dump_sampleinfo( dcl.u.ps.sampleinfo );
else if (di.is_ps) {
@@ -486,7 +486,7 @@ svga_shader_dump(
else
dump_usageinfo( dcl.u.vs.semantic );
dump_dstreg( dcl.reg, &di );
- debug_printf( "\n" );
+ _debug_printf( "\n" );
assem += sizeof( struct sh_dcl ) / sizeof( unsigned );
}
break;
@@ -495,11 +495,11 @@ svga_shader_dump(
{
struct sh_defb defb = *(struct sh_defb *) assem;
- debug_printf( "defb " );
+ _debug_printf( "defb " );
dump_reg( defb.reg, NULL, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_bdata( defb.data );
- debug_printf( "\n" );
+ _debug_printf( "\n" );
assem += sizeof( struct sh_defb ) / sizeof( unsigned );
}
break;
@@ -508,11 +508,11 @@ svga_shader_dump(
{
struct sh_defi defi = *(struct sh_defi *) assem;
- debug_printf( "defi " );
+ _debug_printf( "defi " );
dump_reg( defi.reg, NULL, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_idata( defi.idata );
- debug_printf( "\n" );
+ _debug_printf( "\n" );
assem += sizeof( struct sh_defi ) / sizeof( unsigned );
}
break;
@@ -528,11 +528,11 @@ svga_shader_dump(
else {
struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
dump_dstreg( unaryop.dst, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_srcreg( unaryop.src, NULL, &di );
assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
}
- debug_printf( "\n" );
+ _debug_printf( "\n" );
break;
case SVGA3DOP_TEX:
@@ -549,7 +549,7 @@ svga_shader_dump(
struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
dump_dstreg( unaryop.dst, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_srcreg( unaryop.src, NULL, &di );
assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
}
@@ -559,30 +559,30 @@ svga_shader_dump(
dump_op( op, "texld" );
dump_dstreg( binaryop.dst, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_srcreg( binaryop.src0, NULL, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_srcreg( binaryop.src1, NULL, &di );
assem += sizeof( struct sh_binaryop ) / sizeof( unsigned );
}
- debug_printf( "\n" );
+ _debug_printf( "\n" );
break;
case SVGA3DOP_DEF:
{
struct sh_def def = *(struct sh_def *) assem;
- debug_printf( "def " );
+ _debug_printf( "def " );
dump_reg( def.reg, NULL, &di );
- debug_printf( ", " );
+ _debug_printf( ", " );
dump_cdata( def.cdata );
- debug_printf( "\n" );
+ _debug_printf( "\n" );
assem += sizeof( struct sh_def ) / sizeof( unsigned );
}
break;
case SVGA3DOP_PHASE:
- debug_printf( "phase\n" );
+ _debug_printf( "phase\n" );
assem += sizeof( struct sh_op ) / sizeof( unsigned );
break;
@@ -596,12 +596,12 @@ svga_shader_dump(
break;
case SVGA3DOP_RET:
- debug_printf( "ret\n" );
+ _debug_printf( "ret\n" );
assem += sizeof( struct sh_op ) / sizeof( unsigned );
break;
case SVGA3DOP_END:
- debug_printf( "end\n" );
+ _debug_printf( "end\n" );
finished = TRUE;
break;
@@ -640,14 +640,14 @@ svga_shader_dump(
}
if (not_first_arg)
- debug_printf( ", " );
+ _debug_printf( ", " );
else
- debug_printf( " " );
+ _debug_printf( " " );
dump_srcreg( srcreg, &indreg, &di );
not_first_arg = TRUE;
}
- debug_printf( "\n" );
+ _debug_printf( "\n" );
}
}
}
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 6d582092941..0102cc18763 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -43,19 +43,6 @@ void trace_dump_format(enum pipe_format format)
}
-void trace_dump_block(const struct pipe_format_block *block)
-{
- if (!trace_dumping_enabled_locked())
- return;
-
- trace_dump_struct_begin("pipe_format_block");
- trace_dump_member(uint, block, size);
- trace_dump_member(uint, block, width);
- trace_dump_member(uint, block, height);
- trace_dump_struct_end();
-}
-
-
static void trace_dump_reference(const struct pipe_reference *reference)
{
if (!trace_dumping_enabled_locked())
@@ -94,10 +81,6 @@ void trace_dump_template(const struct pipe_texture *templat)
trace_dump_uint(templat->depth0);
trace_dump_member_end();
- trace_dump_member_begin("block");
- trace_dump_block(&templat->block);
- trace_dump_member_end();
-
trace_dump_member(uint, templat, last_level);
trace_dump_member(uint, templat, tex_usage);
@@ -483,16 +466,9 @@ void trace_dump_transfer(const struct pipe_transfer *state)
trace_dump_struct_begin("pipe_transfer");
- trace_dump_member(format, state, format);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
- trace_dump_member_begin("block");
- trace_dump_block(&state->block);
- trace_dump_member_end();
-
- trace_dump_member(uint, state, nblocksx);
- trace_dump_member(uint, state, nblocksy);
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, usage);
diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h
index 05b821adb64..07ad6fbb205 100644
--- a/src/gallium/drivers/trace/tr_dump_state.h
+++ b/src/gallium/drivers/trace/tr_dump_state.h
@@ -35,11 +35,8 @@
void trace_dump_format(enum pipe_format format);
-void trace_dump_block(const struct pipe_format_block *block);
-
void trace_dump_template(const struct pipe_texture *templat);
-
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index b59458c0e37..af1d7f3224e 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -203,7 +203,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
&t->width0, 1,
&t->height0, 1,
&t->depth0, 1,
- t->block.width, t->block.height, t->block.size,
+ pf_get_blockwidth(t->format),
+ pf_get_blockheight(t->format),
+ pf_get_blocksize(t->format),
t->last_level,
t->nr_samples,
t->tex_usage,
@@ -251,9 +253,12 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
map = screen->transfer_map(screen, t);
rbug_send_texture_read_reply(tr_rbug->con, serial,
- t->format,
- t->block.width, t->block.height, t->block.size,
- (uint8_t*)map, t->stride * t->nblocksy,
+ t->texture->format,
+ pf_get_blockwidth(t->texture->format),
+ pf_get_blockheight(t->texture->format),
+ pf_get_blocksize(t->texture->format),
+ (uint8_t*)map,
+ t->stride * pf_get_nblocksy(t->texture->format, t->height),
t->stride,
NULL);
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 7da9bd3866b..f69f7da000d 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -35,6 +35,7 @@
#include "tr_screen.h"
#include "pipe/p_inlines.h"
+#include "pipe/p_format.h"
static boolean trace = FALSE;
@@ -424,7 +425,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
struct pipe_transfer *transfer = tr_trans->transfer;
if(tr_trans->map) {
- size_t size = transfer->nblocksy * transfer->stride;
+ size_t size = pf_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride;
trace_dump_call_begin("pipe_screen", "transfer_write");