summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/xlib
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-01-16 13:14:19 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-01-16 13:14:19 +1100
commit3119e9a14b66fcfb08fcc3563602273dd2e1893c (patch)
tree74ff685faec3430b66d70522b6ed717f57e54f00 /src/mesa/pipe/xlib
parent9de335f5807553bc9251931ba3e80c4b454b5818 (diff)
parent587e2becc237bc1c900a1c0ba114a1a0192690ff (diff)
Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
Conflicts: src/mesa/pipe/Makefile
Diffstat (limited to 'src/mesa/pipe/xlib')
-rw-r--r--src/mesa/pipe/xlib/xm_api.c21
-rw-r--r--src/mesa/pipe/xlib/xm_winsys.c9
-rw-r--r--src/mesa/pipe/xlib/xm_winsys_aub.c12
3 files changed, 24 insertions, 18 deletions
diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/mesa/pipe/xlib/xm_api.c
index 168eba0784..03985eab5a 100644
--- a/src/mesa/pipe/xlib/xm_api.c
+++ b/src/mesa/pipe/xlib/xm_api.c
@@ -1247,22 +1247,11 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
GLint *bytesPerValue, void **buffer )
{
- struct pipe_surface *surf
- = st_get_framebuffer_surface(b->stfb, ST_SURFACE_DEPTH);
- if (surf) {
- *width = surf->width;
- *height = surf->pitch;
- *bytesPerValue = surf->cpp;
- *buffer = surf->map;
- return GL_TRUE;
- }
- else {
- *width = 0;
- *height = 0;
- *bytesPerValue = 0;
- *buffer = 0;
- return GL_FALSE;
- }
+ *width = 0;
+ *height = 0;
+ *bytesPerValue = 0;
+ *buffer = 0;
+ return GL_FALSE;
}
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c
index 42c43387af..10dc09b13c 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/mesa/pipe/xlib/xm_winsys.c
@@ -45,7 +45,10 @@
#ifdef GALLIUM_CELL
#include "pipe/cell/ppu/cell_context.h"
#include "pipe/cell/ppu/cell_winsys.h"
+#else
+#define TILE_SIZE 32 /* avoid compilation errors */
#endif
+
#include "xm_winsys_aub.h"
@@ -214,7 +217,6 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
{
XImage *ximage = b->tempImage;
struct xm_buffer *xm_buf = xm_bo(surf->buffer);
- const int TILE_SIZE = 32;
const uint tilesPerRow = (surf->width + TILE_SIZE - 1) / TILE_SIZE;
uint x, y;
@@ -234,6 +236,7 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
int tx = x / TILE_SIZE;
int ty = y / TILE_SIZE;
int offset = ty * tilesPerRow + tx;
+
offset *= 4 * TILE_SIZE * TILE_SIZE;
ximage->data = (char *) xm_buf->data + offset;
@@ -364,6 +367,10 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
surf->cpp = pf_get_size(format);
surf->pitch = round_up(width, alignment / surf->cpp);
+#ifdef GALLIUM_CELL /* XXX a bit of a hack */
+ height = round_up(height, TILE_SIZE);
+#endif
+
assert(!surf->buffer);
surf->buffer = winsys->buffer_create(winsys, alignment, 0, 0);
if(!surf->buffer)
diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.c b/src/mesa/pipe/xlib/xm_winsys_aub.c
index b207638390..2be8f8793d 100644
--- a/src/mesa/pipe/xlib/xm_winsys_aub.c
+++ b/src/mesa/pipe/xlib/xm_winsys_aub.c
@@ -99,6 +99,8 @@ static void *aub_buffer_map(struct pipe_winsys *winsys,
{
struct aub_buffer *sbo = aub_bo(buf);
+ assert(sbo->data);
+
if (flags & PIPE_BUFFER_FLAG_WRITE)
sbo->dump_on_unmap = 1;
@@ -116,6 +118,9 @@ static void aub_buffer_unmap(struct pipe_winsys *winsys,
if (sbo->map_count == 0 &&
sbo->dump_on_unmap) {
+
+ sbo->dump_on_unmap = 0;
+
brw_aub_gtt_data( iws->aubfile,
sbo->offset,
sbo->data,
@@ -132,6 +137,7 @@ aub_buffer_reference(struct pipe_winsys *winsys,
struct pipe_buffer_handle *buf)
{
if (*ptr) {
+ assert(aub_bo(*ptr)->refcount != 0);
if (--(aub_bo(*ptr)->refcount) == 0)
free(*ptr);
*ptr = NULL;
@@ -273,7 +279,9 @@ aub_buffer_create(struct pipe_winsys *winsys,
unsigned flags,
unsigned hint)
{
- return pipe_bo(CALLOC_STRUCT(aub_buffer));
+ struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
+ sbo->refcount = 1;
+ return pipe_bo(sbo);
}
@@ -282,6 +290,8 @@ aub_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned bytes)
{
struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
+ sbo->refcount = 1;
+
/* Lets hope this is meant for upload, not as a result!
*/
aub_buffer_data( winsys,