Re: [Mesa-dev] [PATCH 0/5] First batch of gm45 clipping/interpolation fixes

2012-07-14 Thread Olivier Galibert
On Fri, Jul 13, 2012 at 02:45:10PM -0700, Kenneth Graunke wrote:
> Sorry...been really busy, and most of us haven't actually spent much if
> any time in the clipper shaders.  I'll try and review it within a week.

Ok cool, lack of time is something I completely understand :-)


> Despite the lack of response, I am really excited to see that you're
> working on this---this is a huge step toward bringing GL 3.x back to
> Gen4/5, and we're all really glad to see it happen!

Excellent.  I was starting to wonder if gen4/5 was abandoned (by lack
of resources if anything), nice to see it isn't.

  OG.

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


[Mesa-dev] [Bug 51960] [bisected] Mesa master fails to build

2012-07-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=51960

Pavel Ondračka  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |

--- Comment #2 from Pavel Ondračka  2012-07-14 
10:07:00 PDT ---
(In reply to comment #1)
> Looks like you just have an invalid .o file in your repo.  Try make clean and
> make again.

Actually it doesn't help, sorry for not mentioning this earlier. I did try make
clean, make distclean, git clean -fdx, git reset --hard, none of this helps.
Only reverting the mentioned commit helps.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] r600g: add htile support v8

2012-07-14 Thread Marek Olšák
On Sat, Jul 14, 2012 at 2:20 AM, Jerome Glisse  wrote:
> On Fri, Jul 13, 2012 at 8:02 PM, Marek Olšák  wrote:
>> Hi Jerome,
>>
>> I have a lot of remarks.
>>
>> 1) The DB decompression fix (where you update DB_RENDER_CONTROL) could
>> be in a separate patch.
>>
>> 2) The fix with EARLY_Z_THEN_LATE_Z (in update_dual_export) could also
>> be in a separate patch.
>
>> 3) r600_context::use_hyperz is set to FALSE by default, why? If the
>> fast clear works and there are no piglit regressions, then please
>> enable it. If the fast clear doesn't work reliably, please put it in a
>> branch. Merging non-working code on purpose is a very bad idea.
>
> Again it does work, but it has a non null probability to lockup gpu,
> probability depends on the gpu and application, but it can be quite
> high. So again code works but given it leads to lockup i dont want it
> to enable it by default. And I do intend to merge this.

Fine. I guess it won't hurt much to have it in master.

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


Re: [Mesa-dev] r600g: hyperz

2012-07-14 Thread Alex Deucher
On Fri, Jul 13, 2012 at 8:11 PM, Jerome Glisse  wrote:
> On Fri, Jul 13, 2012 at 8:08 PM, Marek Olšák  wrote:
>> Hi Jerome,
>>
>> I couldn't open the patch, because freedesktop.org doesn't seem to
>> work for me today, it always times out.
>>
>> Anyway, non-working code shouldn't be merged into Mesa master, because
>> it decreases the quality of the driver and is a pain to maintain. As
>> as I said in another email, merging non-working code on purpose is a
>> very bad idea. Please don't do it.
>>
>> Marek
>
> Code works, no regression, but if you enable hyperz get ready to
> experience lockup, likelyhood depends on what you are doing.
>
> So no i don't consider this a non working code. It does work and
> doesn't regress.

Is it just 6xx/7xx that locks or also evergreen?  Also even if we
don't turn on hyperz, it probably makes sense to always have an htile
buffer bound as the htile cache (and backing htile buffer) is used for
Z/S compression, culling, fast ops, etc. in addition to HiZ/S if a Z
or S buffer is bound.

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


[Mesa-dev] [Bug 50593] Account request

2012-07-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=50593

--- Comment #3 from vincent  2012-07-14 16:21:38 PDT ---
Hi,

I'd like this account to work on a glsl-to-llvm converter, and on r600 llvm
backend.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] r600g: hyperz

2012-07-14 Thread Jerome Glisse
On Sat, Jul 14, 2012 at 9:56 AM, Alex Deucher  wrote:
> On Fri, Jul 13, 2012 at 8:11 PM, Jerome Glisse  wrote:
>> On Fri, Jul 13, 2012 at 8:08 PM, Marek Olšák  wrote:
>>> Hi Jerome,
>>>
>>> I couldn't open the patch, because freedesktop.org doesn't seem to
>>> work for me today, it always times out.
>>>
>>> Anyway, non-working code shouldn't be merged into Mesa master, because
>>> it decreases the quality of the driver and is a pain to maintain. As
>>> as I said in another email, merging non-working code on purpose is a
>>> very bad idea. Please don't do it.
>>>
>>> Marek
>>
>> Code works, no regression, but if you enable hyperz get ready to
>> experience lockup, likelyhood depends on what you are doing.
>>
>> So no i don't consider this a non working code. It does work and
>> doesn't regress.
>
> Is it just 6xx/7xx that locks or also evergreen?  Also even if we
> don't turn on hyperz, it probably makes sense to always have an htile
> buffer bound as the htile cache (and backing htile buffer) is used for
> Z/S compression, culling, fast ops, etc. in addition to HiZ/S if a Z
> or S buffer is bound.
>
> Alex

Just enabling htile surface is enough to trigger the lockup, thus we
can't bind the htile buffer. Quite frankly i don't know how much
evergreen is an issue, i pretty much stuck with r6xx/r7xx as they were
always locking up with my test case. Thought i have been able to
lockup evergreen but i did have the feeling that it was lot less
likely to happen.

Basicly to trigger the lockup you have to switch btw a lot of depth
surface/htile surface, if you just have a single depth buffer you will
be fine. Thus most use case will just work properly.

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


Re: [Mesa-dev] [PATCH] r600g: add htile support v8

2012-07-14 Thread Dave Airlie
On Sat, Jul 14, 2012 at 10:20 PM, Marek Olšák  wrote:
> On Sat, Jul 14, 2012 at 2:20 AM, Jerome Glisse  wrote:
>> On Fri, Jul 13, 2012 at 8:02 PM, Marek Olšák  wrote:
>>> Hi Jerome,
>>>
>>> I have a lot of remarks.
>>>
>>> 1) The DB decompression fix (where you update DB_RENDER_CONTROL) could
>>> be in a separate patch.
>>>
>>> 2) The fix with EARLY_Z_THEN_LATE_Z (in update_dual_export) could also
>>> be in a separate patch.
>>
>>> 3) r600_context::use_hyperz is set to FALSE by default, why? If the
>>> fast clear works and there are no piglit regressions, then please
>>> enable it. If the fast clear doesn't work reliably, please put it in a
>>> branch. Merging non-working code on purpose is a very bad idea.
>>
>> Again it does work, but it has a non null probability to lockup gpu,
>> probability depends on the gpu and application, but it can be quite
>> high. So again code works but given it leads to lockup i dont want it
>> to enable it by default. And I do intend to merge this.
>
> Fine. I guess it won't hurt much to have it in master.

I'd like to see this merged, but yeah, like Marek said split out some
of the fixes from the rest of the big patch.

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


