[Mesa-dev] [PATCH 2/2] i965: Add support for 16-bit unorm L, A, and I textures.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 8 20:26:23 PST 2011


On 11/08/2011 11:27 AM, Eric Anholt wrote:
> While not required by any particular spec version, mplayer was asking
> for L16 and hoping for actual L16 without checking.  The 8 bits
> allocated led to 10-bit planar video data stored in the lower 10 bits
> giving only 2 bits of precision in video.  While it was an amusing
> effect, give them what they actually wanted instead.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41461
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    3 +++
>  src/mesa/drivers/dri/intel/intel_context.c       |    6 +++++-
>  2 files changed, 8 insertions(+), 1 deletions(-)

For this patch:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

I see what you're trying to do in patch 1, but I'm afraid I'm not
familiar enough with the arcanities to comment on its correctness.

> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 04dc389..66a8a5a 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -80,6 +80,9 @@ brw_format_for_mesa_format(gl_format mesa_format)
>        [MESA_FORMAT_I8] = BRW_SURFACEFORMAT_I8_UNORM,
>        [MESA_FORMAT_A8] = BRW_SURFACEFORMAT_A8_UNORM,
>        [MESA_FORMAT_AL88] = BRW_SURFACEFORMAT_L8A8_UNORM,
> +      [MESA_FORMAT_L16] = BRW_SURFACEFORMAT_L16_UNORM,
> +      [MESA_FORMAT_A16] = BRW_SURFACEFORMAT_A16_UNORM,
> +      [MESA_FORMAT_I16] = BRW_SURFACEFORMAT_I16_UNORM,
>        [MESA_FORMAT_AL1616] = BRW_SURFACEFORMAT_L16A16_UNORM,
>        [MESA_FORMAT_R8] = BRW_SURFACEFORMAT_R8_UNORM,
>        [MESA_FORMAT_R16] = BRW_SURFACEFORMAT_R16_UNORM,
> diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
> index 8e8ab73..3e10ce0 100644
> --- a/src/mesa/drivers/dri/intel/intel_context.c
> +++ b/src/mesa/drivers/dri/intel/intel_context.c
> @@ -640,8 +640,12 @@ intelInitContext(struct intel_context *intel,
>     ctx->TextureFormatSupported[MESA_FORMAT_A8] = true;
>     ctx->TextureFormatSupported[MESA_FORMAT_I8] = true;
>     ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true;
> -   if (intel->gen >= 4)
> +   if (intel->gen >= 4) {
> +      ctx->TextureFormatSupported[MESA_FORMAT_L16] = true;
> +      ctx->TextureFormatSupported[MESA_FORMAT_A16] = true;
> +      ctx->TextureFormatSupported[MESA_FORMAT_I16] = true;
>        ctx->TextureFormatSupported[MESA_FORMAT_AL1616] = true;
> +   }
>  
>     /* Depth and stencil */
>     ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;



More information about the mesa-dev mailing list