fixups for interface changes (mostly state trackers)
This commit is contained in:
@@ -1449,7 +1449,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
|
|||||||
assert(r);
|
assert(r);
|
||||||
assert(blocks);
|
assert(blocks);
|
||||||
|
|
||||||
tex_pitch = r->tex_transfer[0]->stride / r->tex_transfer[0]->block.size;
|
tex_pitch = r->tex_transfer[0]->stride / pf_get_blocksize(r->tex_transfer[0]->texture->format);
|
||||||
texels = r->texels[0] + mbpy * tex_pitch + mbpx;
|
texels = r->texels[0] + mbpy * tex_pitch + mbpx;
|
||||||
|
|
||||||
for (y = 0; y < 2; ++y) {
|
for (y = 0; y < 2; ++y) {
|
||||||
@@ -1488,7 +1488,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby,
|
|||||||
mbpy /= 2;
|
mbpy /= 2;
|
||||||
|
|
||||||
for (tb = 0; tb < 2; ++tb) {
|
for (tb = 0; tb < 2; ++tb) {
|
||||||
tex_pitch = r->tex_transfer[tb + 1]->stride / r->tex_transfer[tb + 1]->block.size;
|
tex_pitch = r->tex_transfer[tb + 1]->stride / pf_get_blocksize(r->tex_transfer[tb + 1]->texture->format);
|
||||||
texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx;
|
texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx;
|
||||||
|
|
||||||
if ((cbp >> (1 - tb)) & 1) {
|
if ((cbp >> (1 - tb)) & 1) {
|
||||||
|
@@ -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)
|
static void trace_dump_reference(const struct pipe_reference *reference)
|
||||||
{
|
{
|
||||||
if (!trace_dumping_enabled_locked())
|
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_uint(templat->depth0);
|
||||||
trace_dump_member_end();
|
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, last_level);
|
||||||
trace_dump_member(uint, templat, tex_usage);
|
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_struct_begin("pipe_transfer");
|
||||||
|
|
||||||
trace_dump_member(format, state, format);
|
|
||||||
trace_dump_member(uint, state, width);
|
trace_dump_member(uint, state, width);
|
||||||
trace_dump_member(uint, state, height);
|
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, stride);
|
||||||
trace_dump_member(uint, state, usage);
|
trace_dump_member(uint, state, usage);
|
||||||
|
|
||||||
|
@@ -35,11 +35,8 @@
|
|||||||
|
|
||||||
void trace_dump_format(enum pipe_format format);
|
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_template(const struct pipe_texture *templat);
|
||||||
|
|
||||||
|
|
||||||
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
|
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
|
||||||
|
|
||||||
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
|
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
|
||||||
|
@@ -203,7 +203,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
|
|||||||
&t->width0, 1,
|
&t->width0, 1,
|
||||||
&t->height0, 1,
|
&t->height0, 1,
|
||||||
&t->depth0, 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->last_level,
|
||||||
t->nr_samples,
|
t->nr_samples,
|
||||||
t->tex_usage,
|
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);
|
map = screen->transfer_map(screen, t);
|
||||||
|
|
||||||
rbug_send_texture_read_reply(tr_rbug->con, serial,
|
rbug_send_texture_read_reply(tr_rbug->con, serial,
|
||||||
t->format,
|
t->texture->format,
|
||||||
t->block.width, t->block.height, t->block.size,
|
pf_get_blockwidth(t->texture->format),
|
||||||
(uint8_t*)map, t->stride * t->nblocksy,
|
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,
|
t->stride,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "tr_screen.h"
|
#include "tr_screen.h"
|
||||||
|
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
|
#include "pipe/p_format.h"
|
||||||
|
|
||||||
|
|
||||||
static boolean trace = FALSE;
|
static boolean trace = FALSE;
|
||||||
@@ -424,7 +425,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
|
|||||||
struct pipe_transfer *transfer = tr_trans->transfer;
|
struct pipe_transfer *transfer = tr_trans->transfer;
|
||||||
|
|
||||||
if(tr_trans->map) {
|
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");
|
trace_dump_call_begin("pipe_screen", "transfer_write");
|
||||||
|
|
||||||
|
@@ -66,7 +66,6 @@ dri_surface_from_handle(struct drm_api *api,
|
|||||||
templat.format = format;
|
templat.format = format;
|
||||||
templat.width0 = width;
|
templat.width0 = width;
|
||||||
templat.height0 = height;
|
templat.height0 = height;
|
||||||
pf_get_block(templat.format, &templat.block);
|
|
||||||
|
|
||||||
texture = api->texture_from_shared_handle(api, screen, &templat,
|
texture = api->texture_from_shared_handle(api, screen, &templat,
|
||||||
"dri2 buffer", pitch, handle);
|
"dri2 buffer", pitch, handle);
|
||||||
|
@@ -118,7 +118,6 @@ drm_create_texture(_EGLDisplay *dpy,
|
|||||||
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
||||||
templat.width0 = w;
|
templat.width0 = w;
|
||||||
templat.height0 = h;
|
templat.height0 = h;
|
||||||
pf_get_block(templat.format, &templat.block);
|
|
||||||
|
|
||||||
texture = screen->texture_create(dev->screen,
|
texture = screen->texture_create(dev->screen,
|
||||||
&templat);
|
&templat);
|
||||||
|
@@ -80,7 +80,6 @@
|
|||||||
%rename(Stencil) pipe_stencil_state;
|
%rename(Stencil) pipe_stencil_state;
|
||||||
%rename(Alpha) pipe_alpha_state;
|
%rename(Alpha) pipe_alpha_state;
|
||||||
%rename(DepthStencilAlpha) pipe_depth_stencil_alpha_state;
|
%rename(DepthStencilAlpha) pipe_depth_stencil_alpha_state;
|
||||||
%rename(FormatBlock) pipe_format_block;
|
|
||||||
%rename(Framebuffer) pipe_framebuffer_state;
|
%rename(Framebuffer) pipe_framebuffer_state;
|
||||||
%rename(PolyStipple) pipe_poly_stipple;
|
%rename(PolyStipple) pipe_poly_stipple;
|
||||||
%rename(Rasterizer) pipe_rasterizer_state;
|
%rename(Rasterizer) pipe_rasterizer_state;
|
||||||
|
@@ -112,7 +112,6 @@ struct st_device {
|
|||||||
struct pipe_texture templat;
|
struct pipe_texture templat;
|
||||||
memset(&templat, 0, sizeof(templat));
|
memset(&templat, 0, sizeof(templat));
|
||||||
templat.format = format;
|
templat.format = format;
|
||||||
pf_get_block(templat.format, &templat.block);
|
|
||||||
templat.width0 = width;
|
templat.width0 = width;
|
||||||
templat.height0 = height;
|
templat.height0 = height;
|
||||||
templat.depth0 = depth;
|
templat.depth0 = depth;
|
||||||
|
@@ -152,11 +152,3 @@ enum pipe_format {
|
|||||||
PIPE_FORMAT_DXT5_SRGBA,
|
PIPE_FORMAT_DXT5_SRGBA,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct pipe_format_block
|
|
||||||
{
|
|
||||||
unsigned size;
|
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@@ -69,15 +69,7 @@
|
|||||||
unsigned get_depth(unsigned level=0) {
|
unsigned get_depth(unsigned level=0) {
|
||||||
return u_minify($self->depth0, level);
|
return u_minify($self->depth0, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned get_nblocksx(unsigned level=0) {
|
|
||||||
return $self->nblocksx[level];
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned get_nblocksy(unsigned level=0) {
|
|
||||||
return $self->nblocksy[level];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get a surface which is a "view" into a texture */
|
/** Get a surface which is a "view" into a texture */
|
||||||
struct st_surface *
|
struct st_surface *
|
||||||
get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
|
get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
|
||||||
@@ -126,8 +118,6 @@ struct st_surface
|
|||||||
unsigned format;
|
unsigned format;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
unsigned nblocksx;
|
|
||||||
unsigned nblocksy;
|
|
||||||
|
|
||||||
~st_surface() {
|
~st_surface() {
|
||||||
pipe_texture_reference(&$self->texture, NULL);
|
pipe_texture_reference(&$self->texture, NULL);
|
||||||
@@ -142,8 +132,8 @@ struct st_surface
|
|||||||
struct pipe_transfer *transfer;
|
struct pipe_transfer *transfer;
|
||||||
unsigned stride;
|
unsigned stride;
|
||||||
|
|
||||||
stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
|
stride = pf_get_stride(texture->format, w);
|
||||||
*LENGTH = pf_get_nblocksy(&texture->block, h) * stride;
|
*LENGTH = pf_get_nblocksy(texture->format, h) * stride;
|
||||||
*STRING = (char *) malloc(*LENGTH);
|
*STRING = (char *) malloc(*LENGTH);
|
||||||
if(!*STRING)
|
if(!*STRING)
|
||||||
return;
|
return;
|
||||||
@@ -169,9 +159,9 @@ struct st_surface
|
|||||||
struct pipe_transfer *transfer;
|
struct pipe_transfer *transfer;
|
||||||
|
|
||||||
if(stride == 0)
|
if(stride == 0)
|
||||||
stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
|
stride = pf_get_stride(texture->format, w);
|
||||||
|
|
||||||
if(LENGTH < pf_get_nblocksy(&texture->block, h) * stride)
|
if(LENGTH < pf_get_nblocksy(texture->format, h) * stride)
|
||||||
SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
|
SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
|
||||||
|
|
||||||
transfer = screen->get_tex_transfer(screen,
|
transfer = screen->get_tex_transfer(screen,
|
||||||
@@ -383,18 +373,6 @@ struct st_surface
|
|||||||
{
|
{
|
||||||
return u_minify(surface->texture->height0, surface->level);
|
return u_minify(surface->texture->height0, surface->level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
|
||||||
st_surface_nblocksx_get(struct st_surface *surface)
|
|
||||||
{
|
|
||||||
return surface->texture->nblocksx[surface->level];
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
st_surface_nblocksy_get(struct st_surface *surface)
|
|
||||||
{
|
|
||||||
return surface->texture->nblocksy[surface->level];
|
|
||||||
}
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
|
/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
|
||||||
|
@@ -99,7 +99,6 @@ struct_factories = {
|
|||||||
"pipe_stencil_state": gallium.Stencil,
|
"pipe_stencil_state": gallium.Stencil,
|
||||||
"pipe_alpha_state": gallium.Alpha,
|
"pipe_alpha_state": gallium.Alpha,
|
||||||
"pipe_depth_stencil_alpha_state": gallium.DepthStencilAlpha,
|
"pipe_depth_stencil_alpha_state": gallium.DepthStencilAlpha,
|
||||||
"pipe_format_block": gallium.FormatBlock,
|
|
||||||
#"pipe_framebuffer_state": gallium.Framebuffer,
|
#"pipe_framebuffer_state": gallium.Framebuffer,
|
||||||
"pipe_poly_stipple": gallium.PolyStipple,
|
"pipe_poly_stipple": gallium.PolyStipple,
|
||||||
"pipe_rasterizer_state": gallium.Rasterizer,
|
"pipe_rasterizer_state": gallium.Rasterizer,
|
||||||
@@ -307,7 +306,7 @@ class Screen(Object):
|
|||||||
def surface_write(self, surface, data, stride, size):
|
def surface_write(self, surface, data, stride, size):
|
||||||
if surface is None:
|
if surface is None:
|
||||||
return
|
return
|
||||||
assert surface.nblocksy * stride == size
|
# assert surface.nblocksy * stride == size
|
||||||
surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
|
surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
|
||||||
|
|
||||||
def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
|
def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
|
||||||
|
@@ -249,9 +249,6 @@ st_context_create(struct st_device *st_dev)
|
|||||||
memset( &templat, 0, sizeof( templat ) );
|
memset( &templat, 0, sizeof( templat ) );
|
||||||
templat.target = PIPE_TEXTURE_2D;
|
templat.target = PIPE_TEXTURE_2D;
|
||||||
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
||||||
templat.block.size = 4;
|
|
||||||
templat.block.width = 1;
|
|
||||||
templat.block.height = 1;
|
|
||||||
templat.width0 = 1;
|
templat.width0 = 1;
|
||||||
templat.height0 = 1;
|
templat.height0 = 1;
|
||||||
templat.depth0 = 1;
|
templat.depth0 = 1;
|
||||||
|
@@ -423,7 +423,6 @@ dxt5_rgba_data[] = {
|
|||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
st_sample_dxt_pixel_block(enum pipe_format format,
|
st_sample_dxt_pixel_block(enum pipe_format format,
|
||||||
const struct pipe_format_block *block,
|
|
||||||
uint8_t *raw,
|
uint8_t *raw,
|
||||||
float *rgba, unsigned rgba_stride,
|
float *rgba, unsigned rgba_stride,
|
||||||
unsigned w, unsigned h)
|
unsigned w, unsigned h)
|
||||||
@@ -462,21 +461,21 @@ st_sample_dxt_pixel_block(enum pipe_format format,
|
|||||||
for(ch = 0; ch < 4; ++ch)
|
for(ch = 0; ch < 4; ++ch)
|
||||||
rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f;
|
rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f;
|
||||||
|
|
||||||
memcpy(raw, data[i].raw, block->size);
|
memcpy(raw, data[i].raw, pf_get_blocksize(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
st_sample_generic_pixel_block(enum pipe_format format,
|
st_sample_generic_pixel_block(enum pipe_format format,
|
||||||
const struct pipe_format_block *block,
|
|
||||||
uint8_t *raw,
|
uint8_t *raw,
|
||||||
float *rgba, unsigned rgba_stride,
|
float *rgba, unsigned rgba_stride,
|
||||||
unsigned w, unsigned h)
|
unsigned w, unsigned h)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned x, y, ch;
|
unsigned x, y, ch;
|
||||||
|
int blocksize = pf_get_blocksize(format);
|
||||||
|
|
||||||
for(i = 0; i < block->size; ++i)
|
for(i = 0; i < blocksize; ++i)
|
||||||
raw[i] = (uint8_t)st_random();
|
raw[i] = (uint8_t)st_random();
|
||||||
|
|
||||||
|
|
||||||
@@ -503,7 +502,6 @@ st_sample_generic_pixel_block(enum pipe_format format,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
st_sample_pixel_block(enum pipe_format format,
|
st_sample_pixel_block(enum pipe_format format,
|
||||||
const struct pipe_format_block *block,
|
|
||||||
void *raw,
|
void *raw,
|
||||||
float *rgba, unsigned rgba_stride,
|
float *rgba, unsigned rgba_stride,
|
||||||
unsigned w, unsigned h)
|
unsigned w, unsigned h)
|
||||||
@@ -513,11 +511,11 @@ st_sample_pixel_block(enum pipe_format format,
|
|||||||
case PIPE_FORMAT_DXT1_RGBA:
|
case PIPE_FORMAT_DXT1_RGBA:
|
||||||
case PIPE_FORMAT_DXT3_RGBA:
|
case PIPE_FORMAT_DXT3_RGBA:
|
||||||
case PIPE_FORMAT_DXT5_RGBA:
|
case PIPE_FORMAT_DXT5_RGBA:
|
||||||
st_sample_dxt_pixel_block(format, block, raw, rgba, rgba_stride, w, h);
|
st_sample_dxt_pixel_block(format, raw, rgba, rgba_stride, w, h);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
st_sample_generic_pixel_block(format, block, raw, rgba, rgba_stride, w, h);
|
st_sample_generic_pixel_block(format, raw, rgba, rgba_stride, w, h);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,18 +546,23 @@ st_sample_surface(struct st_surface *surface, float *rgba)
|
|||||||
|
|
||||||
raw = screen->transfer_map(screen, transfer);
|
raw = screen->transfer_map(screen, transfer);
|
||||||
if (raw) {
|
if (raw) {
|
||||||
const struct pipe_format_block *block = &texture->block;
|
enum pipe_format format = texture->format;
|
||||||
uint x, y;
|
uint x, y;
|
||||||
|
int nblocksx = pf_get_nblocksx(format, width);
|
||||||
|
int nblocksy = pf_get_nblocksy(format, height);
|
||||||
|
int blockwidth = pf_get_blockwidth(format);
|
||||||
|
int blockheight = pf_get_blockheight(format);
|
||||||
|
int blocksize = pf_get_blocksize(format);
|
||||||
|
|
||||||
for (y = 0; y < transfer->nblocksy; ++y) {
|
|
||||||
for (x = 0; x < transfer->nblocksx; ++x) {
|
for (y = 0; y < nblocksy; ++y) {
|
||||||
st_sample_pixel_block(texture->format,
|
for (x = 0; x < nblocksx; ++x) {
|
||||||
block,
|
st_sample_pixel_block(format,
|
||||||
(uint8_t *) raw + y * transfer->stride + x * block->size,
|
(uint8_t *) raw + y * transfer->stride + x * blocksize,
|
||||||
rgba + y * block->height * rgba_stride + x * block->width * 4,
|
rgba + y * blockheight * rgba_stride + x * blockwidth * 4,
|
||||||
rgba_stride,
|
rgba_stride,
|
||||||
MIN2(block->width, width - x*block->width),
|
MIN2(blockwidth, width - x*blockwidth),
|
||||||
MIN2(block->height, height - y*block->height));
|
MIN2(blockheight, height - y*blockheight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
void
|
void
|
||||||
st_sample_pixel_block(enum pipe_format format,
|
st_sample_pixel_block(enum pipe_format format,
|
||||||
const struct pipe_format_block *block,
|
|
||||||
void *raw,
|
void *raw,
|
||||||
float *rgba, unsigned rgba_stride,
|
float *rgba, unsigned rgba_stride,
|
||||||
unsigned w, unsigned h);
|
unsigned w, unsigned h);
|
||||||
|
@@ -157,16 +157,6 @@ st_softpipe_user_buffer_create(struct pipe_winsys *winsys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Round n up to next multiple.
|
|
||||||
*/
|
|
||||||
static INLINE unsigned
|
|
||||||
round_up(unsigned n, unsigned multiple)
|
|
||||||
{
|
|
||||||
return (n + multiple - 1) & ~(multiple - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_buffer *
|
static struct pipe_buffer *
|
||||||
st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
@@ -176,13 +166,10 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
const unsigned alignment = 64;
|
const unsigned alignment = 64;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy;
|
||||||
unsigned nblocksx, nblocksy;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = round_up(nblocksx * block.size, alignment);
|
|
||||||
|
|
||||||
return winsys->buffer_create(winsys, alignment,
|
return winsys->buffer_create(winsys, alignment,
|
||||||
usage,
|
usage,
|
||||||
|
@@ -98,9 +98,10 @@ class TextureTest(TestCase):
|
|||||||
y = 0
|
y = 0
|
||||||
w = dst_surface.width
|
w = dst_surface.width
|
||||||
h = dst_surface.height
|
h = dst_surface.height
|
||||||
|
|
||||||
stride = dst_surface.nblocksx * dst_texture.block.size
|
# ???
|
||||||
size = dst_surface.nblocksy * stride
|
stride = pf_get_stride(texture->format, w)
|
||||||
|
size = pf_get_nblocksy(texture->format) * stride
|
||||||
src_raw = os.urandom(size)
|
src_raw = os.urandom(size)
|
||||||
|
|
||||||
src_surface.put_tile_raw(0, 0, w, h, src_raw, stride)
|
src_surface.put_tile_raw(0, 0, w, h, src_raw, stride)
|
||||||
|
@@ -86,8 +86,9 @@ class TextureTest(TestCase):
|
|||||||
|
|
||||||
surface = texture.get_surface(face, level, zslice)
|
surface = texture.get_surface(face, level, zslice)
|
||||||
|
|
||||||
stride = surface.nblocksx * texture.block.size
|
# ???
|
||||||
size = surface.nblocksy * stride
|
stride = pf_get_stride(texture->format, w)
|
||||||
|
size = pf_get_nblocksy(texture->format) * stride
|
||||||
|
|
||||||
in_raw = os.urandom(size)
|
in_raw = os.urandom(size)
|
||||||
|
|
||||||
|
@@ -71,7 +71,6 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
|
|||||||
templ.width0 = color_data_len;
|
templ.width0 = color_data_len;
|
||||||
templ.height0 = 1;
|
templ.height0 = 1;
|
||||||
templ.depth0 = 1;
|
templ.depth0 = 1;
|
||||||
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
|
|
||||||
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
||||||
|
|
||||||
tex = screen->texture_create(screen, &templ);
|
tex = screen->texture_create(screen, &templ);
|
||||||
|
@@ -270,7 +270,6 @@ struct vg_image * image_create(VGImageFormat format,
|
|||||||
memset(&pt, 0, sizeof(pt));
|
memset(&pt, 0, sizeof(pt));
|
||||||
pt.target = PIPE_TEXTURE_2D;
|
pt.target = PIPE_TEXTURE_2D;
|
||||||
pt.format = pformat;
|
pt.format = pformat;
|
||||||
pf_get_block(pformat, &pt.block);
|
|
||||||
pt.last_level = 0;
|
pt.last_level = 0;
|
||||||
pt.width0 = width;
|
pt.width0 = width;
|
||||||
pt.height0 = height;
|
pt.height0 = height;
|
||||||
|
@@ -491,7 +491,6 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
|
|||||||
memset(&pt, 0, sizeof(pt));
|
memset(&pt, 0, sizeof(pt));
|
||||||
pt.target = PIPE_TEXTURE_2D;
|
pt.target = PIPE_TEXTURE_2D;
|
||||||
pt.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
pt.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
||||||
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block);
|
|
||||||
pt.last_level = 0;
|
pt.last_level = 0;
|
||||||
pt.width0 = width;
|
pt.width0 = width;
|
||||||
pt.height0 = height;
|
pt.height0 = height;
|
||||||
|
@@ -154,7 +154,6 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
|
|||||||
templ.width0 = 1024;
|
templ.width0 = 1024;
|
||||||
templ.height0 = 1;
|
templ.height0 = 1;
|
||||||
templ.depth0 = 1;
|
templ.depth0 = 1;
|
||||||
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
|
|
||||||
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
||||||
|
|
||||||
tex = screen->texture_create(screen, &templ);
|
tex = screen->texture_create(screen, &templ);
|
||||||
|
@@ -448,7 +448,6 @@ void renderer_copy_surface(struct renderer *ctx,
|
|||||||
texTemp.width0 = srcW;
|
texTemp.width0 = srcW;
|
||||||
texTemp.height0 = srcH;
|
texTemp.height0 = srcH;
|
||||||
texTemp.depth0 = 1;
|
texTemp.depth0 = 1;
|
||||||
pf_get_block(src->format, &texTemp.block);
|
|
||||||
|
|
||||||
tex = screen->texture_create(screen, &texTemp);
|
tex = screen->texture_create(screen, &texTemp);
|
||||||
if (!tex)
|
if (!tex)
|
||||||
|
@@ -50,7 +50,6 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ.target = PIPE_TEXTURE_2D;
|
templ.target = PIPE_TEXTURE_2D;
|
||||||
pf_get_block(templ.format, &templ.block);
|
|
||||||
templ.width0 = width;
|
templ.width0 = width;
|
||||||
templ.height0 = height;
|
templ.height0 = height;
|
||||||
templ.depth0 = 1;
|
templ.depth0 = 1;
|
||||||
|
@@ -191,7 +191,6 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
|
|||||||
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
|
||||||
templat.width0 = 64;
|
templat.width0 = 64;
|
||||||
templat.height0 = 64;
|
templat.height0 = 64;
|
||||||
pf_get_block(templat.format, &templat.block);
|
|
||||||
|
|
||||||
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
|
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
|
||||||
&templat);
|
&templat);
|
||||||
@@ -207,7 +206,7 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
|
|||||||
PIPE_TRANSFER_WRITE,
|
PIPE_TRANSFER_WRITE,
|
||||||
0, 0, 64, 64);
|
0, 0, 64, 64);
|
||||||
ptr = ms->screen->transfer_map(ms->screen, transfer);
|
ptr = ms->screen->transfer_map(ms->screen, transfer);
|
||||||
util_copy_rect(ptr, &crtcp->cursor_tex->block,
|
util_copy_rect(ptr, crtcp->cursor_tex->format,
|
||||||
transfer->stride, 0, 0,
|
transfer->stride, 0, 0,
|
||||||
64, 64, (void*)image, 64 * 4, 0, 0);
|
64, 64, (void*)image, 64 * 4, 0, 0);
|
||||||
ms->screen->transfer_unmap(ms->screen, transfer);
|
ms->screen->transfer_unmap(ms->screen, transfer);
|
||||||
|
@@ -108,7 +108,6 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
|
|||||||
else
|
else
|
||||||
template.format = ms->ds_depth_bits_last ?
|
template.format = ms->ds_depth_bits_last ?
|
||||||
PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
|
PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
|
||||||
pf_get_block(template.format, &template.block);
|
|
||||||
template.width0 = pDraw->width;
|
template.width0 = pDraw->width;
|
||||||
template.height0 = pDraw->height;
|
template.height0 = pDraw->height;
|
||||||
template.depth0 = 1;
|
template.depth0 = 1;
|
||||||
|
@@ -206,7 +206,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
|
|||||||
x, y, w, h, dst_pitch);
|
x, y, w, h, dst_pitch);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
util_copy_rect((unsigned char*)dst, &priv->tex->block, dst_pitch, 0, 0,
|
util_copy_rect((unsigned char*)dst, priv->tex->format, dst_pitch, 0, 0,
|
||||||
w, h, exa->scrn->transfer_map(exa->scrn, transfer),
|
w, h, exa->scrn->transfer_map(exa->scrn, transfer),
|
||||||
transfer->stride, 0, 0);
|
transfer->stride, 0, 0);
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
|
util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
|
||||||
&priv->tex->block, transfer->stride, 0, 0, w, h,
|
priv->tex->format, transfer->stride, 0, 0, w, h,
|
||||||
(unsigned char*)src, src_pitch, 0, 0);
|
(unsigned char*)src, src_pitch, 0, 0);
|
||||||
|
|
||||||
exa->scrn->transfer_unmap(exa->scrn, transfer);
|
exa->scrn->transfer_unmap(exa->scrn, transfer);
|
||||||
@@ -761,7 +761,6 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
|
|||||||
memset(&template, 0, sizeof(template));
|
memset(&template, 0, sizeof(template));
|
||||||
template.target = PIPE_TEXTURE_2D;
|
template.target = PIPE_TEXTURE_2D;
|
||||||
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
|
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
|
||||||
pf_get_block(template.format, &template.block);
|
|
||||||
template.width0 = width;
|
template.width0 = width;
|
||||||
template.height0 = height;
|
template.height0 = height;
|
||||||
template.depth0 = 1;
|
template.depth0 = 1;
|
||||||
@@ -840,7 +839,6 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
|
|||||||
memset(&template, 0, sizeof(template));
|
memset(&template, 0, sizeof(template));
|
||||||
template.target = PIPE_TEXTURE_2D;
|
template.target = PIPE_TEXTURE_2D;
|
||||||
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy);
|
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy);
|
||||||
pf_get_block(template.format, &template.block);
|
|
||||||
template.width0 = width;
|
template.width0 = width;
|
||||||
template.height0 = height;
|
template.height0 = height;
|
||||||
template.depth0 = 1;
|
template.depth0 = 1;
|
||||||
|
@@ -733,7 +733,6 @@ create_sampler_texture(struct xorg_renderer *r,
|
|||||||
templ.width0 = src->width0;
|
templ.width0 = src->width0;
|
||||||
templ.height0 = src->height0;
|
templ.height0 = src->height0;
|
||||||
templ.depth0 = 1;
|
templ.depth0 = 1;
|
||||||
pf_get_block(format, &templ.block);
|
|
||||||
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
||||||
|
|
||||||
pt = screen->texture_create(screen, &templ);
|
pt = screen->texture_create(screen, &templ);
|
||||||
|
@@ -170,7 +170,6 @@ create_component_texture(struct pipe_context *pipe,
|
|||||||
templ.width0 = width;
|
templ.width0 = width;
|
||||||
templ.height0 = height;
|
templ.height0 = height;
|
||||||
templ.depth0 = 1;
|
templ.depth0 = 1;
|
||||||
pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
|
|
||||||
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
||||||
|
|
||||||
tex = screen->texture_create(screen, &templ);
|
tex = screen->texture_create(screen, &templ);
|
||||||
|
@@ -28,7 +28,6 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
|
|||||||
tmpl.format = format;
|
tmpl.format = format;
|
||||||
tmpl.width0 = width;
|
tmpl.width0 = width;
|
||||||
tmpl.height0 = height;
|
tmpl.height0 = height;
|
||||||
pf_get_block(tmpl.format, &tmpl.block);
|
|
||||||
|
|
||||||
pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
|
pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
|
||||||
"front buffer", pitch, handle);
|
"front buffer", pitch, handle);
|
||||||
@@ -247,7 +246,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
*handle = mt->bo->handle;
|
*handle = mt->bo->handle;
|
||||||
*stride = mt->base.nblocksx[0] * mt->base.block.size;
|
*stride = pf_get_stride(mt->base.format, mt->base.width0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,17 +113,13 @@ static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws,
|
|||||||
unsigned tex_usage,
|
unsigned tex_usage,
|
||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
struct pipe_format_block block;
|
|
||||||
unsigned nblocksx, nblocksy, size;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
|
||||||
|
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
|
|
||||||
/* Radeons enjoy things in multiples of 32. */
|
/* Radeons enjoy things in multiples of 32. */
|
||||||
/* XXX this can be 32 when POT */
|
/* XXX this can be 32 when POT */
|
||||||
*stride = (nblocksx * block.size + 63) & ~63;
|
const unsigned alignment = 64;
|
||||||
|
unsigned nblocksy, size;
|
||||||
|
|
||||||
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
size = *stride * nblocksy;
|
size = *stride * nblocksy;
|
||||||
|
|
||||||
return radeon_buffer_create(ws, 64, usage, size);
|
return radeon_buffer_create(ws, 64, usage, size);
|
||||||
@@ -321,9 +317,6 @@ struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_co
|
|||||||
tmpl.height0 = h;
|
tmpl.height0 = h;
|
||||||
tmpl.depth0 = 1;
|
tmpl.depth0 = 1;
|
||||||
tmpl.format = format;
|
tmpl.format = format;
|
||||||
pf_get_block(tmpl.format, &tmpl.block);
|
|
||||||
tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
|
|
||||||
tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h);
|
|
||||||
|
|
||||||
pt = pipe_screen->texture_blanket(pipe_screen, &tmpl, &pitch, pb);
|
pt = pipe_screen->texture_blanket(pipe_screen, &tmpl, &pitch, pb);
|
||||||
if (pt == NULL) {
|
if (pt == NULL) {
|
||||||
|
@@ -71,16 +71,6 @@ sw_pipe_buffer(struct pipe_buffer *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Round n up to next multiple.
|
|
||||||
*/
|
|
||||||
static INLINE unsigned
|
|
||||||
round_up(unsigned n, unsigned multiple)
|
|
||||||
{
|
|
||||||
return (n + multiple - 1) & ~(multiple - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_name(struct pipe_winsys *pws)
|
get_name(struct pipe_winsys *pws)
|
||||||
{
|
{
|
||||||
@@ -170,13 +160,10 @@ surface_buffer_create(struct pipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
const unsigned alignment = 64;
|
const unsigned alignment = 64;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy;
|
||||||
unsigned nblocksx, nblocksy;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = round_up(nblocksx * block.size, alignment);
|
|
||||||
|
|
||||||
return winsys->buffer_create(winsys, alignment,
|
return winsys->buffer_create(winsys, alignment,
|
||||||
usage,
|
usage,
|
||||||
|
@@ -138,13 +138,10 @@ static struct pipe_buffer* xsp_surface_buffer_create
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const unsigned int ALIGNMENT = 1;
|
const unsigned int ALIGNMENT = 1;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy;
|
||||||
unsigned nblocksx, nblocksy;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), ALIGNMENT);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = align(nblocksx * block.size, ALIGNMENT);
|
|
||||||
|
|
||||||
return pws->buffer_create(pws, ALIGNMENT, usage,
|
return pws->buffer_create(pws, ALIGNMENT, usage,
|
||||||
*stride * nblocksy);
|
*stride * nblocksy);
|
||||||
|
@@ -49,7 +49,6 @@
|
|||||||
struct gdi_llvmpipe_displaytarget
|
struct gdi_llvmpipe_displaytarget
|
||||||
{
|
{
|
||||||
enum pipe_format format;
|
enum pipe_format format;
|
||||||
struct pipe_format_block block;
|
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
unsigned stride;
|
unsigned stride;
|
||||||
@@ -118,16 +117,6 @@ gdi_llvmpipe_displaytarget_destroy(struct llvmpipe_winsys *winsys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Round n up to next multiple.
|
|
||||||
*/
|
|
||||||
static INLINE unsigned
|
|
||||||
round_up(unsigned n, unsigned multiple)
|
|
||||||
{
|
|
||||||
return (n + multiple - 1) & ~(multiple - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct llvmpipe_displaytarget *
|
static struct llvmpipe_displaytarget *
|
||||||
gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
|
gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
|
||||||
enum pipe_format format,
|
enum pipe_format format,
|
||||||
@@ -147,10 +136,10 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
|
|||||||
gdt->width = width;
|
gdt->width = width;
|
||||||
gdt->height = height;
|
gdt->height = height;
|
||||||
|
|
||||||
bpp = pf_get_bits(format);
|
bpp = pf_get_blocksizebits(format);
|
||||||
cpp = pf_get_size(format);
|
cpp = pf_get_blocksize(format);
|
||||||
|
|
||||||
gdt->stride = round_up(width * cpp, alignment);
|
gdt->stride = align(width * cpp, alignment);
|
||||||
gdt->size = gdt->stride * height;
|
gdt->size = gdt->stride * height;
|
||||||
|
|
||||||
gdt->data = align_malloc(gdt->size, alignment);
|
gdt->data = align_malloc(gdt->size, alignment);
|
||||||
|
@@ -151,16 +151,6 @@ gdi_softpipe_user_buffer_create(struct pipe_winsys *winsys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Round n up to next multiple.
|
|
||||||
*/
|
|
||||||
static INLINE unsigned
|
|
||||||
round_up(unsigned n, unsigned multiple)
|
|
||||||
{
|
|
||||||
return (n + multiple - 1) & ~(multiple - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_buffer *
|
static struct pipe_buffer *
|
||||||
gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
@@ -170,13 +160,10 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
const unsigned alignment = 64;
|
const unsigned alignment = 64;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy;
|
||||||
unsigned nblocksx, nblocksy;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = round_up(nblocksx * block.size, alignment);
|
|
||||||
|
|
||||||
return winsys->buffer_create(winsys, alignment,
|
return winsys->buffer_create(winsys, alignment,
|
||||||
usage,
|
usage,
|
||||||
@@ -283,10 +270,10 @@ gdi_softpipe_present(struct pipe_screen *screen,
|
|||||||
|
|
||||||
memset(&bmi, 0, sizeof(BITMAPINFO));
|
memset(&bmi, 0, sizeof(BITMAPINFO));
|
||||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_size(surface->format);
|
bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_blocksize(surface->format);
|
||||||
bmi.bmiHeader.biHeight= -(long)surface->height;
|
bmi.bmiHeader.biHeight= -(long)surface->height;
|
||||||
bmi.bmiHeader.biPlanes = 1;
|
bmi.bmiHeader.biPlanes = 1;
|
||||||
bmi.bmiHeader.biBitCount = pf_get_bits(surface->format);
|
bmi.bmiHeader.biBitCount = pf_get_blocksizebits(surface->format);
|
||||||
bmi.bmiHeader.biCompression = BI_RGB;
|
bmi.bmiHeader.biCompression = BI_RGB;
|
||||||
bmi.bmiHeader.biSizeImage = 0;
|
bmi.bmiHeader.biSizeImage = 0;
|
||||||
bmi.bmiHeader.biXPelsPerMeter = 0;
|
bmi.bmiHeader.biXPelsPerMeter = 0;
|
||||||
|
@@ -277,15 +277,6 @@ xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Round n up to next multiple.
|
|
||||||
*/
|
|
||||||
static INLINE unsigned
|
|
||||||
round_up(unsigned n, unsigned multiple)
|
|
||||||
{
|
|
||||||
return (n + multiple - 1) & ~(multiple - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct pipe_buffer *
|
static struct pipe_buffer *
|
||||||
xm_surface_buffer_create(struct pipe_winsys *winsys,
|
xm_surface_buffer_create(struct pipe_winsys *winsys,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
@@ -294,18 +285,15 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
const unsigned alignment = 64;
|
const unsigned alignment = 64;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy;
|
||||||
unsigned nblocksx, nblocksy;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = round_up(nblocksx * block.size, alignment);
|
|
||||||
|
|
||||||
return winsys->buffer_create(winsys, alignment,
|
return winsys->buffer_create(winsys, alignment,
|
||||||
usage,
|
usage,
|
||||||
/* XXX a bit of a hack */
|
/* XXX a bit of a hack */
|
||||||
*stride * round_up(nblocksy, TILE_SIZE));
|
*stride * align(nblocksy, TILE_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -58,7 +58,6 @@
|
|||||||
struct xm_displaytarget
|
struct xm_displaytarget
|
||||||
{
|
{
|
||||||
enum pipe_format format;
|
enum pipe_format format;
|
||||||
struct pipe_format_block block;
|
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
unsigned stride;
|
unsigned stride;
|
||||||
@@ -262,10 +261,10 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
|
|||||||
{
|
{
|
||||||
if (xm_dt->tempImage == NULL)
|
if (xm_dt->tempImage == NULL)
|
||||||
{
|
{
|
||||||
assert(xm_dt->block.width == 1);
|
assert(pf_get_blockwidth(xm_dt->format) == 1);
|
||||||
assert(xm_dt->block.height == 1);
|
assert(pf_get_blockheight(xm_dt->format) == 1);
|
||||||
alloc_shm_ximage(xm_dt, xm_buffer,
|
alloc_shm_ximage(xm_dt, xm_buffer,
|
||||||
xm_dt->stride / xm_dt->block.size,
|
xm_dt->stride / pf_get_blocksize(xm_dt->format),
|
||||||
xm_dt->height);
|
xm_dt->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +320,7 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
struct xm_displaytarget *xm_dt = CALLOC_STRUCT(xm_displaytarget);
|
struct xm_displaytarget *xm_dt = CALLOC_STRUCT(xm_displaytarget);
|
||||||
unsigned nblocksx, nblocksy, size;
|
unsigned nblocksy, size;
|
||||||
|
|
||||||
xm_dt = CALLOC_STRUCT(xm_displaytarget);
|
xm_dt = CALLOC_STRUCT(xm_displaytarget);
|
||||||
if(!xm_dt)
|
if(!xm_dt)
|
||||||
@@ -331,10 +330,8 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
|
|||||||
xm_dt->width = width;
|
xm_dt->width = width;
|
||||||
xm_dt->height = height;
|
xm_dt->height = height;
|
||||||
|
|
||||||
pf_get_block(format, &xm_dt->block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&xm_dt->block, width);
|
xm_dt->stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&xm_dt->block, height);
|
|
||||||
xm_dt->stride = align(nblocksx * xm_dt->block.size, alignment);
|
|
||||||
size = xm_dt->stride * nblocksy;
|
size = xm_dt->stride * nblocksy;
|
||||||
|
|
||||||
#ifdef USE_XSHM
|
#ifdef USE_XSHM
|
||||||
|
@@ -254,10 +254,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
|
|||||||
{
|
{
|
||||||
if (xm_buf->tempImage == NULL)
|
if (xm_buf->tempImage == NULL)
|
||||||
{
|
{
|
||||||
assert(surf->texture->block.width == 1);
|
assert(pf_get_blockwidth(surf->texture->format) == 1);
|
||||||
assert(surf->texture->block.height == 1);
|
assert(pf_get_blockheight(surf->texture->format) == 1);
|
||||||
alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
|
alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
|
||||||
surf->texture->block.size, surf->height);
|
pf_get_blocksize(surf->texture->format), surf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
ximage = xm_buf->tempImage;
|
ximage = xm_buf->tempImage;
|
||||||
@@ -360,13 +360,10 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
|
|||||||
unsigned *stride)
|
unsigned *stride)
|
||||||
{
|
{
|
||||||
const unsigned alignment = 64;
|
const unsigned alignment = 64;
|
||||||
struct pipe_format_block block;
|
unsigned nblocksy, size;
|
||||||
unsigned nblocksx, nblocksy, size;
|
|
||||||
|
|
||||||
pf_get_block(format, &block);
|
nblocksy = pf_get_nblocksy(format, height);
|
||||||
nblocksx = pf_get_nblocksx(&block, width);
|
*stride = align(pf_get_stride(format, width), alignment);
|
||||||
nblocksy = pf_get_nblocksy(&block, height);
|
|
||||||
*stride = align(nblocksx * block.size, alignment);
|
|
||||||
size = *stride * nblocksy;
|
size = *stride * nblocksy;
|
||||||
|
|
||||||
#ifdef USE_XSHM
|
#ifdef USE_XSHM
|
||||||
|
Reference in New Issue
Block a user