Re: [Mesa-dev] [PATCH 2/2] mesa/st: Generates TGSI that always recognizes INSTANCEID/VERTEXID as integers.

2012-07-14 Thread Stéphane Marchesin
On Fri, Jul 13, 2012 at 5:03 AM, Jose Fonseca  wrote:
> - Original Message -
>> On Thu, Jul 12, 2012 at 08:50:13PM +0100, jfons...@vmware.com wrote:
>> > From: José Fonseca 
>> >
>> > Tested by running piglit draw-instanced, and by forcing llvmpipe
>> > advertise no native
>> > integer support, which now produces:
>>
>> Looks like a very good solution to me.  Did you check
>> draw-non-instanced too?  51366 is a variant of the same issue.
>
> I got a bogus assertion failure because TGSI_PROCESSOR_VERTEX != 
> PIPE_SHADER_VERTEX, but after fixing that draw-non-instanced works fine.
>
> I've pushed the patches now. If there are any further issues let me know.
>
> Jose

Hi José,

I just tested it, and these two patches fix the issue with i915g.
Thanks a bunch!

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


[Mesa-dev] [Bug 52098] New: [llvmpipe] piglit glsl-mat-from-int-ctor-03.shader_test regression

2012-07-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52098

 Bug #: 52098
   Summary: [llvmpipe] piglit
glsl-mat-from-int-ctor-03.shader_test regression
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: v...@freedesktop.org
CC: jfons...@vmware.com


mesa; e3ff4d4c10e038b7be6dffe6c12b015ef36b5e7c (master)

Run piglit glsl-mat-from-int-ctor-03 on llvmpipe.

$ ./bin/shader_runner tests/shaders/glsl-mat-from-int-ctor-03.shader_test -auto
Probe at (15,15)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 0.00
PIGLIT: {'result': 'fail' }


6184803da5f67f69e7c243dbb596b4dd4b9d is the first bad commit
commit 6184803da5f67f69e7c243dbb596b4dd4b9d
Author: José Fonseca 
Date:   Thu Jul 12 20:47:20 2012 +0100

draw,gallivm: Fix draw_get_shader_param.

- Use LLVM limits when LLVM is being used, instead of TGSI limits
- Provide draw_get_shader_param_no_llvm for when llvm is never used
(softpipe)
- Eliminate several of the hacks around draw shader caps in several drivers

Unfortunately the hack for PIPE_MAX_VERTEX_SAMPLERS is still necessary.

Reviewed-by: Marek Olšák 

:04 04 ebd886997769f8fe08cb8216eecdfcaab6cc0dae
a927e4d7adf900b14189e76e603ca28659d429ee Msrc
bisect run success

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] src/glsl/Makefile.am: Fix for automake-1.12 C++ yacc header file naming change (v2)

2012-07-14 Thread Jon TURNEY
Commit 68e04cc6 was tested using automake-1.11.  Unfortunately, automake-1.12
made a "slightly backward-incompatible change" in the use of yacc with C++, and
for a .yy file, the generated header file is now .hh, not .h

To work with both, write our own rule for running yacc, which generates a
header file named .h, rather than using automake's rule.

Also, remove things from BUILD_SOURCES which don't need to be there

Also, update EXCLUDE rules in doxygen/glsl.doxy, for change of generated files
from .cpp -> .cc, and glsl_lexer.h has never existed.

Signed-off-by: Jon TURNEY 
---
 doxygen/glsl.doxy|5 ++---
 src/glsl/Makefile.am |   14 ++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/doxygen/glsl.doxy b/doxygen/glsl.doxy
index 5411ec4..aa907ae 100644
--- a/doxygen/glsl.doxy
+++ b/doxygen/glsl.doxy
@@ -11,9 +11,8 @@ PROJECT_NAME   = "Mesa GLSL module"
 #---
 INPUT  = ../src/glsl/
 RECURSIVE  = NO
-EXCLUDE= ../src/glsl/glsl_lexer.cpp \
- ../src/glsl/glsl_lexer.h \
- ../src/glsl/glsl_parser.cpp \
+EXCLUDE= ../src/glsl/glsl_lexer.cc \
+ ../src/glsl/glsl_parser.cc \
  ../src/glsl/glsl_parser.h
 EXCLUDE_PATTERNS   =
 #---
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 2b9ca2c..d86153c 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -37,7 +37,6 @@ AM_CFLAGS = \
 
 AM_CXXFLAGS = $(AM_CFLAGS)
 
-AM_YFLAGS = -v -d -p "_mesa_glsl_"
 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 
 GLSL_SRCDIR=$(top_srcdir)/src/glsl
@@ -49,7 +48,7 @@ noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler
 # common sources for builtin_compiler and libglsl
 libglslcommon_la_SOURCES = \
glsl_lexer.ll \
-   glsl_parser.yy \
+   glsl_parser.cc \
$(LIBGLSL_FILES) \
$(LIBGLSL_CXX_FILES)
 
@@ -87,8 +86,15 @@ builtin_compiler_SOURCES = \
 
 builtin_compiler_LDADD = libglslcommon.la
 
-BUILT_SOURCES = glsl_lexer.cc glsl_parser.cc glsl_parser.h builtin_function.cpp
-CLEANFILES = $(BUILT_SOURCES)
+# automake <=1.11 and automake >=1.12 have different conventions for naming 
C++ header files
+# made by yacc.  To work with both, we write our own rule rather than using 
automake's.
+# When (if) we require automake >=1.12 in configure.ac, this can be removed, 
and we can use
+# the automake rule.
+glsl_parser.cc glsl_parser.h: glsl_parser.yy
+   $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" 
--defines=glsl_parser.h $<
+
+BUILT_SOURCES = glsl_parser.h builtin_function.cpp
+CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
 
 builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* 
builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py 
builtin_compiler$(EXEEXT)
$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) 
builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp 
|| rm -f builtin_function.cpp
-- 
1.7.9

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


Re: [Mesa-dev] [PATCH] r600g: add htile support v8

2012-07-14 Thread Marek Olšák
FYI, I have pushed your DB decompression fix, because my
not-yet-published work depends on it.

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


[Mesa-dev] [PATCH 00/13] R600 improvements

2012-07-14 Thread Marek Olšák
This series fixes 20 depth-stencil piglit tests on evergreen and enables 
ARB_blend_func_extended also on evergreen, so that evergreen support is on par 
with r700 in those areas. There's also a bunch of sampler view fixes and a 
couple of small optimization. Last but not least, samplers views are reworked 
to use r600_atom, which simplifies the code a bit.

For some reason, stencil texturing doesn't work on evergreen if I set the 
RADEON_SURF_SBUFFER flag with the stencil-only format S8_UINT. This looks like 
a bug in the surface allocator in libdrm. The workaround used here is not to 
set the flag.

Marek Olšák (13):
  r600g: fix all failing depth-stencil tests for evergreen
  gallium/util: add util_bit_last - finds the last bit set in a word
  r600g: don't call inval_shader_cache in r600_context_flush twice
  r600g: do fine-grained vertex buffer updates
  r600g: remove unused flag have_depth_fb
  r600g: consolidate code for setting sampler views and fix bugs in the 
