Commit b1ed72eb authored by Michal Krol's avatar Michal Krol

Move the remaining format pf_get_* functions to u_format.h.

Previously they depended on format blocks, but after removing those
they started depending on format encoding.
parent ec5577a8
......@@ -25,6 +25,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_debug.h"
#include "util/u_network.h"
......@@ -54,10 +55,7 @@ static void dump(unsigned width, unsigned height,
unsigned src_stride, enum pipe_format src_format,
uint8_t *data, unsigned src_size)
{
struct pipe_format_block src_block;
enum pipe_format dst_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
struct pipe_format_block dst_block;
unsigned dst_stride;
unsigned dst_size;
float *rgba;
......@@ -65,14 +63,11 @@ static void dump(unsigned width, unsigned height,
char filename[512];
{
pf_get_block(src_format, &src_block);
assert(src_stride >= pf_get_stride(&src_block, width));
assert(src_size >= pf_get_2d_size(&src_block, src_stride, width));
assert(src_stride >= util_format_get_stride(src_format, width));
}
{
pf_get_block(dst_format, &dst_block);
dst_stride = pf_get_stride(&dst_block, width);
dst_size = pf_get_2d_size(&dst_block, dst_stride, width);
dst_stride = util_format_get_stride(dst_format, width);
dst_size = util_format_get_2d_size(dst_format, dst_stride, width);
rgba = MALLOC(dst_size);
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -200,7 +200,7 @@ util_format_is_depth_and_stencil(enum pipe_format format)
* Return total bits needed for the pixel format.
*/
static INLINE uint
util_format_get_bits(enum pipe_format format)
util_format_get_blocksizebits(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
......@@ -216,15 +216,92 @@ util_format_get_bits(enum pipe_format format)
* Return bytes per pixel for the given format.
*/
static INLINE uint
util_format_get_size(enum pipe_format format)
util_format_get_blocksize(enum pipe_format format)
{
uint bits = util_format_get_bits(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,
......
......@@ -998,7 +998,7 @@ reduce_2d(enum pipe_format pformat,
{
enum dtype datatype;
uint comps;
const int bpt = util_format_get_size(pformat);
const int bpt = util_format_get_blocksize(pformat);
const ubyte *srcA, *srcB;
ubyte *dst;
int row;
......@@ -1037,7 +1037,7 @@ reduce_3d(enum pipe_format pformat,
int dstWidth, int dstHeight, int dstDepth,
int dstRowStride, ubyte *dstPtr)
{
const int bpt = util_format_get_size(pformat);
const int bpt = util_format_get_blocksize(pformat);
const int border = 0;
int img, row;
int bytesPerSrcImage, bytesPerDstImage;
......@@ -1161,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;
......@@ -1206,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;
......
......@@ -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:
......
......@@ -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;
......
......@@ -1444,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) {
......@@ -1483,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) {
......
......@@ -67,11 +67,11 @@ cell_texture_layout(struct cell_texture *ct)
w_tile = align(width, TILE_SIZE);
h_tile = align(height, TILE_SIZE);
ct->stride[level] = pf_get_stride(pt->format, w_tile);
ct->stride[level] = util_format_get_stride(pt->format, w_tile);
ct->level_offset[level] = ct->buffer_size;
size = ct->stride[level] * pf_get_nblocksy(pt->format, h_tile);
size = ct->stride[level] * util_format_get_nblocksy(pt->format, h_tile);
if (pt->target == PIPE_TEXTURE_CUBE)
size *= 6;
else
......@@ -283,11 +283,11 @@ cell_get_tex_surface(struct pipe_screen *screen,
if (pt->target == PIPE_TEXTURE_CUBE) {
unsigned h_tile = align(ps->height, TILE_SIZE);
ps->offset += face * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
ps->offset += face * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
unsigned h_tile = align(ps->height, TILE_SIZE);
ps->offset += zslice * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level];
ps->offset += zslice * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
}
else {
assert(face == 0);
......@@ -342,11 +342,11 @@ cell_get_tex_transfer(struct pipe_screen *screen,
if (texture->target == PIPE_TEXTURE_CUBE) {
unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
ctrans->offset += face * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
ctrans->offset += face * util_format_get_nblocksy(texture->format, h_tile) * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE);
ctrans->offset += zslice * pf_get_nblocksy(texture->format, h_tile) * pt->stride;
ctrans->offset += zslice * util_format_get_nblocksy(texture->format, h_tile) * pt->stride;
}
else {
assert(face == 0);
......@@ -399,8 +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 = pf_get_stride(pt->format, align(texWidth, TILE_SIZE)) *
pf_get_nblocksy(pt->format, align(texHeight, TILE_SIZE));
size = util_format_get_stride(pt->format, align(texWidth, TILE_SIZE)) *
util_format_get_nblocksy(pt->format, align(texHeight, TILE_SIZE));
ctrans->map = align_malloc(size, 16);
if (!ctrans->map)
......@@ -408,7 +408,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
if (transfer->usage & PIPE_TRANSFER_READ) {
/* need to untwiddle the texture to make a linear version */
const uint bpp = util_format_get_size(ct->base.format);
const uint bpp = util_format_get_blocksize(ct->base.format);
if (bpp == 4) {
const uint *src = (uint *) (ct->mapped + ctrans->offset);
uint *dst = ctrans->map;
......@@ -451,7 +451,7 @@ cell_transfer_unmap(struct pipe_screen *screen,
/* The user wrote new texture data into the mapped buffer.
* We need to convert the new linear data into the twiddled/tiled format.
*/
const uint bpp = util_format_get_size(ct->base.format);
const uint bpp = util_format_get_blocksize(ct->base.format);
if (bpp == 4) {
const uint *src = ctrans->map;
uint *dst = (uint *) (ct->mapped + ctrans->offset);
......
......@@ -32,6 +32,7 @@
#include "pipe/p_inlines.h"
#include "pipe/p_inlines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
......@@ -52,15 +53,15 @@ i915_surface_copy(struct pipe_context *pipe,
struct pipe_texture *spt = &src_tex->base;
assert( dst != src );
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 );
assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
assert( util_format_get_blockwidth(dpt->format) == util_format_get_blockwidth(spt->format) );
assert( util_format_get_blockheight(dpt->format) == util_format_get_blockheight(spt->format) );
assert( util_format_get_blockwidth(dpt->format) == 1 );
assert( util_format_get_blockheight(dpt->format) == 1 );
i915_copy_blit( i915_context(pipe),
FALSE,
pf_get_blocksize(dpt->format),
util_format_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 );
......@@ -76,11 +77,11 @@ i915_surface_fill(struct pipe_context *pipe,
struct i915_texture *tex = (struct i915_texture *)dst->texture;
struct pipe_texture *pt = &tex->base;
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);
i915_fill_blit( i915_context(pipe),
pf_get_blocksize(pt->format),
util_format_get_blocksize(pt->format),
(unsigned short) tex->stride,
tex->buffer, dst->offset,
(short) dstx, (short) dsty,
......
This diff is collapsed.
......@@ -41,6 +41,7 @@
#include "draw/draw_vertex.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_thread.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "lp_bld_debug.h"
......@@ -166,7 +167,7 @@ shade_quads(struct llvmpipe_context *llvmpipe,
assert((y % 2) == 0);
depth = llvmpipe->zsbuf_map +
y*llvmpipe->zsbuf_transfer->stride +
2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
2*x*util_format_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
}
else
depth = NULL;
......
......@@ -69,10 +69,10 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
/* 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->format, align(width, 2));
nblocksy = pf_get_nblocksy(pt->format, align(height, 2));
nblocksx = util_format_get_nblocksx(pt->format, align(width, 2));
nblocksy = util_format_get_nblocksy(pt->format, align(height, 2));
lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16);
lpt->stride[level] = align(nblocksx * util_format_get_blocksize(pt->format), 16);
lpt->level_offset[level] = buffer_size;
......@@ -251,11 +251,11 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
*/
if (pt->target == PIPE_TEXTURE_CUBE) {
unsigned tex_height = ps->height;
ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
ps->offset += face * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
unsigned tex_height = ps->height;
ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
ps->offset += zslice * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else {
assert(face == 0);
......@@ -314,11 +314,11 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
*/
if (texture->target == PIPE_TEXTURE_CUBE) {
unsigned tex_height = u_minify(texture->height0, level);
lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
lpt->offset += face * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
unsigned tex_height = u_minify(texture->height0, level);
lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
lpt->offset += zslice * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else {
assert(face == 0);
......@@ -379,8 +379,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
}
xfer_map = map + llvmpipe_transfer(transfer)->offset +
transfer->y / pf_get_blockheight(format) * transfer->stride +
transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
transfer->y / util_format_get_blockheight(format) * transfer->stride +
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
return xfer_map;
}
......
#include "pipe/p_context.h"
#include "pipe/p_format.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......@@ -158,10 +159,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) * pf_get_blocksize(dst->texture->format)) & 63));
assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_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) * pf_get_blocksize(dst->texture->format),
OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * util_format_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);
......@@ -180,7 +181,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) * pf_get_blocksize(src->texture->format),
OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * util_format_get_blocksize(src->texture->format),
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RING (chan, 0);
}
......@@ -201,9 +202,9 @@ 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 * pf_get_blocksize(dst->texture->format);
dx * util_format_get_blocksize(dst->texture->format);
unsigned src_offset = src->offset + sy * src_pitch +
sx * pf_get_blocksize(src->texture->format);
sx * util_format_get_blocksize(src->texture->format);
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);
......@@ -222,7 +223,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 * pf_get_blocksize(src->texture->format));
OUT_RING (chan, w * util_format_get_blocksize(src->texture->format));
OUT_RING (chan, count);
OUT_RING (chan, 0x0101);
OUT_RING (chan, 0);
......
#include <pipe/p_state.h>
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
#include <util/u_math.h>
#include <nouveau/nouveau_winsys.h>
......@@ -151,7 +152,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 * pf_get_blocksize(ptx->texture->format);
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
}
static void
......
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "nv10_context.h"
......@@ -23,9 +24,9 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
for (l = 0; l <= pt->last_level; l++) {
if (swizzled)
nv10mt->level[l].pitch = pf_get_stride(pt->format, width);
nv10mt->level[l].pitch = util_format_get_stride(pt->format, width);
else
nv10mt->level[l].pitch = pf_get_stride(pt->format, pt->width0);
nv10mt->level[l].pitch = util_format_get_stride(pt->format, pt->width0);
nv10mt->level[l].pitch = (nv10mt->level[l].pitch + 63) & ~63;
nv10mt->level[l].image_offset =
......
#include <pipe/p_state.h>
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
#include <util/u_math.h>
#include <nouveau/nouveau_winsys.h>
......@@ -151,7 +152,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 * pf_get_blocksize(ptx->texture->format);
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
}
static void
......
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "nv20_context.h"
......@@ -27,9 +28,9 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
for (l = 0; l <= pt->last_level; l++) {
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
nv20mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
nv20mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
else
nv20mt->level[l].pitch = pf_get_stride(pt->format, width);
nv20mt->level[l].pitch = util_format_get_stride(pt->format, width);
nv20mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
......
#include <pipe/p_state.h>
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
#include <util/u_math.h>
#include <nouveau/nouveau_winsys.h>
......@@ -151,7 +152,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 * pf_get_blocksize(ptx->texture->format);
ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
}
static void
......
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "nv30_context.h"
......@@ -29,9 +30,9 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
for (l = 0; l <= pt->last_level; l++) {
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
nv30mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64);
nv30mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
else
nv30mt->level[l].pitch = pf_get_stride(pt->format, width);
nv30mt->level[l].pitch = util_format_get_stride(pt->format, width);
nv30mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
......
#include <pipe/p_state.h>
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
#include <util/u_math.h>
#include <nouveau/nouveau_winsys.h>
......@@ -151,7 +152,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
pipe_transfer_buffer_flags(ptx));