#include "../../radeon/drm/radeon_winsys.h"
#include "util/u_hash_table.h"
#include "os/os_thread.h"
+#include "radeon_drm.h"
#define PKT_COUNT_C 0xC000FFFF
#define PKT_COUNT_S(x) (((x) & 0x3FFF) << 16)
-struct r600_bo;
-
struct radeon {
struct radeon_winsys *ws;
struct radeon_info info;
unsigned family;
enum chip_class chip_class;
struct r600_tiling_info tiling_info;
- unsigned fence;
- unsigned *cfence;
- struct r600_bo *fence_bo;
- unsigned num_tile_pipes;
- unsigned backend_map;
- boolean backend_map_valid;
};
/* these flags are used in register flags and added into block flags */
struct radeon_bo {
struct pipe_reference reference;
struct pb_buffer *buf;
-
- unsigned handle;
+ struct radeon_winsys_cs_handle *cs_buf;
unsigned size;
- int map_count;
- void *data;
- struct list_head fencedlist;
- unsigned fence;
- struct r600_context *ctx;
- boolean shared;
- struct r600_reloc *reloc;
- unsigned reloc_id;
+
unsigned last_flush;
unsigned binding;
};
struct r600_bo {
struct pipe_reference reference; /* this must be the first member for the r600_bo_reference inline to work */
/* DO NOT MOVE THIS ^ */
- unsigned size;
unsigned domains;
struct radeon_bo *bo;
- unsigned fence;
};
/*
unsigned size, unsigned alignment, unsigned bind, unsigned initial_domain);
void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst,
struct radeon_bo *src);
-int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
-int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain);
-int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, uint32_t num_bo);
-int radeon_bo_get_tiling_flags(struct radeon *radeon,
- struct radeon_bo *bo,
- uint32_t *tiling_flags);
-int radeon_bo_get_name(struct radeon *radeon,
- struct radeon_bo *bo,
- uint32_t *name);
-int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo);
/*
* r600_hw_context.c
*/
-int r600_context_init_fence(struct r600_context *ctx);
-void r600_context_get_reloc(struct r600_context *ctx, struct r600_bo *rbo);
void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
unsigned flush_mask, struct r600_bo *rbo);
struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset);
void r600_init_cs(struct r600_context *ctx);
int r600_resource_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride, struct r600_reg *reg, int nreg, unsigned offset_base);
-static INLINE void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo)
+static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r600_bo *rbo)
{
struct radeon_bo *bo = rbo->bo;
+ unsigned reloc_index;
assert(bo != NULL);
- if (!bo->reloc)
- r600_context_get_reloc(ctx, rbo);
+ reloc_index = ctx->radeon->ws->cs_add_reloc(ctx->cs, bo->cs_buf,
+ rbo->domains, rbo->domains);
+
+ if (reloc_index >= ctx->creloc)
+ ctx->creloc = reloc_index+1;
- /* set PKT3 to point to proper reloc */
- *pm4 = bo->reloc_id;
+ radeon_bo_reference(ctx->radeon, &ctx->bo[reloc_index], bo);
+ return reloc_index * 4;
}
/*
*/
void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo);
-
-/*
- * radeon_bo.c
- */
-static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
-{
- if (bo->map_count == 0 && !bo->data)
- return radeon_bo_fixed_map(radeon, bo);
- bo->map_count++;
- return 0;
-}
-
-static inline void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo)
-{
- bo->map_count--;
- assert(bo->map_count >= 0);
-}
-
-/*
- * fence
- */
-static inline boolean fence_is_after(unsigned fence, unsigned ofence)
-{
- /* handle wrap around */
- if (fence < 0x80000000 && ofence > 0x80000000)
- return TRUE;
- if (fence > ofence)
- return TRUE;
- return FALSE;
-}
-
#endif