process
  r600g: don't invalidate texture caches when setting sampler states
  r600g: consolidate and optimize sampler states changes for evergreen
  r600g: properly track which textures are depth
  r600g: only make constant buffers dirty if there's something to update
  r600g: convert sampler view emission into atoms
  r600g: remove unused code after conversion of sampler views
  r600g: fix lockups with and enable dual source blending on evergreen

 src/gallium/auxiliary/util/u_math.h |   14 ++
 src/gallium/drivers/r600/evergreen_compute.c|   12 +-
 src/gallium/drivers/r600/evergreen_hw_context.c |   27 ---
 src/gallium/drivers/r600/evergreen_state.c  |  236 +++
 src/gallium/drivers/r600/r600.h |   11 --
 src/gallium/drivers/r600/r600_blit.c|   28 ++-
 src/gallium/drivers/r600/r600_buffer.c  |   15 +-
 src/gallium/drivers/r600/r600_hw_context.c  |  216 ++---
 src/gallium/drivers/r600/r600_hw_context_priv.h |3 -
 src/gallium/drivers/r600/r600_pipe.c|5 +-
 src/gallium/drivers/r600/r600_pipe.h|   54 --
 src/gallium/drivers/r600/r600_resource.h|3 +-
 src/gallium/drivers/r600/r600_state.c   |  219 ++---
 src/gallium/drivers/r600/r600_state_common.c|  149 --
 src/gallium/drivers/r600/r600_texture.c |   27 ++-
 15 files changed, 452 insertions(+), 567 deletions(-)

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


[Mesa-dev] [PATCH 02/13] gallium/util: add util_bit_last - finds the last bit set in a word

2012-07-14 Thread Marek Olšák
---
 src/gallium/auxiliary/util/u_math.h |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index f35c35f..90b421e 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -477,6 +477,20 @@ unsigned ffs( unsigned u )
 
 #endif /* FFS_DEFINED */
 
+/**
+ * Find last bit set in a word.  The least significant bit is 1.
+ * Return 0 if no bits are set.
+ */
+static INLINE unsigned util_last_bit(unsigned u)
+{
+   unsigned r = 0;
+   while (u) {
+   r++;
+   u >>= 1;
+   }
+   return r;
+}
+
 
 /* Destructively loop over all of the bits in a mask as in:
  *
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 01/13] r600g: fix all failing depth-stencil tests for evergreen

2012-07-14 Thread Marek Olšák
---
 src/gallium/drivers/r600/evergreen_state.c |2 +-
 src/gallium/drivers/r600/r600_resource.h   |3 ++-
 src/gallium/drivers/r600/r600_texture.c|   27 +++
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index a66387b..0d2fa30 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1664,7 +1664,7 @@ static void evergreen_db(struct r600_context *rctx, 
struct r600_pipe_state *rsta
offset, &rtex->resource,
RADEON_USAGE_READWRITE);
r600_pipe_state_add_reg_bo(rstate, 
R_028044_DB_STENCIL_INFO,
-   0, NULL, 
RADEON_USAGE_READWRITE);
+   1, NULL, 
RADEON_USAGE_READWRITE);
}
}
 
diff --git a/src/gallium/drivers/r600/r600_resource.h 
b/src/gallium/drivers/r600/r600_resource.h
index a7570c7..0046ce7 100644
--- a/src/gallium/drivers/r600/r600_resource.h
+++ b/src/gallium/drivers/r600/r600_resource.h
@@ -26,7 +26,8 @@
 #include "r600.h"
 
 /* flag to indicate a resource is to be used as a transfer so should not be 
tiled */
-#define R600_RESOURCE_FLAG_TRANSFER PIPE_RESOURCE_FLAG_DRV_PRIV
+#define R600_RESOURCE_FLAG_TRANSFERPIPE_RESOURCE_FLAG_DRV_PRIV
+#define R600_RESOURCE_FLAG_FLUSHED_DEPTH   (PIPE_RESOURCE_FLAG_DRV_PRIV << 
1)
 
 struct r600_transfer {
struct pipe_transfertransfer;
diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index d16c252..cbb9e5a 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -234,8 +234,16 @@ static void r600_texture_set_array_mode(struct pipe_screen 
*screen,
 
 static int r600_init_surface(struct radeon_surface *surface,
 const struct pipe_resource *ptex,
-unsigned array_mode, bool is_transfer)
+unsigned array_mode,
+bool is_transfer, bool is_flushed_depth)
 {
+   const struct util_format_description *desc =
+   util_format_description(ptex->format);
+   bool is_depth, is_stencil;
+
+   is_depth = util_format_has_depth(desc);
+   is_stencil = util_format_has_stencil(desc);
+
surface->npix_x = ptex->width0;
surface->npix_y = ptex->height0;
surface->npix_z = ptex->depth0;
@@ -295,12 +303,14 @@ static int r600_init_surface(struct radeon_surface 
*surface,
if (ptex->bind & PIPE_BIND_SCANOUT) {
surface->flags |= RADEON_SURF_SCANOUT;
}
-   if ((ptex->bind & PIPE_BIND_DEPTH_STENCIL) &&
-   util_format_is_depth_and_stencil(ptex->format) && 
!is_transfer) {
+
+   if (!is_transfer && !is_flushed_depth && is_depth) {
surface->flags |= RADEON_SURF_ZBUFFER;
-   surface->flags |= RADEON_SURF_SBUFFER;
-   }
 
+   if (is_stencil) {
+   surface->flags |= RADEON_SURF_SBUFFER;
+   }
+   }
return 0;
 }
 
@@ -638,7 +648,8 @@ struct pipe_resource *r600_texture_create(struct 
pipe_screen *screen,
}
 
r = r600_init_surface(&surface, templ, array_mode,
- templ->flags & R600_RESOURCE_FLAG_TRANSFER);
+ templ->flags & R600_RESOURCE_FLAG_TRANSFER,
+ templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH);
if (r) {
return NULL;
}
@@ -719,7 +730,7 @@ struct pipe_resource *r600_texture_from_handle(struct 
pipe_screen *screen,
else
array_mode = 0;
 
-   r = r600_init_surface(&surface, templ, array_mode, 0);
+   r = r600_init_surface(&surface, templ, array_mode, false, false);
if (r) {
return NULL;
}
@@ -749,7 +760,7 @@ void r600_init_flushed_depth_texture(struct pipe_context 
*ctx,
resource.nr_samples = texture->nr_samples;
resource.usage = staging ? PIPE_USAGE_DYNAMIC : PIPE_USAGE_DEFAULT;
resource.bind = texture->bind & ~PIPE_BIND_DEPTH_STENCIL;
-   resource.flags = texture->flags;
+   resource.flags = texture->flags | R600_RESOURCE_FLAG_FLUSHED_DEPTH;
 
if (staging)
resource.flags |= R600_RESOURCE_FLAG_TRANSFER;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 03/13] r600g: don't call inval_shader_cache in r600_context_flush twice

2012-07-14 Thread Marek Olšák
It's already called in r600_constant_buffers_dirty.
---
 src/gallium/drivers/r600/r600_hw_context.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
b/src/gallium/drivers/r600/r600_hw_context.c
index e80f39c..2951b86 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -1276,7 +1276,6 @@ void r600_context_flush(struct r600_context *ctx, 
unsigned flags)
/* Invalidate caches. */
r600_inval_vertex_cache(ctx);
r600_inval_texture_cache(ctx);
-   r600_inval_shader_cache(ctx);
r600_flush_framebuffer(ctx, false);
 
/* Re-emit states. */
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 04/13] r600g: do fine-grained vertex buffer updates

2012-07-14 Thread Marek Olšák
If only some buffers are changed, the other ones don't have to re-emitted.
This uses bitmasks of enabled and dirty buffers just like
emit_constant_buffers does.
---
 src/gallium/drivers/r600/evergreen_compute.c |   12 +++---
 src/gallium/drivers/r600/evergreen_state.c   |   23 +++
 src/gallium/drivers/r600/r600_blit.c |4 +-
 src/gallium/drivers/r600/r600_buffer.c   |   15 ---
 src/gallium/drivers/r600/r600_hw_context.c   |5 ++-
 src/gallium/drivers/r600/r600_pipe.h |   12 +++---
 src/gallium/drivers/r600/r600_state.c|   23 ++-
 src/gallium/drivers/r600/r600_state_common.c |   56 +-
 8 files changed, 87 insertions(+), 63 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
b/src/gallium/drivers/r600/evergreen_compute.c
index 947a328..caaa752 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -89,14 +89,15 @@ static void evergreen_cs_set_vertex_buffer(
unsigned offset,
struct pipe_resource * buffer)
 {
-   struct pipe_vertex_buffer *vb = &rctx->cs_vertex_buffer[vb_index];
-   struct r600_vertexbuf_state * state = &rctx->cs_vertex_buffer_state;
+   struct r600_vertexbuf_state *state = &rctx->cs_vertex_buffer_state;
+   struct pipe_vertex_buffer *vb = &state->vb[vb_index];
vb->stride = 1;
vb->buffer_offset = offset;
vb->buffer = buffer;
vb->user_buffer = NULL;
 
r600_inval_vertex_cache(rctx);
+   state->enabled_mask |= 1 << vb_index;
state->dirty_mask |= 1 << vb_index;
r600_atom_dirty(rctx, &state->atom);
 }
@@ -369,7 +370,7 @@ static void compute_emit_cs(struct r600_context *ctx)
r600_context_pipe_state_emit(ctx, cb_state, 
RADEON_CP_PACKET3_COMPUTE_MODE);
 
/* Emit vertex buffer state */
-   ctx->cs_vertex_buffer_state.atom.num_dw = 12 * 
ctx->nr_cs_vertex_buffers;
+   ctx->cs_vertex_buffer_state.atom.num_dw = 12 * 
util_bitcount(ctx->cs_vertex_buffer_state.dirty_mask);
r600_emit_atom(ctx, &ctx->cs_vertex_buffer_state.atom);
 
for (i = 0; i < get_compute_resource_num(); i++) {
@@ -493,10 +494,8 @@ static void evergreen_set_compute_resources(struct 
pipe_context * ctx_,
evergreen_cs_set_vertex_buffer(ctx, vtx_id,
buffer->chunk->start_in_dw * 4,
resources[i]->base.texture);
-   ctx->nr_cs_vertex_buffers = vtx_id + 1;
}
}
-
 }
 
 static void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
