**************************************************************************/
#include <errno.h>
-#include "main/imports.c"
#include "intel_batchbuffer.h"
#include "intel_context.h"
#include "intel_screen.h"
*/
static void
-intel_dump_batchbuffer(GLuint offset, GLuint * ptr, GLuint count)
+intel_dump_batchbuffer(uint offset, uint * ptr, uint count)
{
int i;
- _mesa_printf("\n\n\nSTART BATCH (%d dwords):\n", count / 4);
+ printf("\n\n\nSTART BATCH (%d dwords):\n", count / 4);
for (i = 0; i < count / 4; i += 1)
- _mesa_printf("\t0x%08x\n", ptr[i]);
- _mesa_printf("END BATCH\n\n\n");
+ printf("\t0x%08x\n", ptr[i]);
+ printf("END BATCH\n\n\n");
}
void
static void
intel_batch_ioctl(struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean allow_unlock)
+ uint start_offset,
+ uint used,
+ boolean allow_unlock)
{
drmI830BatchBuffer batch;
if (drmCommandWrite(intel->driFd, DRM_I830_BATCHBUFFER, &batch,
sizeof(batch))) {
- _mesa_printf("DRM_I830_BATCHBUFFER: %d\n", -errno);
+ printf("DRM_I830_BATCHBUFFER: %d\n", -errno);
UNLOCK_HARDWARE(intel);
exit(1);
}
*/
static void
do_flush_locked(struct intel_batchbuffer *batch,
- GLuint used,
- GLboolean allow_unlock)
+ uint used,
+ boolean allow_unlock)
{
- GLuint *ptr;
- GLuint i;
+ uint *ptr;
+ uint i;
unsigned fenceFlags;
struct _DriFenceObject *fo;
* whole task should be done internally by the memory manager, and
* that dma buffers probably need to be pinned within agp space.
*/
- ptr = (GLuint *) driBOMap(batch->buffer, DRM_BO_FLAG_WRITE,
+ ptr = (uint *) driBOMap(batch->buffer, DRM_BO_FLAG_WRITE,
DRM_BO_HINT_ALLOW_UNFENCED_MAP);
intel_batchbuffer_flush(struct intel_batchbuffer *batch)
{
struct intel_context *intel = batch->intel;
- GLuint used = batch->ptr - batch->map;
- GLboolean was_locked = intel->locked;
+ uint used = batch->ptr - batch->map;
+ boolean was_locked = intel->locked;
if (used == 0)
return batch->last_fence;
/* This is the only way buffers get added to the validate list.
*/
-GLboolean
+boolean
intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
struct _DriBufferObject *buffer,
- GLuint flags, GLuint mask, GLuint delta)
+ uint flags, uint mask, uint delta)
{
assert(batch->nr_relocs < MAX_RELOCS);
r->buf = buffer;
r->offset = batch->ptr - batch->map;
r->delta = delta;
- *(GLuint *) batch->ptr = 0x12345678;
+ *(uint *) batch->ptr = 0x12345678;
}
batch->ptr += 4;
void
intel_batchbuffer_data(struct intel_batchbuffer *batch,
- const void *data, GLuint bytes, GLuint flags)
+ const void *data, uint bytes, uint flags)
{
assert((bytes & 3) == 0);
intel_batchbuffer_require_space(batch, bytes, flags);
#ifndef INTEL_BATCHBUFFER_H
#define INTEL_BATCHBUFFER_H
-#include "main/glheader.h"
+#include "pipe/p_compiler.h"
#include "dri_bufmgr.h"
struct intel_context;
struct buffer_reloc
{
struct _DriBufferObject *buf;
- GLuint offset;
- GLuint delta; /* not needed? */
+ uint offset;
+ uint delta; /* not needed? */
};
struct intel_batchbuffer
struct _DriBufferObject *buffer;
struct _DriFenceObject *last_fence;
- GLuint flags;
+ uint flags;
drmBOList list;
- GLuint list_count;
- GLubyte *map;
- GLubyte *ptr;
+ uint list_count;
+ ubyte *map;
+ ubyte *ptr;
struct buffer_reloc reloc[MAX_RELOCS];
- GLuint nr_relocs;
- GLuint size;
+ uint nr_relocs;
+ uint size;
};
-struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context
- *intel);
+struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context *intel);
void intel_batchbuffer_free(struct intel_batchbuffer *batch);
* intel_buffer_dword() calls.
*/
void intel_batchbuffer_data(struct intel_batchbuffer *batch,
- const void *data, GLuint bytes, GLuint flags);
+ const void *data, uint bytes, uint flags);
void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
- GLuint bytes);
+ uint bytes);
-GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
- struct _DriBufferObject *buffer,
- GLuint flags,
- GLuint mask, GLuint offset);
+boolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
+ struct _DriBufferObject *buffer,
+ uint flags,
+ uint mask, uint offset);
/* Inline functions - might actually be better off with these
* non-inlined. Certainly better off switching all command packets to
* be passed as structs rather than dwords, but that's a little bit of
* work...
*/
-static INLINE GLuint
+static INLINE uint
intel_batchbuffer_space(struct intel_batchbuffer *batch)
{
return (batch->size - BATCH_RESERVED) - (batch->ptr - batch->map);
static INLINE void
-intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)
+intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, uint dword)
{
assert(batch->map);
assert(intel_batchbuffer_space(batch) >= 4);
- *(GLuint *) (batch->ptr) = dword;
+ *(uint *) (batch->ptr) = dword;
batch->ptr += 4;
}
static INLINE void
intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
- GLuint sz, GLuint flags)
+ uint sz, uint flags)
{
assert(sz < batch->size - 8);
if (intel_batchbuffer_space(batch) < sz ||