summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_shader_build.c23
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_surface.c29
-rw-r--r--src/gallium/winsys/g3dvl/xsp_winsys.c15
-rw-r--r--src/libXvMC/Makefile2
5 files changed, 41 insertions, 30 deletions
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index 88da47c06a..bd8743dc9a 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -1407,7 +1407,7 @@ static int vlInitMC(struct VL_CONTEXT *context)
template.height[0] = 8 * 4;
template.depth[0] = 1;
template.compressed = 0;
- template.cpp = 2;
+ pf_get_block(template.format, &template.block);
context->states.mc.textures[0] = pipe->screen->texture_create(pipe->screen, &template);
diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.c b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
index fd9de7dab8..365ad69725 100644
--- a/src/gallium/state_trackers/g3dvl/vl_shader_build.c
+++ b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
@@ -11,8 +11,8 @@ struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
@@ -39,10 +39,9 @@ struct tgsi_full_declaration vl_decl_interpolated_input
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.Declaration.Interpolate = 1;
- decl.Interpolation.Interpolate = interpolation;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.Declaration.Interpolate = interpolation;;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
@@ -55,8 +54,8 @@ struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int i
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
@@ -69,8 +68,8 @@ struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int inde
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
@@ -81,8 +80,8 @@ struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int l
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_SAMPLER;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index d2220d7abf..68313cc750 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -98,6 +98,7 @@ static int vlGrabBlocks
{
struct pipe_surface *tex_surface;
short *texels;
+ unsigned int tex_pitch;
unsigned int tb, sb = 0;
assert(context);
@@ -111,6 +112,7 @@ static int vlGrabBlocks
);
texels = pipe_surface_map(tex_surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+ tex_pitch = tex_surface->stride / tex_surface->block.size;
for (tb = 0; tb < 4; ++tb)
{
@@ -121,35 +123,35 @@ static int vlGrabBlocks
vlGrabFrameCodedFullBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT,
- tex_surface->pitch
+ texels + tb * tex_pitch * VL_BLOCK_HEIGHT,
+ tex_pitch
);
else
vlGrabFrameCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT,
- tex_surface->pitch
+ texels + tb * tex_pitch * VL_BLOCK_HEIGHT,
+ tex_pitch
);
else
if (sample_type == VL_FULL_SAMPLE)
vlGrabFieldCodedFullBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + (tb % 2) * tex_surface->pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_surface->pitch,
- tex_surface->pitch
+ texels + (tb % 2) * tex_pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_pitch,
+ tex_pitch
);
else
vlGrabFieldCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + (tb % 2) * tex_surface->pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_surface->pitch,
- tex_surface->pitch
+ texels + (tb % 2) * tex_pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_pitch,
+ tex_pitch
);
++sb;
}
else
- vlGrabNoBlock(texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT, tex_surface->pitch);
+ vlGrabNoBlock(texels + tb * tex_pitch * VL_BLOCK_HEIGHT, tex_pitch);
}
pipe_surface_unmap(tex_surface);
@@ -165,6 +167,7 @@ static int vlGrabBlocks
);
texels = pipe_surface_map(tex_surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+ tex_pitch = tex_surface->stride / tex_surface->block.size;
if ((coded_block_pattern >> (1 - tb)) & 1)
{
@@ -173,20 +176,20 @@ static int vlGrabBlocks
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
texels,
- tex_surface->pitch
+ tex_pitch
);
else
vlGrabFrameCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
texels,
- tex_surface->pitch
+ tex_pitch
);
++sb;
}
else
- vlGrabNoBlock(texels, tex_surface->pitch);
+ vlGrabNoBlock(texels, tex_pitch);
pipe_surface_unmap(tex_surface);
}
@@ -223,7 +226,7 @@ int vlCreateSurface(struct VL_CONTEXT *context, struct VL_SURFACE **surface)
template.height[0] = sfc->height;
template.depth[0] = 1;
template.compressed = 0;
- template.cpp = 4;
+ pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
sfc->texture = pipe->screen->texture_create(pipe->screen, &template);
diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c
index eb4c9085d6..d04c4be580 100644
--- a/src/gallium/winsys/g3dvl/xsp_winsys.c
+++ b/src/gallium/winsys/g3dvl/xsp_winsys.c
@@ -101,6 +101,12 @@ static struct pipe_surface* xsp_surface_alloc(struct pipe_winsys *pws)
return surface;
}
+/* Borrowed from Mesa's xm_winsys */
+static unsigned int round_up(unsigned n, unsigned multiple)
+{
+ return (n + multiple - 1) & ~(multiple - 1);
+}
+
static int xsp_surface_alloc_storage
(
struct pipe_winsys *pws,
@@ -120,10 +126,13 @@ static int xsp_surface_alloc_storage
surface->width = width;
surface->height = height;
surface->format = format;
- surface->cpp = pf_get_size(format);
- surface->pitch = width;
+ pf_get_block(format, &surface->block);
+ surface->nblocksx = pf_get_nblocksx(&surface->block, width);
+ surface->nblocksy = pf_get_nblocksy(&surface->block, height);
+ surface->stride = round_up(surface->nblocksx * surface->block.size, ALIGNMENT);
surface->usage = flags;
- surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->pitch * surface->cpp * height);
+ /* XXX: Need to consider block dims? See xm_winsys.c */
+ surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->stride * height);
return 0;
}
diff --git a/src/libXvMC/Makefile b/src/libXvMC/Makefile
index b2f41e176d..4985ecd3e9 100644
--- a/src/libXvMC/Makefile
+++ b/src/libXvMC/Makefile
@@ -17,7 +17,7 @@ LDFLAGS += -L${GALLIUMDIR}/state_trackers/g3dvl \
-L${GALLIUMDIR}/auxiliary/cso_cache \
-L${GALLIUMDIR}/auxiliary/util \
-L${GALLIUMDIR}/auxiliary/rtasm
-LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil
+LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil -lm
#############################################