@@ -740,7 +739,8 @@ void evergreen_init_compute_state_functions(struct 
r600_context *ctx)
 
/* We always use at least two vertex buffers for compute, one for
  * parameters and one for global memory */
-   ctx->nr_cs_vertex_buffers = 2;
+   ctx->cs_vertex_buffer_state.enabled_mask =
+   ctx->cs_vertex_buffer_state.dirty_mask = 1 | 2;
 }
 
 
diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 0d2fa30..72ddc0b 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1772,8 +1772,6 @@ static void evergreen_emit_db_misc_state(struct 
r600_context *rctx, struct r600_
 
 static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
  struct r600_vertexbuf_state *state,
- struct pipe_vertex_buffer 
*vertex_buffers,
- unsigned vb_count,
  unsigned resource_offset,
  unsigned pkt_flags)
 {
@@ -1784,13 +1782,11 @@ static void evergreen_emit_vertex_buffers(struct 
r600_context *rctx,
struct pipe_vertex_buffer *vb;
struct r600_resource *rbuffer;
uint64_t va;
-   unsigned buffer_index = ffs(dirty_mask) - 1;
+   unsigned buffer_index = u_bit_scan(&dirty_mask);
 
-   vb = &vertex_buffers[buffer_index];
+   vb = &state->vb[buffer_index];
rbuffer = (struct r600_resource*)vb->buffer;
-   if (!rbuffer) {
-   goto next;
-   }
+   assert(rbuffer);
 
va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
va += vb->buffer_offset;
@@ -1816,26 +1812,19 @@ static void evergreen_emit_vertex_buffers(struct 
r600_context *rctx,
 
r600_write_value(cs, PKT3(PKT3_NOP, 0, 0) | pkt_flags);
r600_write_value(cs, r600_context_bo_reloc(rctx, rbuffer, 
RADEON_USAGE_READ));
-
-next:
-   dirty_mask &= ~(1 << buffer_index);
}
state->dirty_mask = 0;
 }
 
 static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx, str

[Mesa-dev] [PATCH 05/13] r600g: remove unused flag have_depth_fb

2012-07-14 Thread Marek Olšák
This is a leftover from:

commit fe1fd675565231b49d3ac53d0b4bec39d8bc6781
Author: Marek Olšák 
Date:   Sun Jul 8 03:10:37 2012 +0200

r600g: don't flush depth textures set as colorbuffers
---
 src/gallium/drivers/r600/evergreen_state.c   |4 
 src/gallium/drivers/r600/r600_pipe.h |2 +-
 src/gallium/drivers/r600/r600_state.c|4 
 src/gallium/drivers/r600/r600_state_common.c |3 ++-
 4 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 72ddc0b..ad0eb2f 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1315,9 +1315,6 @@ void evergreen_cb(struct r600_context *rctx, struct 
r600_pipe_state *rstate,
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
pipe_tex = state->cbufs[cb]->texture;
 
-   if (rtex->is_depth)
-   rctx->have_depth_fb = TRUE;
-
if (rtex->is_depth && !rtex->is_flushing_texture) {
r600_init_flushed_depth_texture(&rctx->context,
state->cbufs[cb]->texture, NULL);
@@ -1695,7 +1692,6 @@ static void evergreen_set_framebuffer_state(struct 
pipe_context *ctx,
util_copy_framebuffer_state(&rctx->framebuffer, state);
 
/* build states */
-   rctx->have_depth_fb = 0;
rctx->export_16bpc = true;
rctx->nr_cbufs = state->nr_cbufs;
for (i = 0; i < state->nr_cbufs; i++) {
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 200f0a2..4688b62 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -329,7 +329,7 @@ struct r600_context {
 
struct u_upload_mgr *uploader;
struct util_slab_mempoolpool_transfers;
-   boolean have_depth_texture, have_depth_fb;
+   boolean have_depth_texture;
 
unsigned default_ps_gprs, default_vs_gprs;
 
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index 4f475b3..0091fe7 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1395,9 +1395,6 @@ static void r600_cb(struct r600_context *rctx, struct 
r600_pipe_state *rstate,
surf = (struct r600_surface *)state->cbufs[cb];
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
 
-   if (rtex->is_depth)
-   rctx->have_depth_fb = TRUE;
-
if (rtex->is_depth && !rtex->is_flushing_texture) {
rtex = rtex->flushed_depth_texture;
}
@@ -1662,7 +1659,6 @@ static void r600_set_framebuffer_state(struct 
pipe_context *ctx,
util_copy_framebuffer_state(&rctx->framebuffer, state);
 
/* build states */
-   rctx->have_depth_fb = 0;
rctx->export_16bpc = true;
rctx->nr_cbufs = state->nr_cbufs;
 
diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index 4fa2699..84c7d5e 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -845,8 +845,9 @@ static void r600_update_derived_state(struct r600_context 
*rctx)
unsigned ps_dirty = 0;
 
if (!rctx->blitter->running) {
-   if (rctx->have_depth_fb || rctx->have_depth_texture)
+   if (rctx->have_depth_texture) {
r600_flush_all_depth_textures(rctx);
+   }
}
 
if (rctx->chip_class < EVERGREEN) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 06/13] r600g: consolidate code for setting sampler views and fix bugs in the process

2012-07-14 Thread Marek Olšák
Issues fixed:

- set_vs_sampler_views for evergreen is now properly implemented.

- Added the missing inval_texture_cache call for evergreen.

- have_depth_texture was sometimes incorrectly set to false on evergreen even
  if there were depth textures in other shader stages. To fix this, set it
  to true once and never set it to false again. It's stupid, but it matches
  the r600 code. The proper fix is left to another patch.

- Optimizaton: The sampler views which aren't changed aren't updated.
---
 src/gallium/drivers/r600/evergreen_state.c   |   58 +-
 src/gallium/drivers/r600/r600_pipe.h |5 +++
 src/gallium/drivers/r600/r600_state.c|   42 ---
 src/gallium/drivers/r600/r600_state_common.c |   47 +
 4 files changed, 62 insertions(+), 90 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index ad0eb2f..5885aec 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1099,58 +1099,20 @@ static struct pipe_sampler_view 
*evergreen_create_sampler_view(struct pipe_conte
return &view->base;
 }
 
-static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned 
count,
-   struct pipe_sampler_view **views)
+static void evergreen_set_vs_sampler_views(struct pipe_context *ctx, unsigned 
count,
+  struct pipe_sampler_view **views)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
-   struct r600_pipe_sampler_view **resource = (struct 
r600_pipe_sampler_view **)views;
-
-   for (int i = 0; i < count; i++) {
-   if (resource[i]) {
-   r600_context_pipe_state_set_vs_resource(rctx, 
&resource[i]->state,
-   i + 
R600_MAX_CONST_BUFFERS);
-   }
-   }
+   r600_set_sampler_views(rctx, &rctx->vs_samplers, count, views,
+  r600_context_pipe_state_set_vs_resource);
 }
 
-static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned 
count,
-   struct pipe_sampler_view **views)
+static void evergreen_set_ps_sampler_views(struct pipe_context *ctx, unsigned 
count,
+  struct pipe_sampler_view **views)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
-   struct r600_pipe_sampler_view **resource = (struct 
r600_pipe_sampler_view **)views;
-   int i;
-   int has_depth = 0;
-
-   for (i = 0; i < count; i++) {
-   if (&rctx->ps_samplers.views[i]->base != views[i]) {
-   if (resource[i]) {
-   if (((struct r600_resource_texture 
*)resource[i]->base.texture)->is_depth)
-   has_depth = 1;
-   r600_context_pipe_state_set_ps_resource(rctx, 
&resource[i]->state,
-   i + 
R600_MAX_CONST_BUFFERS);
-   } else
-   r600_context_pipe_state_set_ps_resource(rctx, 
NULL,
-   i + 
R600_MAX_CONST_BUFFERS);
-
-   pipe_sampler_view_reference(
-   (struct pipe_sampler_view 
**)&rctx->ps_samplers.views[i],
-   views[i]);
-   } else {
-   if (resource[i]) {
-   if (((struct r600_resource_texture 
*)resource[i]->base.texture)->is_depth)
-   has_depth = 1;
-   }
-   }
-   }
-   for (i = count; i < NUM_TEX_UNITS; i++) {
-   if (rctx->ps_samplers.views[i]) {
-   r600_context_pipe_state_set_ps_resource(rctx, NULL,
-   i + 
R600_MAX_CONST_BUFFERS);
-   pipe_sampler_view_reference((struct pipe_sampler_view 
**)&rctx->ps_samplers.views[i], NULL);
-   }
-   }
-   rctx->have_depth_texture = has_depth;
-   rctx->ps_samplers.n_views = count;
+   r600_set_sampler_views(rctx, &rctx->ps_samplers, count, views,
+  r600_context_pipe_state_set_ps_resource);
 }
 
 static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned 
count, void **states)
@@ -1929,7 +1891,7 @@ void evergreen_init_state_functions(struct r600_context 
*rctx)
rctx->context.set_blend_color = r600_set_blend_color;
rctx->context.set_clip_state = evergreen_set_clip_state;
rctx->context.set_constant_buffer = r600_set_constant_buffer;
-   rctx->context.set_fragment_sampler_views = 
evergreen_set_ps_sampler_view;
+   r

[Mesa-dev] [PATCH 07/13] r600g: don't invalidate texture caches when setting sampler states

2012-07-14 Thread Marek Olšák
Changing sampler states doesn't change resource bindings.
---
 src/gallium/drivers/r600/evergreen_state.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 5885aec..11cd329 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1120,9 +1120,6 @@ static void evergreen_bind_ps_sampler(struct pipe_context 
*ctx, unsigned count,
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
 
-   if (count)
-   r600_inval_texture_cache(rctx);
-
memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
rctx->ps_samplers.n_samplers = count;
 
@@ -1136,9 +1133,6 @@ static void evergreen_bind_vs_sampler(struct pipe_context 
*ctx, unsigned count,
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
 
-   if (count)
-   r600_inval_texture_cache(rctx);
-
for (int i = 0; i < count; i++) {
evergreen_context_pipe_state_set_vs_sampler(rctx, rstates[i], 
i);
}
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 08/13] r600g: consolidate and optimize sampler states changes for evergreen

2012-07-14 Thread Marek Olšák
Only set sampler states which changed.
---
 src/gallium/drivers/r600/evergreen_state.c |   36 +---
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 11cd329..d4e9fae 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1115,27 +1115,35 @@ static void evergreen_set_ps_sampler_views(struct 
pipe_context *ctx, unsigned co
   r600_context_pipe_state_set_ps_resource);
 }
 
-static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned 
count, void **states)
+static void evergreen_bind_samplers(struct r600_context *rctx,
+   struct r600_textures_info *dst,
+   unsigned count, void **states,
+   void (*set_sampler)(struct r600_context 
*ctx, struct r600_pipe_state *state, unsigned id))
 {
-   struct r600_context *rctx = (struct r600_context *)ctx;
-   struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
-
-   memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
-   rctx->ps_samplers.n_samplers = count;
+   struct r600_pipe_sampler_state **rstates = (struct 
r600_pipe_sampler_state**)states;
 
for (int i = 0; i < count; i++) {
-   evergreen_context_pipe_state_set_ps_sampler(rctx, rstates[i], 
i);
+   if (rstates[i] != dst->samplers[i]) {
+   set_sampler(rctx, &rstates[i]->rstate, i);
+   }
}
+
+   memcpy(dst->samplers, states, sizeof(void*) * count);
+   dst->n_samplers = count;
 }
 
-static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned 
count, void **states)
+static void evergreen_bind_ps_samplers(struct pipe_context *ctx, unsigned 
count, void **states)
 {
struct r600_context *rctx = (struct r600_context *)ctx;
-   struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
+   evergreen_bind_samplers(rctx, &rctx->ps_samplers, count, states,
+   evergreen_context_pipe_state_set_ps_sampler);
+}
 
