mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
gallium: minor cleanups to pipe interface
- Remove put/get tile, just have users call put_tile_raw, etc directly. - Remove surface_data call, just map it locally.
This commit is contained in:
parent
1e9e4341e0
commit
f3aa4de034
8 changed files with 44 additions and 93 deletions
|
|
@ -140,7 +140,6 @@ struct pipe_context *failover_create( struct pipe_context *hw,
|
||||||
#endif
|
#endif
|
||||||
failover->pipe.get_tex_surface = hw->get_tex_surface;
|
failover->pipe.get_tex_surface = hw->get_tex_surface;
|
||||||
|
|
||||||
failover->pipe.surface_data = hw->surface_data;
|
|
||||||
failover->pipe.surface_copy = hw->surface_copy;
|
failover->pipe.surface_copy = hw->surface_copy;
|
||||||
failover->pipe.surface_fill = hw->surface_fill;
|
failover->pipe.surface_fill = hw->surface_fill;
|
||||||
failover->pipe.texture_create = hw->texture_create;
|
failover->pipe.texture_create = hw->texture_create;
|
||||||
|
|
|
||||||
|
|
@ -77,27 +77,6 @@ i915_get_tex_surface(struct pipe_context *pipe,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Upload data to a rectangular sub-region. Lots of choices how to do this:
|
|
||||||
*
|
|
||||||
* - memcpy by span to current destination
|
|
||||||
* - upload data as new buffer and blit
|
|
||||||
*
|
|
||||||
* Currently always memcpy.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
i915_surface_data(struct pipe_context *pipe,
|
|
||||||
struct pipe_surface *dst,
|
|
||||||
unsigned dstx, unsigned dsty,
|
|
||||||
const void *src, unsigned src_pitch,
|
|
||||||
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
pipe_copy_rect(pipe_surface_map(dst),
|
|
||||||
dst->cpp, dst->pitch,
|
|
||||||
dstx, dsty, width, height, src, src_pitch, srcx, srcy);
|
|
||||||
|
|
||||||
pipe_surface_unmap(dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Assumes all values are within bounds -- no checking at this level -
|
/* Assumes all values are within bounds -- no checking at this level -
|
||||||
* do it higher up if required.
|
* do it higher up if required.
|
||||||
|
|
@ -204,10 +183,7 @@ void
|
||||||
i915_init_surface_functions(struct i915_context *i915)
|
i915_init_surface_functions(struct i915_context *i915)
|
||||||
{
|
{
|
||||||
i915->pipe.get_tex_surface = i915_get_tex_surface;
|
i915->pipe.get_tex_surface = i915_get_tex_surface;
|
||||||
i915->pipe.get_tile = pipe_get_tile_raw;
|
|
||||||
i915->pipe.put_tile = pipe_put_tile_raw;
|
|
||||||
|
|
||||||
i915->pipe.surface_data = i915_surface_data;
|
|
||||||
i915->pipe.surface_copy = i915_surface_copy;
|
i915->pipe.surface_copy = i915_surface_copy;
|
||||||
i915->pipe.surface_fill = i915_surface_fill;
|
i915->pipe.surface_fill = i915_surface_fill;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,10 +203,6 @@ void
|
||||||
brw_init_surface_functions(struct brw_context *brw)
|
brw_init_surface_functions(struct brw_context *brw)
|
||||||
{
|
{
|
||||||
brw->pipe.get_tex_surface = brw_get_tex_surface;
|
brw->pipe.get_tex_surface = brw_get_tex_surface;
|
||||||
brw->pipe.get_tile = pipe_get_tile_raw;
|
|
||||||
brw->pipe.put_tile = pipe_put_tile_raw;
|
|
||||||
|
|
||||||
brw->pipe.surface_data = brw_surface_data;
|
|
||||||
brw->pipe.surface_copy = brw_surface_copy;
|
brw->pipe.surface_copy = brw_surface_copy;
|
||||||
brw->pipe.surface_fill = brw_surface_fill;
|
brw->pipe.surface_fill = brw_surface_fill;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,6 @@ struct pipe_context {
|
||||||
unsigned indexSize,
|
unsigned indexSize,
|
||||||
unsigned mode, unsigned start, unsigned count);
|
unsigned mode, unsigned start, unsigned count);
|
||||||
|
|
||||||
/** Clear a surface to given value (no scissor; clear whole surface) */
|
|
||||||
void (*clear)(struct pipe_context *pipe, struct pipe_surface *ps,
|
|
||||||
unsigned clearValue);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query objects
|
* Query objects
|
||||||
|
|
@ -176,33 +173,9 @@ struct pipe_context {
|
||||||
const struct pipe_vertex_element * );
|
const struct pipe_vertex_element * );
|
||||||
|
|
||||||
|
|
||||||
/** Get a surface which is a "view" into a texture */
|
|
||||||
struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *texture,
|
|
||||||
unsigned face, unsigned level,
|
|
||||||
unsigned zslice);
|
|
||||||
|
|
||||||
/** Get a block of raw pixel data from a surface */
|
|
||||||
void (*get_tile)(struct pipe_context *pipe,
|
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
|
||||||
void *p, int dst_stride);
|
|
||||||
/** Put a block of raw pixel data into a surface */
|
|
||||||
void (*put_tile)(struct pipe_context *pipe,
|
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
|
||||||
const void *p, int src_stride);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Surface functions
|
* Surface functions
|
||||||
*/
|
*/
|
||||||
void (*surface_data)(struct pipe_context *pipe,
|
|
||||||
struct pipe_surface *dest,
|
|
||||||
unsigned destx, unsigned desty,
|
|
||||||
const void *src, unsigned src_stride,
|
|
||||||
unsigned srcx, unsigned srcy,
|
|
||||||
unsigned width, unsigned height);
|
|
||||||
|
|
||||||
void (*surface_copy)(struct pipe_context *pipe,
|
void (*surface_copy)(struct pipe_context *pipe,
|
||||||
struct pipe_surface *dest,
|
struct pipe_surface *dest,
|
||||||
|
|
@ -218,6 +191,10 @@ struct pipe_context {
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
unsigned value);
|
unsigned value);
|
||||||
|
|
||||||
|
void (*clear)(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
unsigned clearValue);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Texture functions
|
* Texture functions
|
||||||
|
|
@ -228,6 +205,11 @@ struct pipe_context {
|
||||||
void (*texture_release)(struct pipe_context *pipe,
|
void (*texture_release)(struct pipe_context *pipe,
|
||||||
struct pipe_texture **pt);
|
struct pipe_texture **pt);
|
||||||
|
|
||||||
|
/** Get a surface which is a "view" into a texture */
|
||||||
|
struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
|
||||||
|
struct pipe_texture *texture,
|
||||||
|
unsigned face, unsigned level,
|
||||||
|
unsigned zslice);
|
||||||
|
|
||||||
/* Flush rendering:
|
/* Flush rendering:
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,27 +34,6 @@
|
||||||
#include "sp_surface.h"
|
#include "sp_surface.h"
|
||||||
|
|
||||||
|
|
||||||
/* Upload data to a rectangular sub-region. Lots of choices how to do this:
|
|
||||||
*
|
|
||||||
* - memcpy by span to current destination
|
|
||||||
* - upload data as new buffer and blit
|
|
||||||
*
|
|
||||||
* Currently always memcpy.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
sp_surface_data(struct pipe_context *pipe,
|
|
||||||
struct pipe_surface *dst,
|
|
||||||
unsigned dstx, unsigned dsty,
|
|
||||||
const void *src, unsigned src_pitch,
|
|
||||||
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
pipe_copy_rect(pipe_surface_map(dst),
|
|
||||||
dst->cpp,
|
|
||||||
dst->pitch,
|
|
||||||
dstx, dsty, width, height, src, src_pitch, srcx, srcy);
|
|
||||||
|
|
||||||
pipe_surface_unmap(dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assumes all values are within bounds -- no checking at this level -
|
/* Assumes all values are within bounds -- no checking at this level -
|
||||||
* do it higher up if required.
|
* do it higher up if required.
|
||||||
|
|
@ -174,10 +153,6 @@ sp_surface_fill(struct pipe_context *pipe,
|
||||||
void
|
void
|
||||||
sp_init_surface_functions(struct softpipe_context *sp)
|
sp_init_surface_functions(struct softpipe_context *sp)
|
||||||
{
|
{
|
||||||
sp->pipe.get_tile = pipe_get_tile_raw;
|
|
||||||
sp->pipe.put_tile = pipe_put_tile_raw;
|
|
||||||
|
|
||||||
sp->pipe.surface_data = sp_surface_data;
|
|
||||||
sp->pipe.surface_copy = sp_surface_copy;
|
sp->pipe.surface_copy = sp_surface_copy;
|
||||||
sp->pipe.surface_fill = sp_surface_fill;
|
sp->pipe.surface_fill = sp_surface_fill;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
|
||||||
for (y = 0; y < h; y += TILE_SIZE) {
|
for (y = 0; y < h; y += TILE_SIZE) {
|
||||||
for (x = 0; x < w; x += TILE_SIZE) {
|
for (x = 0; x < w; x += TILE_SIZE) {
|
||||||
if (is_clear_flag_set(tc->clear_flags, x, y)) {
|
if (is_clear_flag_set(tc->clear_flags, x, y)) {
|
||||||
pipe->put_tile(pipe, ps,
|
pipe_put_tile_raw(pipe, ps,
|
||||||
x, y, TILE_SIZE, TILE_SIZE,
|
x, y, TILE_SIZE, TILE_SIZE,
|
||||||
tc->tile.data.color32, 0/*STRIDE*/);
|
tc->tile.data.color32, 0/*STRIDE*/);
|
||||||
|
|
||||||
|
|
@ -365,7 +365,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
|
||||||
struct softpipe_cached_tile *tile = tc->entries + pos;
|
struct softpipe_cached_tile *tile = tc->entries + pos;
|
||||||
if (tile->x >= 0) {
|
if (tile->x >= 0) {
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe->put_tile(pipe, ps,
|
pipe_put_tile_raw(pipe, ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
|
|
@ -414,7 +414,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
|
||||||
if (tile->x != -1) {
|
if (tile->x != -1) {
|
||||||
/* put dirty tile back in framebuffer */
|
/* put dirty tile back in framebuffer */
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe->put_tile(pipe, ps,
|
pipe_put_tile_raw(pipe, ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +441,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
|
||||||
else {
|
else {
|
||||||
/* get new tile data from surface */
|
/* get new tile data from surface */
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe->get_tile(pipe, ps,
|
pipe_put_tile_raw(pipe, ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
|
||||||
if (!packed)
|
if (!packed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pipe->get_tile(pipe, ps, x, y, w, h, packed, w * ps->cpp);
|
pipe_get_tile_raw(pipe, ps, x, y, w, h, packed, w * ps->cpp);
|
||||||
|
|
||||||
switch (ps->format) {
|
switch (ps->format) {
|
||||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||||
|
|
@ -693,7 +693,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->put_tile(pipe, ps, x, y, w, h, packed, w * ps->cpp);
|
pipe_put_tile_raw(pipe, ps, x, y, w, h, packed, w * ps->cpp);
|
||||||
|
|
||||||
FREE(packed);
|
FREE(packed);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,29 @@ st_texture_image_unmap(struct st_texture_image *stImage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Upload data to a rectangular sub-region. Lots of choices how to do this:
|
||||||
|
*
|
||||||
|
* - memcpy by span to current destination
|
||||||
|
* - upload data as new buffer and blit
|
||||||
|
*
|
||||||
|
* Currently always memcpy.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
st_surface_data(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *dst,
|
||||||
|
unsigned dstx, unsigned dsty,
|
||||||
|
const void *src, unsigned src_pitch,
|
||||||
|
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
pipe_copy_rect(pipe_surface_map(dst),
|
||||||
|
dst->cpp,
|
||||||
|
dst->pitch,
|
||||||
|
dstx, dsty, width, height, src, src_pitch, srcx, srcy);
|
||||||
|
|
||||||
|
pipe_surface_unmap(dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Upload data for a particular image.
|
/* Upload data for a particular image.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|
@ -225,12 +248,12 @@ st_texture_image_data(struct pipe_context *pipe,
|
||||||
|
|
||||||
dst_surface = pipe->get_tex_surface(pipe, dst, face, level, i);
|
dst_surface = pipe->get_tex_surface(pipe, dst, face, level, i);
|
||||||
|
|
||||||
pipe->surface_data(pipe, dst_surface,
|
st_surface_data(pipe, dst_surface,
|
||||||
0, 0, /* dstx, dsty */
|
0, 0, /* dstx, dsty */
|
||||||
srcUB,
|
srcUB,
|
||||||
src_row_pitch,
|
src_row_pitch,
|
||||||
0, 0, /* source x, y */
|
0, 0, /* source x, y */
|
||||||
dst->width[level], height); /* width, height */
|
dst->width[level], height); /* width, height */
|
||||||
|
|
||||||
pipe_surface_reference(&dst_surface, NULL);
|
pipe_surface_reference(&dst_surface, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue