Re: [Mesa-dev] [PATCH v2 3/9] i915: Use L8A8 instead of I8 to simulate A8 on gen2

2014-08-15 Thread Erik Faye-Lund
On Thu, Aug 7, 2014 at 10:31 AM,  ville.syrj...@linux.intel.com wrote:
 diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
 index c61a748..f414ea3 100644
 --- a/src/mesa/main/texformat.c
 +++ b/src/mesa/main/texformat.c
 case GL_ALPHA12:
 case GL_ALPHA16:
RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16);
RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
 +  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
break;

I know this isn't exactly what your patch looked to support, but
shouldn't MESA_FORMAT_L16A16_UNORM be tried as a lossless alternative
also?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/9] i915: Use L8A8 instead of I8 to simulate A8 on gen2

2014-08-15 Thread Ville Syrjälä
On Fri, Aug 15, 2014 at 10:52:50AM +0200, Erik Faye-Lund wrote:
 On Thu, Aug 7, 2014 at 10:31 AM,  ville.syrj...@linux.intel.com wrote:
  diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
  index c61a748..f414ea3 100644
  --- a/src/mesa/main/texformat.c
  +++ b/src/mesa/main/texformat.c
  case GL_ALPHA12:
  case GL_ALPHA16:
 RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16);
 RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
  +  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
 break;
 
 I know this isn't exactly what your patch looked to support, but
 shouldn't MESA_FORMAT_L16A16_UNORM be tried as a lossless alternative
 also?

I suppose, but I suspect you'll have a hard time finding hardware that
supports L16A16 but not A16.

-- 
Ville Syrjälä
Intel OTC
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/9] i915: Use L8A8 instead of I8 to simulate A8 on gen2

2014-08-15 Thread Erik Faye-Lund
On Fri, Aug 15, 2014 at 11:57 AM, Ville Syrjälä
ville.syrj...@linux.intel.com wrote:
 On Fri, Aug 15, 2014 at 10:52:50AM +0200, Erik Faye-Lund wrote:
 On Thu, Aug 7, 2014 at 10:31 AM,  ville.syrj...@linux.intel.com wrote:
  diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
  index c61a748..f414ea3 100644
  --- a/src/mesa/main/texformat.c
  +++ b/src/mesa/main/texformat.c
  case GL_ALPHA12:
  case GL_ALPHA16:
 RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16);
 RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
  +  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
 break;

 I know this isn't exactly what your patch looked to support, but
 shouldn't MESA_FORMAT_L16A16_UNORM be tried as a lossless alternative
 also?

 I suppose, but I suspect you'll have a hard time finding hardware that
 supports L16A16 but not A16.

Fair point.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 3/9] i915: Use L8A8 instead of I8 to simulate A8 on gen2

2014-08-07 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Gen2 doesn't support the A8 texture format. Currently the driver
substitutes it with I8, but that results in incorrect RGB values.
Use A8L8 instead. We end up wasting a bit of memory, but at least
we should get the correct results.

v2: Handle the fallback in _mesa_choose_tex_format() and also
do it for all alpha formats that currently accept A8

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72819
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80050
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38873
Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 src/mesa/drivers/dri/i915/i830_texstate.c | 2 --
 src/mesa/drivers/dri/i915/i915_context.c  | 3 ++-
 src/mesa/main/texformat.c | 3 +++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c 
b/src/mesa/drivers/dri/i915/i830_texstate.c
index 58d3356..b1414c7 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -47,8 +47,6 @@ translate_texture_format(GLuint mesa_format)
   return MAPSURF_8BIT | MT_8BIT_L8;
case MESA_FORMAT_I_UNORM8:
   return MAPSURF_8BIT | MT_8BIT_I8;
-   case MESA_FORMAT_A_UNORM8:
-  return MAPSURF_8BIT | MT_8BIT_I8; /* Kludge! */
case MESA_FORMAT_L8A8_UNORM:
   return MAPSURF_16BIT | MT_16BIT_AY88;
case MESA_FORMAT_B5G6R5_UNORM:
diff --git a/src/mesa/drivers/dri/i915/i915_context.c 
b/src/mesa/drivers/dri/i915/i915_context.c
index 7f43896..3fd571d 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -109,7 +109,8 @@ intel_init_texture_formats(struct gl_context *ctx)
ctx-TextureFormatSupported[MESA_FORMAT_B5G5R5A1_UNORM] = true;
ctx-TextureFormatSupported[MESA_FORMAT_B5G6R5_UNORM] = true;
ctx-TextureFormatSupported[MESA_FORMAT_L_UNORM8] = true;
-   ctx-TextureFormatSupported[MESA_FORMAT_A_UNORM8] = true;
+   if (intel-gen == 3)
+  ctx-TextureFormatSupported[MESA_FORMAT_A_UNORM8] = true;
ctx-TextureFormatSupported[MESA_FORMAT_I_UNORM8] = true;
ctx-TextureFormatSupported[MESA_FORMAT_L8A8_UNORM] = true;
 
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index c61a748..f414ea3 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -155,12 +155,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum 
target,
case GL_ALPHA4:
case GL_ALPHA8:
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
+  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
   break;
 
case GL_ALPHA12:
case GL_ALPHA16:
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16);
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
+  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
   break;
 
/* Luminance formats */
@@ -224,6 +226,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum 
target,
 
case GL_COMPRESSED_ALPHA_ARB:
   RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8);
+  RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
   break;
case GL_COMPRESSED_LUMINANCE_ARB:
   RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8);
-- 
1.8.5.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/9] i915: Use L8A8 instead of I8 to simulate A8 on gen2

2014-08-07 Thread Eric Anholt
ville.syrj...@linux.intel.com writes:

 From: Ville Syrjälä ville.syrj...@linux.intel.com

 Gen2 doesn't support the A8 texture format. Currently the driver
 substitutes it with I8, but that results in incorrect RGB values.
 Use A8L8 instead. We end up wasting a bit of memory, but at least
 we should get the correct results.

 v2: Handle the fallback in _mesa_choose_tex_format() and also
 do it for all alpha formats that currently accept A8

Reviewed-by: Eric Anholt e...@anholt.net


pgp_XSal5Kybr.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev