summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-04 15:23:35 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-03-04 15:23:35 +0000
commit5b04939b16eb6e13858b070315dee1d0fc09d94f (patch)
tree0f8739ea6fa7219eaebbb9ff090f86713ef820e0 /src/gallium/drivers/softpipe
parentcfd5298f240612ef69ae321aebbc425710a8d731 (diff)
parentf9ce417aaf14c00e72e92307b910de5dbed1bb6d (diff)
Merge commit 'origin/master' into gallium-map-range
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_llvm.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c5
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_state_surface.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c76
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c14
10 files changed, 37 insertions, 68 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index ff5d1b54a4..06ace27d14 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -32,7 +32,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "sp_clear.h"
@@ -87,7 +86,6 @@ softpipe_unmap_transfers(struct softpipe_context *sp)
static void softpipe_destroy( struct pipe_context *pipe )
{
struct softpipe_context *softpipe = softpipe_context( pipe );
- struct pipe_screen *screen = pipe->screen;
uint i;
if (softpipe->draw)
@@ -116,7 +114,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
for (i = 0; i < Elements(softpipe->constants); i++) {
if (softpipe->constants[i].buffer) {
- pipe_buffer_reference(screen, &softpipe->constants[i].buffer, NULL);
+ pipe_buffer_reference(&softpipe->constants[i].buffer, NULL);
}
}
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 3c7ba565d6..0c14d92864 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -35,7 +35,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_parse.h"
diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c
index 34adac5226..f33b3e3285 100644
--- a/src/gallium/drivers/softpipe/sp_fs_llvm.c
+++ b/src/gallium/drivers/softpipe/sp_fs_llvm.c
@@ -37,7 +37,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "tgsi/tgsi_sse2.h"
#if 0
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index 7e22081132..abd37547a9 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -35,7 +35,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_sse2.h"
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index b0d8e01426..93dab236d6 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -31,7 +31,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_query.h"
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 4d01a9dbe1..b63180baa5 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -31,7 +31,6 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
@@ -146,14 +145,12 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
const struct pipe_constant_buffer *buf)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct pipe_screen *screen = pipe->screen;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
/* note: reference counting */
- pipe_buffer_reference(screen,
- &softpipe->constants[shader].buffer,
+ pipe_buffer_reference(&softpipe->constants[shader].buffer,
buf ? buf->buffer : NULL);
softpipe->dirty |= SP_NEW_CONSTANTS;
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 99a28c0d7e..cb517b02e4 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -30,7 +30,6 @@
*/
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c
index 1493c65884..7c06d864a7 100644
--- a/src/gallium/drivers/softpipe/sp_state_surface.c
+++ b/src/gallium/drivers/softpipe/sp_state_surface.c
@@ -27,7 +27,6 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "pipe/p_inlines.h"
#include "sp_context.h"
#include "sp_state.h"
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 142ce230fc..4919ec826e 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -59,7 +59,6 @@ static boolean
softpipe_texture_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
{
- struct pipe_winsys *ws = screen->winsys;
struct pipe_texture *pt = &spt->base;
unsigned level;
unsigned width = pt->width[0];
@@ -87,9 +86,9 @@ softpipe_texture_layout(struct pipe_screen *screen,
depth = minify(depth);
}
- spt->buffer = ws->buffer_create(ws, 32,
- PIPE_BUFFER_USAGE_PIXEL,
- buffer_size);
+ spt->buffer = screen->buffer_create(screen, 32,
+ PIPE_BUFFER_USAGE_PIXEL,
+ buffer_size);
return spt->buffer != NULL;
}
@@ -98,19 +97,18 @@ static boolean
softpipe_displaytarget_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
{
- struct pipe_winsys *ws = screen->winsys;
unsigned usage = (PIPE_BUFFER_USAGE_CPU_READ_WRITE |
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
- spt->buffer = ws->surface_buffer_create( ws,
- spt->base.width[0],
- spt->base.height[0],
- spt->base.format,
- usage,
- &spt->stride[0]);
+ spt->buffer = screen->surface_buffer_create( screen,
+ spt->base.width[0],
+ spt->base.height[0],
+ spt->base.format,
+ usage,
+ &spt->stride[0]);
return spt->buffer != NULL;
}
@@ -128,7 +126,7 @@ softpipe_texture_create(struct pipe_screen *screen,
return NULL;
spt->base = *templat;
- spt->base.refcount = 1;
+ pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
if (spt->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
@@ -140,7 +138,7 @@ softpipe_texture_create(struct pipe_screen *screen,
goto fail;
}
- assert(spt->base.refcount == 1);
+ assert(spt->base.reference.count == 1);
return &spt->base;
fail:
@@ -170,32 +168,25 @@ softpipe_texture_blanket(struct pipe_screen * screen,
return NULL;
spt->base = *base;
- spt->base.refcount = 1;
+ pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
spt->stride[0] = stride[0];
- pipe_buffer_reference(screen, &spt->buffer, buffer);
+ pipe_buffer_reference(&spt->buffer, buffer);
return &spt->base;
}
static void
-softpipe_texture_release(struct pipe_screen *screen,
- struct pipe_texture **pt)
+softpipe_texture_destroy(struct pipe_texture *pt)
{
- if (!*pt)
- return;
-
- if (--(*pt)->refcount <= 0) {
- struct softpipe_texture *spt = softpipe_texture(*pt);
+ struct softpipe_texture *spt = softpipe_texture(pt);
- pipe_buffer_reference(screen, &spt->buffer, NULL);
- FREE(spt);
- }
- *pt = NULL;
+ pipe_buffer_reference(&spt->buffer, NULL);
+ FREE(spt);
}
@@ -212,7 +203,7 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps = CALLOC_STRUCT(pipe_surface);
if (ps) {
- ps->refcount = 1;
+ pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
ps->width = pt->width[level];
@@ -259,20 +250,15 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
static void
-softpipe_tex_surface_release(struct pipe_screen *screen,
- struct pipe_surface **s)
+softpipe_tex_surface_destroy(struct pipe_surface *surf)
{
- struct pipe_surface *surf = *s;
/* Effectively do the texture_update work here - if texture images
* needed post-processing to put them into hardware layout, this is
* where it would happen. For softpipe, nothing to do.
*/
assert(surf->texture);
- if (--surf->refcount == 0) {
- pipe_texture_reference(&surf->texture, NULL);
- FREE(surf);
- }
- *s = NULL;
+ pipe_texture_reference(&surf->texture, NULL);
+ FREE(surf);
}
@@ -292,7 +278,6 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
spt = CALLOC_STRUCT(softpipe_transfer);
if (spt) {
struct pipe_transfer *pt = &spt->base;
- pt->refcount = 1;
pipe_texture_reference(&pt->texture, texture);
pt->format = texture->format;
pt->block = texture->block;
@@ -327,20 +312,15 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
static void
-softpipe_tex_transfer_release(struct pipe_screen *screen,
- struct pipe_transfer **t)
+softpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
{
- struct softpipe_transfer *transfer = softpipe_transfer(*t);
/* Effectively do the texture_update work here - if texture images
* needed post-processing to put them into hardware layout, this is
* where it would happen. For softpipe, nothing to do.
*/
- assert (transfer->base.texture);
- if (--transfer->base.refcount == 0) {
- pipe_texture_reference(&transfer->base.texture, NULL);
- FREE(transfer);
- }
- *t = NULL;
+ assert (transfer->texture);
+ pipe_texture_reference(&transfer->texture, NULL);
+ FREE(transfer);
}
@@ -408,13 +388,13 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = softpipe_texture_create;
screen->texture_blanket = softpipe_texture_blanket;
- screen->texture_release = softpipe_texture_release;
+ screen->texture_destroy = softpipe_texture_destroy;
screen->get_tex_surface = softpipe_get_tex_surface;
- screen->tex_surface_release = softpipe_tex_surface_release;
+ screen->tex_surface_destroy = softpipe_tex_surface_destroy;
screen->get_tex_transfer = softpipe_get_tex_transfer;
- screen->tex_transfer_release = softpipe_tex_transfer_release;
+ screen->tex_transfer_destroy = softpipe_tex_transfer_destroy;
screen->transfer_map = softpipe_transfer_map;
screen->transfer_unmap = softpipe_transfer_unmap;
}
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 593360aab0..51e34d0d62 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -140,11 +140,11 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
}
if (tc->transfer) {
screen = tc->transfer->texture->screen;
- screen->tex_transfer_release(screen, &tc->transfer);
+ screen->tex_transfer_destroy(tc->transfer);
}
if (tc->tex_trans) {
screen = tc->tex_trans->texture->screen;
- screen->tex_transfer_release(screen, &tc->tex_trans);
+ screen->tex_transfer_destroy(tc->tex_trans);
}
FREE( tc );
@@ -167,11 +167,11 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
return;
if (tc->transfer_map) {
- tc->screen->transfer_unmap(tc->screen, tc->transfer);
+ screen->transfer_unmap(screen, tc->transfer);
tc->transfer_map = NULL;
}
- screen->tex_transfer_release(screen, &tc->transfer);
+ screen->tex_transfer_destroy(tc->transfer);
}
tc->surface = ps;
@@ -249,11 +249,11 @@ sp_tile_cache_set_texture(struct pipe_context *pipe,
struct pipe_screen *screen = tc->transfer->texture->screen;
if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ screen->transfer_unmap(screen, tc->tex_trans);
tc->tex_trans_map = NULL;
}
- screen->tex_transfer_release(screen, &tc->tex_trans);
+ screen->tex_transfer_destroy(tc->tex_trans);
}
/* mark as entries as invalid/empty */
@@ -559,7 +559,7 @@ sp_get_cached_tile_tex(struct softpipe_context *sp,
if (tc->tex_trans_map)
tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
- screen->tex_transfer_release(screen, &tc->tex_trans);
+ screen->tex_transfer_destroy(tc->tex_trans);
}
tc->tex_trans = screen->get_tex_transfer(screen, tc->texture, face, level, z,