summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-01-18 15:35:50 +0100
committerJakob Bornecrantz <[email protected]>2009-01-18 15:35:50 +0100
commita874cf37ee2a792991819cad2cb73e3d2ddc87a3 (patch)
treed8f99bc6411c04cfb2014c52cbefb40d1aaf51af /src
parent94ddd621d13310aca229ab64a86aee3d4db680e8 (diff)
i915: Update gem backend a bit
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c3
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.c15
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.h20
3 files changed, 25 insertions, 13 deletions
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
index 23999106138..af5c0277484 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
@@ -12,6 +12,7 @@ intel_be_batchbuffer_alloc(struct intel_be_context *intel)
{
struct intel_be_batchbuffer *batch = CALLOC_STRUCT(intel_be_batchbuffer);
+
batch->base.buffer = NULL;
batch->base.winsys = &intel->base;
batch->base.map = NULL;
@@ -28,7 +29,7 @@ intel_be_batchbuffer_alloc(struct intel_be_context *intel)
intel_be_batchbuffer_reset(batch);
- return NULL;
+ return batch;
}
void
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index cf0c1408dc8..201a4850498 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -141,9 +141,10 @@ err:
}
struct pipe_buffer *
-intel_be_buffer_from_handle(struct intel_be_device *dev,
- const char* name, unsigned handle)
+intel_be_buffer_from_handle(struct pipe_winsys *winsys,
+ const char* name, unsigned handle)
{
+ struct intel_be_device *dev = intel_be_device(winsys);
struct intel_be_buffer *buffer = CALLOC_STRUCT(intel_be_buffer);
if (!buffer)
@@ -169,6 +170,14 @@ err:
return NULL;
}
+unsigned
+intel_be_handle_from_buffer(struct pipe_winsys *winsys,
+ struct pipe_buffer *buf)
+{
+ drm_intel_bo *bo = intel_bo(buf);
+ return bo->handle;
+}
+
/*
* Fence
*/
@@ -248,8 +257,6 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size);
- dev->screen = i915_create_screen(&dev->base, id);
-
return true;
}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
index 53d63536c97..96e94c47e71 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
@@ -16,11 +16,6 @@ struct intel_be_device
{
struct pipe_winsys base;
- /**
- * Hw level screen
- */
- struct pipe_screen *screen;
-
int fd; /**< Drm file discriptor */
size_t max_batch_size;
@@ -47,14 +42,23 @@ struct intel_be_buffer {
};
/**
- * Create a be buffer from a drm bo handle
+ * Create a be buffer from a drm bo handle.
*
- * Takes a reference
+ * Takes a reference.
*/
struct pipe_buffer *
-intel_be_buffer_from_handle(struct intel_be_device *device,
+intel_be_buffer_from_handle(struct pipe_winsys *winsys,
const char* name, unsigned handle);
+/**
+ * Gets a handle from a buffer.
+ *
+ * If buffer is destroyed handle may become invalid.
+ */
+unsigned
+intel_be_handle_from_buffer(struct pipe_winsys *winsys,
+ struct pipe_buffer *buffer);
+
static INLINE struct intel_be_buffer *
intel_be_buffer(struct pipe_buffer *buf)
{