From: Kenneth Graunke Date: Fri, 7 Dec 2018 18:46:04 +0000 (-0800) Subject: iris: Add iris_resource fields for aux surfaces X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7bc4d60749cc4dd81d46bdfebf2266def389b59;p=mesa.git iris: Add iris_resource fields for aux surfaces But without fast clears or HiZ per-level tracking just yet. --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index f67d8165bdf..5dbc4f7de6c 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -196,12 +196,26 @@ iris_get_depth_stencil_resources(struct pipe_resource *res, } } +static void +iris_resource_disable_aux(struct iris_resource *res) +{ + iris_bo_unreference(res->aux.bo); + free(res->aux.state); + + res->aux.usage = ISL_AUX_USAGE_NONE; + res->aux.surf.size_B = 0; + res->aux.bo = NULL; + res->aux.state = NULL; +} + static void iris_resource_destroy(struct pipe_screen *screen, struct pipe_resource *resource) { struct iris_resource *res = (struct iris_resource *)resource; + iris_resource_disable_aux(res); + iris_bo_unreference(res->bo); free(res); } diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h index 060472f6df3..80bde8a2108 100644 --- a/src/gallium/drivers/iris/iris_resource.h +++ b/src/gallium/drivers/iris/iris_resource.h @@ -67,6 +67,46 @@ struct iris_resource { * in the past. Only meaningful for PIPE_BUFFER; used for flushing. */ unsigned bind_history; + + /** + * Auxiliary buffer information (CCS, MCS, or HiZ). + */ + struct { + /** The surface layout for the auxiliary buffer. */ + struct isl_surf surf; + + /** The buffer object containing the auxiliary data. */ + struct iris_bo *bo; + + /** Offset into 'bo' where the auxiliary surface starts. */ + uint32_t offset; + + /** + * \brief The type of auxiliary compression used by this resource. + * + * This describes the type of auxiliary compression that is intended to + * be used by this resource. An aux usage of ISL_AUX_USAGE_NONE means + * that auxiliary compression is permanently disabled. An aux usage + * other than ISL_AUX_USAGE_NONE does not imply that auxiliary + * compression will always be enabled for this surface. + */ + enum isl_aux_usage usage; + + /** + * A bitfield of ISL_AUX_* modes that might this resource might use. + * + * For example, a surface might use both CCS_E and CCS_D at times. + */ + unsigned possible_usages; + + /** + * \brief Maps miptree slices to their current aux state. + * + * This two-dimensional array is indexed as [level][layer] and stores an + * aux state for each slice. + */ + enum isl_aux_state **state; + } aux; }; /**