r600g: move more DRM queries into winsys/radeon
[mesa.git] / src / gallium / winsys / r600 / drm / r600_priv.h
index baf7c98d5780e652fe3e5ef9e2bf9fa9291f69c8..036468e3a31f14fcf1e7a6b1e2162adf999b4fc0 100644 (file)
@@ -30,6 +30,7 @@
 #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)
@@ -40,9 +41,6 @@ struct radeon {
        unsigned                        family;
        enum chip_class                 chip_class;
        struct r600_tiling_info         tiling_info;
-       unsigned                        num_tile_pipes;
-       unsigned                        backend_map;
-       boolean                         backend_map_valid;
 };
 
 /* these flags are used in register flags and added into block flags */
@@ -71,8 +69,6 @@ struct radeon_bo {
        int                             map_count;
        void                            *data;
 
-       struct r600_reloc               *reloc;
-       unsigned                        reloc_id;
        unsigned                        last_flush;
        unsigned                        binding;
 };
@@ -111,7 +107,6 @@ 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);
@@ -129,17 +124,21 @@ void r600_context_reg(struct r600_context *ctx,
 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);
 
-       /* set PKT3 to point to proper reloc */
-       *pm4 = bo->reloc_id;
+       if (reloc_index >= ctx->creloc)
+               ctx->creloc = reloc_index+1;
+
+       radeon_bo_reference(ctx->radeon, &ctx->bo[reloc_index], bo);
+       return reloc_index * 4;
 }
 
 /*