From 3e324f99d3b8f6b9da00c3f90719fba19e77ae7d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 8 Mar 2014 23:55:15 +0800 Subject: ilo: replace bo alloc flags by initial domains The only alloc flag is INTEL_ALLOC_FOR_RENDER, which can as well be expressed by specifying the initial write domain. The change makes it obvious that we failed to set INTEL_ALLOC_FOR_RENDER in several places. --- src/gallium/winsys/intel/drm/intel_drm_winsys.c | 12 ++++++++---- src/gallium/winsys/intel/intel_winsys.h | 13 ++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c index 12ae4aae8e2..e119f9ed9a1 100644 --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c @@ -219,17 +219,18 @@ struct intel_bo * intel_winsys_alloc_buffer(struct intel_winsys *winsys, const char *name, unsigned long size, - unsigned long flags) + uint32_t initial_domain) { + const bool for_render = + (initial_domain & (INTEL_DOMAIN_RENDER | INTEL_DOMAIN_INSTRUCTION)); const int alignment = 4096; /* always page-aligned */ drm_intel_bo *bo; - if (flags == INTEL_ALLOC_FOR_RENDER) { + if (for_render) { bo = drm_intel_bo_alloc_for_render(winsys->bufmgr, name, size, alignment); } else { - assert(!flags); bo = drm_intel_bo_alloc(winsys->bufmgr, name, size, alignment); } @@ -241,9 +242,12 @@ intel_winsys_alloc_texture(struct intel_winsys *winsys, const char *name, int width, int height, int cpp, enum intel_tiling_mode tiling, - unsigned long flags, + uint32_t initial_domain, unsigned long *pitch) { + const unsigned long flags = + (initial_domain & (INTEL_DOMAIN_RENDER | INTEL_DOMAIN_INSTRUCTION)) ? + BO_ALLOC_FOR_RENDER : 0; uint32_t real_tiling = tiling; drm_intel_bo *bo; diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h index ccc4620275d..b16f3a2d8a8 100644 --- a/src/gallium/winsys/intel/intel_winsys.h +++ b/src/gallium/winsys/intel/intel_winsys.h @@ -62,11 +62,6 @@ enum intel_tiling_mode { INTEL_TILING_Y = 2, }; -/* this is compatible with intel_bufmgr.h's definitions */ -enum intel_alloc_flag { - INTEL_ALLOC_FOR_RENDER = 1 << 0, -}; - struct winsys_handle; struct intel_winsys; struct intel_context; @@ -117,13 +112,13 @@ intel_winsys_read_reg(struct intel_winsys *winsys, * * \param name Informative description of the bo. * \param size Size of the bo. - * \param flags bitmask of enum intel_alloc_flag. + * \param initial_domain Initial (write) domain. */ struct intel_bo * intel_winsys_alloc_buffer(struct intel_winsys *winsys, const char *name, unsigned long size, - unsigned long flags); + uint32_t initial_domain); /** * Allocate a 2-dimentional buffer object. @@ -133,7 +128,7 @@ intel_winsys_alloc_buffer(struct intel_winsys *winsys, * \param height Height of the bo. * \param cpp Bytes per texel. * \param tiling Tiling mode. - * \param flags bitmask of enum intel_alloc_flag. + * \param initial_domain Initial (write) domain. * \param pitch Pitch of the bo. */ struct intel_bo * @@ -141,7 +136,7 @@ intel_winsys_alloc_texture(struct intel_winsys *winsys, const char *name, int width, int height, int cpp, enum intel_tiling_mode tiling, - unsigned long flags, + uint32_t initial_domain, unsigned long *pitch); /** -- cgit v1.2.3