-   for (int i = 0; i < count; i++) {
-   evergreen_context_pipe_state_set_vs_sampler(rctx, rstates[i], 
i);
-   }
+static void evergreen_bind_vs_samplers(struct pipe_context *ctx, unsigned 
count, void **states)
+{
+   struct r600_context *rctx = (struct r600_context *)ctx;
+   evergreen_bind_samplers(rctx, &rctx->vs_samplers, count, states,
+   evergreen_context_pipe_state_set_vs_sampler);
 }
 
 static void evergreen_set_clip_state(struct pipe_context *ctx,
@@ -1869,11 +1877,11 @@ void evergreen_init_state_functions(struct r600_context 
*rctx)
rctx->context.create_vs_state = r600_create_shader_state_vs;
rctx->context.bind_blend_state = r600_bind_blend_state;
rctx->context.bind_depth_stencil_alpha_state = r600_bind_dsa_state;
-   rctx->context.bind_fragment_sampler_states = evergreen_bind_ps_sampler;
+   rctx->context.bind_fragment_sampler_states = evergreen_bind_ps_samplers;
rctx->context.bind_fs_state = r600_bind_ps_shader;
rctx->context.bind_rasterizer_state = r600_bind_rs_state;
rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements;
-   rctx->context.bind_vertex_sampler_states = evergreen_bind_vs_sampler;
+   rctx->context.bind_vertex_sampler_states = evergreen_bind_vs_samplers;
rctx->context.bind_vs_state = r600_bind_vs_shader;
rctx->context.delete_blend_state = r600_delete_state;
rctx->context.delete_depth_stencil_alpha_state = r600_delete_state;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 09/13] r600g: properly track which textures are depth

