{
struct intel_be_batchbuffer *batch = CALLOC_STRUCT(intel_be_batchbuffer);
+
batch->base.buffer = NULL;
batch->base.winsys = &intel->base;
batch->base.map = NULL;
intel_be_batchbuffer_reset(batch);
- return NULL;
+ return batch;
}
void
}
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)
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
*/
dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size);
- dev->screen = i915_create_screen(&dev->base, id);
-
return true;
}
{
struct pipe_winsys base;
- /**
- * Hw level screen
- */
- struct pipe_screen *screen;
-
int fd; /**< Drm file discriptor */
size_t max_batch_size;
};
/**
- * 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)
{