summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c53
1 files changed, 27 insertions, 26 deletions
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 43ed0602a4..910c0d2cc5 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c
@@ -43,6 +43,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
@@ -65,7 +66,7 @@ intel_pipe_winsys( struct pipe_winsys *winsys )
/* Most callbacks map direcly onto dri_bufmgr operations:
*/
static void *intel_buffer_map(struct pipe_winsys *winsys,
- struct pipe_buffer_handle *buf,
+ struct pipe_buffer *buf,
unsigned flags )
{
unsigned drm_flags = 0;
@@ -80,26 +81,17 @@ static void *intel_buffer_map(struct pipe_winsys *winsys,
}
static void intel_buffer_unmap(struct pipe_winsys *winsys,
- struct pipe_buffer_handle *buf)
+ struct pipe_buffer *buf)
{
driBOUnmap( dri_bo(buf) );
}
static void
-intel_buffer_reference(struct pipe_winsys *winsys,
- struct pipe_buffer_handle **ptr,
- struct pipe_buffer_handle *buf)
+intel_buffer_destroy(struct pipe_winsys *winsys,
+ struct pipe_buffer *buf)
{
- if (*ptr) {
- driBOUnReference( dri_bo(*ptr) );
- *ptr = NULL;
- }
-
- if (buf) {
- driBOReference( dri_bo(buf) );
- *ptr = buf;
- }
+ driBOUnReference( dri_bo(buf) );
}
@@ -107,16 +99,21 @@ intel_buffer_reference(struct pipe_winsys *winsys,
* for all buffers.
* Grabs the hardware lock!
*/
-static struct pipe_buffer_handle *
+static struct pipe_buffer *
intel_buffer_create(struct pipe_winsys *winsys,
unsigned alignment,
unsigned usage,
unsigned size )
{
- struct _DriBufferObject *buffer;
+ struct intel_buffer *buffer = CALLOC_STRUCT( intel_buffer );
struct intel_pipe_winsys *iws = intel_pipe_winsys(winsys);
unsigned flags = 0;
+ buffer->base.refcount = 1;
+ buffer->base.alignment = alignment;
+ buffer->base.usage = usage;
+ buffer->base.size = size;
+
if (usage & (PIPE_BUFFER_USAGE_VERTEX /*| IWS_BUFFER_USAGE_LOCAL*/)) {
flags |= DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED;
} else {
@@ -143,20 +140,24 @@ intel_buffer_create(struct pipe_winsys *winsys,
#endif
driGenBuffers( iws->regionPool,
- "pipe buffer", 1, &buffer, alignment, flags, 0 );
- driBOData( buffer, size, NULL, 0 );
- return pipe_bo(buffer);
+ "pipe buffer", 1, &buffer->driBO, alignment, flags, 0 );
+
+ driBOData( buffer->driBO, size, NULL, 0 );
+
+ return &buffer->base;
}
-static struct pipe_buffer_handle *
+static struct pipe_buffer *
intel_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned bytes)
{
- struct _DriBufferObject *buffer;
+ struct intel_buffer *buffer = CALLOC_STRUCT( intel_buffer );
struct intel_pipe_winsys *iws = intel_pipe_winsys(winsys);
+
driGenUserBuffer( iws->regionPool,
- "pipe user buffer", &buffer, ptr, bytes);
- return pipe_bo(buffer);
+ "pipe user buffer", &buffer->driBO, ptr, bytes);
+
+ return &buffer->base;
}
@@ -224,7 +225,7 @@ intel_i915_surface_alloc_storage(struct pipe_winsys *winsys,
return -1;
if(ret) {
- winsys->buffer_reference(winsys, &surf->buffer, NULL);
+ pipe_buffer_reference(winsys, &surf->buffer, NULL);
return ret;
}
@@ -239,7 +240,7 @@ intel_i915_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
surf->refcount--;
if (surf->refcount == 0) {
if (surf->buffer)
- winsys->buffer_reference(winsys, &surf->buffer, NULL);
+ pipe_buffer_reference(winsys, &surf->buffer, NULL);
free(surf);
}
*s = NULL;
@@ -279,7 +280,7 @@ intel_create_pipe_winsys( int fd )
iws->winsys.user_buffer_create = intel_user_buffer_create;
iws->winsys.buffer_map = intel_buffer_map;
iws->winsys.buffer_unmap = intel_buffer_unmap;
- iws->winsys.buffer_reference = intel_buffer_reference;
+ iws->winsys.buffer_destroy = intel_buffer_destroy;
iws->winsys.flush_frontbuffer = intel_flush_frontbuffer;
iws->winsys.printf = intel_printf;
iws->winsys.get_name = intel_get_name;