Re: [Mesa-dev] [PATCH 7/7] i965/blorp: Allow format conversions.

2013-10-08 Thread Ian Romanick
On 10/07/2013 04:31 PM, Kenneth Graunke wrote:
 BLORP performs blits by drawing a rectangle with a shader that samples
 from the source texture, and writes color data to the destination.
 
 The sampler always returns 32-bit RGBA float data, regardless of the
 source format's component ordering or data type.  Likewise, the render
 target write message takes 32-bit RGBA float data, and converts it
 appropriately.  So the bulk of the work is already taken care of for us.
 
 This greatly accelerates a lot of blits and CopyTexSubImage calls, and
 makes Legends of Aethereus playable on Ivybridge.  At the default
 settings, LOA continually blits between SRGBA (the window format)
 and RGBA16_FLOAT.  Since neither BLORP nor our BLT paths supported this,
 it fell back to meta, spending 33% of the CPU in floorf() converting
 between floats and half-floats.
 
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 15 ++-
  1 file changed, 14 insertions(+), 1 deletion(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp 
 b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
 index 2427085..c44f7c4 100644
 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
 @@ -353,10 +353,23 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
 if (brw-gen  6)
return false;
  
 -   if (!color_formats_match(src_mt-format, dst_mt-format)) {
 +   if (_mesa_get_format_base_format(src_mt-format) !=
 +   _mesa_get_format_base_format(dst_mt-format)) {
return false;
 }
  
 +   /* We can't handle format conversions between Z24 and other formats since
 +* we have to lie about the surface format.  See the comments in
 +* brw_blorp_surface_info::set().
 +*/
 +   if ((src_mt-format == MESA_FORMAT_X8_Z24) ^
 +   (dst_mt-format == MESA_FORMAT_X8_Z24)) {

You can use != instead of ^ here.

 +  return false;
 +   }
 +
 +   if (!brw-format_supported_as_render_target[dst_mt-format])
 +  return false;
 +
 /* Source clipping shouldn't be necessary, since copytexsubimage (in
  * src/mesa/main/teximage.c) calls _mesa_clip_copytexsubimage() which
  * takes care of it.
 

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


Re: [Mesa-dev] [PATCH 7/7] i965/blorp: Allow format conversions.

2013-10-08 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:

 BLORP performs blits by drawing a rectangle with a shader that samples
 from the source texture, and writes color data to the destination.

 The sampler always returns 32-bit RGBA float data, regardless of the
 source format's component ordering or data type.  Likewise, the render
 target write message takes 32-bit RGBA float data, and converts it
 appropriately.  So the bulk of the work is already taken care of for us.

 This greatly accelerates a lot of blits and CopyTexSubImage calls, and
 makes Legends of Aethereus playable on Ivybridge.  At the default
 settings, LOA continually blits between SRGBA (the window format)
 and RGBA16_FLOAT.  Since neither BLORP nor our BLT paths supported this,
 it fell back to meta, spending 33% of the CPU in floorf() converting
 between floats and half-floats.

Does this actually accelerate blits other than CopyTexSubImage calls?
It looks like the old format equality checks are still in place for
BlitFramebuffer.

Other than the review provided by others, and possibly updating this
message, this series is:

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


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


Re: [Mesa-dev] [PATCH 7/7] i965/blorp: Allow format conversions.

2013-10-08 Thread Chad Versace

On 10/07/2013 04:31 PM, Kenneth Graunke wrote:

BLORP performs blits by drawing a rectangle with a shader that samples
from the source texture, and writes color data to the destination.

The sampler always returns 32-bit RGBA float data, regardless of the
source format's component ordering or data type.  Likewise, the render
target write message takes 32-bit RGBA float data, and converts it
appropriately.  So the bulk of the work is already taken care of for us.

This greatly accelerates a lot of blits and CopyTexSubImage calls, and
makes Legends of Aethereus playable on Ivybridge.  At the default
settings, LOA continually blits between SRGBA (the window format)
and RGBA16_FLOAT.  Since neither BLORP nor our BLT paths supported this,
it fell back to meta, spending 33% of the CPU in floorf() converting
between floats and half-floats.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
  src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 15 ++-
  1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 2427085..c44f7c4 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp





+   /* We can't handle format conversions between Z24 and other formats since

Please clarify the comment by inserting depth here-|

+* we have to lie about the surface format.  See the comments in
+* brw_blorp_surface_info::set().
+*/
+   if ((src_mt-format == MESA_FORMAT_X8_Z24) ^
+   (dst_mt-format == MESA_FORMAT_X8_Z24)) {
+  return false;
+   }


With Daniel's little fix, this series is
Reviewed-by: Chad Versace chad.vers...@linux.intel.com







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


Re: [Mesa-dev] [PATCH 7/7] i965/blorp: Allow format conversions.

2013-10-08 Thread Kenneth Graunke
On 10/08/2013 01:42 PM, Eric Anholt wrote:
 Kenneth Graunke kenn...@whitecape.org writes:
 
 BLORP performs blits by drawing a rectangle with a shader that samples
 from the source texture, and writes color data to the destination.

 The sampler always returns 32-bit RGBA float data, regardless of the
 source format's component ordering or data type.  Likewise, the render
 target write message takes 32-bit RGBA float data, and converts it
 appropriately.  So the bulk of the work is already taken care of for us.

 This greatly accelerates a lot of blits and CopyTexSubImage calls, and
 makes Legends of Aethereus playable on Ivybridge.  At the default
 settings, LOA continually blits between SRGBA (the window format)
 and RGBA16_FLOAT.  Since neither BLORP nor our BLT paths supported this,
 it fell back to meta, spending 33% of the CPU in floorf() converting
 between floats and half-floats.
 
 Does this actually accelerate blits other than CopyTexSubImage calls?
 It looks like the old format equality checks are still in place for
 BlitFramebuffer.

Oops!  You're right, this only affects CopyTexSubImage.  I've removed
of blits and from the above paragraph and renamed the patch to
i965/blorp: Allow format conversions for CopyTexSubImage.

I suppose we should actually relax the restrictions in BlitFramebuffer too.

Thanks for the review, Eric.

 Other than the review provided by others, and possibly updating this
 message, this series is:
 
 Reviewed-by: Eric Anholt e...@anholt.net

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