summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-12-18 09:08:26 +0100
committerMichal Krol <michal@vmware.com>2009-12-18 09:08:26 +0100
commit7855fcb63ba0594cdaee15f8579b66af651828e0 (patch)
tree4ec55e91e49cd9600f362c32acc539696a8b1b8b /src/gallium/auxiliary
parent465333ab7078daf878ad34ab172ebb15f8a003b3 (diff)
parentb1ed72ebe2599ec178f51d86fd42f26486b9a19b (diff)
Merge branch 'pipe-format-simplify'
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c1
-rw-r--r--src/gallium/auxiliary/util/u_blit.c1
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c4
-rw-r--r--src/gallium/auxiliary/util/u_debug.c7
-rw-r--r--src/gallium/auxiliary/util/u_format.c15
-rw-r--r--src/gallium/auxiliary/util/u_format.csv8
-rw-r--r--src/gallium/auxiliary/util/u_format.h203
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_table.py18
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c13
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h3
-rw-r--r--src/gallium/auxiliary/util/u_rect.c21
-rw-r--r--src/gallium/auxiliary/util/u_surface.c1
-rw-r--r--src/gallium/auxiliary/util/u_tile.c9
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c5
15 files changed, 262 insertions, 49 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 23d8b609e1..14375426ed 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -35,6 +35,8 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
+
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index bcb860da2e..0cc2b71864 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -38,6 +38,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index c9050ca864..3f74e2aa8b 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -42,6 +42,7 @@
#include "util/u_blit.h"
#include "util/u_draw_quad.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 895af2c8d0..0242b79615 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -579,8 +579,8 @@ void util_blitter_copy(struct blitter_context *blitter,
if (!dst->texture || !src->texture)
return;
- is_depth = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_Z) != 0;
- is_stencil = pf_get_component_bits(src->format, PIPE_FORMAT_COMP_S) != 0;
+ is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
+ is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
dst_tex_usage = is_depth || is_stencil ? PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
PIPE_TEXTURE_USAGE_RENDER_TARGET;
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 40633574b0..27e0b0d159 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -64,6 +64,7 @@
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_stream.h"
@@ -670,9 +671,9 @@ void debug_dump_surface(const char *prefix,
debug_dump_image(prefix,
texture->format,
- pf_get_blocksize(texture->format),
- pf_get_nblocksx(texture->format, transfer->width),
- pf_get_nblocksy(texture->format, transfer->height),
+ util_format_get_blocksize(texture->format),
+ util_format_get_nblocksx(texture->format, transfer->width),
+ util_format_get_nblocksy(texture->format, transfer->height),
transfer->stride,
data);
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 98ea13b60b..e0724a1a8b 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -32,15 +32,14 @@
const struct util_format_description *
util_format_description(enum pipe_format format)
{
- const struct util_format_description *desc = util_format_description_table;
+ const struct util_format_description *desc;
- while(TRUE) {
- if(desc->format == format)
- return desc;
+ if (format >= PIPE_FORMAT_COUNT) {
+ return NULL;
+ }
- if(desc->format == PIPE_FORMAT_NONE)
- return NULL;
+ desc = &util_format_description_table[format];
+ assert(desc->format == format);
- ++desc;
- };
+ return desc;
}
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index b9cc2aa716..866b18ff16 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -11,6 +11,8 @@ PIPE_FORMAT_A8_UNORM , arith , 1, 1, un8 , , , , 000x,
PIPE_FORMAT_I8_UNORM , arith , 1, 1, un8 , , , , xxxx, rgb
PIPE_FORMAT_A8L8_UNORM , arith , 1, 1, un8 , un8 , , , xxxy, rgb
PIPE_FORMAT_L16_UNORM , arith , 1, 1, un16, , , , xxx1, rgb
+PIPE_FORMAT_YCBCR , yuv , 2, 1, x32 , , , , xyz1, yuv
+PIPE_FORMAT_YCBCR_REV , yuv , 2, 1, x32 , , , , xyz1, yuv
PIPE_FORMAT_Z16_UNORM , array , 1, 1, un16, , , , x___, zs
PIPE_FORMAT_Z32_UNORM , array , 1, 1, un32, , , , x___, zs
PIPE_FORMAT_Z32_FLOAT , array , 1, 1, f32 , , , , x___, zs
@@ -97,13 +99,11 @@ PIPE_FORMAT_B8G8R8A8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyxw,
PIPE_FORMAT_B8G8R8X8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyx1, srgb
PIPE_FORMAT_X8UB8UG8SR8S_NORM , arith , 1, 1, sn8 , sn8 , un8 , x8 , 1zyx, rgb
PIPE_FORMAT_B6UG5SR5S_NORM , arith , 1, 1, sn5 , sn5 , un6 , , xyz1, rgb
-PIPE_FORMAT_YCBCR , yuv , 2, 1, x32 , , , , xyz1, yuv
-PIPE_FORMAT_YCBCR_REV , yuv , 2, 1, x32 , , , , xyz1, yuv
-PIPE_FORMAT_DXT1_RGBA , dxt , 4, 4, x64 , , , , xyzw, rgb
PIPE_FORMAT_DXT1_RGB , dxt , 4, 4, x64 , , , , xyz1, rgb
+PIPE_FORMAT_DXT1_RGBA , dxt , 4, 4, x64 , , , , xyzw, rgb
PIPE_FORMAT_DXT3_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb
PIPE_FORMAT_DXT5_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb
-PIPE_FORMAT_DXT1_SRGBA , dxt , 4, 4, x64 , , , , xyzw, srgb
PIPE_FORMAT_DXT1_SRGB , dxt , 4, 4, x64 , , , , xyz1, srgb
+PIPE_FORMAT_DXT1_SRGBA , dxt , 4, 4, x64 , , , , xyzw, srgb
PIPE_FORMAT_DXT3_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb
PIPE_FORMAT_DXT5_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 19b902db98..97e4d959bc 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -147,6 +147,209 @@ const struct util_format_description *
util_format_description(enum pipe_format format);
+/*
+ * Format query functions.
+ */
+
+static INLINE boolean
+util_format_is_compressed(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->layout == UTIL_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
+}
+
+static INLINE boolean
+util_format_is_depth_or_stencil(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ? TRUE : FALSE;
+}
+
+static INLINE boolean
+util_format_is_depth_and_stencil(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) {
+ return FALSE;
+ }
+
+ return (desc->swizzle[0] != UTIL_FORMAT_SWIZZLE_NONE &&
+ desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
+}
+
+
+/**
+ * Return total bits needed for the pixel format.
+ */
+static INLINE uint
+util_format_get_blocksizebits(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return 0;
+ }
+
+ return desc->block.bits / (desc->block.width * desc->block.height);
+}
+
+/**
+ * Return bytes per pixel for the given format.
+ */
+static INLINE uint
+util_format_get_blocksize(enum pipe_format format)
+{
+ uint bits = util_format_get_blocksizebits(format);
+
+ assert(bits % 8 == 0);
+
+ return bits / 8;
+}
+
+static INLINE uint
+util_format_get_blockwidth(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return 1;
+ }
+
+ switch (desc->layout) {
+ case UTIL_FORMAT_LAYOUT_YUV:
+ return 2;
+ case UTIL_FORMAT_LAYOUT_DXT:
+ return 4;
+ default:
+ return 1;
+ }
+}
+
+static INLINE uint
+util_format_get_blockheight(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return 1;
+ }
+
+ switch (desc->layout) {
+ case UTIL_FORMAT_LAYOUT_DXT:
+ return 4;
+ default:
+ return 1;
+ }
+}
+
+static INLINE unsigned
+util_format_get_nblocksx(enum pipe_format format,
+ unsigned x)
+{
+ unsigned blockwidth = util_format_get_blockwidth(format);
+ return (x + blockwidth - 1) / blockwidth;
+}
+
+static INLINE unsigned
+util_format_get_nblocksy(enum pipe_format format,
+ unsigned y)
+{
+ unsigned blockheight = util_format_get_blockheight(format);
+ return (y + blockheight - 1) / blockheight;
+}
+
+static INLINE unsigned
+util_format_get_nblocks(enum pipe_format format,
+ unsigned width,
+ unsigned height)
+{
+ return util_format_get_nblocksx(format, width) * util_format_get_nblocksy(format, height);
+}
+
+static INLINE size_t
+util_format_get_stride(enum pipe_format format,
+ unsigned width)
+{
+ return util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
+}
+
+static INLINE size_t
+util_format_get_2d_size(enum pipe_format format,
+ size_t stride,
+ unsigned height)
+{
+ return util_format_get_nblocksy(format, height) * stride;
+}
+
+static INLINE uint
+util_format_get_component_bits(enum pipe_format format,
+ enum util_format_colorspace colorspace,
+ uint component)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ enum util_format_colorspace desc_colorspace;
+
+ assert(format);
+ if (!format) {
+ return 0;
+ }
+
+ assert(component < 4);
+
+ /* Treat RGB and SRGB as equivalent. */
+ if (colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+ colorspace = UTIL_FORMAT_COLORSPACE_RGB;
+ }
+ if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+ desc_colorspace = UTIL_FORMAT_COLORSPACE_RGB;
+ } else {
+ desc_colorspace = desc->colorspace;
+ }
+
+ if (desc_colorspace != colorspace) {
+ return 0;
+ }
+
+ switch (desc->swizzle[component]) {
+ case UTIL_FORMAT_SWIZZLE_X:
+ return desc->channel[0].size;
+ case UTIL_FORMAT_SWIZZLE_Y:
+ return desc->channel[1].size;
+ case UTIL_FORMAT_SWIZZLE_Z:
+ return desc->channel[2].size;
+ case UTIL_FORMAT_SWIZZLE_W:
+ return desc->channel[3].size;
+ default:
+ return 0;
+ }
+}
+
+
+/*
+ * Format access functions.
+ */
+
void
util_format_read_4f(enum pipe_format format,
float *dst, unsigned dst_stride,
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 2cd0f95678..571cab55dc 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -89,6 +89,15 @@ def write_format_table(formats):
print 'const struct util_format_description'
print 'util_format_description_table[] = '
print "{"
+ print " {"
+ print " PIPE_FORMAT_NONE,"
+ print " \"PIPE_FORMAT_NONE\","
+ print " {0, 0, 0},"
+ print " 0,"
+ print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
+ print " {0, 0, 0, 0},"
+ print " 0"
+ print " },"
for format in formats:
print " {"
print " %s," % (format.name,)
@@ -119,15 +128,6 @@ def write_format_table(formats):
print " },"
print " %s," % (colorspace_map(format.colorspace),)
print " },"
- print " {"
- print " PIPE_FORMAT_NONE,"
- print " \"PIPE_FORMAT_NONE\","
- print " {0, 0, 0},"
- print " 0,"
- print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
- print " {0, 0, 0, 0},"
- print " 0"
- print " },"
print "};"
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 69ff3b9dd9..0dad6ccbc0 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -41,6 +41,7 @@
#include "pipe/p_shader_tokens.h"
#include "pipe/p_state.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_draw_quad.h"
#include "util/u_gen_mipmap.h"
@@ -997,7 +998,7 @@ reduce_2d(enum pipe_format pformat,
{
enum dtype datatype;
uint comps;
- const int bpt = pf_get_blocksize(pformat);
+ const int bpt = util_format_get_blocksize(pformat);
const ubyte *srcA, *srcB;
ubyte *dst;
int row;
@@ -1036,7 +1037,7 @@ reduce_3d(enum pipe_format pformat,
int dstWidth, int dstHeight, int dstDepth,
int dstRowStride, ubyte *dstPtr)
{
- const int bpt = pf_get_blocksize(pformat);
+ const int bpt = util_format_get_blocksize(pformat);
const int border = 0;
int img, row;
int bytesPerSrcImage, bytesPerDstImage;
@@ -1160,8 +1161,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
const uint zslice = 0;
uint dstLevel;
- assert(pf_get_blockwidth(pt->format) == 1);
- assert(pf_get_blockheight(pt->format) == 1);
+ assert(util_format_get_blockwidth(pt->format) == 1);
+ assert(util_format_get_blockheight(pt->format) == 1);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
const uint srcLevel = dstLevel - 1;
@@ -1205,8 +1206,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_screen *screen = pipe->screen;
uint dstLevel, zslice = 0;
- assert(pf_get_blockwidth(pt->format) == 1);
- assert(pf_get_blockheight(pt->format) == 1);
+ assert(util_format_get_blockwidth(pt->format) == 1);
+ assert(util_format_get_blockheight(pt->format) == 1);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
const uint srcLevel = dstLevel - 1;
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index a2e0f26686..7de62d3228 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -37,6 +37,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
+#include "util/u_format.h"
#include "util/u_math.h"
@@ -302,7 +303,7 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color *
ubyte b = 0;
ubyte a = 0;
- if (pf_size_x(format) <= 8) {
+ if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) <= 8) {
/* format uses 8-bit components or less */
r = float_to_ubyte(rgba[0]);
g = float_to_ubyte(rgba[1]);
diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c
index 72725b59d2..298fbacecb 100644
--- a/src/gallium/auxiliary/util/u_rect.c
+++ b/src/gallium/auxiliary/util/u_rect.c
@@ -34,6 +34,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
+#include "util/u_format.h"
#include "util/u_rect.h"
@@ -57,9 +58,9 @@ util_copy_rect(ubyte * dst,
{
unsigned i;
int src_stride_pos = src_stride < 0 ? -src_stride : src_stride;
- int blocksize = pf_get_blocksize(format);
- int blockwidth = pf_get_blockwidth(format);
- int blockheight = pf_get_blockheight(format);
+ int blocksize = util_format_get_blocksize(format);
+ int blockwidth = util_format_get_blockwidth(format);
+ int blockheight = util_format_get_blockheight(format);
assert(blocksize > 0);
assert(blockwidth > 0);
@@ -105,9 +106,9 @@ util_fill_rect(ubyte * dst,
{
unsigned i, j;
unsigned width_size;
- int blocksize = pf_get_blocksize(format);
- int blockwidth = pf_get_blockwidth(format);
- int blockheight = pf_get_blockheight(format);
+ int blocksize = util_format_get_blocksize(format);
+ int blockwidth = util_format_get_blockwidth(format);
+ int blockheight = util_format_get_blockheight(format);
assert(blocksize > 0);
assert(blockwidth > 0);
@@ -203,9 +204,9 @@ util_surface_copy(struct pipe_context *pipe,
PIPE_TRANSFER_WRITE,
dst_x, dst_y, w, h);
- assert(pf_get_blocksize(dst_format) == pf_get_blocksize(src_format));
- assert(pf_get_blockwidth(dst_format) == pf_get_blockwidth(src_format));
- assert(pf_get_blockheight(dst_format) == pf_get_blockheight(src_format));
+ assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format));
+ assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
+ assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format));
src_map = pipe->screen->transfer_map(screen, src_trans);
dst_map = pipe->screen->transfer_map(screen, dst_trans);
@@ -270,7 +271,7 @@ util_surface_fill(struct pipe_context *pipe,
if (dst_map) {
assert(dst_trans->stride > 0);
- switch (pf_get_blocksize(dst_trans->texture->format)) {
+ switch (util_format_get_blocksize(dst_trans->texture->format)) {
case 1:
case 2:
case 4:
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index f828908f0b..35c4978204 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -36,6 +36,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
+#include "util/u_format.h"
#include "util/u_surface.h"
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 88c9a1f097..5b8dd1abb9 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -34,6 +34,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
@@ -52,7 +53,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
const void *src;
if (dst_stride == 0)
- dst_stride = pf_get_stride(pt->texture->format, w);
+ dst_stride = util_format_get_stride(pt->texture->format, w);
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -81,7 +82,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
enum pipe_format format = pt->texture->format;
if (src_stride == 0)
- src_stride = pf_get_stride(format, w);
+ src_stride = util_format_get_stride(format, w);
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
@@ -1275,7 +1276,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
+ packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
if (!packed)
return;
@@ -1303,7 +1304,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format));
+ packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
if (!packed)
return;
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 4952e9c9f8..ab196c21f8 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -29,6 +29,7 @@
#include <assert.h>
#include <pipe/p_context.h>
#include <pipe/p_inlines.h>
+#include <util/u_format.h>
#include <util/u_math.h>
#include <util/u_memory.h>
#include <tgsi/tgsi_parse.h>
@@ -1443,7 +1444,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
assert(r);
assert(blocks);
- tex_pitch = r->tex_transfer[0]->stride / pf_get_blocksize(r->tex_transfer[0]->texture->format);
+ tex_pitch = r->tex_transfer[0]->stride / util_format_get_blocksize(r->tex_transfer[0]->texture->format);
texels = r->texels[0] + mbpy * tex_pitch + mbpx;
for (y = 0; y < 2; ++y) {
@@ -1482,7 +1483,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
mbpy /= 2;
for (tb = 0; tb < 2; ++tb) {
- tex_pitch = r->tex_transfer[tb + 1]->stride / pf_get_blocksize(r->tex_transfer[tb + 1]->texture->format);
+ tex_pitch = r->tex_transfer[tb + 1]->stride / util_format_get_blocksize(r->tex_transfer[tb + 1]->texture->format);
texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx;
if ((cbp >> (1 - tb)) & 1) {