i965: Prepare to delete intel_miptree_alloc_ccs()

We're going to delete intel_miptree_alloc_ccs() in the next commit. With
that in mind, replace the use of this function in
do_single_blorp_clear() with intel_miptree_alloc_aux() and move the
delayed allocation logic to it's callers.

v2: Duplicate the delayed allocation comment (Topi Pohjolainen).

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Nanley Chery 2018-05-02 20:05:08 -07:00
parent beed9c4550
commit 6c41a2ef3b
3 changed files with 16 additions and 15 deletions

View File

@ -1208,7 +1208,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
*/
if (can_fast_clear && !irb->mt->aux_buf) {
assert(irb->mt->aux_usage == ISL_AUX_USAGE_CCS_D);
if (!intel_miptree_alloc_ccs(brw, irb->mt)) {
if (!intel_miptree_alloc_aux(brw, irb->mt)) {
/* There are a few reasons in addition to out-of-memory, that can
* cause intel_miptree_alloc_non_msrt_mcs to fail. Try to recover by
* falling back to non-fast clear.

View File

@ -59,10 +59,6 @@ static void *intel_miptree_map_raw(struct brw_context *brw,
static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
static bool
intel_miptree_alloc_aux(struct brw_context *brw,
struct intel_mipmap_tree *mt);
static bool
intel_miptree_supports_mcs(struct brw_context *brw,
const struct intel_mipmap_tree *mt)
@ -791,7 +787,12 @@ intel_miptree_create(struct brw_context *brw,
mt->offset = 0;
if (!intel_miptree_alloc_aux(brw, mt)) {
/* Create the auxiliary surface up-front. CCS_D, on the other hand, can only
* compress clear color so we wait until an actual fast-clear to allocate
* it.
*/
if (mt->aux_usage != ISL_AUX_USAGE_CCS_D &&
!intel_miptree_alloc_aux(brw, mt)) {
intel_miptree_release(&mt);
return NULL;
}
@ -882,7 +883,12 @@ intel_miptree_create_for_bo(struct brw_context *brw,
if (!(flags & MIPTREE_CREATE_NO_AUX)) {
intel_miptree_choose_aux_usage(brw, mt);
if (!intel_miptree_alloc_aux(brw, mt)) {
/* Create the auxiliary surface up-front. CCS_D, on the other hand, can
* only compress clear color so we wait until an actual fast-clear to
* allocate it.
*/
if (mt->aux_usage != ISL_AUX_USAGE_CCS_D &&
!intel_miptree_alloc_aux(brw, mt)) {
intel_miptree_release(&mt);
return NULL;
}
@ -1776,7 +1782,7 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
return true;
}
bool
static bool
intel_miptree_alloc_ccs(struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
@ -1897,7 +1903,7 @@ intel_miptree_alloc_hiz(struct brw_context *brw,
* create the auxiliary surfaces up-front. CCS_D, on the other hand, can only
* compress clear color so we wait until an actual fast-clear to allocate it.
*/
static bool
bool
intel_miptree_alloc_aux(struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
@ -1919,11 +1925,6 @@ intel_miptree_alloc_aux(struct brw_context *brw,
return true;
case ISL_AUX_USAGE_CCS_D:
/* Since CCS_D can only compress clear color so we wait until an actual
* fast-clear to allocate it.
*/
return true;
case ISL_AUX_USAGE_CCS_E:
assert(_mesa_is_format_color_format(mt->format));
assert(mt->surf.samples == 1);

View File

@ -354,7 +354,7 @@ struct intel_mipmap_tree
};
bool
intel_miptree_alloc_ccs(struct brw_context *brw,
intel_miptree_alloc_aux(struct brw_context *brw,
struct intel_mipmap_tree *mt);
enum intel_miptree_create_flags {