2012-07-14 Thread Marek Olšák
This fixes the issue with have_depth_texture never being set to false.
---
 src/gallium/drivers/r600/r600_blit.c |   20 
 src/gallium/drivers/r600/r600_pipe.h |6 +++---
 src/gallium/drivers/r600/r600_state_common.c |   19 +++
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c 
b/src/gallium/drivers/r600/r600_blit.c
index ca5aaf8..7679012 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -183,21 +183,23 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx,
r600_atom_dirty(rctx, &rctx->db_misc_state.atom);
 }
 
-static void r600_flush_depth_textures(struct r600_context *rctx,
- struct r600_textures_info *textures)
+void r600_flush_depth_textures(struct r600_context *rctx,
+  struct r600_textures_info *textures)
 {
unsigned i;
+   unsigned depth_texture_mask = textures->depth_texture_mask;
 
-   for (i = 0; i < textures->n_views; ++i) {
+   while (depth_texture_mask) {
struct pipe_sampler_view *view;
struct r600_resource_texture *tex;
 
+   i = u_bit_scan(&depth_texture_mask);
+
view = &textures->views[i]->base;
-   if (!view) continue;
+   assert(view);
 
tex = (struct r600_resource_texture *)view->texture;
-   if (!tex->is_depth || tex->is_flushing_texture)
-   continue;
+   assert(tex->is_depth && !tex->is_flushing_texture);
 
r600_blit_uncompress_depth(&rctx->context, tex, NULL,
   view->u.tex.first_level,
@@ -207,12 +209,6 @@ static void r600_flush_depth_textures(struct r600_context 
*rctx,
}
 }
 
-void r600_flush_all_depth_textures(struct r600_context *rctx)
-{
-   r600_flush_depth_textures(rctx, &rctx->ps_samplers);
-   r600_flush_depth_textures(rctx, &rctx->vs_samplers);
-}
-
 static void r600_clear(struct pipe_context *ctx, unsigned buffers,
   const union pipe_color_union *color,
   double depth, unsigned stencil)
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index fd11134..0b45314 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -238,6 +238,7 @@ struct r600_textures_info {
struct r600_pipe_sampler_view   *views[NUM_TEX_UNITS];
struct r600_pipe_sampler_state  *samplers[NUM_TEX_UNITS];
unsignedn_views;
+   uint32_tdepth_texture_mask; /* which textures 
are depth */
unsignedn_samplers;
boolsamplers_dirty;
boolis_array_sampler[NUM_TEX_UNITS];
@@ -329,7 +330,6 @@ struct r600_context {
 
struct u_upload_mgr *uploader;
struct util_slab_mempoolpool_transfers;
-   boolean have_depth_texture;
 
unsigned default_ps_gprs, default_vs_gprs;
 
@@ -451,8 +451,8 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx,
struct r600_resource_texture *staging,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer);
-void r600_flush_all_depth_textures(struct r600_context *rctx);
-
+void r600_flush_depth_textures(struct r600_context *rctx,
+  struct r600_textures_info *textures);
 /* r600_buffer.c */
 bool r600_init_resource(struct r600_screen *rscreen,
struct r600_resource *res,
diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index 76a28ff..23adf3b 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -475,8 +475,14 @@ void r600_set_sampler_views(struct r600_context *rctx,
}
 
if (rviews[i]) {
-   if (((struct r600_resource_texture 
*)rviews[i]->base.texture)->is_depth)
-   rctx->have_depth_texture = true;
+   struct r600_resource_texture *rtex =
+   (struct 
r600_resource_texture*)rviews[i]->base.texture;
+
+   if (rtex->is_depth && !rtex->is_flushing_texture) {
+   dst->depth_texture_mask |= 1 << i;
+   } else {
+   dst->depth_texture_mask &= ~(1 << i);
+   }
 
/* Changing from array to non-arrays textures and vice
 * versa requires updating TEX_ARRAY_OVERRIDE on 
R6xx-R7xx. */
@@ -489,6 +495,7 @@ void r600_set_sampler_views(struct r600_context *rctx

[Mesa-dev] [PATCH 10/13] r600g: only make constant buffers dirty if there's something to update

2012-07-14 Thread Marek Olšák
---
 src/gallium/drivers/r600/r600_state_common.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index 23adf3b..f1d5d57 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -757,10 +757,12 @@ static void r600_update_alpha_ref(struct r600_context 
*rctx)
 
 void r600_constant_buffers_dirty(struct r600_context *rctx, struct 
r600_constbuf_state *state)
 {
-   r600_inval_shader_cache(rctx);
-   state->atom.num_dw = rctx->chip_class >= EVERGREEN ? 
util_bitcount(state->dirty_mask)*20
-  : 
util_bitcount(state->dirty_mask)*19;
-   r600_atom_dirty(rctx, &state->atom);
+   if (state->dirty_mask) {
+   r600_inval_shader_cache(rctx);
+   state->atom.num_dw = rctx->chip_class >= EVERGREEN ? 
util_bitcount(state->dirty_mask)*20
+  : 
util_bitcount(state->dirty_mask)*19;
+   r600_atom_dirty(rctx, &state->atom);
+   }
 }
 
 void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint 
index,
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 11/13] r600g: convert sampler view emission into atoms

2012-07-14 Thread Marek Olšák
Vertex and constant buffers are emitted in the same way.
This is mainly a simplification of the code. The cleanup is in another patch.
---
 src/gallium/drivers/r600/evergreen_state.c   |  111 ---
 src/gallium/drivers/r600/r600_blit.c |6 +-
 src/gallium/drivers/r600/r600_hw_context.c   |5 +
 src/gallium/drivers/r600/r600_pipe.h |   35 --
 src/gallium/drivers/r600/r600_state.c|  150 +++---
 src/gallium/drivers/r600/r600_state_common.c |   65 +++
 6 files changed, 238 insertions(+), 134 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index d4e9fae..8f037e2 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -956,7 +956,6 @@ static struct pipe_sampler_view 
*evergreen_create_sampler_view(struct pipe_conte
 {
struct r600_screen *rscreen = (struct r600_screen*)ctx->screen;
struct r600_pipe_sampler_view *view = 
CALLOC_STRUCT(r600_pipe_sampler_view);
-   struct r600_pipe_resource_state *rstate;
struct r600_resource_texture *tmp = (struct 
r600_resource_texture*)texture;
unsigned format, endian;
uint32_t word4 = 0, yuv_format = 0, pitch = 0;
@@ -966,7 +965,6 @@ static struct pipe_sampler_view 
*evergreen_create_sampler_view(struct pipe_conte
 
if (view == NULL)
return NULL;
-   rstate = &view->state;
 
/* initialize base object */
view->base = *state;
@@ -1058,44 +1056,39 @@ static struct pipe_sampler_view 
*evergreen_create_sampler_view(struct pipe_conte
depth = texture->array_size;
}
 
-   rstate->bo[0] = &tmp->resource;
-   rstate->bo[1] = &tmp->resource;
-   rstate->bo_usage[0] = RADEON_USAGE_READ;
-   rstate->bo_usage[1] = RADEON_USAGE_READ;
-
-   rstate->val[0] = (S_03_DIM(r600_tex_dim(texture->target)) |
- S_03_PITCH((pitch / 8) - 1) |
- S_03_TEX_WIDTH(width - 1));
+   view->tex_resource = &tmp->resource;
+   view->tex_resource_words[0] = 
(S_03_DIM(r600_tex_dim(texture->target)) |
+  S_03_PITCH((pitch / 8) - 1) |
+  S_03_TEX_WIDTH(width - 1));
if (rscreen->chip_class == CAYMAN)
-   rstate->val[0] |= CM_S_03_NON_DISP_TILING_ORDER(tile_type);
+   view->tex_resource_words[0] |= 
CM_S_03_NON_DISP_TILING_ORDER(tile_type);
else
-   rstate->val[0] |= S_03_NON_DISP_TILING_ORDER(tile_type);
-   rstate->val[1] = (S_030004_TEX_HEIGHT(height - 1) |
- S_030004_TEX_DEPTH(depth - 1) |
- S_030004_ARRAY_MODE(array_mode));
-   rstate->val[2] = (tmp->offset[0] + r600_resource_va(ctx->screen, 
texture)) >> 8;
+   view->tex_resource_words[0] |= 
S_03_NON_DISP_TILING_ORDER(tile_type);
+   view->tex_resource_words[1] = (S_030004_TEX_HEIGHT(height - 1) |
+  S_030004_TEX_DEPTH(depth - 1) |
+  S_030004_ARRAY_MODE(array_mode));
+   view->tex_resource_words[2] = (tmp->offset[0] + 
r600_resource_va(ctx->screen, texture)) >> 8;
if (state->u.tex.last_level) {
-   rstate->val[3] = (tmp->offset[1] + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   view->tex_resource_words[3] = (tmp->offset[1] + 
r600_resource_va(ctx->screen, texture)) >> 8;
} else {
-   rstate->val[3] = (tmp->offset[0] + 
r600_resource_va(ctx->screen, texture)) >> 8;
-   }
-   rstate->val[4] = (word4 |
- 
S_030010_SRF_MODE_ALL(V_030010_SRF_MODE_ZERO_CLAMP_MINUS_ONE) |
- S_030010_ENDIAN_SWAP(endian) |
- S_030010_BASE_LEVEL(state->u.tex.first_level));
-   rstate->val[5] = (S_030014_LAST_LEVEL(state->u.tex.last_level) |
- S_030014_BASE_ARRAY(state->u.tex.first_layer) |
- S_030014_LAST_ARRAY(state->u.tex.last_layer));
+   view->tex_resource_words[3] = (tmp->offset[0] + 
r600_resource_va(ctx->screen, texture)) >> 8;
+   }
+   view->tex_resource_words[4] = (word4 |
+  
S_030010_SRF_MODE_ALL(V_030010_SRF_MODE_ZERO_CLAMP_MINUS_ONE) |
+  S_030010_ENDIAN_SWAP(endian) |
+  
S_030010_BASE_LEVEL(state->u.tex.first_level));
+   view->tex_resource_words[5] = 
(S_030014_LAST_LEVEL(state->u.tex.last_level) |
+  
S_030014_BASE_ARRAY(state->u.tex.first_layer) |
+  
S_030014_LAST_ARRAY(state->u.tex.last_layer));
/* aniso max 16 samples */
-   rstate->val[6] = (S_030018_MAX_ANISO(4)) |
- 

[Mesa-dev] [PATCH 12/13] r600g: remove unused code after conversion of sampler views

2012-07-14 Thread Marek Olšák
---
 src/gallium/drivers/r600/evergreen_hw_context.c |   27 ---
 src/gallium/drivers/r600/r600.h |   11 --
 src/gallium/drivers/r600/r600_hw_context.c  |  205 +--
 src/gallium/drivers/r600/r600_hw_context_priv.h |3 -
 src/gallium/drivers/r600/r600_pipe.c|1 -
 src/gallium/drivers/r600/r600_pipe.h|4 -
 src/gallium/drivers/r600/r600_state_common.c|3 -
 7 files changed, 5 insertions(+), 249 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c 
b/src/gallium/drivers/r600/evergreen_hw_context.c
index 081701f..5297c05 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -579,24 +579,6 @@ static const struct r600_reg cayman_context_reg_list[] = {
{R_028EAC_CB_COLOR11_DIM, 0, 0},
 };
 
-/* SHADER RESOURCE EG/CM */
-static int evergreen_resource_range_init(struct r600_context *ctx, struct 
r600_range *range, unsigned offset, unsigned nblocks, unsigned stride)
-{
-   struct r600_reg r600_shader_resource[] = {
-   {R_03_RESOURCE0_WORD0, REG_FLAG_NEED_BO, 0},
-   {R_030004_RESOURCE0_WORD1, REG_FLAG_NEED_BO, 0},
-   {R_030008_RESOURCE0_WORD2, 0, 0},
-   {R_03000C_RESOURCE0_WORD3, 0, 0},
-   {R_030010_RESOURCE0_WORD4, 0, 0},
-   {R_030014_RESOURCE0_WORD5, 0, 0},
-   {R_030018_RESOURCE0_WORD6, 0, 0},
-   {R_03001C_RESOURCE0_WORD7, 0, 0},
-   };
-   unsigned nreg = Elements(r600_shader_resource);
-
-   return r600_resource_init(ctx, range, offset, nblocks, stride, 
r600_shader_resource, nreg, EVERGREEN_RESOURCE_OFFSET);
-}
-
 /* SHADER SAMPLER BORDER EG/CM */
 static int evergreen_state_sampler_border_init(struct r600_context *ctx, 
uint32_t offset, unsigned id)
 {
@@ -694,15 +676,6 @@ int evergreen_context_init(struct r600_context *ctx)
goto out_err;
}
 
-   ctx->num_ps_resources = 176;
-   ctx->num_vs_resources = 160;
-   r = evergreen_resource_range_init(ctx, &ctx->ps_resources, 0, 176, 
0x20);
-   if (r)
-   goto out_err;
-   r = evergreen_resource_range_init(ctx, &ctx->vs_resources, 0x1600, 160, 
0x20);
-   if (r)
-   goto out_err;
-
/* PS loop const */
evergreen_loop_const_init(ctx, 0);
/* VS loop const */
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 0ae7959..0e3fde7 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -117,16 +117,8 @@ struct r600_pipe_state {
struct r600_pipe_regregs[R600_BLOCK_MAX_REG];
 };
 
-struct r600_pipe_resource_state {
-   unsignedid;
-   uint32_tval[8];
-   struct r600_resource*bo[2];
-   enum radeon_bo_usagebo_usage[2];
-};
-
 #define R600_BLOCK_STATUS_ENABLED  (1 << 0)
 #define R600_BLOCK_STATUS_DIRTY(1 << 1)
-#define R600_BLOCK_STATUS_RESOURCE_DIRTY   (1 << 2)
 
 struct r600_block_reloc {
struct r600_resource*bo;
@@ -199,8 +191,6 @@ int r600_context_init(struct r600_context *ctx);
 void r600_context_fini(struct r600_context *ctx);
 void r600_context_pipe_state_emit(struct r600_context *ctx, struct 
r600_pipe_state *state, unsigned pkt_flags);
 void r600_context_pipe_state_set(struct r600_context *ctx, struct 
r600_pipe_state *state);
-void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct 
r600_pipe_resource_state *state, unsigned rid);
-void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct 
r600_pipe_resource_state *state, unsigned rid);
 void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct 
r600_pipe_state *state, unsigned id);
 void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct 
r600_pipe_state *state, unsigned id);
 void r600_context_flush(struct r600_context *ctx, unsigned flags);
@@ -217,7 +207,6 @@ void r600_context_streamout_end(struct r600_context *ctx);
 void r600_context_draw_opaque_count(struct r600_context *ctx, struct 
r600_so_target *t);
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean 
count_draw_in);
 void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block 
*block, unsigned pkt_flags);
-void r600_context_block_resource_emit_dirty(struct r600_context *ctx, struct 
r600_block *block);
 
 int evergreen_context_init(struct r600_context *ctx);
 void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, 
struct r600_pipe_state *state, unsigned id);
diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
b/src/gallium/drivers/r600/r600_hw_context.c
index bf93d41..29b9dfd 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -136,13 +136,8 @@ static void r600

[Mesa-dev] [PATCH 13/13] r600g: fix lockups with and enable dual source blending on evergreen

2012-07-14 Thread Marek Olšák
GL_ARB_blend_func_extended is now enabled on all chipsets.
---
 src/gallium/drivers/r600/evergreen_state.c |4 +++-
 src/gallium/drivers/r600/r600_pipe.c   |4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 8f037e2..5486a96 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1652,7 +1652,9 @@ static void evergreen_set_framebuffer_state(struct 
pipe_context *ctx,
for (i = 0; i < state->nr_cbufs; i++) {
evergreen_cb(rctx, rstate, state, i);
}
-
+   /* CB_COLOR1_INFO is already initialized for possible dual-src blending 
*/
+   if (i == 1)
+   i++;
for (; i < 8 ; i++) {
r600_pipe_state_add_reg(rstate, R_028C70_CB_COLOR0_INFO + i * 
0x3C, 0);
}
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index 48e94f5..2a10262 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -384,6 +384,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_USER_CONSTANT_BUFFERS:
case PIPE_CAP_COMPUTE:
case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
return 1;
 
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
@@ -451,9 +452,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
 
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 7;
-
-   case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
-   return family < CHIP_CEDAR ?  1 : 0;
}
return 0;
 }
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH] Fix build to use glsl_parser.hh instead of glsl_parser.h.

2012-07-14 Thread Ian Romanick

On 07/13/2012 03:03 PM, Jon TURNEY wrote:

On 13/07/2012 22:23, Marcin Baczyński wrote:

Commit 68e04cc6014bf7a2c9bd0b3b783b4ec12aa2e824 changed .cpp -> .cc,
but forgot to update references .h -> .hh.


Header files are named .h.  NAK changes to .hh or .hpp.  Seriously,


Also update Doxygen and .gitignore.

Signed-off-by: Marcin Baczyński 


Thanks, and sorry for the breakage.

But this patch isn't right, as the name of the header file depends on the
automake version. While automake 1.12 names the output .hh, earlier versions
named the output .h, which is very inconvenient and why this wasn't spotted in
testing :-(

doxygen/glsl.doxy exclude definitely needs updating though, thanks for
spotting that.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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