summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2007-12-07 12:30:35 +0100
committerMichel Dänzer <[email protected]>2007-12-07 12:30:35 +0100
commitb859cdf6f191b4d8b56537c8dc30082a7e2d94b3 (patch)
tree4bd3149cc81a2fb6434282a70b34361f94710cfd /src/mesa/drivers
parent987d59bb83e9e08192563e5f1b52949c5511053c (diff)
Eliminate struct pipe_region.
Directly use struct pipe_buffer_handle for storage and struct pipe_surface for (un)mapping.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c7
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c51
2 files changed, 7 insertions, 51 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c
index f96209d1b06..454cd71f6c0 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c
@@ -88,12 +88,11 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv,
const drm_clip_rect_t *pbox = dPriv->pClipRects;
const int pitch = intelScreen->front.pitch / intelScreen->front.cpp;
const int cpp = intelScreen->front.cpp;
- const struct pipe_region *srcRegion = surf->region;
const int srcpitch = surf->pitch;
int BR13, CMD;
int i;
- ASSERT(srcRegion);
+ ASSERT(surf->buffer);
ASSERT(surf->cpp == cpp);
DBG(SWAP, "screen pitch %d src surface pitch %d\n",
@@ -159,7 +158,7 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv,
assert(box.x1 < box.x2);
assert(box.y1 < box.y2);
- /* XXX this could be done with pipe->region_copy() */
+ /* XXX this could be done with pipe->surface_copy() */
BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
OUT_BATCH(CMD);
OUT_BATCH(BR13);
@@ -171,7 +170,7 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
OUT_BATCH((sbox.y1 << 16) | sbox.x1);
OUT_BATCH((srcpitch * cpp) & 0xffff);
- OUT_RELOC(dri_bo(srcRegion->buffer),
+ OUT_RELOC(dri_bo(surf->buffer),
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
index 7b3aa994824..1b71d0ac107 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
@@ -135,13 +135,12 @@ static void intel_buffer_get_subdata(struct pipe_winsys *winsys,
* for all buffers.
*/
static struct pipe_buffer_handle *
-intel_buffer_create(struct pipe_winsys *winsys,
- unsigned alignment)
+intel_buffer_create(struct pipe_winsys *winsys, unsigned flags)
{
struct _DriBufferObject *buffer;
struct intel_pipe_winsys *iws = intel_pipe_winsys(winsys);
driGenBuffers( iws->regionPool,
- "pipe buffer", 1, &buffer, alignment, 0, 0 );
+ "pipe buffer", 1, &buffer, 64, 0, 0 );
return pipe_bo(buffer);
}
@@ -193,46 +192,6 @@ intel_i915_surface_pitch(struct pipe_winsys *winsys,
}
-static struct pipe_region *
-intel_i915_region_alloc(struct pipe_winsys *winsys,
- unsigned size, unsigned flags)
-{
- struct pipe_region *region = calloc(sizeof(*region), 1);
- const unsigned alignment = 64;
-
- region->refcount = 1;
-
- region->buffer = winsys->buffer_create( winsys, alignment );
-
- winsys->buffer_data( winsys,
- region->buffer,
- size,
- NULL,
- PIPE_BUFFER_USAGE_PIXEL );
-
- return region;
-}
-
-static void
-intel_i915_region_release(struct pipe_winsys *winsys,
- struct pipe_region **region)
-{
- if (!*region)
- return;
-
- assert((*region)->refcount > 0);
- (*region)->refcount--;
-
- if ((*region)->refcount == 0) {
- assert((*region)->map_refcount == 0);
-
- winsys->buffer_reference( winsys, &((*region)->buffer), NULL );
- free(*region);
- }
- *region = NULL;
-}
-
-
static struct pipe_surface *
intel_i915_surface_alloc(struct pipe_winsys *winsys, unsigned format)
{
@@ -252,8 +211,8 @@ intel_i915_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
struct pipe_surface *surf = *s;
surf->refcount--;
if (surf->refcount == 0) {
- if (surf->region)
- winsys->region_release(winsys, &surf->region);
+ if (surf->buffer)
+ winsys->buffer_reference(winsys, &surf->buffer, NULL);
free(surf);
}
*s = NULL;
@@ -300,8 +259,6 @@ intel_create_pipe_winsys( int fd )
iws->winsys.flush_frontbuffer = intel_flush_frontbuffer;
iws->winsys.printf = intel_printf;
iws->winsys.get_name = intel_get_name;
- iws->winsys.region_alloc = intel_i915_region_alloc;
- iws->winsys.region_release = intel_i915_region_release;
iws->winsys.surface_pitch = intel_i915_surface_pitch;
iws->winsys.surface_alloc = intel_i915_surface_alloc;
iws->winsys.surface_release = intel_i915_surface_release;