#define BRW_WINSYS_H
#include "pipe/p_compiler.h"
-#include "pipe/p_error.h"
-#include "pipe/p_refcnt.h"
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
struct brw_winsys;
struct pipe_fence_handle;
};
+/* Matches the i915_drm definitions:
+ */
+#define BRW_TILING_NONE 0
+#define BRW_TILING_X 1
+#define BRW_TILING_Y 2
+
+
/* Relocations to be applied with subdata in a call to sws->bo_subdata, below.
*
* Effectively this encodes:
struct brw_winsys_screen {
+ unsigned pci_id;
/**
* Buffer functions.
unsigned alignment,
struct brw_winsys_buffer **bo_out);
+ enum pipe_error (*bo_from_handle)(struct brw_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ unsigned *stride,
+ unsigned *tiling,
+ struct brw_winsys_buffer **bo_out);
+
+ enum pipe_error (*bo_get_handle)(struct brw_winsys_buffer *buffer,
+ struct winsys_handle *whandle,
+ unsigned stride);
+
/* Destroy a buffer when our refcount goes to zero:
*/
void (*bo_destroy)(struct brw_winsys_buffer *buffer);
{
struct brw_winsys_buffer *old_buf = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &buf->reference))
+ if (pipe_reference(&(*ptr)->reference, &buf->reference))
old_buf->sws->bo_destroy(old_buf);
-}
-
-/**
- * Create brw pipe_screen.
- */
-struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id);
+ *ptr = buf;
+}
-/**
- * Create a brw pipe_context.
- */
-struct pipe_context *brw_create_context(struct pipe_screen *screen);
-/**
- * Get the brw_winsys buffer backing the texture.
- *
- * TODO UGLY
- */
-struct pipe_texture;
-boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
- struct brw_winsys_buffer **buffer,
- unsigned *stride);
-/**
- * Wrap a brw_winsys buffer with a texture blanket.
- *
- * TODO UGLY
+/*************************************************************************
+ * Cooperative dumping between winsys and driver. TODO: make this
+ * driver-only by wrapping calls to winsys->bo_subdata().
*/
-struct pipe_texture *
-brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
- const struct pipe_texture *template,
- const unsigned pitch,
- struct brw_winsys_buffer *buffer);
-
+#ifdef DEBUG
+extern int BRW_DUMP;
+#else
+#define BRW_DUMP 0
+#endif
+
+#define DUMP_ASM 0x1
+#define DUMP_STATE 0x2
+#define DUMP_BATCH 0x4
+
+void brw_dump_data( unsigned pci_id,
+ enum brw_buffer_data_type data_type,
+ unsigned offset,
+ const void *data,
+ size_t size );
#endif