Use intel_emit_reloc from video to prettify 965 render bind_bo setup.

This commit is contained in:
Eric Anholt 2009-01-19 19:11:41 -08:00
parent aefe198ca4
commit a340fe5e42
3 changed files with 32 additions and 32 deletions

View File

@ -1023,6 +1023,23 @@ Bool i830_pixmap_tiled(PixmapPtr p);
if (pitch > KB(8)) I830FALLBACK("pitch exceeds 3d limit 8K\n");\
} while(0)
/**
* Little wrapper around drm_intel_bo_reloc to return the initial value you
* should stuff into the relocation entry.
*
* If only we'd done this before settling on the library API.
*/
static inline uint32_t
intel_emit_reloc(drm_intel_bo *bo, uint32_t offset,
drm_intel_bo *target_bo, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain)
{
drm_intel_bo_emit_reloc(bo, offset, target_bo, target_offset,
read_domains, write_domain);
return target_bo->offset + target_offset;
}
extern const int I830PatternROP[16];
extern const int I830CopyROP[16];

View File

@ -1360,24 +1360,24 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
}
binding_table = binding_table_bo->virtual;
binding_table[0] = 0 * sizeof (brw_surface_state_padded) + surface_state_bo->offset;
dri_bo_emit_reloc (binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
0 * sizeof (brw_surface_state_padded),
0 * sizeof (uint32_t),
surface_state_bo);
binding_table[0] = intel_emit_reloc(binding_table_bo,
0 * sizeof(uint32_t),
surface_state_bo,
0 * sizeof(brw_surface_state_padded),
I915_GEM_DOMAIN_INSTRUCTION, 0);
binding_table[1] = 1 * sizeof (brw_surface_state_padded) + surface_state_bo->offset;
dri_bo_emit_reloc (binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
1 * sizeof (brw_surface_state_padded),
1 * sizeof (uint32_t),
surface_state_bo);
binding_table[1] = intel_emit_reloc(binding_table_bo,
1 * sizeof(uint32_t),
surface_state_bo,
1 * sizeof(brw_surface_state_padded),
I915_GEM_DOMAIN_INSTRUCTION, 0);
if (pMask) {
binding_table[2] = 2 * sizeof (brw_surface_state_padded) + surface_state_bo->offset;
dri_bo_emit_reloc (binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
2 * sizeof (brw_surface_state_padded),
2 * sizeof (uint32_t),
surface_state_bo);
binding_table[2] = intel_emit_reloc(binding_table_bo,
2 * sizeof(uint32_t),
surface_state_bo,
2 * sizeof(brw_surface_state_padded),
I915_GEM_DOMAIN_INSTRUCTION, 0);
} else {
binding_table[2] = 0;
}

View File

@ -326,23 +326,6 @@ i965_post_draw_debug(ScrnInfoPtr scrn)
#define URB_CS_ENTRIES 0
#define URB_CS_ENTRY_SIZE 0
/**
* Little wrapper around drm_intel_bo_reloc to return the initial value you
* should stuff into the relocation entry.
*
* If only we'd done this before settling on the library API.
*/
static uint32_t
intel_emit_reloc(drm_intel_bo *bo, uint32_t offset,
drm_intel_bo *target_bo, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain)
{
drm_intel_bo_emit_reloc(bo, offset, target_bo, target_offset,
read_domains, write_domain);
return target_bo->offset + target_offset;
}
static int
intel_alloc_and_map(I830Ptr i830, char *name, int size,
drm_intel_bo **bop, void *virtualp)