[Mesa-dev] [PATCH 1/2] i965/gen9: Configure rbc buffers as plain for non-rbc tex views

Matt Turner mattst88 at gmail.com
Tue May 31 17:58:47 UTC 2016


On Tue, May 31, 2016 at 7:16 AM, Topi Pohjolainen
<topi.pohjolainen at intel.com> wrote:
> Fixes rendering in Shadow of Mordor with rbc. Application writes
> RGBA_UNORM texture filling it with values the application wants to
> later on treat as SRGB_ALPHA.
> Intel driver enables lossless compression for the buffer by the time
> of writing. However, the driver fails to make sure the buffer can be
> sampled as something else later on and unfortunately there is
> restriction in the hardware for using lossless compression for srgb
> formats which looks to extend itself to the sampling engine also.
> Requesting srgb to linear conversion on top of compressed buffer
> results the color values to be pretty much garbage.
>
> Fortunately none of tracked benchmarks showed a regression with
> this.
>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> CC: Kenneth Graunke <kenneth at whitecape.org

Presumably we want to tag these for stable.

> ---
>  src/mesa/drivers/dri/i965/brw_context.c        | 38 ++++++++++++++++++++++++--
>  src/mesa/drivers/dri/i965/gen8_surface_state.c | 13 ++++++++-
>  2 files changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 2504dce..652acbf 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -70,6 +70,7 @@
>  #include "tnl/t_pipeline.h"
>  #include "util/ralloc.h"
>  #include "util/debug.h"
> +#include "isl/isl.h"
>
>  /***************************************
>   * Mesa's Driver Functions
> @@ -166,6 +167,38 @@ intel_update_framebuffer(struct gl_context *ctx,
>                                   fb->DefaultGeometry.NumSamples);
>  }
>
> +/* On Gen9 color buffers may be compressed by the hardware (lossless
> + * compression). There are, however, format restrictions and care needs to be
> + * taken that the sampler engine is capable for re-interpreting a buffer with
> + * format different the buffer was originally written with.
> + *
> + * For example, SRGB formats are not compressible and the sampler engine isn't
> + * capable of treating RGBA_UNORM as SRGB_ALPHA. In such a case the underlying
> + * color buffer needs to be resolved so that the sampling surface can be
> + * sampled as non-compressed (i.e., without the auxiliary MCS buffer being
> + * set).
> + */
> +static bool
> +intel_texture_view_requires_resolve(struct brw_context *brw,
> +                                    struct intel_texture_object *intel_tex)
> +{
> +   if (brw->gen < 9 ||
> +      !intel_miptree_is_lossless_compressed(brw, intel_tex->mt))

Needs one more space of indentation.

> +     return false;


More information about the mesa-dev mailing list