Re: [Mesa-dev] egl dma-buf export extension again

2015-03-04 Thread Daniel Stone
Hi,

On 3 March 2015 at 23:26, Kristian Høgsberg  wrote:
> On Tue, Mar 3, 2015 at 10:43 AM, Chad Versace  wrote:
>> Please use EGLImages as the import/export object. That provides
>> consistency with existing similar EGL APIs. And it allows a clean
>> separation between EGL-aware code and GL-aware code in applications
>> and compositors.
>>
>> For what it's worth, extensions in this area being developed by Google's
>> Chrome OS team also use EGLImages as the transport object.
>
> We can't both implement EGLImages in a compliant way *and* use them
> for cross-process sharing like we do.  The spec language around
> orphaning and siblings is obscure, but the idea is that whenever you
> add a sibling (another client API object, eg a texture or a vg
> renderbuffer) the contents become invalid.  The intended use case is
> that you create all siblings up front and then start using them.  For
> example, to share an image between VG and GL, you create the VG
> buffer, then the EGLImage and then the GL texture.  Implementations
> will defer allocation until all the siblings are set up and then only
> once you start rendering allocate the memory.  This allows the
> implementation to accommodate constraints from all siblings. If you
> add another sibling, the implementation may have to reallocate storage
> to satisfy new constraints.  This clearly isn't compatible with how we
> create and share EGLImages left and right across process boundaries.
> Khronos specifically developed EGLStreams as a cross-process color
> buffer sharing mechanism without pulling in EGLImage as a dependency.
>
> Anyway, the damage is done and we can continue digging ourselves
> deeper into this hole, but we should at least 1) have a good reason
> why the extra EGLImage indirection is necessary (it also rules out GLX
> usage) and 2) acknowledge that we're going to continue to rely on our
> broken EGLImage semantics.

Which is all fair enough, but I think it's worth noting that
SurfaceFlinger, when confronted with the exact same problem space,
decided that the same answer was the best way forward. So we've got
some precedent established there.

Given the various interesting and creative ways in which people have
broken their EGLImage implementations, I'm not really sure that I want
to leave them to chance another, much less standard, spec, which has
less of a precedent around it.

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


Re: [Mesa-dev] [PATCH] main/base_tex_format: Properly handle STENCIL_INDEX1/4/16

2015-03-04 Thread Pohjolainen, Topi
On Tue, Mar 03, 2015 at 05:08:23PM +, Neil Roberts wrote:
> Jason Ekstrand  writes:
> 
> > On Mon, Mar 2, 2015 at 11:33 AM, Ilia Mirkin  wrote:
> >
> >> On Mon, Mar 2, 2015 at 2:32 PM, Jason Ekstrand 
> >> wrote:
> >> >
> >> >
> >> > On Mon, Mar 2, 2015 at 11:18 AM, Ilia Mirkin 
> >> wrote:
> >> >>
> >> >> Hmmm... I was just looking at this code in connection to attepmting to
> >> >> enable ARB_texture_stencil8, and it _seems_ like that should be if
> >> >> (ARB_texture_stencil8) -- I didn't see what in ARB_stencil_texturing
> >> >> had to do with being able to have a GL_STENCIL_INDEX* internal
> >> >> format...
> >> >
> >> >
> >> > I just pushed it because it does fix a bug...  However, you do raise a
> >> good
> >> > point.  Maybe we should change the i965 driver to use GL_STENCIL_INDEX
> >> for
> >> > the internal format for our internal stencil buffers.
> >>
> >> How do you end up with a GL_STENCIL_INDEX internal format in the first
> >> place? Without ARB_texture_stencil8 that's not a thing, is it?
> >>
> >
> > We're using it internally for doing stencil blits.  I'm going to Cc Neil
> > and he can explain what's going on there better than I can as he was the
> > one who wrote most of that code.
> 
> Do you mean the code to do the meta stencil blit? I haven't touched
> that. Maybe I can pass the buck on to Topi :)

I may not be answering to the question but I'll explain what the meta path
does. It sets the texturing mode using:

   _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
  GL_STENCIL_INDEX);

This in order to follow the spec:

"Texture lookups involving texture objects with an internal format of
 DEPTH_STENCIL can read the stencil value as described in section
 3.10.18 by setting the DEPTH_STENCIL_TEXTURE_MODE to STENCIL_INDEX."

But this should be effecting only gl_texture_object::StencilSampling which
is considered by the surface state setup later on in i965. I don't believe
I have altered any internal format related logic for this.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] RFC: Prune stale components

2015-03-04 Thread Jose Fonseca

On 04/03/15 00:24, Emil Velikov wrote:

On 03/03/15 22:04, Jose Fonseca wrote:

On 03/03/15 18:39, Emil Velikov wrote:

On 3 March 2015 at 17:16, Jose Fonseca  wrote:
...


I've prototyped this in


https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_-7Ejrfonseca_mesa_log_-3Fh-3Dremove-2Dst-2Degl&d=AwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=DBmTkQmzY89vDw_KLOol0FBhKxmBTyqNfsx_ly5H-ZU&s=zhIQc271rsRkCQHGsaFYKm3SFwRTGWAib63t3Fjdhyo&e=


The changes are massive, so I'm not sure it's even worth spamming the
list
with them.

Could you please give a look and let me know if there are any concerns?


I've spotted a few trivial bits:

   - windows/gdi: Remove.
Drop drivers/windows from src/mesa/Makefile.am:EXTRA_DIST
The driver had interesting api/wrapper similar to osmesa. Did not know
that :-)

-  st/egl: Remove.
Update the src/egl/main/Sconscript to create a SharedLibrary, add
versioning, create symlink - copy the bits from egl-static.



Drop st/egl and targets/egl-static from
src/gallium/Makefile.am:EXTRA_DIST



Remove the _EGL_BUILT_IN_DRIVER_GALLIUM define from
src/egl/main/Android.mk.
   - st/vega: Remove.
A few "openvg" references left - one in configure.ac another one in
docs/contents.html


Thanks. I pushed a new version of the branch with all issues fixed.


I'm guessing you made a typo in src/egl/main/SConscript

+egl = env.InstallSharedLibrary(egl, version=(1, 0, 0))

Shouldn't the version be 1.4 ?


No, it wasn't a typo.  It matches what autotools does now.

I can't say which is more correct 1.0 or 1.4, but it doesn't make sense 
for SCons to do something different than autotools for the exact same code.









The only snafu is Android.mk -- it will be broken with gallium
drivers until
somebody familiar with that infrastructure updates it to use
egl_dri2. But
it should build fine without gallium drivers.


The Android build is mostly limping around mesa 10.4. I've pinged the
Android-x86 guys, but but might get to it soon(ish). Don't worry too
much about it.

I'm guessing that the scons and automake build do not point out
anything unusual ?


Right. automake, scons/linux and scons/windows all build happily. Of
course, automake has many options, and I only tested one (with dri and
gallium sw rasterizers).


These components are rather nicely isolated, so it should not matter
that much.

I'm suspecting that scons does not link against all libs for libEGL.


ldd -r build/linux-x86_64-debug/egl/main/libEGL.so is clean.


Adding -Wl,--no-undefined/-Wl,-z,defs to SHLINKFLAGS should clear it up,
yet feel free to do it as a follow up. I would highly recommend adding
it (-Wl...) for every SharedLibrary in scons. Using the version scripts
like autotools, to restrict the exported symbols, will be great.


I'll see what can be done.

Unfortunately (at least in the past) we used to have .so depending on 
symbols from the .so/executable that dlopened it (ie, cyclic 
dependencies), so doing this universally woulddn't be possible. Not sure 
if that's still the case.



With the versioning question addressed, feel free to add
Reviewed-by: Emil Velikov 


Thanks for the reviews.


Please drop a couple of lines in the release notes, when you're finished
removing all the old/unused bits.


Sure.


-Emil

P.S. Strange. After spending so much time fixing the builds, it feels so
nice as various chunks of it end up removed :-P


Yeah. I feel the same, even with code I wrote myself. Maintaining code 
takes a toll in time and energy (all those worries about things one 
should have done but never had the time). So removing code (or 
abandoning projects) is effectively taking a weight from ones 
conscience. And enables one to use that time/energy for better things.

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


Re: [Mesa-dev] [PATCH] glsl: Fix GCC unused-variable warning in release build.

2015-03-04 Thread Timothy Arceri
Reviewed-by: Timothy Arceri 

On Tue, 2015-03-03 at 18:49 -0800, Vinson Lee wrote:
>   CXX  ast_array_index.lo
> ast_array_index.cpp: In function ‘void update_max_array_access(ir_rvalue*, 
> int, YYLTYPE*, _mesa_glsl_parse_state*)’:
> ast_array_index.cpp:86:30: warning: unused variable ‘interface_type’ 
> [-Wunused-variable]
>  const glsl_type *interface_type =
>   ^
> 
> Signed-off-by: Vinson Lee 
> ---
>  src/glsl/ast_array_index.cpp | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
> index ff0c757..ecef651 100644
> --- a/src/glsl/ast_array_index.cpp
> +++ b/src/glsl/ast_array_index.cpp
> @@ -83,11 +83,9 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE 
> *loc,
>  
>if (deref_var != NULL) {
>   if (deref_var->var->is_interface_instance()) {
> -const glsl_type *interface_type =
> -   deref_var->var->get_interface_type();
>  unsigned field_index =
> deref_record->record->type->field_index(deref_record->field);
> -assert(field_index < interface_type->length);
> +assert(field_index < 
> deref_var->var->get_interface_type()->length);
>  
>  unsigned *const max_ifc_array_access =
> deref_var->var->get_max_ifc_array_access();


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


Re: [Mesa-dev] [PATCH excerpt] mesa: Wrap unlikely() around conditions leading to _mesa_error().

2015-03-04 Thread Kenneth Graunke
On Monday, March 02, 2015 03:03:00 PM Eric Anholt wrote:
> Kenneth Graunke  writes:
> 
> > Generated by the following Coccinelle semantic patch:
> >
> > @@
> > expression E;
> > @@
> > if (
> > -E
> > +unlikely(E)
> >  )
> > { ... _mesa_error(...) ... }
> >
> > Improves performance in OglBatch7 (a CPU-bound microbenchmark) on
> > an i7 4750HQ (Haswell) by 1.08546% +/- 0.519734% (n=292).
> >
> > Signed-off-by: Kenneth Graunke 
> 
> Neat!
> 
> I think you're supposed to be able to get the same result by marking
> _mesa_error as attribute cold.  Then nobody can forget to mark their
> conditions as unlikely in the future.

Oh, neat!  I wasn't aware of __attribute__((cold)).

I tried it out and ran some measurements, this time on Baytrail (since
it should more more sensitive to CPU improvements like this).  Oddly,
the results were different:

attribute cold on _mesa_error: -1.60367% +/- 0.43555%
unlikely on all _mesa_error callers: -2.92994% +/- 0.0632798%

I haven't dug into the assembly yet to try and see why.

(It's also bizarre to me that these /hurt/ performance on Baytrail, on
a CPU-limited microbenchmark that never hits _mesa_error, both with or
without the performance governor set.  More mysteries...)

I'll have to try measuring on Haswell.


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] GSoC 2015 Proposal : Porting Glean tests to piglit

2015-03-04 Thread Juliet Fru
Hello,

Here is my proposal for Adding Porting Glean tests to piglit. I'll like to
get your comments and tweaks.

Thanks,
Juliet​
 Porting Glean tests to Piglit framework OPW Proposal

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


Re: [Mesa-dev] nesa-10.4.4: gallivm/lp_bld_misc.cpp:503:38: error: no viable conversion from 'ShaderMemoryManager *' to 'std::unique_ptr'

2015-03-04 Thread Jose Fonseca

On 04/03/15 02:00, Emil Velikov wrote:

On 27 February 2015 at 23:28, Sedat Dilek  wrote:

On Mon, Feb 9, 2015 at 6:30 PM, Emil Velikov  wrote:

On 07/02/15 21:44, Sedat Dilek wrote:

Hi,

I was building mesa v10.4.4 with my llvm-toolchain v3.6.0rc2.

My build breaks like this...

...

Please cherry-pick...

commit ef7e0b39a24966526b102643523feac765771842
"gallivm: Update for RTDyldMemoryManager becoming an unique_ptr."

..for mesa 10.4 Git branch.


Hi Sedat,

Picking a fix in a stable branch against a non-final release sounds like
a no-go in our books. As the official llvm 3.6 rolls out we'll pick this
fix for the stable branches - until then I would recommend (a) applying
it locally or (b) using mesa from the 10.5 or master branch.



Just FYI...

[LLVMdev] LLVM 3.6 Release (see [1]).

Please pick this patch for-10.4, thanks.


As promised, mesa 10.4.6 will feature this.


But is cross-porting this patch enough?

As I said when this first issue was raised fixing the build with LLVM 
3.6 is just half of the problem.  It must also _run_ correctly.  And 
building correctly doesn't necessarily means it will run correctly.




That is, unless somebody actually ensures that all LLVM 3.6 related 
fixes have been crossported and that things run correctly, it is 
misleading to enable the build of Mesa 10.4.6 with LLVM 3.6.


I don't know about radeon drivers, but at least from llvmpipe POV I 
simply don't have the time to do this (go through every LLVM 3.6 related 
patch, ensure they are all in 10.4.6, and test).



I quickly went through the diffs between 10.4 branch, and found one such 
commit is missing:



http://cgit.freedesktop.org/mesa/mesa/commit/?id=74f505fa73eda0c9b5b1984bebb44cedac8e8794
  https://bugs.freedesktop.org/show_bug.cgi?id=85467

But there might be more, and I don't know if crossporting this is safe 
or not.



Therefore my stance for is that building Mesa stable releases with LLVM 
releases after the Mesa release was branched is still unsupported.  If 
people want to do so, they will do at their own peril. And any incoming 
bugs will be "unsupported, use Mesa.



If having a Mesa release capable of building LLVM 3.6 is so important, I 
think it might be easier/safer to just make a new release from a recent 
enough commit, than trying to backport it.



Jose

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


Re: [Mesa-dev] RFC: Prune stale components

2015-03-04 Thread Emil Velikov
On 4 March 2015 at 08:31, Jose Fonseca  wrote:
> On 04/03/15 00:24, Emil Velikov wrote:
>>
>> On 03/03/15 22:04, Jose Fonseca wrote:
>>>
>>> On 03/03/15 18:39, Emil Velikov wrote:

 On 3 March 2015 at 17:16, Jose Fonseca  wrote:
 ...
>
>
> I've prototyped this in
>
>
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_-7Ejrfonseca_mesa_log_-3Fh-3Dremove-2Dst-2Degl&d=AwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=DBmTkQmzY89vDw_KLOol0FBhKxmBTyqNfsx_ly5H-ZU&s=zhIQc271rsRkCQHGsaFYKm3SFwRTGWAib63t3Fjdhyo&e=
>
>
> The changes are massive, so I'm not sure it's even worth spamming the
> list
> with them.
>
> Could you please give a look and let me know if there are any concerns?
>
 I've spotted a few trivial bits:

- windows/gdi: Remove.
 Drop drivers/windows from src/mesa/Makefile.am:EXTRA_DIST
 The driver had interesting api/wrapper similar to osmesa. Did not know
 that :-)

 -  st/egl: Remove.
 Update the src/egl/main/Sconscript to create a SharedLibrary, add
 versioning, create symlink - copy the bits from egl-static.
>>>
>>>
 Drop st/egl and targets/egl-static from
 src/gallium/Makefile.am:EXTRA_DIST
>>>
>>>
 Remove the _EGL_BUILT_IN_DRIVER_GALLIUM define from
 src/egl/main/Android.mk.
- st/vega: Remove.
 A few "openvg" references left - one in configure.ac another one in
 docs/contents.html
>>>
>>>
>>> Thanks. I pushed a new version of the branch with all issues fixed.
>>>
>> I'm guessing you made a typo in src/egl/main/SConscript
>>
>> +egl = env.InstallSharedLibrary(egl, version=(1, 0, 0))
>>
>> Shouldn't the version be 1.4 ?
>
>
> No, it wasn't a typo.  It matches what autotools does now.
>
> I can't say which is more correct 1.0 or 1.4, but it doesn't make sense for
> SCons to do something different than autotools for the exact same code.
>
Nicely spotted. I've naively assumed that we had 1.4 for Autotools.

>>
>>>

> The only snafu is Android.mk -- it will be broken with gallium
> drivers until
> somebody familiar with that infrastructure updates it to use
> egl_dri2. But
> it should build fine without gallium drivers.
>
 The Android build is mostly limping around mesa 10.4. I've pinged the
 Android-x86 guys, but but might get to it soon(ish). Don't worry too
 much about it.

 I'm guessing that the scons and automake build do not point out
 anything unusual ?
>>>
>>>
>>> Right. automake, scons/linux and scons/windows all build happily. Of
>>> course, automake has many options, and I only tested one (with dri and
>>> gallium sw rasterizers).
>>>
>> These components are rather nicely isolated, so it should not matter
>> that much.
>>
>> I'm suspecting that scons does not link against all libs for libEGL.
>
>
> ldd -r build/linux-x86_64-debug/egl/main/libEGL.so is clean.
>
>> Adding -Wl,--no-undefined/-Wl,-z,defs to SHLINKFLAGS should clear it up,
>> yet feel free to do it as a follow up. I would highly recommend adding
>> it (-Wl...) for every SharedLibrary in scons. Using the version scripts
>> like autotools, to restrict the exported symbols, will be great.
>
>
> I'll see what can be done.
>
> Unfortunately (at least in the past) we used to have .so depending on
> symbols from the .so/executable that dlopened it (ie, cyclic dependencies),
> so doing this universally woulddn't be possible. Not sure if that's still
> the case.
>
The only such case in current mesa ought to be the dri modules
(LoadableModule) - both gallium and classic ones. That is for the
Autotools build, cannot say anything for scons.

Thanks again for clearing these up.
-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] New stable-branch 10.4 candidate pushed

2015-03-04 Thread Emil Velikov
Hello list,

A candidate for the Mesa 10.4.6 release is now available. The current
patch queue is as follows:
 - 16 queued
 - 7 nominated (outstanding)
 - and 0 rejected (obsolete) patches

In a nut shell this gives us a few build fixes, bugfix in libGL for the
GLX_MESA_query_renderer specification. correct handling of saturates for
pre SM 3.0 hardware (r300, nv30) and a few driver specific patches -
radeonsi and i965.

Take a look at section "Mesa stable queue" for more information.

NOTE: This release resolves the build against LLVM 3.6, effectively adding
partial support. Everyone is welcome to use it, but be warned that it's not
fully supported.


Testing
---
The following results are against piglit a68d27e7254.


Changes - classic i965(snb)
---
None.


Changes - swrast classic

Fixes
 - ARB_framebuffer_object
+ fbo-drawbuffers-none glColorMaskIndexed fail > pass
+ fbo-drawbuffers-none gl_FragDatafail > pass

 - ATI_draw_buffers
+ arbfp-no-index  fail > pass
+ ati_draw_buffers-arbfp  fail > pass

 - EXT_framebuffer_object
+ fbo-drawbuffers-arbfp   fail > pass
+ fbo-drawbuffers-blend-add   fail > pass
+ fbo-drawbuffers-maxtargets  fail > pass


Changes - gallium softpipe, llvmpipe (LLVM 3.5.1)

None.


Testing reports/general approval

Any testing reports (or general approval of the state of the branch)
will be greatly appreciated.


Trivial merge conflicts
---
Here are the commits where I manually merged conflicts, so these might
merit additional review:

commit a598a9bdfe9f5d0ed35ca89a55cf74a2b678e8e1
Author: Matt Turner 

mesa: Correct backwards NULL check.

(cherry picked from commit 491d42135ad0e5670756216154f2ba9fc79d4ba7)


commit 39ae85732d29906ea2a16dfdfc77f8e5dbed5853
Author: Eduardo Lima Mitev 

mesa: Fix error validating args for TexSubImage3D

(cherry picked from commit 2aa71e9485a5a062b1bd2dd8bdc081a8fa4c873d)


commit 61c1aabb9f25a6e0710ab6a49a9fb889c4fa7752
Author: Marek Olšák 

radeonsi: fix point sprites

(cherry picked from commit 7820a11e3dea2aca8e2b9b4ed9faf94ff5696990)

Squashed with commit

radeonsi: fix a warning caused by previous commit

(cherry picked from commit 050bf75c8bbaa7cad537aabaf8612129edfee3a4)



The plan is to have 10.4.6 this Friday(6th March).

If you have any questions or comments that you would like to share
before the release, please go ahead.


Cheers,
Emil


Mesa stable queue
-

Nominated (15)
==

Brian Paul (3):
  configure: don't try to build gallium DRI drivers if --disable-dri is set

Daniel Stone (1):
  egl: Report correct GBM formats

Emil Velikov (1):
  mesa: rename format_info.c to format_info.h

Frank Henigman (1):
  intel: fix EGLImage renderbuffer _BaseFormat

Laura Ekstrand (4):
  common: Correct texture init for meta pbo uploads and downloads.
  common: Correct PBO 2D_ARRAY handling.
  main: Fix target checking for CompressedTexSubImage*D.
  main: Fix target checking for CopyTexSubImage*D.

Mario Kleiner (1):
  glx: Handle out-of-sequence swap completion events correctly.

Matt Turner (4):
  mesa: Indent break statements and add a missing one.
  mesa: Free memory allocated for luminance in readpixels.
  r300g: Use PATH_MAX instead of limiting ourselves to 100 chars.
  r300g: Check return value of snprintf().


Queued (16)
===

Abdiel Janulgue (2):
  glsl: Don't optimize min/max into saturate when EmitNoSat is set
  st/mesa: For vertex shaders, don't emit saturate when SM 3.0 is 
unsupported

Andreas Boll (1):
  glx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA

Brian Paul (2):
  swrast: fix multiple color buffer writing
  st/mesa: fix sampler view reference counting bug in glDraw/CopyPixels

Chris Forbes (1):
  i965/gs: Check newly-generated GS-out VUE map against correct stage

Eduardo Lima Mitev (1):
  mesa: Fix error validating args for TexSubImage3D

Emil Velikov (1):
  install-lib-links: remove the .install-lib-links file

Jonathan Gray (1):
  auxilary/os: correct sysctl use in os_get_total_physical_memory()

José Fonseca (1):
  gallivm: Update for RTDyldMemoryManager becoming an unique_ptr.

Leo Liu (1):
  st/omx/dec/h264: fix picture out-of-order with poc type 0 v2

Lucas Stach (1):
  install-lib-links: don't depend on .libs directory

Marek Olšák (2):
  vbo: fix an unitialized-variable warning
  radeonsi: fix point sprites

Matt Turner (3):
  glsl: Rewrite and fix min/max to saturate optimization.
  mesa: Correct backwards NULL check.
  i965/fs: Don't use backend_visitor::instructions after creating the CFG.


___
mesa-dev mailing list
mesa-

Re: [Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

2015-03-04 Thread Jose Fonseca

On 04/03/15 04:20, Matt Turner wrote:

On Tue, Mar 3, 2015 at 8:07 PM, Brian Paul  wrote:

---
  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 5210acc..e2578cf 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -493,7 +493,7 @@ 
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 builder.setMCPU(MCPU);
  #endif

-   ShaderMemoryManager *MM;
+   ShaderMemoryManager *MM = NULL;
 if (useMCJIT) {
  #if HAVE_LLVM > 0x0303
 BaseMemoryManager* JMM = reinterpret_cast(CMM);
--
1.9.1


I'm guessing it's the 'delete MM;' that generates the warning? If so,
shouldn't you just wrap it in #if HAVE_LLVM > ...?

I think MCJIT is the only option in llvm >= 3.6? The code could
probably be trivially refactored to avoid the assert(0) as well.

 From what I can tell, it seems like adding initializers is nearly
always the wrong thing to do.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=eFrgqffTZg-fVfsgBecewE76PU07pVGCehKDjd2rc2Q&s=NmdJuPH44mfwP-iaquREc8ZPTboVxNFpMQhNXlMv2FY&e=



Yes, this is probably related to 
https://bugs.freedesktop.org/show_bug.cgi?id=89387


But unfortunately I haven't found time to catch up with it.

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


Re: [Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

2015-03-04 Thread Jose Fonseca

On 04/03/15 12:58, Jose Fonseca wrote:

On 04/03/15 04:20, Matt Turner wrote:

On Tue, Mar 3, 2015 at 8:07 PM, Brian Paul  wrote:

---
  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 5210acc..e2578cf 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -493,7 +493,7 @@
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 builder.setMCPU(MCPU);
  #endif

-   ShaderMemoryManager *MM;
+   ShaderMemoryManager *MM = NULL;
 if (useMCJIT) {
  #if HAVE_LLVM > 0x0303
 BaseMemoryManager* JMM =
reinterpret_cast(CMM);
--
1.9.1


I'm guessing it's the 'delete MM;' that generates the warning? If so,
shouldn't you just wrap it in #if HAVE_LLVM > ...?

I think MCJIT is the only option in llvm >= 3.6? The code could
probably be trivially refactored to avoid the assert(0) as well.

 From what I can tell, it seems like adding initializers is nearly
always the wrong thing to do.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=eFrgqffTZg-fVfsgBecewE76PU07pVGCehKDjd2rc2Q&s=NmdJuPH44mfwP-iaquREc8ZPTboVxNFpMQhNXlMv2FY&e=




Yes, this is probably related to
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89387&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=QY0p_bDuP-f3LPn9v8UCnsJc9MFPxmK5yIA_AQLYfpk&s=QtRiKhT6OE4Vfm-MYI7OR5SNu_iqhBPIOUnOp_5tmTc&e=

But unfortunately I haven't found time to catch up with it.


On closer look, this is a different issue.  As Matt said, the issue is 
the delete for older LLVM.


That said, `delete NULL` is safe, hence Brian's patch is good.

Jose

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


[Mesa-dev] [Bug 89387] Double delete in lp_bld_misc.cpp

2015-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89387

José Fonseca  changed:

   What|Removed |Added

 QA Contact|mesa-dev@lists.freedesktop. |jfons...@vmware.com
   |org |

--- Comment #1 from José Fonseca  ---
Would this fix it?

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 5210acc..7387ffb 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -502,6 +502,7 @@
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,

 #if HAVE_LLVM >= 0x0306
   
builder.setMCJITMemoryManager(std::unique_ptr(MM));
+   MM = NULL;
 #else
builder.setMCJITMemoryManager(MM);
 #endif

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
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 4/4] scons: Update for the fact that we require GCC 4.2

2015-03-04 Thread Jose Fonseca
---
 scons/gallium.py | 25 ++---
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index f839758..7533f06 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -369,20 +369,16 @@ def generate(env):
 'HAVE___BUILTIN_FFS',
 'HAVE___BUILTIN_FFSLL',
 'HAVE_FUNC_ATTRIBUTE_FLATTEN',
+# GCC 3.0
+'HAVE_FUNC_ATTRIBUTE_FORMAT',
+'HAVE_FUNC_ATTRIBUTE_PACKED',
+# GCC 3.4
+'HAVE___BUILTIN_CTZ',
+'HAVE___BUILTIN_POPCOUNT',
+'HAVE___BUILTIN_POPCOUNTLL',
+'HAVE___BUILTIN_CLZ',
+'HAVE___BUILTIN_CLZLL',
 ]
-if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('3'):
-cppdefines += [
-'HAVE_FUNC_ATTRIBUTE_FORMAT',
-'HAVE_FUNC_ATTRIBUTE_PACKED',
-]
-if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('3.4'):
-cppdefines += [
-'HAVE___BUILTIN_CTZ',
-'HAVE___BUILTIN_POPCOUNT',
-'HAVE___BUILTIN_POPCOUNTLL',
-'HAVE___BUILTIN_CLZ',
-'HAVE___BUILTIN_CLZLL',
-]
 if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('4.5'):
 cppdefines += ['HAVE___BUILTIN_UNREACHABLE']
 env.Append(CPPDEFINES = cppdefines)
@@ -420,8 +416,7 @@ def generate(env):
 '-m32',
 #'-march=pentium4',
 ]
-if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('4.2') \
-   and platform != 'haiku':
+if platform != 'haiku':
 # NOTE: We need to ensure stack is realigned given that we
 # produce shared objects, and have no control over the stack
 # alignment policy of the application. Therefore we need
-- 
2.1.0

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


[Mesa-dev] [PATCH 1/4] scons: Use -Werror MSVC compatibility flags per-directory.

2015-03-04 Thread Jose Fonseca
Matching what we already do with autotools builds.
---
 scons/gallium.py| 27 ---
 src/egl/main/SConscript |  2 ++
 src/gallium/auxiliary/SConscript|  4 
 src/gallium/drivers/llvmpipe/SConscript |  2 ++
 src/glsl/SConscript |  2 ++
 src/loader/SConscript   |  2 ++
 src/mapi/glapi/SConscript   |  2 ++
 src/mesa/SConscript |  2 ++
 src/util/SConscript |  2 ++
 9 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index c34468f..f839758 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -87,6 +87,25 @@ def createInstallMethods(env):
 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
 
 
+def msvc2013_compat(env):
+if env['gcc']:
+env.Append(CCFLAGS = [
+'-Werror=vla',
+'-Werror=pointer-arith',
+])
+
+def msvc2008_compat(env):
+msvc2013_compat(env)
+if env['gcc']:
+env.Append(CFLAGS = [
+'-Werror=declaration-after-statement',
+])
+
+def createMSVCCompatMethods(env):
+env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
+env.AddMethod(msvc2008_compat, 'MSVC2008Compat')
+
+
 def num_jobs():
 try:
 return int(os.environ['NUMBER_OF_PROCESSORS'])
@@ -443,13 +462,6 @@ def generate(env):
 '-Wmissing-prototypes',
 '-std=gnu99',
 ]
-if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('4.2'):
-ccflags += [
-'-Wpointer-arith',
-]
-cflags += [
-'-Wdeclaration-after-statement',
-]
 if icc:
 cflags += [
 '-std=gnu99',
@@ -617,6 +629,7 @@ def generate(env):
 # Custom builders and methods
 env.Tool('custom')
 createInstallMethods(env)
+createMSVCCompatMethods(env)
 
 env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto 
>= 1.4.13'])
 env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 
1.8'])
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 399c020..b4e9b67 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -6,6 +6,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPDEFINES = [
 '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
 ])
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 6cb6b8c..d5fa880 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -8,6 +8,10 @@ env.Append(CPPPATH = [
 'util',
 ])
 
+env = env.Clone()
+
+env.MSVC2008Compat()
+
 env.CodeGenerate(
 target = 'indices/u_indices_gen.c', 
 script = 'indices/u_indices_gen.py', 
diff --git a/src/gallium/drivers/llvmpipe/SConscript 
b/src/gallium/drivers/llvmpipe/SConscript
index 1bea611..3a51efc 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -9,6 +9,8 @@ if not env['llvm']:
 
 env = env.Clone()
 
+env.MSVC2008Compat()
+
 llvmpipe = env.ConvenienceLibrary(
target = 'llvmpipe',
source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 21c8266..26de455 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -6,6 +6,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Prepend(CPPPATH = [
 '#include',
 '#src',
diff --git a/src/loader/SConscript b/src/loader/SConscript
index 359fc18..16d1053 100644
--- a/src/loader/SConscript
+++ b/src/loader/SConscript
@@ -2,6 +2,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Prepend(CPPPATH = [
 '#include'
 ])
diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
index 97ebfe6..84a5068 100644
--- a/src/mapi/glapi/SConscript
+++ b/src/mapi/glapi/SConscript
@@ -8,6 +8,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPDEFINES = [
 'MAPI_MODE_UTIL',
 ])
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 62e81ce..d6ff083 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -10,6 +10,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPPATH = [
 '#/src',
 '#/src/mapi',
diff --git a/src/util/SConscript b/src/util/SConscript
index 84bd7a1..9e4d481 100644
--- a/src/util/SConscript
+++ b/src/util/SConscript
@@ -6,6 +6,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2008Compat()
+
 env.Prepend(CPPPATH = [
 '#include',
 '#src',
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 7/7] mapi: remove u_compiler.h

2015-03-04 Thread Jose Fonseca

On 04/03/15 04:07, Brian Paul wrote:

Just include c99_compat.h or util/macros.h where needed.
---
  src/mapi/Makefile.sources | 1 -
  src/mapi/entry.h  | 1 -
  src/mapi/glapi/glapi.h| 1 +
  src/mapi/mapi.h   | 2 --
  src/mapi/table.h  | 4 +++-
  src/mapi/u_compiler.h | 7 ---
  src/mapi/u_current.h  | 6 --
  src/mapi/u_execmem.c  | 2 +-
  src/mapi/u_thread.h   | 2 +-
  9 files changed, 10 insertions(+), 16 deletions(-)
  delete mode 100644 src/mapi/u_compiler.h

diff --git a/src/mapi/Makefile.sources b/src/mapi/Makefile.sources
index 41dbb24..a179662 100644
--- a/src/mapi/Makefile.sources
+++ b/src/mapi/Makefile.sources
@@ -15,7 +15,6 @@
  #this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined.

  MAPI_UTIL_FILES = \
-   u_compiler.h \
u_current.c \
u_current.h \
u_execmem.c \
diff --git a/src/mapi/entry.h b/src/mapi/entry.h
index dba1c06..7c8137c 100644
--- a/src/mapi/entry.h
+++ b/src/mapi/entry.h
@@ -28,7 +28,6 @@
  #ifndef _ENTRY_H_
  #define _ENTRY_H_

-#include "u_compiler.h"

  typedef void (*mapi_func)(void);

diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index e2fa925..e3f76b4 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -44,6 +44,7 @@
  #ifndef _GLAPI_H
  #define _GLAPI_H

+#include "util/macros.h"
  #include "u_thread.h"


diff --git a/src/mapi/mapi.h b/src/mapi/mapi.h
index 2aa8d9f..9adf8b5 100644
--- a/src/mapi/mapi.h
+++ b/src/mapi/mapi.h
@@ -28,8 +28,6 @@
  #ifndef _MAPI_H_
  #define _MAPI_H_

-#include "u_compiler.h"
-
  #ifdef _WIN32
  #ifdef MAPI_DLL_EXPORTS
  #define MAPI_EXPORT __declspec(dllexport)
diff --git a/src/mapi/table.h b/src/mapi/table.h
index 8180db9..e2d6ef0 100644
--- a/src/mapi/table.h
+++ b/src/mapi/table.h
@@ -28,7 +28,7 @@
  #ifndef _TABLE_H_
  #define _TABLE_H_

-#include "u_compiler.h"
+#include "c99_compat.h"
  #include "entry.h"

  #define MAPI_TMP_TABLE
@@ -37,6 +37,8 @@
  #define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC)
  #define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func))

+struct mapi_table;
+
  extern const mapi_func table_noop_array[];

  /**
diff --git a/src/mapi/u_compiler.h b/src/mapi/u_compiler.h
deleted file mode 100644
index cd80f68..000
--- a/src/mapi/u_compiler.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _U_COMPILER_H_
-#define _U_COMPILER_H_
-
-#include "c99_compat.h" /* inline, __func__, etc. */
-#include "util/macros.h"
-
-#endif /* _U_COMPILER_H_ */
diff --git a/src/mapi/u_current.h b/src/mapi/u_current.h
index 252e696..ea4f817 100644
--- a/src/mapi/u_current.h
+++ b/src/mapi/u_current.h
@@ -1,6 +1,10 @@
  #ifndef _U_CURRENT_H_
  #define _U_CURRENT_H_

+#include "c99_compat.h"
+#include "util/macros.h"
+
+
  #if defined(MAPI_MODE_UTIL) || defined(MAPI_MODE_GLAPI) || \
  defined(MAPI_MODE_BRIDGE)

@@ -24,8 +28,6 @@

  #else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */

-#include "u_compiler.h"
-
  struct mapi_table;

  #ifdef GLX_USE_TLS
diff --git a/src/mapi/u_execmem.c b/src/mapi/u_execmem.c
index ac1cae0..ad6427b 100644
--- a/src/mapi/u_execmem.c
+++ b/src/mapi/u_execmem.c
@@ -32,7 +32,7 @@
   */


-#include "u_compiler.h"
+#include "c99_compat.h"
  #include "u_thread.h"
  #include "u_execmem.h"

diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h
index 3cd07b5..4dd9515 100644
--- a/src/mapi/u_thread.h
+++ b/src/mapi/u_thread.h
@@ -44,7 +44,7 @@

  #include 
  #include 
-#include "u_compiler.h"
+#include "c99_compat.h"

  #include "c11/threads.h"




Series looks good to me.

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


[Mesa-dev] [PATCH 2/4] softpipe, trace: Set MSVC 2008 compat flags.

2015-03-04 Thread Jose Fonseca
Although we don't deploy these, we need to use them for debugging.
---
 src/gallium/drivers/softpipe/Makefile.am | 3 ++-
 src/gallium/drivers/softpipe/SConscript  | 1 +
 src/gallium/drivers/trace/Makefile.am| 3 ++-
 src/gallium/drivers/trace/SConscript | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/softpipe/Makefile.am 
b/src/gallium/drivers/softpipe/Makefile.am
index 20f11f8..05126a5 100644
--- a/src/gallium/drivers/softpipe/Makefile.am
+++ b/src/gallium/drivers/softpipe/Makefile.am
@@ -24,7 +24,8 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_DRIVER_CFLAGS)
+   $(GALLIUM_DRIVER_CFLAGS) \
+   $(MSVC2008_COMPAT_CFLAGS)
 
 noinst_LTLIBRARIES = libsoftpipe.la
 
diff --git a/src/gallium/drivers/softpipe/SConscript 
b/src/gallium/drivers/softpipe/SConscript
index 6768cbb..dc3542c 100644
--- a/src/gallium/drivers/softpipe/SConscript
+++ b/src/gallium/drivers/softpipe/SConscript
@@ -2,6 +2,7 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2008Compat()
 
 softpipe = env.ConvenienceLibrary(
target = 'softpipe',
diff --git a/src/gallium/drivers/trace/Makefile.am 
b/src/gallium/drivers/trace/Makefile.am
index db7b449..6a8a74a 100644
--- a/src/gallium/drivers/trace/Makefile.am
+++ b/src/gallium/drivers/trace/Makefile.am
@@ -2,7 +2,8 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_DRIVER_CFLAGS)
+   $(GALLIUM_DRIVER_CFLAGS) \
+   $(MSVC2008_COMPAT_CFLAGS)
 
 noinst_LTLIBRARIES = libtrace.la
 
diff --git a/src/gallium/drivers/trace/SConscript 
b/src/gallium/drivers/trace/SConscript
index 7341d1c..1bbed73 100644
--- a/src/gallium/drivers/trace/SConscript
+++ b/src/gallium/drivers/trace/SConscript
@@ -2,6 +2,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2008Compat()
+
 trace = env.ConvenienceLibrary(
 target = 'trace',
 source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
-- 
2.1.0

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


[Mesa-dev] [PATCH 3/4] svga: Set MSVC2013 compat flags.

2015-03-04 Thread Jose Fonseca
---
 src/gallium/drivers/svga/Makefile.am | 3 ++-
 src/gallium/drivers/svga/SConscript  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/Makefile.am 
b/src/gallium/drivers/svga/Makefile.am
index 50d44cf..e0a8cad 100644
--- a/src/gallium/drivers/svga/Makefile.am
+++ b/src/gallium/drivers/svga/Makefile.am
@@ -26,7 +26,8 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_DRIVER_CFLAGS)
+   $(GALLIUM_DRIVER_CFLAGS) \
+   $(MSVC2013_COMPAT_CFLAGS)
 
 #On some systems -std= must be added to CFLAGS to be the last -std=
 CFLAGS += -std=gnu99
diff --git a/src/gallium/drivers/svga/SConscript 
b/src/gallium/drivers/svga/SConscript
index 2051a3e..bb4d034 100644
--- a/src/gallium/drivers/svga/SConscript
+++ b/src/gallium/drivers/svga/SConscript
@@ -2,6 +2,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 if env['suncc']:
print 'warning: not building svga'
Return()
-- 
2.1.0

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


[Mesa-dev] [PATCH 2/2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Neil Roberts
Stepping C0 of Skylake fails when using SIMD16 with 3-source
instructions (such as MAD). This patch just makes it disable SIMD16 in
that case.

This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
tests.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 21 +
 src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
 2 files changed, 22 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 533feb4..62f29e5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3729,6 +3729,26 @@ fs_visitor::fixup_3src_null_dest()
}
 }
 
+/**
+ * 3-source instructions don't work on Skylake stepping C0. If the revision
+ * isn't known then it will take the safe option and disable it in case it's
+ * C0. Implements WaDisableSIMD16On3SrcInstr.
+ */
+void
+fs_visitor::disable_simd16_with_3src()
+{
+   if (brw->gen != 9 || (brw->revision != 2 && brw->revision != -1))
+  return;
+
+   foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
+  if (inst->is_3src()) {
+ no16("SIMD16 doesn't work with 3-source instructions on "
+  "Gen9 stepping C0\n");
+ return;
+  }
+   }
+}
+
 void
 fs_visitor::allocate_registers()
 {
@@ -3910,6 +3930,7 @@ fs_visitor::run_fs()
   assign_urb_setup();
 
   fixup_3src_null_dest();
+  disable_simd16_with_3src();
   allocate_registers();
 
   if (failed)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 70098d8..7091b9f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -196,6 +196,7 @@ public:
void setup_payload_gen6();
void setup_vs_payload();
void fixup_3src_null_dest();
+   void disable_simd16_with_3src();
void assign_curb_setup();
void calculate_urb_setup();
void assign_urb_setup();
-- 
1.9.3

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


[Mesa-dev] [PATCH 1/2] i965: Store the GPU revision number in brw_context

2015-03-04 Thread Neil Roberts
brwContextInit now queries the GPU revision number via a new parameter
for DRM_I915_GETPARAM. This new parameter requires a kernel patch and
a patch to libdrm. If the kernel doesn't support it then it will
continue but set the revision number to -1. The intention is to use
this to implement workarounds that are only needed on certain
steppings of the GPU.
---
 configure.ac|  2 +-
 src/mesa/drivers/dri/i965/brw_context.c | 19 +++
 src/mesa/drivers/dri/i965/brw_context.h |  4 
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c5abbfd..23ac927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ AC_SUBST([OSMESA_VERSION])
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.38
 LIBDRM_RADEON_REQUIRED=2.4.56
-LIBDRM_INTEL_REQUIRED=2.4.52
+LIBDRM_INTEL_REQUIRED=2.4.59
 LIBDRM_NVVIEUX_REQUIRED=2.4.33
 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
 LIBDRM_FREEDRENO_REQUIRED=2.4.57
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 786e6f5..18f72d8 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -651,6 +651,24 @@ brw_process_driconf_options(struct brw_context *brw)
   driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
 }
 
+static int
+brw_get_revision(int fd)
+{
+   struct drm_i915_getparam gp;
+   int revision;
+   int ret;
+
+   memset(&gp, 0, sizeof(gp));
+   gp.param = I915_PARAM_REVISION;
+   gp.value = &revision;
+
+   ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
+   if (ret)
+  revision = -1;
+
+   return revision;
+}
+
 GLboolean
 brwCreateContext(gl_api api,
 const struct gl_config *mesaVis,
@@ -709,6 +727,7 @@ brwCreateContext(gl_api api,
brw->has_negative_rhw_bug = devinfo->has_negative_rhw_bug;
brw->needs_unlit_centroid_workaround =
   devinfo->needs_unlit_centroid_workaround;
+   brw->revision = brw_get_revision(sPriv->fd);
 
brw->must_use_separate_stencil = screen->hw_must_use_separate_stencil;
brw->has_swizzling = screen->hw_has_swizzling;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 682fbe9..10e8274 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1064,6 +1064,10 @@ struct brw_context
 
int gen;
int gt;
+   /* GT revision. This will be -1 if the revision couldn't be determined (eg,
+* if the kernel doesn't support the query).
+*/
+   int revision;
 
bool is_g4x;
bool is_baytrail;
-- 
1.9.3

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


Re: [Mesa-dev] [PATCH 2/2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Ilia Mirkin
On Wed, Mar 4, 2015 at 9:33 AM, Neil Roberts  wrote:
> Stepping C0 of Skylake fails when using SIMD16 with 3-source
> instructions (such as MAD). This patch just makes it disable SIMD16 in
> that case.
>
> This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
> tests.

Just curious -- is this faster than lowering MAD into MUL + ADD but
staying in SIMD16? (Should be fairly easy to implement as a post-RA
fixup I'd think, although not totally familiar with how the i965
compiler works.)

  -ilia

> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 21 +
>  src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
>  2 files changed, 22 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 533feb4..62f29e5 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3729,6 +3729,26 @@ fs_visitor::fixup_3src_null_dest()
> }
>  }
>
> +/**
> + * 3-source instructions don't work on Skylake stepping C0. If the revision
> + * isn't known then it will take the safe option and disable it in case it's
> + * C0. Implements WaDisableSIMD16On3SrcInstr.
> + */
> +void
> +fs_visitor::disable_simd16_with_3src()
> +{
> +   if (brw->gen != 9 || (brw->revision != 2 && brw->revision != -1))
> +  return;
> +
> +   foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
> +  if (inst->is_3src()) {
> + no16("SIMD16 doesn't work with 3-source instructions on "
> +  "Gen9 stepping C0\n");
> + return;
> +  }
> +   }
> +}
> +
>  void
>  fs_visitor::allocate_registers()
>  {
> @@ -3910,6 +3930,7 @@ fs_visitor::run_fs()
>assign_urb_setup();
>
>fixup_3src_null_dest();
> +  disable_simd16_with_3src();
>allocate_registers();
>
>if (failed)
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
> b/src/mesa/drivers/dri/i965/brw_fs.h
> index 70098d8..7091b9f 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -196,6 +196,7 @@ public:
> void setup_payload_gen6();
> void setup_vs_payload();
> void fixup_3src_null_dest();
> +   void disable_simd16_with_3src();
> void assign_curb_setup();
> void calculate_urb_setup();
> void assign_urb_setup();
> --
> 1.9.3
>
> ___
> 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


Re: [Mesa-dev] [PATCH] configure: ax_check_python_mako_module.m4 sets output variable

2015-03-04 Thread Kai Wasserbäch
Samuel Iglesias Gonsálvez wrote on 04.03.2015 07:54:
> On Tue, 2015-03-03 at 16:50 +0100, Kai Wasserbäch wrote:
>> Samuel Iglesias Gonsalvez wrote on 03.03.2015 08:56:
>>> This output variables gives more flexibility for future changes
>>> in autoconf to detect if it is needed to auto-generate files and
>>> check for the auto-generation dependencies.
>>>
>>> It is still returning error when Python is not installed.
>>>
>>> Signed-off-by: Samuel Iglesias Gonsalvez 
>>> ---
>>>  configure.ac  | 9 -
>>>  m4/ax_check_python_mako_module.m4 | 4 ++--
>>>  2 files changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 2ba79ef..ff7d6c9 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -114,7 +114,14 @@ if test "x$INDENT" != "xcat"; then
>>>  fi
>>>  fi
>>>  
>>> -AX_CHECK_PYTHON_MAKO_MODULE(0.3.4)
>>> +PYTHON_MAKO_REQUIRED=0.3.4
>>
>> Can you put that up into the section where all the other minimum versions are
>> defined? That would be more consistent.
>>
> 
> Yeah, I'll do it. Has this patch your R-b with this change?

Sure:
  Reviewed-by: Kai Wasserbäch 

Bonus nit: can we change the subject to something like:
 configure: Introduce new output variable to ax_check_python_mako_module.m4

Cheers,
Kai



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure: ax_check_python_mako_module.m4 sets output variable

2015-03-04 Thread Samuel Iglesias Gonsálvez
On Wed, 2015-03-04 at 15:35 +0100, Kai Wasserbäch wrote:
> Samuel Iglesias Gonsálvez wrote on 04.03.2015 07:54:
> > On Tue, 2015-03-03 at 16:50 +0100, Kai Wasserbäch wrote:
> >> Samuel Iglesias Gonsalvez wrote on 03.03.2015 08:56:
> >>> This output variables gives more flexibility for future changes
> >>> in autoconf to detect if it is needed to auto-generate files and
> >>> check for the auto-generation dependencies.
> >>>
> >>> It is still returning error when Python is not installed.
> >>>
> >>> Signed-off-by: Samuel Iglesias Gonsalvez 
> >>> ---
> >>>  configure.ac  | 9 -
> >>>  m4/ax_check_python_mako_module.m4 | 4 ++--
> >>>  2 files changed, 10 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/configure.ac b/configure.ac
> >>> index 2ba79ef..ff7d6c9 100644
> >>> --- a/configure.ac
> >>> +++ b/configure.ac
> >>> @@ -114,7 +114,14 @@ if test "x$INDENT" != "xcat"; then
> >>>  fi
> >>>  fi
> >>>  
> >>> -AX_CHECK_PYTHON_MAKO_MODULE(0.3.4)
> >>> +PYTHON_MAKO_REQUIRED=0.3.4
> >>
> >> Can you put that up into the section where all the other minimum versions 
> >> are
> >> defined? That would be more consistent.
> >>
> > 
> > Yeah, I'll do it. Has this patch your R-b with this change?
> 
> Sure:
>   Reviewed-by: Kai Wasserbäch 
> 
> Bonus nit: can we change the subject to something like:
>  configure: Introduce new output variable to ax_check_python_mako_module.m4
> 

OK.

Thanks!

Sam



signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Neil Roberts
Ilia Mirkin  writes:

> On Wed, Mar 4, 2015 at 9:33 AM, Neil Roberts  wrote:
>> Stepping C0 of Skylake fails when using SIMD16 with 3-source
>> instructions (such as MAD). This patch just makes it disable SIMD16 in
>> that case.
>>
>> This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
>> tests.
>
> Just curious -- is this faster than lowering MAD into MUL + ADD but
> staying in SIMD16? (Should be fairly easy to implement as a post-RA
> fixup I'd think, although not totally familiar with how the i965
> compiler works.)

I haven't tested it but I think you're right that it would probably be
faster to lower the instruction. However that sounds like more work and
it's only relevant for a limited set of hardware so it doesn't seem
worth doing. I think there are also other 3-source instructions and it
might be more difficult to lower those (although I'm not sure).

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


Re: [Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

2015-03-04 Thread Brian Paul

On 03/04/2015 07:08 AM, Jose Fonseca wrote:

On 04/03/15 12:58, Jose Fonseca wrote:

On 04/03/15 04:20, Matt Turner wrote:

On Tue, Mar 3, 2015 at 8:07 PM, Brian Paul  wrote:

---
  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 5210acc..e2578cf 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -493,7 +493,7 @@
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 builder.setMCPU(MCPU);
  #endif

-   ShaderMemoryManager *MM;
+   ShaderMemoryManager *MM = NULL;
 if (useMCJIT) {
  #if HAVE_LLVM > 0x0303
 BaseMemoryManager* JMM =
reinterpret_cast(CMM);
--
1.9.1


I'm guessing it's the 'delete MM;' that generates the warning? If so,
shouldn't you just wrap it in #if HAVE_LLVM > ...?

I think MCJIT is the only option in llvm >= 3.6? The code could
probably be trivially refactored to avoid the assert(0) as well.

 From what I can tell, it seems like adding initializers is nearly
always the wrong thing to do.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=eFrgqffTZg-fVfsgBecewE76PU07pVGCehKDjd2rc2Q&s=NmdJuPH44mfwP-iaquREc8ZPTboVxNFpMQhNXlMv2FY&e=





Yes, this is probably related to
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89387&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=QY0p_bDuP-f3LPn9v8UCnsJc9MFPxmK5yIA_AQLYfpk&s=QtRiKhT6OE4Vfm-MYI7OR5SNu_iqhBPIOUnOp_5tmTc&e=


But unfortunately I haven't found time to catch up with it.


On closer look, this is a different issue.  As Matt said, the issue is
the delete for older LLVM.

That said, `delete NULL` is safe, hence Brian's patch is good.


I think this is simplest.  Matt, if you look at the rest of the 
neighboring code, MM gets assigned (basically) if (using MCJIT and llvm 
>= 303) or llvm < 306 so it's kind of complex condition.  Just init'int 
to null is the simplest solution.


I'll take Jose's comment as an R-b.

-Brian


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


Re: [Mesa-dev] [PATCH 1/4] scons: Use -Werror MSVC compatibility flags per-directory.

2015-03-04 Thread Brian Paul

Series LGTM.  Reviewed-by: Brian Paul 

On 03/04/2015 07:27 AM, Jose Fonseca wrote:

Matching what we already do with autotools builds.
---
  scons/gallium.py| 27 ---
  src/egl/main/SConscript |  2 ++
  src/gallium/auxiliary/SConscript|  4 
  src/gallium/drivers/llvmpipe/SConscript |  2 ++
  src/glsl/SConscript |  2 ++
  src/loader/SConscript   |  2 ++
  src/mapi/glapi/SConscript   |  2 ++
  src/mesa/SConscript |  2 ++
  src/util/SConscript |  2 ++
  9 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index c34468f..f839758 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -87,6 +87,25 @@ def createInstallMethods(env):
  env.AddMethod(install_shared_library, 'InstallSharedLibrary')


+def msvc2013_compat(env):
+if env['gcc']:
+env.Append(CCFLAGS = [
+'-Werror=vla',
+'-Werror=pointer-arith',
+])
+
+def msvc2008_compat(env):
+msvc2013_compat(env)
+if env['gcc']:
+env.Append(CFLAGS = [
+'-Werror=declaration-after-statement',
+])
+
+def createMSVCCompatMethods(env):
+env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
+env.AddMethod(msvc2008_compat, 'MSVC2008Compat')
+
+
  def num_jobs():
  try:
  return int(os.environ['NUMBER_OF_PROCESSORS'])
@@ -443,13 +462,6 @@ def generate(env):
  '-Wmissing-prototypes',
  '-std=gnu99',
  ]
-if distutils.version.LooseVersion(ccversion) >= 
distutils.version.LooseVersion('4.2'):
-ccflags += [
-'-Wpointer-arith',
-]
-cflags += [
-'-Wdeclaration-after-statement',
-]
  if icc:
  cflags += [
  '-std=gnu99',
@@ -617,6 +629,7 @@ def generate(env):
  # Custom builders and methods
  env.Tool('custom')
  createInstallMethods(env)
+createMSVCCompatMethods(env)

  env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto 
>= 1.4.13'])
  env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 
1.8'])
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 399c020..b4e9b67 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -6,6 +6,8 @@ Import('*')

  env = env.Clone()

+env.MSVC2013Compat()
+
  env.Append(CPPDEFINES = [
  '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
  ])
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 6cb6b8c..d5fa880 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -8,6 +8,10 @@ env.Append(CPPPATH = [
  'util',
  ])

+env = env.Clone()
+
+env.MSVC2008Compat()
+
  env.CodeGenerate(
  target = 'indices/u_indices_gen.c',
  script = 'indices/u_indices_gen.py',
diff --git a/src/gallium/drivers/llvmpipe/SConscript 
b/src/gallium/drivers/llvmpipe/SConscript
index 1bea611..3a51efc 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -9,6 +9,8 @@ if not env['llvm']:

  env = env.Clone()

+env.MSVC2008Compat()
+
  llvmpipe = env.ConvenienceLibrary(
target = 'llvmpipe',
source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 21c8266..26de455 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -6,6 +6,8 @@ from sys import executable as python_cmd

  env = env.Clone()

+env.MSVC2013Compat()
+
  env.Prepend(CPPPATH = [
  '#include',
  '#src',
diff --git a/src/loader/SConscript b/src/loader/SConscript
index 359fc18..16d1053 100644
--- a/src/loader/SConscript
+++ b/src/loader/SConscript
@@ -2,6 +2,8 @@ Import('*')

  env = env.Clone()

+env.MSVC2013Compat()
+
  env.Prepend(CPPPATH = [
  '#include'
  ])
diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
index 97ebfe6..84a5068 100644
--- a/src/mapi/glapi/SConscript
+++ b/src/mapi/glapi/SConscript
@@ -8,6 +8,8 @@ Import('*')

  env = env.Clone()

+env.MSVC2013Compat()
+
  env.Append(CPPDEFINES = [
  'MAPI_MODE_UTIL',
  ])
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 62e81ce..d6ff083 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -10,6 +10,8 @@ from sys import executable as python_cmd

  env = env.Clone()

+env.MSVC2013Compat()
+
  env.Append(CPPPATH = [
  '#/src',
  '#/src/mapi',
diff --git a/src/util/SConscript b/src/util/SConscript
index 84bd7a1..9e4d481 100644
--- a/src/util/SConscript
+++ b/src/util/SConscript
@@ -6,6 +6,8 @@ from sys import executable as python_cmd

  env = env.Clone()

+env.MSVC2008Compat()
+
  env.Prepend(CPPPATH = [
  '#include',
  '#src',



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

Re: [Mesa-dev] [PATCH 2/6] i965/fs: Silence unused parameter warning

2015-03-04 Thread Ian Romanick
On 03/01/2015 05:19 PM, Jason Ekstrand wrote:
> Not sure why you Cc'd me, but whatever.  Seems obvious enough.

Because b18fd23 was your commit.  Sometimes left over, unused parameters
are the result of a mistake.  I just wanted to be sure.

> Reviewed-by: Jason Ekstrand 
> On 02/27/2015 06:50 PM, Ian Romanick wrote:
>> From: Ian Romanick 
>>
>> Unused since b18fd23.
>>
>> brw_fs.cpp:2878:44: warning: unused parameter 'dispatch_width'
>> [-Wunused-parameter]
>>   clear_deps_for_inst_src(fs_inst *inst, int dispatch_width, bool *deps,
>>  ^
>>
>> Signed-off-by: Ian Romanick 
>> Cc: Jason Ekstrand 
>> ---
>>   src/mesa/drivers/dri/i965/brw_fs.cpp | 12 
>>   1 file changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index 0354f56..126b7d0 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -2875,8 +2875,7 @@ fs_visitor::remove_duplicate_mrf_writes()
>>   }
>> static void
>> -clear_deps_for_inst_src(fs_inst *inst, int dispatch_width, bool *deps,
>> -int first_grf, int grf_len)
>> +clear_deps_for_inst_src(fs_inst *inst, bool *deps, int first_grf, int
>> grf_len)
>>   {
>>  /* Clear the flag for registers that actually got read (as
>> expected). */
>>  for (int i = 0; i < inst->sources; i++) {
>> @@ -2927,8 +2926,7 @@
>> fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
>>  memset(needs_dep, false, sizeof(needs_dep));
>>  memset(needs_dep, true, write_len);
>>   -   clear_deps_for_inst_src(inst, dispatch_width,
>> -   needs_dep, first_write_grf, write_len);
>> +   clear_deps_for_inst_src(inst, needs_dep, first_write_grf, write_len);
>>/* Walk backwards looking for writes to registers we're writing
>> which
>>   * aren't read since being written.  If we hit the start of the
>> program,
>> @@ -2968,8 +2966,7 @@
>> fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
>> }
>>   /* Clear the flag for registers that actually got read (as
>> expected). */
>> -  clear_deps_for_inst_src(scan_inst, dispatch_width,
>> -  needs_dep, first_write_grf, write_len);
>> +  clear_deps_for_inst_src(scan_inst, needs_dep, first_write_grf,
>> write_len);
>>   /* Continue the loop only if we haven't resolved all the
>> dependencies */
>> int i;
>> @@ -3014,8 +3011,7 @@
>> fs_visitor::insert_gen4_post_send_dependency_workarounds(bblock_t
>> *block, fs_ins
>> }
>>   /* Clear the flag for registers that actually got read (as
>> expected). */
>> -  clear_deps_for_inst_src(scan_inst, dispatch_width,
>> -  needs_dep, first_write_grf, write_len);
>> +  clear_deps_for_inst_src(scan_inst, needs_dep, first_write_grf,
>> write_len);
>>   /* We insert our reads as late as possible since they're
>> reading the
>>  * result of a SEND, which has massive latency.

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


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-03-04 Thread Ian Romanick
On 02/28/2015 10:33 AM, Ilia Mirkin wrote:
> On Sat, Feb 28, 2015 at 1:26 PM, Carl Worth  wrote:
>> On Fri, Feb 27 2015, Ian Romanick wrote:
>>> All dd functions take a gl_context as the first parameter.  Instead of
>>> removing it, just silence the warning.
>>
>> For code using gcc, I really prefer the __attribute__((__unused__))
>> style, (though, obviously hidden in a reasonable looking macro). That
>> results in cleaner looking code than these weird unused expressions
>> being cast to void.
> 
> Another clean alternative is to leave the name of the variable out, i.e.
> 
> function(struct gl_context *)
> 
> instead of
> 
> function(struct gl_context *foo)

I use that method a lot because it makes the intention very obvious,
but, as others have mentioned, it's only available in C++.

>> Does MSVC have an equivalent? Or, does it not emit the warning in the
>> first place such that we could just define the macro as empty outside of
>> gcc?
>>
>> So there's room for investigation here. In the meantime:
>>
>> Reviewed-by: Carl Worth 
>>
>> -Carl
>>
>> ___
>> 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


[Mesa-dev] [PATCH] clover: Enable cl_khr_fp64 for devices that support doubles v4

2015-03-04 Thread Tom Stellard
v2:
  - Report correct values for CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
and CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE.
  - Only define cl_khr_fp64 if the extension is supported.
  - Remove trailing space from extension string.
  - Rename device query function from cl_khr_fp86() to
has_doubles().

v3:
  - Return 0 for device::doubled_fp_confg() when doubles aren't
supported.

v4:
  - Remove device query for double fp_config.
---
 src/gallium/state_trackers/clover/api/device.cpp  | 21 ++---
 src/gallium/state_trackers/clover/core/device.cpp |  6 ++
 src/gallium/state_trackers/clover/core/device.hpp |  1 +
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/device.cpp 
b/src/gallium/state_trackers/clover/api/device.cpp
index e825468..b1f556f 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -145,7 +145,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
   break;
 
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE:
-  buf.as_scalar() = 2;
+  buf.as_scalar() = dev.has_doubles() ? 2 : 0;
   break;
 
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF:
@@ -205,6 +205,21 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
  CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
   break;
 
+   case CL_DEVICE_DOUBLE_FP_CONFIG:
+  if (dev.has_doubles())
+ // This is the "mandated minimum double precision floating-point
+ // capability"
+ buf.as_scalar() =
+   CL_FP_FMA
+ | CL_FP_ROUND_TO_NEAREST
+ | CL_FP_ROUND_TO_ZERO
+ | CL_FP_ROUND_TO_INF
+ | CL_FP_INF_NAN
+ | CL_FP_DENORM;
+  else
+ buf.as_scalar() = 0;
+  break;
+
case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:
   buf.as_scalar() = CL_NONE;
   break;
@@ -283,7 +298,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
   break;
 
case CL_DEVICE_EXTENSIONS:
-  buf.as_string() = "";
+  buf.as_string() = dev.has_doubles() ? "cl_khr_fp64" : "";
   break;
 
case CL_DEVICE_PLATFORM:
@@ -315,7 +330,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
   break;
 
case CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE:
-  buf.as_scalar() = 2;
+  buf.as_scalar() = dev.has_doubles() ? 2 : 0;
   break;
 
case CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF:
diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
b/src/gallium/state_trackers/clover/core/device.cpp
index 688a7dd..c3f3b4e 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -173,6 +173,12 @@ device::image_support() const {
   PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0];
 }
 
+bool
+device::has_doubles() const {
+   return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
+ PIPE_SHADER_CAP_DOUBLES);
+}
+
 std::vector
 device::max_block_size() const {
auto v = get_compute_param(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
diff --git a/src/gallium/state_trackers/clover/core/device.hpp 
b/src/gallium/state_trackers/clover/core/device.hpp
index 2201700..de5fc6b 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -64,6 +64,7 @@ namespace clover {
   cl_uint max_clock_frequency() const;
   cl_uint max_compute_units() const;
   bool image_support() const;
+  bool has_doubles() const;
 
   std::vector max_block_size() const;
   std::string device_name() const;
-- 
2.0.4

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


Re: [Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

2015-03-04 Thread Mark Janes
Hi Brian,

Did you try to `make check` in mesa with these patches?

I get errors compiling glx-test:

src/glx/glxclient.h:59:25: fatal error: util/macros.h: No such file or
directory

-Mark

Brian Paul  writes:

> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
> b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 5210acc..e2578cf 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -493,7 +493,7 @@ 
> lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
> builder.setMCPU(MCPU);
>  #endif
>  
> -   ShaderMemoryManager *MM;
> +   ShaderMemoryManager *MM = NULL;
> if (useMCJIT) {
>  #if HAVE_LLVM > 0x0303
> BaseMemoryManager* JMM = reinterpret_cast(CMM);
> -- 
> 1.9.1
>
> ___
> 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


[Mesa-dev] [PATCH] glx/tests: add -I src/ to fix make check

2015-03-04 Thread Brian Paul
---
 src/glx/tests/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index dd82449..b02a9e3 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -2,6 +2,7 @@ if HAVE_SHARED_GLAPI
 AM_CFLAGS = $(PTHREAD_CFLAGS)
 AM_CPPFLAGS = \
-I$(top_srcdir)/src/gtest/include \
+   -I$(top_srcdir)/src \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/glx \
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] common: Correct PBO 2D_ARRAY handling.

2015-03-04 Thread Laura Ekstrand
The Meta PBO upload path does not exist in 10.4, so we don't need to worry
about a backport.

On Tue, Mar 3, 2015 at 6:01 PM, Emil Velikov 
wrote:

> On 24 February 2015 at 23:20, Laura Ekstrand  wrote:
> > Changes PBO uploads and downloads to use a tall (height * depth) 2D
> texture
> > for blitting. This fixes the bug where 2D_ARRAY, 3D, and CUBE_MAP_ARRAY
> > textures are not properly uploaded and downloaded.
> >
> > Removes the option to use a 2D ARRAY texture for the PBO during upload
> and
> > download.  This option didn't work because the miptree couldn't be set up
> > reliably.
> >
> > v2: Review from Jason Ekstrand and Neil Roberts:
> >-Delete the depth parameter from create_texture_for_pbo
> >-Abandon the option to create a 2D ARRAY texture in
> create_texture_for_pbo
> > ---
> >  src/mesa/drivers/common/meta_tex_subimage.c | 26
> +-
> >  1 file changed, 17 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
> b/src/mesa/drivers/common/meta_tex_subimage.c
> > index 2d2b9d8..b659426 100644
> > --- a/src/mesa/drivers/common/meta_tex_subimage.c
> > +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> > @@ -44,7 +44,7 @@
> >
> >  static struct gl_texture_image *
> >  create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,
> > -   GLenum pbo_target, int width, int height, int
> depth,
> > +   GLenum pbo_target, int width, int height,
> > GLenum format, GLenum type, const void *pixels,
> > const struct gl_pixelstore_attrib *packing,
> > GLuint *tmp_pbo, GLuint *tmp_tex)
> > @@ -57,8 +57,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
> > struct gl_texture_image *tex_image;
> > bool read_only;
> >
> > -   if ((packing->ImageHeight != 0 && packing->ImageHeight != height) ||
> > -   packing->SwapBytes ||
> > +   if (packing->SwapBytes ||
> > packing->LsbFirst ||
> > packing->Invert)
> >return NULL;
> > @@ -99,7 +98,6 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
> >
> > _mesa_GenTextures(1, tmp_tex);
> > tex_obj = _mesa_lookup_texture(ctx, *tmp_tex);
> > -   tex_obj->Target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
> > _mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex,
> GL_TEXTURE_2D);
> > /* This must be set after _mesa_initialize_texture_object, not
> before. */
> > tex_obj->Immutable = GL_TRUE;
> > @@ -109,7 +107,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
> > internal_format = _mesa_get_format_base_format(pbo_format);
> >
> > tex_image = _mesa_get_tex_image(ctx, tex_obj, tex_obj->Target, 0);
> > -   _mesa_init_teximage_fields(ctx, tex_image, width, height, depth,
> > +   _mesa_init_teximage_fields(ctx, tex_image, width, height, 1,
> >0, internal_format, pbo_format);
> >
> > read_only = pbo_target == GL_PIXEL_UNPACK_BUFFER;
> > @@ -169,9 +167,14 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
> >return true;
> > }
> >
> > +   /* Only accept tightly packed pixels from the user. */
> > +   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
> > +  return false;
> > +
> > +   /* For arrays, use a tall (height * depth) 2D texture. */
> > pbo_tex_image = create_texture_for_pbo(ctx, create_pbo,
> >GL_PIXEL_UNPACK_BUFFER,
> > -  width, height, depth,
> > +  width, height * depth,
> >format, type, pixels, packing,
> >&pbo, &pbo_tex);
> > if (!pbo_tex_image)
> > @@ -225,7 +228,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
> >_mesa_update_state(ctx);
> >
> >_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
> > - 0, 0, width, height,
> > + 0, z * height, width, (z + 1) * height,
> >   xoffset, yoffset,
> >   xoffset + width, yoffset + height,
> >   GL_COLOR_BUFFER_BIT, GL_NEAREST);
> > @@ -285,8 +288,13 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context
> *ctx, GLuint dims,
> >return true;
> > }
> >
> > +   /* Only accept tightly packed pixels from the user. */
> > +   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
> > +  return false;
> > +
> > +   /* For arrays, use a tall (height * depth) 2D texture. */
> > pbo_tex_image = create_texture_for_pbo(ctx, false,
> GL_PIXEL_PACK_BUFFER,
> > -  width, height, depth,
> > +  width, height * depth,
> >

[Mesa-dev] [PATCH v2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Neil Roberts
Steppings C0 and D0 of Skylake fail when using SIMD16 with 3-source
instructions (such as MAD). This patch just makes it disable SIMD16 in
those cases.

This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
tests.

v2: Also apply on stepping D0
---

Damien Lespiau pointed out that the workaround also needs to be
applied on stepping D0.

 src/mesa/drivers/dri/i965/brw_fs.cpp | 22 ++
 src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
 2 files changed, 23 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 533feb4..b61208b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3729,6 +3729,27 @@ fs_visitor::fixup_3src_null_dest()
}
 }
 
+/**
+ * 3-source instructions don't work on Skylake steppings C0 and D0. If the
+ * revision isn't known then it will take the safe option and disable it in
+ * case it's one of those. Implements WaDisableSIMD16On3SrcInstr.
+ */
+void
+fs_visitor::disable_simd16_with_3src()
+{
+   if (brw->gen != 9 ||
+   (brw->revision != 2 && brw->revision != 3 && brw->revision != -1))
+  return;
+
+   foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
+  if (inst->is_3src()) {
+ no16("SIMD16 doesn't work with 3-source instructions on "
+  "Gen9 steppings C0 and D0\n");
+ return;
+  }
+   }
+}
+
 void
 fs_visitor::allocate_registers()
 {
@@ -3910,6 +3931,7 @@ fs_visitor::run_fs()
   assign_urb_setup();
 
   fixup_3src_null_dest();
+  disable_simd16_with_3src();
   allocate_registers();
 
   if (failed)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 70098d8..7091b9f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -196,6 +196,7 @@ public:
void setup_payload_gen6();
void setup_vs_payload();
void fixup_3src_null_dest();
+   void disable_simd16_with_3src();
void assign_curb_setup();
void calculate_urb_setup();
void assign_urb_setup();
-- 
1.9.3

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


[Mesa-dev] [PATCH 3/3] meta: Fix the y offset for 1D_ARRAY in _mesa_meta_pbo_TexSubImage

2015-03-04 Thread Neil Roberts
The yoffset needs to be interpreted as a slice offset for 1D array
textures. This patch implements that by moving the yoffset into
zoffset similar to how it moves the height into depth.
---
 src/mesa/drivers/common/meta_tex_subimage.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/meta_tex_subimage.c 
b/src/mesa/drivers/common/meta_tex_subimage.c
index f360d64..e29addb 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -205,8 +205,12 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
 
if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
   assert(depth == 1);
+  assert(zoffset == 0);
   depth = height;
   height = 1;
+  image_height = 1;
+  zoffset = yoffset;
+  yoffset = 0;
}
 
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
@@ -322,8 +326,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
 
if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
   assert(depth == 1);
+  assert(zoffset == 0);
   depth = height;
   height = 1;
+  image_height = 1;
+  zoffset = yoffset;
+  yoffset = 0;
}
 
/* If we were given a texture, bind it to the read framebuffer.  If not,
-- 
1.9.3

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


[Mesa-dev] [PATCH 2/3] meta: Allow GL_UN/PACK_IMAGE_HEIGHT in _mesa_meta_pbo_Get/TexSubImage

2015-03-04 Thread Neil Roberts
Now that a layered source PBO is interpreted as a single tall 2D image
it's quite easy to accept the image height packing option by just
creating an image that is tall enough to include the image padding.

I'm not sure whether the image height property should affect 1D_ARRAY
textures. My intuition and interpretation of the GL spec (which is a
bit vague) would be that it shouldn't. However the software fallback
path in Mesa uses the property for packing but not for unpacking. The
binary NVidia driver uses it for both. This patch doesn't use it for
either case so it is different from the software fallback. There is
some discussion about this here:

http://lists.freedesktop.org/archives/mesa-dev/2015-February/077925.html

This is tested by the texsubimage Piglit test with the array and pbo
arguments. Previously this test was skipping this code path because it
always sets the image height.

I've also tested it by modifying the getteximage-targets test. It
wasn't using this code path before because it was using the default
texture object so this code couldn't successfully create a frame
buffer. I also modified it to add some image padding with the image
height in the PBO.
---
 src/mesa/drivers/common/meta_tex_subimage.c | 32 ++---
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/common/meta_tex_subimage.c 
b/src/mesa/drivers/common/meta_tex_subimage.c
index 1fef79d..f360d64 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -144,6 +144,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
const struct gl_pixelstore_attrib *packing)
 {
GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
+   int full_height, image_height;
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
@@ -177,14 +178,16 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
   return true;
}
 
-   /* Only accept tightly packed pixels from the user. */
-   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
-  return false;
+   /* For arrays, use a tall (height * depth) 2D texture but taking into
+* account the inter-image padding specified with the image height packing
+* property.
+*/
+   image_height = packing->ImageHeight == 0 ? height : packing->ImageHeight;
+   full_height = image_height * (depth - 1) + height;
 
-   /* For arrays, use a tall (height * depth) 2D texture. */
pbo_tex_image = create_texture_for_pbo(ctx, create_pbo,
   GL_PIXEL_UNPACK_BUFFER,
-  width, height * depth,
+  width, full_height,
   format, type, pixels, packing,
   &pbo, &pbo_tex);
if (!pbo_tex_image)
@@ -236,7 +239,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
   _mesa_update_state(ctx);
 
   _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
- 0, z * height, width, (z + 1) * height,
+ 0, z * image_height,
+ width, z * image_height + height,
  xoffset, yoffset,
  xoffset + width, yoffset + height,
  GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -263,6 +267,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
   const struct gl_pixelstore_attrib *packing)
 {
GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
+   int full_height, image_height;
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
@@ -296,13 +301,15 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
   return true;
}
 
-   /* Only accept tightly packed pixels from the user. */
-   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
-  return false;
+   /* For arrays, use a tall (height * depth) 2D texture but taking into
+* account the inter-image padding specified with the image height packing
+* property.
+*/
+   image_height = packing->ImageHeight == 0 ? height : packing->ImageHeight;
+   full_height = image_height * (depth - 1) + height;
 
-   /* For arrays, use a tall (height * depth) 2D texture. */
pbo_tex_image = create_texture_for_pbo(ctx, false, GL_PIXEL_PACK_BUFFER,
-  width, height * depth,
+  width, full_height * depth,
   format, type, pixels, packing,
   &pbo, &pbo_tex);
if (!pbo_tex_image)
@@ -361,7 +368,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
   _mesa_meta_BlitFramebuf

[Mesa-dev] [PATCH 1/3] Revert "common: Fix PBOs for 1D_ARRAY."

2015-03-04 Thread Neil Roberts
This reverts commit 546aba143d13ba3f993ead4cc30b2404abfc0202.

I think the changes to the calls to glBlitFramebuffer from this patch
are no different to what it was doing previously because it used to
set height to 1 before doing the blits. However it was introducing
some problems with the blit for layer 0 because this was no longer
special cased. It didn't fix problems with the yoffset which needs to
be interpreted as a slice offset. I think a better solution would be
to modify the original if statement to cope with the yoffset.

Conflicts:
src/mesa/drivers/common/meta_tex_subimage.c
---
 src/mesa/drivers/common/meta_tex_subimage.c | 62 -
 1 file changed, 26 insertions(+), 36 deletions(-)

diff --git a/src/mesa/drivers/common/meta_tex_subimage.c 
b/src/mesa/drivers/common/meta_tex_subimage.c
index 971ed59..1fef79d 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -147,7 +147,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
-   int z, iters;
+   int z;
 
/* XXX: This should probably be passed in from somewhere */
const char *where = "_mesa_meta_pbo_TexSubImage";
@@ -200,6 +200,12 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
_mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
 
+   if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+  assert(depth == 1);
+  depth = height;
+  height = 1;
+   }
+
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
  pbo_tex_image, 0);
/* If this passes on the first layer it should pass on the others */
@@ -223,27 +229,17 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint 
dims,
   GL_COLOR_BUFFER_BIT, GL_NEAREST))
   goto fail;
 
-   iters = tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY ?
-   height : depth;
-
-   for (z = 1; z < iters; z++) {
+   for (z = 1; z < depth; z++) {
   _mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
 tex_image, zoffset + z);
 
   _mesa_update_state(ctx);
 
-  if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
-0, z, width, z + 1,
-xoffset, yoffset,
-xoffset + width, yoffset + 1,
-GL_COLOR_BUFFER_BIT, GL_NEAREST);
-  else
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
-0, z * height, width, (z + 1) * height,
-xoffset, yoffset,
-xoffset + width, yoffset + height,
-GL_COLOR_BUFFER_BIT, GL_NEAREST);
+  _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
+ 0, z * height, width, (z + 1) * height,
+ xoffset, yoffset,
+ xoffset + width, yoffset + height,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
 
success = true;
@@ -270,7 +266,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
-   int z, iters;
+   int z;
 
/* XXX: This should probably be passed in from somewhere */
const char *where = "_mesa_meta_pbo_GetTexSubImage";
@@ -317,6 +313,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
 
_mesa_GenFramebuffers(2, fbos);
 
+   if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+  assert(depth == 1);
+  depth = height;
+  height = 1;
+   }
+
/* If we were given a texture, bind it to the read framebuffer.  If not,
 * we're doing a ReadPixels and we should just use whatever framebuffer
 * the client has bound.
@@ -350,29 +352,17 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
   GL_COLOR_BUFFER_BIT, GL_NEAREST))
   goto fail;
 
-   if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
-  iters = height;
-   else
-  iters = depth;
-
-   for (z = 1; z < iters; z++) {
+   for (z = 1; z < depth; z++) {
   _mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
 tex_image, zoffset + z);
 
   _mesa_update_state(ctx);
 
-  if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
-xoffset, yoffset,
-  

Re: [Mesa-dev] [PATCH] i965: Throttle rendering to an fbo

2015-03-04 Thread Chad Versace
On 02/26/2015 05:24 AM, Chris Wilson wrote:
> When rendering to an fbo, even though it may be acting as a winsys
> frontbuffer or just generally, we never throttle. However, when rendering
> to an fbo, there is no natural frame boundary. Conventionally we use
> SwapBuffers and glFinish, but potential callers avoid often glFinish for
> being too heavy handed (waiting on all outstanding rendering to complete).
> The kernel provides a soft-throttling option for this case that waits for
> rendering older than 20ms to be complete (that's a little too lax to be
> used for swapbuffers, but is here a useful safety net). The remaining
> choice is then either never to throttle, throttle after every draw call,
> or at an intermediate user defined point such as glFlush and thus all the
> implied flushes. This patch opts for the latter.
> 
> Signed-off-by: Chris Wilson 
> Cc: Daniel Vetter 
> Cc: Kenneth Graunke 
> Cc: Ben Widawsky 
> Cc: Kristian Høgsberg 
> ---
>  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index c844888..f190df1 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -229,11 +229,14 @@ static void
>  intel_glFlush(struct gl_context *ctx)
>  {
> struct brw_context *brw = brw_context(ctx);
> +   __DRIscreen *psp = brw->intelScreen->driScrnPriv;
>  
> intel_batchbuffer_flush(brw);
> intel_flush_front(ctx);
> if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
>brw->need_throttle = true;
> +
> +   drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
>  }
>  
>  static void
> 

glFlush should not wait for previous rendering to complete. It's not supposed
to be a blocking operation.

Why this patch? What are you trying to fix?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] i965: Store the GPU revision number in brw_context

2015-03-04 Thread Kristian Høgsberg
On Wed, Mar 4, 2015 at 6:32 AM, Neil Roberts  wrote:
> brwContextInit now queries the GPU revision number via a new parameter
> for DRM_I915_GETPARAM. This new parameter requires a kernel patch and
> a patch to libdrm. If the kernel doesn't support it then it will
> continue but set the revision number to -1. The intention is to use
> this to implement workarounds that are only needed on certain
> steppings of the GPU.

Reviewed-by: Kristian Høgsberg 

> ---
>  configure.ac|  2 +-
>  src/mesa/drivers/dri/i965/brw_context.c | 19 +++
>  src/mesa/drivers/dri/i965/brw_context.h |  4 
>  3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index c5abbfd..23ac927 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -61,7 +61,7 @@ AC_SUBST([OSMESA_VERSION])
>  dnl Versions for external dependencies
>  LIBDRM_REQUIRED=2.4.38
>  LIBDRM_RADEON_REQUIRED=2.4.56
> -LIBDRM_INTEL_REQUIRED=2.4.52
> +LIBDRM_INTEL_REQUIRED=2.4.59
>  LIBDRM_NVVIEUX_REQUIRED=2.4.33
>  LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
>  LIBDRM_FREEDRENO_REQUIRED=2.4.57
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index 786e6f5..18f72d8 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -651,6 +651,24 @@ brw_process_driconf_options(struct brw_context *brw)
>driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
>  }
>
> +static int
> +brw_get_revision(int fd)
> +{
> +   struct drm_i915_getparam gp;
> +   int revision;
> +   int ret;
> +
> +   memset(&gp, 0, sizeof(gp));
> +   gp.param = I915_PARAM_REVISION;
> +   gp.value = &revision;
> +
> +   ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
> +   if (ret)
> +  revision = -1;
> +
> +   return revision;
> +}
> +
>  GLboolean
>  brwCreateContext(gl_api api,
>  const struct gl_config *mesaVis,
> @@ -709,6 +727,7 @@ brwCreateContext(gl_api api,
> brw->has_negative_rhw_bug = devinfo->has_negative_rhw_bug;
> brw->needs_unlit_centroid_workaround =
>devinfo->needs_unlit_centroid_workaround;
> +   brw->revision = brw_get_revision(sPriv->fd);
>
> brw->must_use_separate_stencil = screen->hw_must_use_separate_stencil;
> brw->has_swizzling = screen->hw_has_swizzling;
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 682fbe9..10e8274 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1064,6 +1064,10 @@ struct brw_context
>
> int gen;
> int gt;
> +   /* GT revision. This will be -1 if the revision couldn't be determined 
> (eg,
> +* if the kernel doesn't support the query).
> +*/
> +   int revision;
>
> bool is_g4x;
> bool is_baytrail;
> --
> 1.9.3
>
> ___
> 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


[Mesa-dev] [PATCH] mapi: fix build after 8aa9191878a5608fc6e4e8c72bea1d25cd821dec

2015-03-04 Thread Mark Janes
Due to recent #include changes, `make check` fails on glx-test.  The
target requires a standard include path to find util/macros.h.
---
 src/glx/tests/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index dd82449..4db01c0 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -1,6 +1,7 @@
 if HAVE_SHARED_GLAPI
 AM_CFLAGS = $(PTHREAD_CFLAGS)
 AM_CPPFLAGS = \
+   -I$(top_srcdir)/src \
-I$(top_srcdir)/src/gtest/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
-- 
2.1.4

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


Re: [Mesa-dev] [PATCH] i965: Throttle rendering to an fbo

2015-03-04 Thread Chris Wilson
On Wed, Mar 04, 2015 at 09:41:56AM -0800, Chad Versace wrote:
> On 02/26/2015 05:24 AM, Chris Wilson wrote:
> > When rendering to an fbo, even though it may be acting as a winsys
> > frontbuffer or just generally, we never throttle. However, when rendering
> > to an fbo, there is no natural frame boundary. Conventionally we use
> > SwapBuffers and glFinish, but potential callers avoid often glFinish for
> > being too heavy handed (waiting on all outstanding rendering to complete).
> > The kernel provides a soft-throttling option for this case that waits for
> > rendering older than 20ms to be complete (that's a little too lax to be
> > used for swapbuffers, but is here a useful safety net). The remaining
> > choice is then either never to throttle, throttle after every draw call,
> > or at an intermediate user defined point such as glFlush and thus all the
> > implied flushes. This patch opts for the latter.
> > 
> > Signed-off-by: Chris Wilson 
> > Cc: Daniel Vetter 
> > Cc: Kenneth Graunke 
> > Cc: Ben Widawsky 
> > Cc: Kristian Høgsberg 
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> > b/src/mesa/drivers/dri/i965/brw_context.c
> > index c844888..f190df1 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.c
> > +++ b/src/mesa/drivers/dri/i965/brw_context.c
> > @@ -229,11 +229,14 @@ static void
> >  intel_glFlush(struct gl_context *ctx)
> >  {
> > struct brw_context *brw = brw_context(ctx);
> > +   __DRIscreen *psp = brw->intelScreen->driScrnPriv;
> >  
> > intel_batchbuffer_flush(brw);
> > intel_flush_front(ctx);
> > if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
> >brw->need_throttle = true;
> > +
> > +   drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
> >  }
> >  
> >  static void
> > 
> 
> glFlush should not wait for previous rendering to complete. It's not supposed
> to be a blocking operation.

The manpage for glFlush says

"glFlush can return at any time.  It does not wait until the execution of *all*
previously issued GL commands is complete."

Emphasis mine. In double buffered, and normal frontbuffered (non-fbo),
rendering the throttle is a no-op as there will not be any old rendering
to wait upon.

> Why this patch? What are you trying to fix?
http://patchwork.freedesktop.org/patch/43432/
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Kristian Høgsberg
On Wed, Mar 4, 2015 at 9:20 AM, Neil Roberts  wrote:
> Steppings C0 and D0 of Skylake fail when using SIMD16 with 3-source
> instructions (such as MAD). This patch just makes it disable SIMD16 in
> those cases.
>
> This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
> tests.
>
> v2: Also apply on stepping D0
> ---
>
> Damien Lespiau pointed out that the workaround also needs to be
> applied on stepping D0.
>
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 22 ++
>  src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
>  2 files changed, 23 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 533feb4..b61208b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3729,6 +3729,27 @@ fs_visitor::fixup_3src_null_dest()
> }
>  }
>
> +/**
> + * 3-source instructions don't work on Skylake steppings C0 and D0. If the
> + * revision isn't known then it will take the safe option and disable it in
> + * case it's one of those. Implements WaDisableSIMD16On3SrcInstr.
> + */
> +void
> +fs_visitor::disable_simd16_with_3src()
> +{
> +   if (brw->gen != 9 ||
> +   (brw->revision != 2 && brw->revision != 3 && brw->revision != -1))
> +  return;
> +
> +   foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
> +  if (inst->is_3src()) {
> + no16("SIMD16 doesn't work with 3-source instructions on "
> +  "Gen9 steppings C0 and D0\n");
> + return;
> +  }
> +   }
> +}
> +
>  void
>  fs_visitor::allocate_registers()
>  {
> @@ -3910,6 +3931,7 @@ fs_visitor::run_fs()
>assign_urb_setup();
>
>fixup_3src_null_dest();
> +  disable_simd16_with_3src();

We need this in run_vs() too, right?

Kristian

>allocate_registers();
>
>if (failed)
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
> b/src/mesa/drivers/dri/i965/brw_fs.h
> index 70098d8..7091b9f 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -196,6 +196,7 @@ public:
> void setup_payload_gen6();
> void setup_vs_payload();
> void fixup_3src_null_dest();
> +   void disable_simd16_with_3src();
> void assign_curb_setup();
> void calculate_urb_setup();
> void assign_urb_setup();
> --
> 1.9.3
>
> ___
> 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


[Mesa-dev] [PATCH v2 6/6] i965: Don't write past the end of the application supplied buffer

2015-03-04 Thread Ian Romanick
From: Ian Romanick 

Both the AMD and Intel APIs provide a dataSize parameter, and this
function would merrily ignore it.  Neither API specifies what to do when
the buffer isn't big enough.  I take the easy route of writing all the
complete bits of data that will fit.  With more complete specs, we could
probably do something different.

I noticed this while looking into an unused parameter warning.  The
warning was actually useful!

brw_performance_monitor.c: In function 'brw_get_perf_monitor_result':
brw_performance_monitor.c:1261:37: warning: unused parameter 'data_size' 
[-Wunused-parameter]
 GLsizei data_size,
 ^

v2: Fix checks to include offset in the calculation.  Noticed by Jan.

Signed-off-by: Ian Romanick 
Cc: Kenneth Graunke 
Cc: Jan Vesely 
---
 src/mesa/drivers/dri/i965/brw_performance_monitor.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c 
b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
index 6c31d4c..2c8cd49 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
@@ -1264,6 +1264,7 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
 {
struct brw_context *brw = brw_context(ctx);
struct brw_perf_monitor_object *monitor = brw_perf_monitor(m);
+   const GLuint *const data_end = (GLuint *)((uint8_t *) data + data_size);
 
DBG("GetResult(%d)\n", m->Name);
brw_dump_perf_monitors(brw);
@@ -1309,9 +1310,11 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
  if (counter < 0 || !BITSET_TEST(m->ActiveCounters[group], counter))
 continue;
 
- data[offset++] = group;
- data[offset++] = counter;
- data[offset++] = monitor->oa_results[i];
+ if (data + offset + 3 <= data_end) {
+data[offset++] = group;
+data[offset++] = counter;
+data[offset++] = monitor->oa_results[i];
+ }
   }
 
   clean_bookend_bo(brw);
@@ -1335,10 +1338,12 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
 
   for (int i = 0; i < num_counters; i++) {
  if (BITSET_TEST(m->ActiveCounters[PIPELINE_STATS_COUNTERS], i)) {
-data[offset++] = PIPELINE_STATS_COUNTERS;
-data[offset++] = i;
-*((uint64_t *) (&data[offset])) = 
monitor->pipeline_stats_results[i];
-offset += 2;
+if (data + offset + 4 <= data_end) {
+   data[offset++] = PIPELINE_STATS_COUNTERS;
+   data[offset++] = i;
+   *((uint64_t *) (&data[offset])) = 
monitor->pipeline_stats_results[i];
+   offset += 2;
+}
  }
   }
}
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH] glx/tests: add -I src/ to fix make check

2015-03-04 Thread Ian Romanick
Due to 0339e7db, right?  If so,

Reviewed-by: Ian Romanick 

On 03/04/2015 09:03 AM, Brian Paul wrote:
> ---
>  src/glx/tests/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
> index dd82449..b02a9e3 100644
> --- a/src/glx/tests/Makefile.am
> +++ b/src/glx/tests/Makefile.am
> @@ -2,6 +2,7 @@ if HAVE_SHARED_GLAPI
>  AM_CFLAGS = $(PTHREAD_CFLAGS)
>  AM_CPPFLAGS = \
>   -I$(top_srcdir)/src/gtest/include \
> + -I$(top_srcdir)/src \
>   -I$(top_srcdir)/src/mapi \
>   -I$(top_srcdir)/src/mesa \
>   -I$(top_srcdir)/src/glx \
> 

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


Re: [Mesa-dev] [PATCH] glx/tests: add -I src/ to fix make check

2015-03-04 Thread Brian Paul

Right.

-Brian

On 03/04/2015 10:56 AM, Ian Romanick wrote:

Due to 0339e7db, right?  If so,

Reviewed-by: Ian Romanick 

On 03/04/2015 09:03 AM, Brian Paul wrote:

---
  src/glx/tests/Makefile.am | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index dd82449..b02a9e3 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -2,6 +2,7 @@ if HAVE_SHARED_GLAPI
  AM_CFLAGS = $(PTHREAD_CFLAGS)
  AM_CPPFLAGS = \
-I$(top_srcdir)/src/gtest/include \
+   -I$(top_srcdir)/src \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/glx \





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


Re: [Mesa-dev] [PATCH] mapi: fix build after 8aa9191878a5608fc6e4e8c72bea1d25cd821dec

2015-03-04 Thread Ian Romanick
Brian also sent this patch, and I sent his a R-b because I saw it first. :)

On 03/04/2015 09:49 AM, Mark Janes wrote:
> Due to recent #include changes, `make check` fails on glx-test.  The
> target requires a standard include path to find util/macros.h.
> ---
>  src/glx/tests/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
> index dd82449..4db01c0 100644
> --- a/src/glx/tests/Makefile.am
> +++ b/src/glx/tests/Makefile.am
> @@ -1,6 +1,7 @@
>  if HAVE_SHARED_GLAPI
>  AM_CFLAGS = $(PTHREAD_CFLAGS)
>  AM_CPPFLAGS = \
> + -I$(top_srcdir)/src \
>   -I$(top_srcdir)/src/gtest/include \
>   -I$(top_srcdir)/src/mapi \
>   -I$(top_srcdir)/src/mesa \
> 

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


Re: [Mesa-dev] nesa-10.4.4: gallivm/lp_bld_misc.cpp:503:38: error: no viable conversion from 'ShaderMemoryManager *' to 'std::unique_ptr'

2015-03-04 Thread Roland Scheidegger
Am 04.03.2015 um 12:38 schrieb Jose Fonseca:
> On 04/03/15 02:00, Emil Velikov wrote:
>> On 27 February 2015 at 23:28, Sedat Dilek  wrote:
>>> On Mon, Feb 9, 2015 at 6:30 PM, Emil Velikov
>>>  wrote:
 On 07/02/15 21:44, Sedat Dilek wrote:
> Hi,
>
> I was building mesa v10.4.4 with my llvm-toolchain v3.6.0rc2.
>
> My build breaks like this...
>
> ...
>
> Please cherry-pick...
>
> commit ef7e0b39a24966526b102643523feac765771842
> "gallivm: Update for RTDyldMemoryManager becoming an unique_ptr."
>
> ..for mesa 10.4 Git branch.
>
 Hi Sedat,

 Picking a fix in a stable branch against a non-final release sounds
 like
 a no-go in our books. As the official llvm 3.6 rolls out we'll pick
 this
 fix for the stable branches - until then I would recommend (a) applying
 it locally or (b) using mesa from the 10.5 or master branch.

>>>
>>> Just FYI...
>>>
>>> [LLVMdev] LLVM 3.6 Release (see [1]).
>>>
>>> Please pick this patch for-10.4, thanks.
>>>
>> As promised, mesa 10.4.6 will feature this.
> 
> But is cross-porting this patch enough?
> 
> As I said when this first issue was raised fixing the build with LLVM
> 3.6 is just half of the problem.  It must also _run_ correctly.  And
> building correctly doesn't necessarily means it will run correctly.
> 
> 
> 
> That is, unless somebody actually ensures that all LLVM 3.6 related
> fixes have been crossported and that things run correctly, it is
> misleading to enable the build of Mesa 10.4.6 with LLVM 3.6.
> 
> I don't know about radeon drivers, but at least from llvmpipe POV I
> simply don't have the time to do this (go through every LLVM 3.6 related
> patch, ensure they are all in 10.4.6, and test).
> 
> 
> I quickly went through the diffs between 10.4 branch, and found one such
> commit is missing:
> 
> 
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=74f505fa73eda0c9b5b1984bebb44cedac8e8794
>  
> https://bugs.freedesktop.org/show_bug.cgi?id=85467
> 
> But there might be more, and I don't know if crossporting this is safe
> or not.
> 
> 
> Therefore my stance for is that building Mesa stable releases with LLVM
> releases after the Mesa release was branched is still unsupported.  If
> people want to do so, they will do at their own peril. And any incoming
> bugs will be "unsupported, use Mesa.
> 
> 
> If having a Mesa release capable of building LLVM 3.6 is so important, I
> think it might be easier/safer to just make a new release from a recent
> enough commit, than trying to backport it.
> 
> 

This is quite right, the above commit is a must if you want to build
with llvm 3.6. I am quite sure crossport should be safe (it missed the
branch point of 10.4 just narrowly), and I don't think there's any other
patches missing, but no guarantees...
I think it is sort of unfortunate that the latest mesa release wouldn't
run with the latest llvm release, but the fact remains that without
testing this sounds all a bit risky...

Roland



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


Re: [Mesa-dev] [PATCH] i965: Throttle rendering to an fbo

2015-03-04 Thread Chad Versace
On 03/04/2015 09:52 AM, Chris Wilson wrote:
> On Wed, Mar 04, 2015 at 09:41:56AM -0800, Chad Versace wrote:
>> On 02/26/2015 05:24 AM, Chris Wilson wrote:
>>> When rendering to an fbo, even though it may be acting as a winsys
>>> frontbuffer or just generally, we never throttle. However, when rendering
>>> to an fbo, there is no natural frame boundary. Conventionally we use
>>> SwapBuffers and glFinish, but potential callers avoid often glFinish for
>>> being too heavy handed (waiting on all outstanding rendering to complete).
>>> The kernel provides a soft-throttling option for this case that waits for
>>> rendering older than 20ms to be complete (that's a little too lax to be
>>> used for swapbuffers, but is here a useful safety net). The remaining
>>> choice is then either never to throttle, throttle after every draw call,
>>> or at an intermediate user defined point such as glFlush and thus all the
>>> implied flushes. This patch opts for the latter.
>>>
>>> Signed-off-by: Chris Wilson 
>>> Cc: Daniel Vetter 
>>> Cc: Kenneth Graunke 
>>> Cc: Ben Widawsky 
>>> Cc: Kristian Høgsberg 
>>> ---
>>>  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
>>> b/src/mesa/drivers/dri/i965/brw_context.c
>>> index c844888..f190df1 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>>> @@ -229,11 +229,14 @@ static void
>>>  intel_glFlush(struct gl_context *ctx)
>>>  {
>>> struct brw_context *brw = brw_context(ctx);
>>> +   __DRIscreen *psp = brw->intelScreen->driScrnPriv;
>>>  
>>> intel_batchbuffer_flush(brw);
>>> intel_flush_front(ctx);
>>> if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
>>>brw->need_throttle = true;
>>> +
>>> +   drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
>>>  }
>>>  
>>>  static void
>>>
>>
>> glFlush should not wait for previous rendering to complete. It's not supposed
>> to be a blocking operation.
> 
> The manpage for glFlush says
> 
> "glFlush can return at any time.  It does not wait until the execution of 
> *all*
> previously issued GL commands is complete."
> 
> Emphasis mine. In double buffered, and normal frontbuffered (non-fbo),
> rendering the throttle is a no-op as there will not be any old rendering
> to wait upon.

That text does not appear in the GL spec. When I read the manpage alongside
the GL spec, to get a more complete context, I think the manpage contains
that phrase simply to contrast with glFinish. In my reading, it does not imply 
that
glFlush may wait for *some* previously issued GL commands to complete.

As usual, the GL spec is too terse and too vague. So I quote Apple's GL 
documentation [1].
I believe it correctly explains the behavior of glFlush.

Q:  What's the difference between glFlush() and glFinish()?

A: [...] glFlush() causes all OpenGL commands currently queued to be 
submitted to
   the hardware for execution. This function returns immediately after 
having
   transferred the pending OpenGL command queue to the hardware (or 
software)
   renderer. These commands are queued for execution in some finite amount 
of time,
   but glFlush() does not block waiting for command completion.

[1] https://developer.apple.com/library/mac/qa/qa1158/_index.html



And I don't agree that the throttle is a no-op in double-buffered rendering. 
Consider
the following calls:

  0 // Setup the draw.
  1 glDraw();
  2 eglSwapBuffers(); --> internally calls glFlush
  3 // Setup the draw
  4 glDraw();
  5 eglSwapBuffers(); --> internally calls glFlush
  6 // Setup the draw
  7 glDraw();
  8 eglSwapBuffers(); --> internally calls glFlush

Before your patch, call 5 returns immediately, even if draw 1 has not
completed, allowing the app to proceed to the CPU actions in line 6.
If the app calls eglSwapBuffers too frequently, then call 8 will block
as needed (assuming EGL_SWAP_INTERVAL != 0 and double-buffering).

After your patch, call 5 may block, throttling on batches that may have been
submitted during the setup in lines 3 and 4. (The glDraw at 4 may submit 
batches for
resolve operations, for example). That prevents the app from proceeding
to whatever CPU actions are planned for line 6. Double-buffered eglSwapBuffers 
now
sometimes blocks, behaving like an almost-glFinish, even when the back buffer is
free for rendering.

>> Why this patch? What are you trying to fix?
> http://patchwork.freedesktop.org/patch/43432/

A valid bug. But I'm not convinced this Mesa patch is correct.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mapi: fix build after 8aa9191878a5608fc6e4e8c72bea1d25cd821dec

2015-03-04 Thread Jose Fonseca

Reviewed-by: Jose Fonseca 

On 04/03/15 17:49, Mark Janes wrote:

Due to recent #include changes, `make check` fails on glx-test.  The
target requires a standard include path to find util/macros.h.
---
  src/glx/tests/Makefile.am | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index dd82449..4db01c0 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -1,6 +1,7 @@
  if HAVE_SHARED_GLAPI
  AM_CFLAGS = $(PTHREAD_CFLAGS)
  AM_CPPFLAGS = \
+   -I$(top_srcdir)/src \
-I$(top_srcdir)/src/gtest/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \



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


Re: [Mesa-dev] [PATCH] i965: Throttle rendering to an fbo

2015-03-04 Thread Chris Wilson
On Wed, Mar 04, 2015 at 10:28:16AM -0800, Chad Versace wrote:
> On 03/04/2015 09:52 AM, Chris Wilson wrote:
> > The manpage for glFlush says
> > 
> > "glFlush can return at any time.  It does not wait until the execution of 
> > *all*
> > previously issued GL commands is complete."
> > 
> > Emphasis mine. In double buffered, and normal frontbuffered (non-fbo),
> > rendering the throttle is a no-op as there will not be any old rendering
> > to wait upon.
> 
> That text does not appear in the GL spec. When I read the manpage alongside
> the GL spec, to get a more complete context, I think the manpage contains
> that phrase simply to contrast with glFinish. In my reading, it does not 
> imply that
> glFlush may wait for *some* previously issued GL commands to complete.
> 
> As usual, the GL spec is too terse and too vague. So I quote Apple's GL 
> documentation [1].
> I believe it correctly explains the behavior of glFlush.
> 
> Q:  What's the difference between glFlush() and glFinish()?
> 
> A: [...] glFlush() causes all OpenGL commands currently queued to be 
> submitted to
>the hardware for execution. This function returns immediately after 
> having
>transferred the pending OpenGL command queue to the hardware (or 
> software)
>renderer. These commands are queued for execution in some finite 
> amount of time,
>but glFlush() does not block waiting for command completion.
> 
> [1] https://developer.apple.com/library/mac/qa/qa1158/_index.html
> 
> 
> 
> And I don't agree that the throttle is a no-op in double-buffered rendering. 
> Consider
> the following calls:
> 
>   0 // Setup the draw.
>   1 glDraw();
>   2 eglSwapBuffers(); --> internally calls glFlush
>   3 // Setup the draw
>   4 glDraw();
>   5 eglSwapBuffers(); --> internally calls glFlush
>   6 // Setup the draw
>   7 glDraw();
>   8 eglSwapBuffers(); --> internally calls glFlush
> 
> Before your patch, call 5 returns immediately, even if draw 1 has not
> completed, allowing the app to proceed to the CPU actions in line 6.
> If the app calls eglSwapBuffers too frequently, then call 8 will block
> as needed (assuming EGL_SWAP_INTERVAL != 0 and double-buffering).

Today steps 3, 6, 9... block due to brw->need_throttle
(intel_prepare_render can occur before a draw operation). If double
buffering and swap-interval!=0, then step 2 (naively, for us it would
be step 3) would block. If triple buffering step 5/6, except for the
brw->need_throttle already causing throttling.
 
> After your patch, call 5 may block, throttling on batches that may have been
> submitted during the setup in lines 3 and 4. (The glDraw at 4 may submit 
> batches for
> resolve operations, for example). That prevents the app from proceeding
> to whatever CPU actions are planned for line 6. Double-buffered 
> eglSwapBuffers now
> sometimes blocks, behaving like an almost-glFinish, even when the back buffer 
> is
> free for rendering.

No, actually it won't block in that situation. It only waits for
rendering older than 20ms to complete, which given that your back buffer
is free for rendering must have already completed.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/6] main: Add utility function _mesa_lookup_bufferobj_err.

2015-03-04 Thread Anuj Phogat
On Tue, Mar 3, 2015 at 5:39 PM, Laura Ekstrand  wrote:
> I also need it in teximage.c for Texture Buffer objects.
>
Right. That's just one file in this series. Mention it in the commit
message If you're aware of future use of this function in multiple
files.

> On Tue, Mar 3, 2015 at 5:24 PM, Fredrik Höglund  wrote:
>>
>> On Wednesday 04 March 2015, Anuj Phogat wrote:
>> > On Fri, Feb 27, 2015 at 4:07 PM, Laura Ekstrand 
>> > wrote:
>> > > ---
>> > >  src/mesa/main/bufferobj.c | 19 +++
>> > >  src/mesa/main/bufferobj.h |  4 
>> > >  2 files changed, 23 insertions(+)
>> > >
>> > > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
>> > > index f026fc3..617242b 100644
>> > > --- a/src/mesa/main/bufferobj.c
>> > > +++ b/src/mesa/main/bufferobj.c
>> > > @@ -1006,6 +1006,25 @@ _mesa_lookup_bufferobj_locked(struct gl_context
>> > > *ctx, GLuint buffer)
>> > >_mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
>> > >  }
>> > >
>> > > +/**
>> > > + * A convenience function for direct state access functions that
>> > > throws
>> > > + * GL_INVALID_OPERATION if buffer is not the name of a buffer object
>> > > in the
>> > > + * hash table.
>> > > + */
>> > > +struct gl_buffer_object *
>> > > +_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
>> > > +   const char *caller)
>> > > +{
>> > > +   struct gl_buffer_object *bufObj;
>> > > +
>> > > +   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
>> > > +   if (!bufObj)
>> > > +  _mesa_error(ctx, GL_INVALID_OPERATION,
>> > > +  "%s(non-generated buffer name %u)", caller,
>> > > buffer);
>> > > +
>> > > +   return bufObj;
>> > > +}
>> > > +
>> > >
>> > >  void
>> > >  _mesa_begin_bufferobj_lookups(struct gl_context *ctx)
>> > > diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
>> > > index fe294fc..8e53bfd 100644
>> > > --- a/src/mesa/main/bufferobj.h
>> > > +++ b/src/mesa/main/bufferobj.h
>> > > @@ -89,6 +89,10 @@ _mesa_lookup_bufferobj(struct gl_context *ctx,
>> > > GLuint buffer);
>> > >  extern struct gl_buffer_object *
>> > >  _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer);
>> > >
>> > > +extern struct gl_buffer_object *
>> > > +_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
>> > > +   const char *caller);
>> > > +
>> > This function is used just inside teximage.c in patch 5/6. So, it can be
>> > made
>> > static.
>>
>> No, I'm using it in arrayobj.c in my arb-direct-state-access branch.
>>
>> > >  extern void
>> > >  _mesa_begin_bufferobj_lookups(struct gl_context *ctx);
>> > >
>> > > --
>> > > 2.1.0
>> > >
>> > > ___
>> > > 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
>> >
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] i965/skl: Disable SIMD16 when 3-source instructions are used

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 6:33 AM, Neil Roberts  wrote:
> Stepping C0 of Skylake fails when using SIMD16 with 3-source
> instructions (such as MAD). This patch just makes it disable SIMD16 in
> that case.
>
> This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
> tests.
> ---

We already have code in brw_fs_generator.cpp to split SIMD16
instructions into 2x SIMD8 for all of the three-source instructions we
support (MAD, LRP, BFE, BFI2). Is there some reason you can't just
enable that for these particular Skylake steppings?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] main: Refactor Tex[ture]Buffer[Range].

2015-03-04 Thread Anuj Phogat
On Fri, Feb 27, 2015 at 4:07 PM, Laura Ekstrand  wrote:
> Uses _mesa_lookup_bufferobj_err to clean up buffer object retrieval.  Moves
> error checking statements into separate functions to allow code sharing
> between traditional and ARB_direct_state_access entry points.
It's little difficult to follow the changes in this patch. I think the patch
can be split in to two:
Patch 1: Use _mesa_lookup_bufferobj_err to clean up buffer object retrieval.
Patch 2:  Use helper functions for error checking in
_mesa_Tex{ture}Buffer{Range}

> ---
>  src/mesa/main/teximage.c | 201 
> ++-
>  src/mesa/main/teximage.h |   6 +-
>  2 files changed, 132 insertions(+), 75 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index d454dd9..9853bc0 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -5301,24 +5301,34 @@ _mesa_validate_texbuffer_format(const struct 
> gl_context *ctx,
>
>  void
>  _mesa_texture_buffer_range(struct gl_context *ctx,
> -   struct gl_texture_object *texObj, GLenum target,
> +   struct gl_texture_object *texObj,
> GLenum internalFormat,
> struct gl_buffer_object *bufObj,
> -   GLintptr offset, GLsizeiptr size, bool range,
> -   bool dsa)
> +   GLintptr offset, GLsizeiptr size,
> +   const char *caller)
>  {
> mesa_format format;
>
> -   FLUSH_VERTICES(ctx, 0);
> +   /* NOTE: ARB_texture_buffer_object has interactions with
> +* the compatibility profile that are not implemented.
> +*/
> +   if (!(ctx->API == API_OPENGL_CORE &&
> + ctx->Extensions.ARB_texture_buffer_object)) {
> +  _mesa_error(ctx, GL_INVALID_OPERATION,
> +  "%s(ARB_texture_buffer_object is not"
> +  " implemented for the compatibility profile)", caller);
> +  return;
> +   }
>
> format = _mesa_validate_texbuffer_format(ctx, internalFormat);
> if (format == MESA_FORMAT_NONE) {
>_mesa_error(ctx, GL_INVALID_ENUM,
> -  "glTex%sBuffer%s(internalFormat 0x%x)", dsa ? "ture" : "",
> -  range ? "Range" : "", internalFormat);
> +  "%s(internalFormat 0x%x)", caller, internalFormat);
>return;
> }
>
> +   FLUSH_VERTICES(ctx, 0);
> +
> _mesa_lock_texture(ctx, texObj);
> {
>_mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
> @@ -5337,6 +5347,75 @@ _mesa_texture_buffer_range(struct gl_context *ctx,
>  }
>
>
> +/**
> + * Make sure the texture buffer target is GL_TEXTURE_BUFFER.
> + * Return true if it is, and return false if it is not
> + * (and throw INVALID ENUM as dictated in the OpenGL 4.5
> + * core spec, 02.02.2015, PDF page 245).
> + */
> +static bool
> +check_texture_buffer_target(struct gl_context *ctx, GLenum target,
> +const char *caller)
> +{
> +   if (target != GL_TEXTURE_BUFFER_ARB) {
> +  _mesa_error(ctx, GL_INVALID_ENUM,
> +  "%s(texture target is not GL_TEXTURE_BUFFER)", caller);
> +  return false;
> +   }
> +   else
else on the same line as curly brace.
> +  return true;
> +}
> +
> +/**
> + * Check for errors related to the texture buffer range.
> + * Return false if errors are found, true if none are found.
> + */
> +static bool
> +check_texture_buffer_range(struct gl_context *ctx,
> +   struct gl_buffer_object *bufObj,
> +   GLintptr offset, GLsizeiptr size,
> +   const char *caller)
> +{
> +   /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
> +* Textures (PDF page 245):
> +*"An INVALID_VALUE error is generated if offset is negative, if
> +*size is less than or equal to zero, or if offset + size is greater
> +*than the value of BUFFER_SIZE for the buffer bound to target."
> +*/
> +   if (offset < 0) {
> +  _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset=%d < 0)", caller,
> +  (int) offset);
> +  return false;
> +   }
> +
> +   if (size <= 0) {
> +  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d <= 0)", caller,
> +  (int) size);
> +  return false;
> +   }
> +
> +   if (offset + size > bufObj->Size) {
> +  _mesa_error(ctx, GL_INVALID_VALUE,
> +  "%s(offset=%d + size=%d > buffer_size=%d)", caller,
> +  (int) offset, (int) size, (int) bufObj->Size);
> +  return false;
> +   }
> +
> +   /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
> +* Textures (PDF page 245):
> +*"An INVALID_VALUE error is generated if offset is not an integer
> +*multiple of the value of TEXTURE_BUFFER_OFFSET_ALIGNMENT."
> +*/
> +   if (offset % ctx->Const.TextureBufferOffsetAlignment) {
> +  _mesa_error(c

Re: [Mesa-dev] [PATCH 2/6] i965/fs: Silence unused parameter warning

2015-03-04 Thread Jason Ekstrand
On Wed, Mar 4, 2015 at 8:45 AM, Ian Romanick  wrote:

> On 03/01/2015 05:19 PM, Jason Ekstrand wrote:
> > Not sure why you Cc'd me, but whatever.  Seems obvious enough.
>
> Because b18fd23 was your commit.  Sometimes left over, unused parameters
> are the result of a mistake.  I just wanted to be sure.
>

Right... Sorry, it's been a while and I forgot I touched those functions.
That said, it makes sense that b18fd23 would have.  Sorry for the noise
--Jason


> > Reviewed-by: Jason Ekstrand 
> > On 02/27/2015 06:50 PM, Ian Romanick wrote:
> >> From: Ian Romanick 
> >>
> >> Unused since b18fd23.
> >>
> >> brw_fs.cpp:2878:44: warning: unused parameter 'dispatch_width'
> >> [-Wunused-parameter]
> >>   clear_deps_for_inst_src(fs_inst *inst, int dispatch_width, bool *deps,
> >>  ^
> >>
> >> Signed-off-by: Ian Romanick 
> >> Cc: Jason Ekstrand 
> >> ---
> >>   src/mesa/drivers/dri/i965/brw_fs.cpp | 12 
> >>   1 file changed, 4 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> index 0354f56..126b7d0 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> @@ -2875,8 +2875,7 @@ fs_visitor::remove_duplicate_mrf_writes()
> >>   }
> >> static void
> >> -clear_deps_for_inst_src(fs_inst *inst, int dispatch_width, bool *deps,
> >> -int first_grf, int grf_len)
> >> +clear_deps_for_inst_src(fs_inst *inst, bool *deps, int first_grf, int
> >> grf_len)
> >>   {
> >>  /* Clear the flag for registers that actually got read (as
> >> expected). */
> >>  for (int i = 0; i < inst->sources; i++) {
> >> @@ -2927,8 +2926,7 @@
> >> fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
> >>  memset(needs_dep, false, sizeof(needs_dep));
> >>  memset(needs_dep, true, write_len);
> >>   -   clear_deps_for_inst_src(inst, dispatch_width,
> >> -   needs_dep, first_write_grf, write_len);
> >> +   clear_deps_for_inst_src(inst, needs_dep, first_write_grf,
> write_len);
> >>/* Walk backwards looking for writes to registers we're writing
> >> which
> >>   * aren't read since being written.  If we hit the start of the
> >> program,
> >> @@ -2968,8 +2966,7 @@
> >> fs_visitor::insert_gen4_pre_send_dependency_workarounds(bblock_t *block,
> >> }
> >>   /* Clear the flag for registers that actually got read (as
> >> expected). */
> >> -  clear_deps_for_inst_src(scan_inst, dispatch_width,
> >> -  needs_dep, first_write_grf, write_len);
> >> +  clear_deps_for_inst_src(scan_inst, needs_dep, first_write_grf,
> >> write_len);
> >>   /* Continue the loop only if we haven't resolved all the
> >> dependencies */
> >> int i;
> >> @@ -3014,8 +3011,7 @@
> >> fs_visitor::insert_gen4_post_send_dependency_workarounds(bblock_t
> >> *block, fs_ins
> >> }
> >>   /* Clear the flag for registers that actually got read (as
> >> expected). */
> >> -  clear_deps_for_inst_src(scan_inst, dispatch_width,
> >> -  needs_dep, first_write_grf, write_len);
> >> +  clear_deps_for_inst_src(scan_inst, needs_dep, first_write_grf,
> >> write_len);
> >>   /* We insert our reads as late as possible since they're
> >> reading the
> >>  * result of a SEND, which has massive latency.
>
> ___
> 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


[Mesa-dev] [PATCH 1/2] i965: Refactor SIMD16-to-2xSIMD8 checks.

2015-03-04 Thread Kenneth Graunke
Gathering all the checks into a single place makes it easier to add new
workarounds.

Signed-off-by: Kenneth Graunke 
Cc: Neil Roberts 
Cc: Matt Turner 
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 28 +--
 src/mesa/drivers/dri/i965/brw_shader.cpp   | 48 ++
 src/mesa/drivers/dri/i965/brw_shader.h |  1 +
 3 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index cbe6191..8a5ad9b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1613,6 +1613,9 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
  unreachable(!"Invalid instruction width");
   }
 
+  bool must_break_down_simd16_to_simd8 = dispatch_width == 16 &&
+ !brw_instruction_supports_simd16(brw, inst->opcode);
+
   switch (inst->opcode) {
   case BRW_OPCODE_MOV:
 brw_MOV(p, dst, src[0]);
@@ -1637,7 +1640,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   case BRW_OPCODE_MAD:
  assert(brw->gen >= 6);
 brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16 && brw->gen < 8 && !brw->is_haswell) {
+ if (must_break_down_simd16_to_simd8) {
brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
 brw_inst *f = brw_MAD(p, firsthalf(dst), firsthalf(src[0]), 
firsthalf(src[1]), firsthalf(src[2]));
brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1658,7 +1661,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   case BRW_OPCODE_LRP:
  assert(brw->gen >= 6);
 brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16 && brw->gen < 8 && !brw->is_haswell) {
+ if (must_break_down_simd16_to_simd8) {
brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
 brw_inst *f = brw_LRP(p, firsthalf(dst), firsthalf(src[0]), 
firsthalf(src[1]), firsthalf(src[2]));
brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1730,7 +1733,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   * coissuing would affect CMP instructions not otherwise affected by
   * the errata.
   */
- if (dispatch_width == 16 && brw->gen == 7 && !brw->is_haswell) {
+ if (must_break_down_simd16_to_simd8) {
 if (dst.file == BRW_GENERAL_REGISTER_FILE) {
brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
brw_CMP(p, firsthalf(dst), inst->conditional_mod,
@@ -1795,7 +1798,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   case BRW_OPCODE_BFE:
  assert(brw->gen >= 7);
  brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16 && brw->gen < 8 && !brw->is_haswell) {
+ if (must_break_down_simd16_to_simd8) {
 brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
 brw_BFE(p, firsthalf(dst), firsthalf(src[0]), firsthalf(src[1]), 
firsthalf(src[2]));
 brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1809,12 +1812,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
 
   case BRW_OPCODE_BFI1:
  assert(brw->gen >= 7);
- /* The Haswell WaForceSIMD8ForBFIInstruction workaround says that we
-  * should
-  *
-  *"Force BFI instructions to be executed always in SIMD8."
-  */
- if (dispatch_width == 16 && brw->is_haswell) {
+ if (must_break_down_simd16_to_simd8) {
 brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
 brw_BFI1(p, firsthalf(dst), firsthalf(src[0]), firsthalf(src[1]));
 brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1827,15 +1825,7 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   case BRW_OPCODE_BFI2:
  assert(brw->gen >= 7);
  brw_set_default_access_mode(p, BRW_ALIGN_16);
- /* The Haswell WaForceSIMD8ForBFIInstruction workaround says that we
-  * should
-  *
-  *"Force BFI instructions to be executed always in SIMD8."
-  *
-  * Otherwise we would be able to emit compressed instructions like we
-  * do for the other three-source instructions.
-  */
- if (dispatch_width == 16 && brw->gen < 8) {
+ if (must_break_down_simd16_to_simd8) {
 brw_set_default_compression_control(p, BRW_COMPRESSION_NONE);
 brw_BFI2(p, firsthalf(dst), firsthalf(src[0]), firsthalf(src[1]), 
firsthalf(src[2]));
 brw_set_default_compression_control(p, BRW_COMPRESSION_2NDHALF);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 

[Mesa-dev] [PATCH 2/2] i965/skl: Break down SIMD16 3-source instructions when required.

2015-03-04 Thread Kenneth Graunke
Several steppings of Skylake fail when using SIMD16 with 3-source
instructions (such as MAD).

This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
tests.

Based on a patch by Neil Roberts.

Signed-off-by: Kenneth Graunke 
Cc: Neil Roberts 
Cc: Matt Turner 
---
 src/mesa/drivers/dri/i965/brw_shader.cpp | 6 ++
 1 file changed, 6 insertions(+)

Neil, what do you think of this approach?  It's a bit smaller of a hammer
than turning off SIMD16 altogether, and pretty simple.  I haven't tested
it at all, though.

Feel free to --reset-author and claim authorship on this patch - it's
really your code, I just moved it over a bit.

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index fed4ba3..74c0e50 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -400,6 +400,12 @@ bool
 brw_instruction_supports_simd16(const struct brw_context *brw, enum opcode op)
 {
bool supports_3src = brw->is_haswell || brw->gen >= 8;
+   /* WaDisableSIMD16On3SrcInstr: 3-source instructions don't work in SIMD16
+* on a few steppings of Skylake.
+*/
+   if (brw->gen == 9 && (brw->revision == 2 || brw->revision == 3 ||
+ brw->revision == -1))
+  supports_3src = false;
 
switch (op) {
case BRW_OPCODE_MAD:
-- 
2.2.2

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


Re: [Mesa-dev] [PATCH 1/2] i965: Refactor SIMD16-to-2xSIMD8 checks.

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 12:53 PM, Kenneth Graunke  wrote:
> Gathering all the checks into a single place makes it easier to add new
> workarounds.
>
> Signed-off-by: Kenneth Graunke 
> Cc: Neil Roberts 
> Cc: Matt Turner 
> ---
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 28 +--
>  src/mesa/drivers/dri/i965/brw_shader.cpp   | 48 
> ++
>  src/mesa/drivers/dri/i965/brw_shader.h |  1 +
>  3 files changed, 58 insertions(+), 19 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index cbe6191..8a5ad9b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -1613,6 +1613,9 @@ fs_generator::generate_code(const cfg_t *cfg, int 
> dispatch_width)
>   unreachable(!"Invalid instruction width");
>}
>
> +  bool must_break_down_simd16_to_simd8 = dispatch_width == 16 &&
> + !brw_instruction_supports_simd16(brw, inst->opcode);

Instead of calling this for every instruction we emit, can we just put
it in the existing if-statements we're modifying below?

With that,

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


Re: [Mesa-dev] [PATCH] clover: Enable cl_khr_fp64 for devices that support doubles v4

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 7:47 AM, Tom Stellard  wrote:
> v2:
>   - Report correct values for CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
> and CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE.
>   - Only define cl_khr_fp64 if the extension is supported.
>   - Remove trailing space from extension string.
>   - Rename device query function from cl_khr_fp86() to

Fingers were off-by-two: s/86/64/
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] i965/skl: Break down SIMD16 3-source instructions when required.

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 12:53 PM, Kenneth Graunke  wrote:
> Several steppings of Skylake fail when using SIMD16 with 3-source
> instructions (such as MAD).
>
> This implements WaDisableSIMD16On3SrcInstr and fixes ~190 Piglit
> tests.
>
> Based on a patch by Neil Roberts.
>
> Signed-off-by: Kenneth Graunke 
> Cc: Neil Roberts 
> Cc: Matt Turner 
> ---
>  src/mesa/drivers/dri/i965/brw_shader.cpp | 6 ++
>  1 file changed, 6 insertions(+)
>
> Neil, what do you think of this approach?  It's a bit smaller of a hammer
> than turning off SIMD16 altogether, and pretty simple.  I haven't tested
> it at all, though.
>
> Feel free to --reset-author and claim authorship on this patch - it's
> really your code, I just moved it over a bit.
>
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
> b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index fed4ba3..74c0e50 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -400,6 +400,12 @@ bool
>  brw_instruction_supports_simd16(const struct brw_context *brw, enum opcode 
> op)
>  {
> bool supports_3src = brw->is_haswell || brw->gen >= 8;

Newline here before the comment?

> +   /* WaDisableSIMD16On3SrcInstr: 3-source instructions don't work in SIMD16
> +* on a few steppings of Skylake.
> +*/
> +   if (brw->gen == 9 && (brw->revision == 2 || brw->revision == 3 ||
> + brw->revision == -1))
> +  supports_3src = false;

I don't have any idea about the actual functional change. I'll leave
that for someone working on Skylake.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] include: Add helper header to help trap includes inside extern C.

2015-03-04 Thread Mark Janes
Jose Fonseca  writes:

> From: José Fonseca 
>
> This is just to help repro and fixing these issues with any C++ compiler --
>
> commiting this will of course wait until all issues are addressed.

Hi Jose,

I have a patch which trivially fixes extern "C" in the 14 files
identified by no_extern_c.h errors.

Should I send the patch?  This helper header was sent a long time ago,
but it seems like a useful mechanism to me.

-Mark

>
>
> $ scons src/glsl/
> scons: Reading SConscript files ...
> Checking for GCC ...  yes
> Checking for Clang ...  no
> Checking for X11 (x11 xext xdamage xfixes glproto >= 1.4.13)... yes
> Checking for XCB (x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8)... yes
> Checking for XF86VIDMODE (xxf86vm)... yes
> Checking for DRM (libdrm >= 2.4.38)... yes
> Checking for UDEV (libudev >= 151)... yes
> warning: LLVM disabled: not building llvmpipe
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: building associated VariantDir targets: build/linux-x86_64-debug/glsl
>   Compiling src/glsl/ast_array_index.cpp ...
>   Compiling src/glsl/ast_expr.cpp ...
>   Compiling src/glsl/ast_function.cpp ...
>   Compiling src/glsl/ast_to_hir.cpp ...
>   Compiling src/glsl/ast_type.cpp ...
>   Compiling src/glsl/builtin_functions.cpp ...
> In file included from include/c99_compat.h:28:0,
>  from src/mapi/u_compiler.h:4,
>  from src/mapi/u_thread.h:47,
>  from src/mapi/glapi/glapi.h:47,
>  from src/mesa/main/mtypes.h:42,
>  from src/mesa/main/errors.h:47,
>  from src/mesa/main/imports.h:41,
>  from src/mesa/main/core.h:44,
>  from src/glsl/builtin_functions.cpp:58:
> include/no_extern_c.h:48:1: error: template with C linkage
>  template class _IncludeInsideExternCNotPortable;
>  ^
> In file included from include/c99_compat.h:28:0,
>  from include/c11/threads.h:38,
>  from src/mapi/u_thread.h:49,
>  from src/mapi/glapi/glapi.h:47,
>  from src/mesa/main/mtypes.h:42,
>  from src/mesa/main/errors.h:47,
>  from src/mesa/main/imports.h:41,
>  from src/mesa/main/core.h:44,
>  from src/glsl/builtin_functions.cpp:58:
> include/no_extern_c.h:48:1: error: template with C linkage
>  template class _IncludeInsideExternCNotPortable;
>  ^
>   Compiling src/glsl/builtin_types.cpp ...
>   Compiling src/glsl/builtin_variables.cpp ...
> scons: *** [build/linux-x86_64-debug/glsl/builtin_functions.os] Error 1
> scons: building terminated because of errors.
> ---
>  include/c99_compat.h  |  2 ++
>  include/no_extern_c.h | 49 +
>  src/util/u_atomic.h   |  3 +++
>  3 files changed, 54 insertions(+)
>  create mode 100644 include/no_extern_c.h
>
> diff --git a/include/c99_compat.h b/include/c99_compat.h
> index 429c601..a8819ac 100644
> --- a/include/c99_compat.h
> +++ b/include/c99_compat.h
> @@ -25,6 +25,8 @@
>   *
>   **/
>  
> +#include "no_extern_c.h"
> +
>  #ifndef _C99_COMPAT_H_
>  #define _C99_COMPAT_H_
>  
> diff --git a/include/no_extern_c.h b/include/no_extern_c.h
> new file mode 100644
> index 000..d038a4f
> --- /dev/null
> +++ b/include/no_extern_c.h
> @@ -0,0 +1,49 @@
> +/**
> + *
> + * Copyright 2014 VMware, Inc.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included
> + * in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + **/
> +
> +
> +/*
> + * Including system's headers inside `extern "C" { ... }` is not safe, as 
> system
> + * headers may have C++ code in them, and C++ code inside extern "C"
> + * leads to syntatically incorrect code.
> + 

[Mesa-dev] [Bug 79706] [TRACKER] Mesa regression tracker

2015-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79706
Bug 79706 depends on bug 89292, which changed state.

Bug 89292 Summary: [regression,bisected] incomplete screenshots in some cases
https://bugs.freedesktop.org/show_bug.cgi?id=89292

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

-- 
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] mesa/st: remove unused TexData

2015-03-04 Thread Dave Airlie
this isn't hooked up to anything at all from what I can see.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_cb_texture.c | 21 -
 src/mesa/state_tracker/st_texture.h|  6 --
 2 files changed, 27 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 0525e87..6b72680 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -177,9 +177,6 @@ st_FreeTextureImageBuffer(struct gl_context *ctx,
   pipe_resource_reference(&stImage->pt, NULL);
}
 
-   _mesa_align_free(stImage->TexData);
-   stImage->TexData = NULL;
-
free(stImage->transfer);
stImage->transfer = NULL;
stImage->num_transfers = 0;
@@ -500,7 +497,6 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
 
DBG("%s\n", __FUNCTION__);
 
-   assert(!stImage->TexData);
assert(!stImage->pt); /* xxx this might be wrong */
 
/* Look if the parent texture object has space for this image */
@@ -1520,23 +1516,6 @@ copy_image_data_to_texture(struct st_context *st,
 
   pipe_resource_reference(&stImage->pt, NULL);
}
-   else if (stImage->TexData) {
-  /* Copy from malloc'd memory */
-  /* XXX this should be re-examined/tested with a compressed format */
-  GLuint blockSize = util_format_get_blocksize(stObj->pt->format);
-  GLuint srcRowStride = stImage->base.Width * blockSize;
-  GLuint srcSliceStride = stImage->base.Height * srcRowStride;
-  st_texture_image_data(st,
-stObj->pt,
-stImage->base.Face,
-dstLevel,
-stImage->TexData,
-srcRowStride,
-srcSliceStride);
-  _mesa_align_free(stImage->TexData);
-  stImage->TexData = NULL;
-   }
-
pipe_resource_reference(&stImage->pt, stObj->pt);
 }
 
diff --git a/src/mesa/state_tracker/st_texture.h 
b/src/mesa/state_tracker/st_texture.h
index 6b7f8c7..3fa55ae 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -55,13 +55,7 @@ struct st_texture_image
 {
struct gl_texture_image base;
 
-   /** Used to store texture data that doesn't fit in the parent
-* object's mipmap buffer.
-*/
-   GLubyte *TexData;
-
/* If stImage->pt != NULL, image data is stored here.
-* Else if stImage->TexData != NULL, image is stored there.
 * Else there is no image data.
 */
struct pipe_resource *pt;
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 1/3] Revert "common: Fix PBOs for 1D_ARRAY."

2015-03-04 Thread Emil Velikov
On 4 March 2015 at 17:22, Neil Roberts  wrote:
> This reverts commit 546aba143d13ba3f993ead4cc30b2404abfc0202.
>
> I think the changes to the calls to glBlitFramebuffer from this patch
> are no different to what it was doing previously because it used to
> set height to 1 before doing the blits. However it was introducing
> some problems with the blit for layer 0 because this was no longer
> special cased. It didn't fix problems with the yoffset which needs to
> be interpreted as a slice offset. I think a better solution would be
> to modify the original if statement to cope with the yoffset.
>
Neil, if others agree with this revert can you cc stable. Seems that
the offending commit already has the tag, plus I've already picked it
up :-\

Cc: "10.5" 

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


[Mesa-dev] [Bug 89433] GCC 4.2 does not support -Wvla

2015-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89433

Bug ID: 89433
   Summary: GCC 4.2 does not support -Wvla
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: regression
  Severity: blocker
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: jfons...@vmware.com, j...@openbsd.org

mesa: b5eb6f769db71557c86c72c3352db149379fdade (master 10.6.0-devel)

-Wvla is available with gcc >= 4.3.

Build fails with this error.

cc1: error: -Werror=vla: No option -Wvla

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
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] i965/hsw: Implement end of batch workaround

2015-03-04 Thread Ben Widawsky
This patch can cause an infinite recursion if the previous patch titled, "i965:
Track finished batch state" isn't present (backporters take notice).

v2: Sent out the wrong patch originally. This patches switches the order of
flushes, doing the generic flush before the CC_STATE, and the required
workaround flush afterwards

v3: Only perform workaround for render ring
Add text to the BATCH_RESERVE comments

Cc: Kenneth Graunke 
Signed-off-by: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 17 +
 src/mesa/drivers/dri/i965/intel_batchbuffer.h |  4 
 2 files changed, 21 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 8b097c8..e4ad6b9 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -32,6 +32,7 @@
 #include "intel_buffers.h"
 #include "intel_fbo.h"
 #include "brw_context.h"
+#include "brw_defines.h"
 
 static void
 intel_batchbuffer_reset(struct brw_context *brw);
@@ -218,6 +219,22 @@ brw_finish_batch(struct brw_context *brw)
if (brw->batch.ring == RENDER_RING)
   brw_perf_monitor_finish_batch(brw);
 
+   if (brw->is_haswell && brw->batch.ring == RENDER_RING) {
+  /* SW must program 3DSTATE_CC_STATE_POINTERS command at the end of every
+   * 3D batch buffer followed by a PIPE_CONTROL with RC flush and CS stall.
+   *
+   * From the example in the docs, it seems to expect a regular pipe 
control
+   * flush here as well. We may have done it already, but meh.
+   */
+  intel_batchbuffer_emit_mi_flush(brw);
+  BEGIN_BATCH(2);
+  OUT_BATCH(_3DSTATE_CC_STATE_POINTERS << 16 | (2 - 2));
+  OUT_BATCH(brw->cc.state_offset | 1);
+  ADVANCE_BATCH();
+  brw_emit_pipe_control_flush(brw, PIPE_CONTROL_RENDER_TARGET_FLUSH |
+   PIPE_CONTROL_CS_STALL);
+   }
+
/* Mark that the current program cache BO has been used by the GPU.
 * It will be reallocated if we need to put new programs in for the
 * next batch.
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 7bdd836..5cc4d7f 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -26,6 +26,10 @@ extern "C" {
  * - 3 DWords for MI_REPORT_PERF_COUNT itself on Gen6+.  ==> 12 bytes.
  *   On Ironlake, it's 6 DWords, but we have some slack due to the lack of
  *   Sandybridge PIPE_CONTROL madness.
+ *   - CC_STATE workaround on HSW (12 * 4 = 48 bytes)
+ * - 5 dwords for initial mi_flush
+ * - 2 dwords for CC state setup
+ * - 5 dwords for the required pipe control at the end
  */
 #define BATCH_RESERVED 146
 
-- 
2.3.1

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


[Mesa-dev] [Bug 89364] c99_alloca.h:40:22: fatal error: alloca.h: No such file or directory

2015-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89364

Vinson Lee  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Vinson Lee  ---
I no longer see this specific build error.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
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 2/6] main: Remove redundant NumLayers checks.

2015-03-04 Thread Laura Ekstrand
ARB_direct_state_access texture functions that operate on cube maps no longer
need to verify that cube map texture objects contain six texture images
because _mesa_cube_level_complete now does that for them.
---
 src/mesa/main/texgetimage.c | 13 -
 src/mesa/main/teximage.c| 14 --
 2 files changed, 27 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index f975c16..42044dd 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1088,19 +1088,6 @@ _mesa_GetTextureImage(GLuint texture, GLint level, 
GLenum format,
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
 
-  /* Error checking */
-  if (texObj->NumLayers < 6) {
- /* Not enough image planes for a cube map.  The spec does not say
-  * what should happen in this case because the user has always
-  * specified each cube face separately (using
-  * GL_TEXTURE_CUBE_MAP_POSITIVE_X+i) in previous GL versions.
-  * This is addressed in Khronos Bug 13223.
-  */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTextureImage(insufficient cube map storage)");
- return;
-  }
-
   /*
* What do we do if the user created a texture with the following code
* and then called this function with its handle?
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 611d664..cb1c81a 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3636,20 +3636,6 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
   GLint rowStride;
 
-  /* Error checking */
-  if (texObj->NumLayers < 6) {
- /* Not enough image planes for a cube map.  The spec does not say
-  * what should happen in this case because the user has always
-  * specified each cube face separately (using
-  * GL_TEXTURE_CUBE_MAP_POSITIVE_X+i) in previous GL versions.
-  * This is addressed in Khronos Bug 13223.
-  */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureSubImage%uD(insufficient cube map storage)",
- dims);
- return;
-  }
-
   /*
* What do we do if the user created a texture with the following code
* and then called this function with its handle?
-- 
2.1.0

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


[Mesa-dev] [PATCH 0/6] v2 of Compressed Textures Cube Map Support

2015-03-04 Thread Laura Ekstrand
This cleans up ARB_direct_state_access texture cube map functions
(mostly in response to reviews from Anuj Phogat).

Laura Ekstrand (6):
  main: _mesa_cube_level_complete checks NumLayers.
  main: Remove redundant NumLayers checks.
  main: Remove redundant copy of cube map block comment in
GetTextureImage.
  main: assert(texImage) in ARB_DSA texture cube map functions.
  main: Add TEXTURE_CUBE_MAP support for glCompressedTextureSubImage3D.
  main: Checking for cube completeness in GetCompressedTextureImage.

 src/mesa/main/texgetimage.c |  61 ---
 src/mesa/main/teximage.c| 177 +---
 src/mesa/main/teximage.h|   3 +-
 src/mesa/main/texobj.c  |   4 +
 4 files changed, 156 insertions(+), 89 deletions(-)

-- 
2.1.0

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


[Mesa-dev] [PATCH 6/6] main: Checking for cube completeness in GetCompressedTextureImage.

2015-03-04 Thread Laura Ekstrand
v2: Review from Anuj Phogat
   - Remove redundant copies of the cube map block comment
   - Replace redundant "if (!texImage) return;" statements with
 assert(texImage)
---
 src/mesa/main/texgetimage.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 9411db8..255d365 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1303,7 +1303,16 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint 
level,
 
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
-  assert(texObj->NumLayers >= 6);
+
+  /* Make sure the texture object is a proper cube.
+   * (See texturesubimage in teximage.c for details on why this check is
+   * performed.)
+   */
+  if (!_mesa_cube_level_complete(texObj, level)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetCompressedTextureImage(cube map incomplete)");
+ return;
+  }
 
   /* Copy each face. */
   for (i = 0; i < 6; ++i) {
-- 
2.1.0

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


[Mesa-dev] [PATCH 1/6] main: _mesa_cube_level_complete checks NumLayers.

2015-03-04 Thread Laura Ekstrand
_mesa_cube_level_complete now verifies that a cube map texture object actually
has six texture images before proceeding.
---
 src/mesa/main/texobj.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index d5aa620..0b200a1 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -878,6 +878,10 @@ _mesa_cube_level_complete(const struct gl_texture_object 
*texObj,
if (texObj->Target != GL_TEXTURE_CUBE_MAP)
   return GL_FALSE;
 
+   /* Make sure we have enough image planes for a cube map. */
+   if (texObj->NumLayers < 6)
+  return GL_FALSE;
+
if ((level < 0) || (level >= MAX_TEXTURE_LEVELS))
   return GL_FALSE;
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 4/6] main: assert(texImage) in ARB_DSA texture cube map functions.

2015-03-04 Thread Laura Ekstrand
ARB_direct_state_access functions that deal with texture cube
maps need to make sure that texture images are not NULL before operating on
them. In the following cases, the error check functions already throw an
error if texImage == NULL, so an assert can be raised instead.

v2: Review from Anuj Phogat
   - Replace redundant "if (!texImage) return;" statements with
 assert(texImage)
---
 src/mesa/main/texgetimage.c | 5 +++--
 src/mesa/main/teximage.c| 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 0287ebf..9411db8 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1101,6 +1101,8 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum 
format,
   /* Copy each face. */
   for (i = 0; i < 6; ++i) {
  texImage = texObj->Image[i][level];
+ assert(texImage);
+
  _mesa_get_texture_image(ctx, texObj, texImage, texObj->Target, level,
  format, type, bufSize, pixels, true);
 
@@ -1306,8 +1308,7 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint 
level,
   /* Copy each face. */
   for (i = 0; i < 6; ++i) {
  texImage = texObj->Image[i][level];
- if (!texImage)
-return;
+ assert(texImage);
 
  _mesa_get_compressed_texture_image(ctx, texObj, texImage,
 texObj->Target, level,
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index cb1c81a..92e2371 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3677,6 +3677,8 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
   /* Copy in each face. */
   for (i = 0; i < 6; ++i) {
  texImage = texObj->Image[i][level];
+ assert(texImage);
+
  _mesa_texture_sub_image(ctx, 3, texObj, texImage, texObj->Target,
  level, xoffset, yoffset, zoffset,
  width, height, 1, format,
@@ -3686,8 +3688,7 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
}
else {
   texImage = _mesa_select_tex_image(texObj, texObj->Target, level);
-  if (!texImage)
- return;
+  assert(texImage);
 
   _mesa_texture_sub_image(ctx, dims, texObj, texImage, texObj->Target,
   level, xoffset, yoffset, zoffset,
-- 
2.1.0

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


[Mesa-dev] [PATCH 3/6] main: Remove redundant copy of cube map block comment in GetTextureImage.

2015-03-04 Thread Laura Ekstrand
The comment describing why ARB_direct_state_access texture cube map functions
use _mesa_cube_level_complete is very long.  To save room in the files,
readers are now referred to one central comment on texturesubimage in
teximage.c.

v2: Review from Anuj Phogat
   - Remove redundant copies of the cube map block comment
---
 src/mesa/main/texgetimage.c | 32 +++-
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 42044dd..0287ebf 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1088,35 +1088,9 @@ _mesa_GetTextureImage(GLuint texture, GLint level, 
GLenum format,
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
 
-  /*
-   * What do we do if the user created a texture with the following code
-   * and then called this function with its handle?
-   *
-   *GLuint tex;
-   *glCreateTextures(GL_TEXTURE_CUBE_MAP, 1, &tex);
-   *glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
-   *glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, ...);
-   *glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, ...);
-   *glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, ...);
-   *// Note: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y not set, or given the
-   *// wrong format, or given the wrong size, etc.
-   *glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, ...);
-   *glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, ...);
-   *
-   * A bug has been filed against the spec for this case.  In the
-   * meantime, we will check for cube completeness.
-   *
-   * According to Section 8.17 Texture Completeness in the OpenGL 4.5
-   * Core Profile spec (30.10.2014):
-   *"[A] cube map texture is cube complete if the
-   *following conditions all hold true: The [base level] texture
-   *images of each of the six cube map faces have identical, positive,
-   *and square dimensions. The [base level] images were each specified
-   *with the same internal format."
-   *
-   * It seems reasonable to check for cube completeness of an arbitrary
-   * level here so that the returned data has a consistent format and size
-   * and therefore fits in the user's buffer.
+  /* Make sure the texture object is a proper cube.
+   * (See texturesubimage in teximage.c for details on why this check is
+   * performed.)
*/
   if (!_mesa_cube_level_complete(texObj, level)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
-- 
2.1.0

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


[Mesa-dev] [PATCH 5/6] main: Add TEXTURE_CUBE_MAP support for glCompressedTextureSubImage3D.

2015-03-04 Thread Laura Ekstrand
v2: Review from Anuj Phogat
   - Remove redundant copies of the cube map block comment
   - Replace redundant "if (!texImage) return;" statements with
 assert(texImage)
---
 src/mesa/main/teximage.c | 158 +++
 src/mesa/main/teximage.h |   3 +-
 2 files changed, 133 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 92e2371..345a8ff 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4735,30 +4735,19 @@ _mesa_CompressedTexImage3D(GLenum target, GLint level,
 void
 _mesa_compressed_texture_sub_image(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
+   struct gl_texture_image *texImage,
GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint zoffset,
GLsizei width, GLsizei height,
GLsizei depth,
GLenum format, GLsizei imageSize,
-   const GLvoid *data, bool dsa)
+   const GLvoid *data)
 {
-   struct gl_texture_image *texImage;
-
-   if (compressed_subtexture_error_check(ctx, dims, texObj, target,
- level, xoffset, yoffset, zoffset,
- width, height, depth,
- format, imageSize, dsa)) {
-  return;
-   }
-
FLUSH_VERTICES(ctx, 0);
 
_mesa_lock_texture(ctx, texObj);
{
-  texImage = _mesa_select_tex_image(texObj, target, level);
-  assert(texImage);
-
   if (width > 0 && height > 0 && depth > 0) {
  ctx->Driver.CompressedTexSubImage(ctx, dims, texImage,
xoffset, yoffset, zoffset,
@@ -4782,6 +4771,8 @@ _mesa_CompressedTexSubImage1D(GLenum target, GLint level, 
GLint xoffset,
   GLsizei imageSize, const GLvoid *data)
 {
struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
GET_CURRENT_CONTEXT(ctx);
 
if (compressed_subtexture_target_check(ctx, target, 1, format, false,
@@ -4793,9 +4784,19 @@ _mesa_CompressedTexSubImage1D(GLenum target, GLint 
level, GLint xoffset,
if (!texObj)
   return;
 
-   _mesa_compressed_texture_sub_image(ctx, 1, texObj, target, level,
+   if (compressed_subtexture_error_check(ctx, 1, texObj, target,
+ level, xoffset, 0, 0,
+ width, 1, 1,
+ format, imageSize, false)) {
+  return;
+   }
+
+   texImage = _mesa_select_tex_image(texObj, target, level);
+   assert(texImage);
+
+   _mesa_compressed_texture_sub_image(ctx, 1, texObj, texImage, target, level,
   xoffset, 0, 0, width, 1, 1,
-  format, imageSize, data, false);
+  format, imageSize, data);
 }
 
 void GLAPIENTRY
@@ -4804,6 +4805,8 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint 
level, GLint xoffset,
   GLsizei imageSize, const GLvoid *data)
 {
struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
GET_CURRENT_CONTEXT(ctx);
 
texObj = _mesa_lookup_texture_err(ctx, texture,
@@ -4817,9 +4820,20 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint 
level, GLint xoffset,
   return;
}
 
-   _mesa_compressed_texture_sub_image(ctx, 1, texObj, texObj->Target, level,
+   if (compressed_subtexture_error_check(ctx, 1, texObj, texObj->Target,
+ level, xoffset, 0, 0,
+ width, 1, 1,
+ format, imageSize, true)) {
+  return;
+   }
+
+   texImage = _mesa_select_tex_image(texObj, texObj->Target, level);
+   assert(texImage);
+
+   _mesa_compressed_texture_sub_image(ctx, 1, texObj, texImage,
+  texObj->Target, level,
   xoffset, 0, 0, width, 1, 1,
-  format, imageSize, data, true);
+  format, imageSize, data);
 }
 
 
@@ -4830,6 +4844,8 @@ _mesa_CompressedTexSubImage2D(GLenum target, GLint level, 
GLint xoffset,
   const GLvoid *data)
 {
struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
GET_CURRENT_CONTEXT(ctx);
 
if (compressed_subtexture_target_check(ctx, target, 2, format, false,
@@ -4841,9 +4857,20 @@ _mesa_CompressedTexSubImage2D(GLenum target, GLint 
level, GLint xoffset,
if (!texObj)
   return;
 
-   _mesa_compressed_texture_sub_image(ctx, 2, texObj, t

[Mesa-dev] [PATCH] i965: Reserve more batch space to accomodate Gen6 perfmonitors.

2015-03-04 Thread Kenneth Graunke
Ben noticed that I said each PIPE_CONTROL was 4 DWords, but it's
actually 5 DWords on Gen6-7.  We've been reserving insufficient space
for performance monitoring on Sandybridge, which means it would likely
break if you used that functionality.  (Thankfully, no one does...)

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

We should probably Cc this to stable unless we delete the broken
performance monitoring code altogether.

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 7bdd836..5a16456 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -22,12 +22,12 @@ extern "C" {
  *   - Disabling OA counters on Gen6+ (3 DWords = 12 bytes)
  *   - Ending MI_REPORT_PERF_COUNT on Gen5+, plus associated PIPE_CONTROLs:
  * - Two sets of PIPE_CONTROLs, which become 3 PIPE_CONTROLs each on SNB,
- *   which are 4 DWords each ==> 2 * 3 * 4 * 4 = 96 bytes
+ *   which are 5 DWords each ==> 2 * 3 * 5 * 4 = 120 bytes
  * - 3 DWords for MI_REPORT_PERF_COUNT itself on Gen6+.  ==> 12 bytes.
  *   On Ironlake, it's 6 DWords, but we have some slack due to the lack of
  *   Sandybridge PIPE_CONTROL madness.
  */
-#define BATCH_RESERVED 146
+#define BATCH_RESERVED 152
 
 struct intel_batchbuffer;
 
-- 
2.2.2

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


Re: [Mesa-dev] [PATCH 2/3] meta: Allow GL_UN/PACK_IMAGE_HEIGHT in _mesa_meta_pbo_Get/TexSubImage

2015-03-04 Thread Laura Ekstrand
I have a new texturing/getteximage-targets test on the Piglit ML that
cleans up the test considerably and causes it to hit these Meta PBO paths.
It just hasn't been given R-B's yet.

http://patchwork.freedesktop.org/patch/42864/

On Wed, Mar 4, 2015 at 9:22 AM, Neil Roberts  wrote:

> Now that a layered source PBO is interpreted as a single tall 2D image
> it's quite easy to accept the image height packing option by just
> creating an image that is tall enough to include the image padding.
>
> I'm not sure whether the image height property should affect 1D_ARRAY
> textures. My intuition and interpretation of the GL spec (which is a
> bit vague) would be that it shouldn't. However the software fallback
> path in Mesa uses the property for packing but not for unpacking. The
> binary NVidia driver uses it for both. This patch doesn't use it for
> either case so it is different from the software fallback. There is
> some discussion about this here:
>
> http://lists.freedesktop.org/archives/mesa-dev/2015-February/077925.html
>
> This is tested by the texsubimage Piglit test with the array and pbo
> arguments. Previously this test was skipping this code path because it
> always sets the image height.
>
> I've also tested it by modifying the getteximage-targets test. It
> wasn't using this code path before because it was using the default
> texture object so this code couldn't successfully create a frame
> buffer. I also modified it to add some image padding with the image
> height in the PBO.
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c | 32
> ++---
>  1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
> b/src/mesa/drivers/common/meta_tex_subimage.c
> index 1fef79d..f360d64 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -144,6 +144,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
> const struct gl_pixelstore_attrib *packing)
>  {
> GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
> +   int full_height, image_height;
> struct gl_texture_image *pbo_tex_image;
> GLenum status;
> bool success = false;
> @@ -177,14 +178,16 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
>return true;
> }
>
> -   /* Only accept tightly packed pixels from the user. */
> -   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
> -  return false;
> +   /* For arrays, use a tall (height * depth) 2D texture but taking into
> +* account the inter-image padding specified with the image height
> packing
> +* property.
> +*/
> +   image_height = packing->ImageHeight == 0 ? height :
> packing->ImageHeight;
> +   full_height = image_height * (depth - 1) + height;
>
> -   /* For arrays, use a tall (height * depth) 2D texture. */
> pbo_tex_image = create_texture_for_pbo(ctx, create_pbo,
>GL_PIXEL_UNPACK_BUFFER,
> -  width, height * depth,
> +  width, full_height,
>format, type, pixels, packing,
>&pbo, &pbo_tex);
> if (!pbo_tex_image)
> @@ -236,7 +239,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
>_mesa_update_state(ctx);
>
>_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
> - 0, z * height, width, (z + 1) * height,
> + 0, z * image_height,
> + width, z * image_height + height,
>   xoffset, yoffset,
>   xoffset + width, yoffset + height,
>   GL_COLOR_BUFFER_BIT, GL_NEAREST);
> @@ -263,6 +267,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx,
> GLuint dims,
>const struct gl_pixelstore_attrib *packing)
>  {
> GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
> +   int full_height, image_height;
> struct gl_texture_image *pbo_tex_image;
> GLenum status;
> bool success = false;
> @@ -296,13 +301,15 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context
> *ctx, GLuint dims,
>return true;
> }
>
> -   /* Only accept tightly packed pixels from the user. */
> -   if (packing->ImageHeight != 0 && packing->ImageHeight != height)
> -  return false;
> +   /* For arrays, use a tall (height * depth) 2D texture but taking into
> +* account the inter-image padding specified with the image height
> packing
> +* property.
> +*/
> +   image_height = packing->ImageHeight == 0 ? height :
> packing->ImageHeight;
> +   full_height = image_height * (depth - 1) + height;
>
> -   /* For arrays, use a tall (height * depth) 2D texture. */
> pbo_tex_ima

[Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Matt Turner
The SSSE3 swizzling code was written for fast uploads to the GPU and
assumed the destination was always 16-byte aligned. When we began using
this code for fast downloads as well we didn't do anything to account
for the fact that the destination pointer given by glReadPixels() or
glGetTexImage() is not guaranteed to be suitably aligned.

With SSSE3 enabled (at compile-time), some applications would crash when
an SSE aligned-store instruction tried to store to an unaligned
destination (or an assertion that the destination is aligned would
trigger).

To remedy this, tell intel_get_memcpy() whether we're uploading or
downloading so that it can select whether to assume the destination or
source is aligned, respectively.

Cc: 10.5 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
---
I don't know what benchmarks I should run to test this code?

 src/mesa/drivers/dri/i965/intel_pixel_read.c   |   3 +-
 src/mesa/drivers/dri/i965/intel_tex_image.c|   3 +-
 src/mesa/drivers/dri/i965/intel_tex_subimage.c |   3 +-
 src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 156 +++--
 src/mesa/drivers/dri/i965/intel_tiled_memcpy.h |  15 ++-
 5 files changed, 138 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c 
b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index df22a63..0972121 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -139,7 +139,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
rb->Format == MESA_FORMAT_R8G8B8X8_UNORM)
   return false;
 
-   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp,
+ INTEL_DOWNLOAD))
   return false;
 
if (!irb->mt ||
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c
index da42fdd..a3312d2 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -408,7 +408,8 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
texImage->TexFormat == MESA_FORMAT_R8G8B8X8_UNORM)
   return false;
 
-   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp,
+ INTEL_UPLOAD))
   return false;
 
/* If this is a nontrivial texture view, let another path handle it 
instead. */
diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 4262f71..909ff25 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -118,7 +118,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Invert)
   return false;
 
-   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp,
+ INTEL_UPLOAD))
   return false;
 
/* If this is a nontrivial texture view, let another path handle it 
instead. */
diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c 
b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
index f2b35cb..c43383b 100644
--- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
+++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
@@ -60,42 +60,79 @@ static const uint32_t ytile_span = 16;
 static const uint8_t rgba8_permutation[16] =
{ 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };
 
-/* NOTE: dst must be 16 byte aligned */
-#define rgba8_copy_16(dst, src) \
-   *(__m128i *)(dst) = _mm_shuffle_epi8(\
-  (__m128i) _mm_loadu_ps((float *)(src)),   \
-  *(__m128i *) rgba8_permutation\
-   )
+/* NOTE: dst must be 16-byte aligned. src may be unaligned. */
+#define rgba8_copy_16_aligned_dst(dst, src)\
+   _mm_store_si128((__m128i *)(dst),   \
+   _mm_shuffle_epi8(_mm_loadu_si128((__m128i *)(src)), \
+*(__m128i *) rgba8_permutation))
+
+/* NOTE: src must be 16-byte aligned. dst may be unaligned. */
+#define rgba8_copy_16_aligned_src(dst, src)\
+   _mm_storeu_si128((__m128i *)(dst),  \
+_mm_shuffle_epi8(_mm_load_si128((__m128i *)(src)), \
+ *(__m128i *) rgba8_permutation))
 #endif
 
 /**
- * Copy RGBA to BGRA - swap R and B.
+ * Copy RGBA to BGRA - swap R and B, with the destination 16-byte aligned.
  */
 static inline void *
-rgba8_copy(void *dst, const void *src, size_t bytes)
+rgba8_copy_aligned_dst(void *dst, const void *src, size_t bytes)
 {
uint8_t *d = dst;
uint8_t const *s = src;
 
 #ifdef __SSSE3__
-   /* Fast copying for tile spans.
-*
-* As

Re: [Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Jason Ekstrand
On Wed, Mar 4, 2015 at 4:19 PM, Matt Turner  wrote:

> The SSSE3 swizzling code was written for fast uploads to the GPU and
> assumed the destination was always 16-byte aligned. When we began using
> this code for fast downloads as well we didn't do anything to account
> for the fact that the destination pointer given by glReadPixels() or
> glGetTexImage() is not guaranteed to be suitably aligned.
>
> With SSSE3 enabled (at compile-time), some applications would crash when
> an SSE aligned-store instruction tried to store to an unaligned
> destination (or an assertion that the destination is aligned would
> trigger).
>
> To remedy this, tell intel_get_memcpy() whether we're uploading or
> downloading so that it can select whether to assume the destination or
> source is aligned, respectively.
>
> Cc: 10.5 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
> ---
> I don't know what benchmarks I should run to test this code?
>
>  src/mesa/drivers/dri/i965/intel_pixel_read.c   |   3 +-
>  src/mesa/drivers/dri/i965/intel_tex_image.c|   3 +-
>  src/mesa/drivers/dri/i965/intel_tex_subimage.c |   3 +-
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 156
> +++--
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.h |  15 ++-
>  5 files changed, 138 insertions(+), 42 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> index df22a63..0972121 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> @@ -139,7 +139,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
> rb->Format == MESA_FORMAT_R8G8B8X8_UNORM)
>return false;
>
> -   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp))
> +   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp,
> + INTEL_DOWNLOAD))
>return false;
>
> if (!irb->mt ||
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c
> b/src/mesa/drivers/dri/i965/intel_tex_image.c
> index da42fdd..a3312d2 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> @@ -408,7 +408,8 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context
> *ctx,
> texImage->TexFormat == MESA_FORMAT_R8G8B8X8_UNORM)
>return false;
>
> -   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp))
> +   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp,
> + INTEL_UPLOAD))
>

Should be INTEL_DOWNLOAD


>return false;
>
> /* If this is a nontrivial texture view, let another path handle it
> instead. */
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> index 4262f71..909ff25 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> @@ -118,7 +118,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
> packing->Invert)
>return false;
>
> -   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp))
> +   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp,
> + INTEL_UPLOAD))
>return false;
>
> /* If this is a nontrivial texture view, let another path handle it
> instead. */
> diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> index f2b35cb..c43383b 100644
> --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> @@ -60,42 +60,79 @@ static const uint32_t ytile_span = 16;
>  static const uint8_t rgba8_permutation[16] =
> { 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };
>
> -/* NOTE: dst must be 16 byte aligned */
> -#define rgba8_copy_16(dst, src) \
> -   *(__m128i *)(dst) = _mm_shuffle_epi8(\
> -  (__m128i) _mm_loadu_ps((float *)(src)),   \
> -  *(__m128i *) rgba8_permutation\
> -   )
> +/* NOTE: dst must be 16-byte aligned. src may be unaligned. */
> +#define rgba8_copy_16_aligned_dst(dst, src)\
> +   _mm_store_si128((__m128i *)(dst),   \
> +   _mm_shuffle_epi8(_mm_loadu_si128((__m128i *)(src)), \
> +*(__m128i *) rgba8_permutation))
> +
> +/* NOTE: src must be 16-byte aligned. dst may be unaligned. */
> +#define rgba8_copy_16_aligned_src(dst, src)\
> +   _mm_storeu_si128((__m128i *)(dst),  \
> +_mm_shuffle_epi8(_mm_load_si128((__m128i *)(src)), \
> + *(__m128i *) rgba8_permutation))
>  #endif
>
>  /**
> - * Copy RGBA to BGRA - swap R and B.
> + * Copy RGBA to BGRA - swap R and B, with the destination 16-byte ali

[Mesa-dev] [PATCH] Fix invalid extern "C" around header inclusion.

2015-03-04 Thread Mark Janes
System headers may contain C++ declarations, which cannot be given C
linkage.  For this reason, include statements should never occur
inside extern "C".

This patch moves the C linkage statements to enclose only the
declarations within a single header.
---
 src/gallium/auxiliary/util/u_math.h  | 11 +--
 src/gallium/drivers/r600/r600_shader.h   | 12 
 src/gallium/drivers/r600/sb/sb_bc.h  |  2 --
 src/gallium/drivers/r600/sb/sb_bc_parser.cpp |  2 --
 src/gallium/drivers/r600/sb/sb_core.cpp  |  2 --
 src/gallium/drivers/r600/sb/sb_public.h  | 12 
 src/glx/indirect_init.h  |  8 
 src/glx/tests/indirect_api.cpp   |  2 --
 src/mapi/shared-glapi/tests/check_table.cpp  |  2 --
 src/mesa/drivers/common/driverfuncs.h|  7 +++
 src/mesa/drivers/dri/i965/brw_fs.cpp |  3 ---
 src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp |  2 --
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   |  3 ---
 src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp|  2 --
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |  3 ---
 src/mesa/drivers/dri/i965/brw_shader.cpp |  2 --
 src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp  |  3 ---
 src/mesa/drivers/dri/i965/brw_wm.h   |  8 
 src/mesa/main/api_exec.h |  7 +++
 src/mesa/main/tests/dispatch_sanity.cpp  |  2 --
 src/mesa/main/tests/program_state_string.cpp |  2 --
 src/mesa/main/vtxfmt.h   |  8 
 src/mesa/vbo/vbo.h   |  8 
 src/mesa/vbo/vbo_context.h   |  8 
 src/util/Makefile.am |  3 +++
 src/util/register_allocate.h | 10 ++
 26 files changed, 96 insertions(+), 38 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 5400fce..8f62cac 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -41,12 +41,6 @@
 
 #include "pipe/p_compiler.h"
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 #include "c99_math.h"
 #include 
 #include 
@@ -56,6 +50,11 @@ extern "C" {
 #endif
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 #ifndef M_SQRT2
 #define M_SQRT2 1.41421356237309504880
 #endif
diff --git a/src/gallium/drivers/r600/r600_shader.h 
b/src/gallium/drivers/r600/r600_shader.h
index b2559e9..dd359d7 100644
--- a/src/gallium/drivers/r600/r600_shader.h
+++ b/src/gallium/drivers/r600/r600_shader.h
@@ -25,6 +25,12 @@
 
 #include "r600_asm.h"
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct r600_shader_io {
unsignedname;
unsignedgpr;
@@ -125,4 +131,10 @@ struct r600_pipe_shader {
  TGSI_INTERPOLATE_LOC_CENTER/SAMPLE/COUNT. Other input values return -1. */
 int eg_get_interpolator_index(unsigned interpolate, unsigned location);
 
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+
 #endif
diff --git a/src/gallium/drivers/r600/sb/sb_bc.h 
b/src/gallium/drivers/r600/sb/sb_bc.h
index 072d8f8..ab988f8 100644
--- a/src/gallium/drivers/r600/sb/sb_bc.h
+++ b/src/gallium/drivers/r600/sb/sb_bc.h
@@ -27,10 +27,8 @@
 #ifndef SB_BC_H_
 #define SB_BC_H_
 
-extern "C" {
 #include 
 #include "r600_isa.h"
-}
 
 #include 
 #include 
diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp 
b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
index 403f938..08e7f5c 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
@@ -32,10 +32,8 @@
 #define BCP_DUMP(q)
 #endif
 
-extern "C" {
 #include "r600_pipe.h"
 #include "r600_shader.h"
-}
 
 #include 
 
diff --git a/src/gallium/drivers/r600/sb/sb_core.cpp 
b/src/gallium/drivers/r600/sb/sb_core.cpp
index 9fd9d9a..7db8008 100644
--- a/src/gallium/drivers/r600/sb/sb_core.cpp
+++ b/src/gallium/drivers/r600/sb/sb_core.cpp
@@ -26,13 +26,11 @@
 
 #define SB_RA_SCHED_CHECK DEBUG
 
-extern "C" {
 #include "os/os_time.h"
 #include "r600_pipe.h"
 #include "r600_shader.h"
 
 #include "sb_public.h"
-}
 
 #include 
 #include 
diff --git a/src/gallium/drivers/r600/sb/sb_public.h 
b/src/gallium/drivers/r600/sb/sb_public.h
index c9f5f97..a90771f 100644
--- a/src/gallium/drivers/r600/sb/sb_public.h
+++ b/src/gallium/drivers/r600/sb/sb_public.h
@@ -27,6 +27,12 @@
 #ifndef R600_SB_H_
 #define R600_SB_H_
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct r600_shader;
 
 void r600_sb_context_destroy(void *sctx);
@@ -37,4 +43,10 @@ int r600_sb_bytecode_process(struct r600_context *rctx,
  int dump_source_bytecode,
  int optimize);
 
+
+#ifdef __cplusplus
+} // 

Re: [Mesa-dev] [PATCH] include: Add helper header to help trap includes inside extern C.

2015-03-04 Thread Mark Janes
Assuming my patch to fix 'extern "C"' issues is pushed before this one, 

Reviewed-by: Mark Janes 

Jose Fonseca  writes:

> From: José Fonseca 
>
> This is just to help repro and fixing these issues with any C++ compiler --
>
> commiting this will of course wait until all issues are addressed.
>
>
> $ scons src/glsl/
> scons: Reading SConscript files ...
> Checking for GCC ...  yes
> Checking for Clang ...  no
> Checking for X11 (x11 xext xdamage xfixes glproto >= 1.4.13)... yes
> Checking for XCB (x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8)... yes
> Checking for XF86VIDMODE (xxf86vm)... yes
> Checking for DRM (libdrm >= 2.4.38)... yes
> Checking for UDEV (libudev >= 151)... yes
> warning: LLVM disabled: not building llvmpipe
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: building associated VariantDir targets: build/linux-x86_64-debug/glsl
>   Compiling src/glsl/ast_array_index.cpp ...
>   Compiling src/glsl/ast_expr.cpp ...
>   Compiling src/glsl/ast_function.cpp ...
>   Compiling src/glsl/ast_to_hir.cpp ...
>   Compiling src/glsl/ast_type.cpp ...
>   Compiling src/glsl/builtin_functions.cpp ...
> In file included from include/c99_compat.h:28:0,
>  from src/mapi/u_compiler.h:4,
>  from src/mapi/u_thread.h:47,
>  from src/mapi/glapi/glapi.h:47,
>  from src/mesa/main/mtypes.h:42,
>  from src/mesa/main/errors.h:47,
>  from src/mesa/main/imports.h:41,
>  from src/mesa/main/core.h:44,
>  from src/glsl/builtin_functions.cpp:58:
> include/no_extern_c.h:48:1: error: template with C linkage
>  template class _IncludeInsideExternCNotPortable;
>  ^
> In file included from include/c99_compat.h:28:0,
>  from include/c11/threads.h:38,
>  from src/mapi/u_thread.h:49,
>  from src/mapi/glapi/glapi.h:47,
>  from src/mesa/main/mtypes.h:42,
>  from src/mesa/main/errors.h:47,
>  from src/mesa/main/imports.h:41,
>  from src/mesa/main/core.h:44,
>  from src/glsl/builtin_functions.cpp:58:
> include/no_extern_c.h:48:1: error: template with C linkage
>  template class _IncludeInsideExternCNotPortable;
>  ^
>   Compiling src/glsl/builtin_types.cpp ...
>   Compiling src/glsl/builtin_variables.cpp ...
> scons: *** [build/linux-x86_64-debug/glsl/builtin_functions.os] Error 1
> scons: building terminated because of errors.
> ---
>  include/c99_compat.h  |  2 ++
>  include/no_extern_c.h | 49 +
>  src/util/u_atomic.h   |  3 +++
>  3 files changed, 54 insertions(+)
>  create mode 100644 include/no_extern_c.h
>
> diff --git a/include/c99_compat.h b/include/c99_compat.h
> index 429c601..a8819ac 100644
> --- a/include/c99_compat.h
> +++ b/include/c99_compat.h
> @@ -25,6 +25,8 @@
>   *
>   **/
>  
> +#include "no_extern_c.h"
> +
>  #ifndef _C99_COMPAT_H_
>  #define _C99_COMPAT_H_
>  
> diff --git a/include/no_extern_c.h b/include/no_extern_c.h
> new file mode 100644
> index 000..d038a4f
> --- /dev/null
> +++ b/include/no_extern_c.h
> @@ -0,0 +1,49 @@
> +/**
> + *
> + * Copyright 2014 VMware, Inc.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included
> + * in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + **/
> +
> +
> +/*
> + * Including system's headers inside `extern "C" { ... }` is not safe, as 
> system
> + * headers may have C++ code in them, and C++ code inside extern "C"
> + * leads to syntatically incorrect code.
> + *
> + * This is because putting code inside extern "C" won't make __cplusplus 
> define
> + * go away, that is, the headers being inclu

[Mesa-dev] [PATCH 1/7] main: Add utility function _mesa_lookup_bufferobj_err.

2015-03-04 Thread Laura Ekstrand
This function is exposed to mesa driver internals so that texture buffer
objects and array objects can use it.
---
 src/mesa/main/bufferobj.c | 19 +++
 src/mesa/main/bufferobj.h |  4 
 2 files changed, 23 insertions(+)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e1c5877..cef284f 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1006,6 +1006,25 @@ _mesa_lookup_bufferobj_locked(struct gl_context *ctx, 
GLuint buffer)
   _mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
 }
 
+/**
+ * A convenience function for direct state access functions that throws
+ * GL_INVALID_OPERATION if buffer is not the name of a buffer object in the
+ * hash table.
+ */
+struct gl_buffer_object *
+_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
+   const char *caller)
+{
+   struct gl_buffer_object *bufObj;
+
+   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+   if (!bufObj)
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(non-generated buffer name %u)", caller, buffer);
+
+   return bufObj;
+}
+
 
 void
 _mesa_begin_bufferobj_lookups(struct gl_context *ctx)
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index fe294fc..8e53bfd 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -89,6 +89,10 @@ _mesa_lookup_bufferobj(struct gl_context *ctx, GLuint 
buffer);
 extern struct gl_buffer_object *
 _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer);
 
+extern struct gl_buffer_object *
+_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
+   const char *caller);
+
 extern void
 _mesa_begin_bufferobj_lookups(struct gl_context *ctx);
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 2/7] main: Use _mesa_lookup_bufferobj_err to simplify Tex[ture]Buffer[Range].

2015-03-04 Thread Laura Ekstrand
v2: Review from Anuj Phogat
   - Split rebase of Tex[ture]Buffer[Range]
   - Closing curly brace on the same line as else
---
 src/mesa/main/teximage.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 345a8ff..6374ec9 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5303,11 +5303,12 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, 
GLuint buffer)
   return;
}
 
-   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
-   if (!bufObj && buffer) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
-  return;
-   }
+   if (buffer) {
+  bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBuffer");
+  if (!bufObj)
+ return;
+   } else
+  bufObj = NULL;
 
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
@@ -5387,12 +5388,12 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
   return;
}
 
-   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
-   if (!bufObj && buffer) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureBuffer(buffer %u)",
-  buffer);
-  return;
-   }
+   if (buffer) {
+  bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer");
+  if (!bufObj)
+ return;
+   } else
+  bufObj = NULL;
 
/* Get the texture object by Name. */
texObj = _mesa_lookup_texture_err(ctx, texture,
-- 
2.1.0

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


[Mesa-dev] [PATCH 4/7] main: Cosmetic changes for Texture Buffers.

2015-03-04 Thread Laura Ekstrand
Adds a useful comment and some whitespace. Fixes an error message.

v2: Review from Anuj Phogat
   - Split rebase of Tex[ture]Buffer[Range]
---
 src/mesa/main/teximage.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 706c76b..22574bd 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5354,6 +5354,14 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
   buffer);
   return;
} else {
+
+  /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+   * Textures (PDF page 254):
+   *"If buffer is zero, then any buffer object attached to the buffer
+   *texture is detached, the values offset and size are ignored and
+   *the state for offset and size for the buffer texture are reset to
+   *zero."
+   */
   offset = 0;
   size = 0;
}
@@ -5382,8 +5390,7 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
   bufObj = NULL;
 
/* Get the texture object by Name. */
-   texObj = _mesa_lookup_texture_err(ctx, texture,
- "glTextureBuffer(texture)");
+   texObj = _mesa_lookup_texture_err(ctx, texture, "glTextureBuffer");
if (!texObj)
   return;
 
@@ -5396,6 +5403,7 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
   bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
 }
 
+
 static GLboolean
 is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat)
 {
-- 
2.1.0

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


[Mesa-dev] [PATCH 6/7] main: Add check_texture_buffer_target.

2015-03-04 Thread Laura Ekstrand
Creates a shared function to ensure that texture buffer target is
GL_TEXTURE_BUFFER. Helps to clean up the Tex[ture]Buffer[Range] functions.

v2: Review from Anuj Phogat
   - Split rebase of Tex[ture]Buffer[Range]
---
 src/mesa/main/teximage.c | 39 ---
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9e2c66..2b981ff 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5290,6 +5290,25 @@ _mesa_texture_buffer_range(struct gl_context *ctx,
 
 
 /**
+ * Make sure the texture buffer target is GL_TEXTURE_BUFFER.
+ * Return true if it is, and return false if it is not
+ * (and throw INVALID ENUM as dictated in the OpenGL 4.5
+ * core spec, 02.02.2015, PDF page 245).
+ */
+static bool
+check_texture_buffer_target(struct gl_context *ctx, GLenum target,
+const char *caller)
+{
+   if (target != GL_TEXTURE_BUFFER_ARB) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  "%s(texture target is not GL_TEXTURE_BUFFER)", caller);
+  return false;
+   }
+   else
+  return true;
+}
+
+/**
  * Check for errors related to the texture buffer range.
  * Return false if errors are found, true if none are found.
  */
@@ -5348,11 +5367,11 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, 
GLuint buffer)
 
GET_CURRENT_CONTEXT(ctx);
 
-   /* Need to catch this before it gets to _mesa_get_current_tex_object */
-   if (target != GL_TEXTURE_BUFFER_ARB) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
+   /* Need to catch a bad target before it gets to
+* _mesa_get_current_tex_object.
+*/
+   if (!check_texture_buffer_target(ctx, target, "glTexBuffer"))
   return;
-   }
 
if (buffer) {
   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBuffer");
@@ -5380,11 +5399,11 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
 
GET_CURRENT_CONTEXT(ctx);
 
-   /* Need to catch this before it gets to _mesa_get_current_tex_object */
-   if (target != GL_TEXTURE_BUFFER_ARB) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glTexBufferRange(target)");
+   /* Need to catch a bad target before it gets to
+* _mesa_get_current_tex_object.
+*/
+   if (!check_texture_buffer_target(ctx, target, "glTexBufferRange"))
   return;
-   }
 
if (buffer) {
   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBufferRange");
@@ -5437,10 +5456,8 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
if (!texObj)
   return;
 
-   if (texObj->Target != GL_TEXTURE_BUFFER_ARB) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glTextureBuffer(target)");
+   if (!check_texture_buffer_target(ctx, texObj->Target, "glTextureBuffer"))
   return;
-   }
 
_mesa_texture_buffer_range(ctx, texObj, internalFormat,
   bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
-- 
2.1.0

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


[Mesa-dev] [PATCH 3/7] main: Refactor _mesa_texture_buffer_range.

2015-03-04 Thread Laura Ekstrand
Changes how the caller is identified in error messages, moves a check for
ARB_texture_buffer_object from the entry points to the shared code in
_mesa_texture_buffer_range, and removes an unused argument (GLenum target).

v2: Review from Anuj Phogat
   - Split rebase of Tex[ture]Buffer[Range]
---
 src/mesa/main/teximage.c | 58 ++--
 src/mesa/main/teximage.h |  6 ++---
 2 files changed, 25 insertions(+), 39 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6374ec9..706c76b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5243,24 +5243,34 @@ _mesa_validate_texbuffer_format(const struct gl_context 
*ctx,
 
 void
 _mesa_texture_buffer_range(struct gl_context *ctx,
-   struct gl_texture_object *texObj, GLenum target,
+   struct gl_texture_object *texObj,
GLenum internalFormat,
struct gl_buffer_object *bufObj,
-   GLintptr offset, GLsizeiptr size, bool range,
-   bool dsa)
+   GLintptr offset, GLsizeiptr size,
+   const char *caller)
 {
mesa_format format;
 
-   FLUSH_VERTICES(ctx, 0);
+   /* NOTE: ARB_texture_buffer_object has interactions with
+* the compatibility profile that are not implemented.
+*/
+   if (!(ctx->API == API_OPENGL_CORE &&
+ ctx->Extensions.ARB_texture_buffer_object)) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(ARB_texture_buffer_object is not"
+  " implemented for the compatibility profile)", caller);
+  return;
+   }
 
format = _mesa_validate_texbuffer_format(ctx, internalFormat);
if (format == MESA_FORMAT_NONE) {
   _mesa_error(ctx, GL_INVALID_ENUM,
-  "glTex%sBuffer%s(internalFormat 0x%x)", dsa ? "ture" : "",
-  range ? "Range" : "", internalFormat);
+  "%s(internalFormat 0x%x)", caller, internalFormat);
   return;
}
 
+   FLUSH_VERTICES(ctx, 0);
+
_mesa_lock_texture(ctx, texObj);
{
   _mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
@@ -5294,15 +5304,6 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, 
GLuint buffer)
   return;
}
 
-   /* NOTE: ARB_texture_buffer_object has interactions with
-* the compatibility profile that are not implemented.
-*/
-   if (!(ctx->API == API_OPENGL_CORE &&
- ctx->Extensions.ARB_texture_buffer_object)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
-  return;
-   }
-
if (buffer) {
   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBuffer");
   if (!bufObj)
@@ -5314,8 +5315,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, 
GLuint buffer)
if (!texObj)
   return;
 
-   _mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj, 0,
-  buffer ? -1 : 0, false, false);
+   _mesa_texture_buffer_range(ctx, texObj, internalFormat, bufObj, 0,
+  buffer ? -1 : 0, "glTexBuffer");
 }
 
 
@@ -5335,12 +5336,6 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
   return;
}
 
-   if (!(ctx->API == API_OPENGL_CORE &&
- ctx->Extensions.ARB_texture_buffer_range)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange");
-  return;
-   }
-
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (bufObj) {
   if (offset < 0 ||
@@ -5367,8 +5362,8 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
if (!texObj)
   return;
 
-   _mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj,
-  offset, size, true, false);
+   _mesa_texture_buffer_range(ctx, texObj, internalFormat, bufObj,
+  offset, size, "glTexBufferRange");
 }
 
 void GLAPIENTRY
@@ -5379,15 +5374,6 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
 
GET_CURRENT_CONTEXT(ctx);
 
-   /* NOTE: ARB_texture_buffer_object has interactions with
-* the compatibility profile that are not implemented.
-*/
-   if (!(ctx->API == API_OPENGL_CORE &&
- ctx->Extensions.ARB_texture_buffer_object)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureBuffer");
-  return;
-   }
-
if (buffer) {
   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer");
   if (!bufObj)
@@ -5406,8 +5392,8 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
   return;
}
 
-   _mesa_texture_buffer_range(ctx, texObj, texObj->Target, internalFormat,
-  bufObj, 0, buffer ? -1 : 0, false, true);
+   _mesa_texture_buffer_range(ctx, texObj, internalFormat,
+  bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
 }
 
 static 

[Mesa-dev] [PATCH 5/7] main: Add check_texture_buffer_range.

2015-03-04 Thread Laura Ekstrand
Creates a shared function that TexBufferRange and TextureBufferRange can use
to check the buffer range. This cleans up TexBufferRange considerably.

v2: Review from Anuj Phogat
   - Split rebase of Tex[ture]Buffer[Range]
---
 src/mesa/main/teximage.c | 73 ++--
 1 file changed, 58 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 22574bd..d9e2c66 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5289,6 +5289,56 @@ _mesa_texture_buffer_range(struct gl_context *ctx,
 }
 
 
+/**
+ * Check for errors related to the texture buffer range.
+ * Return false if errors are found, true if none are found.
+ */
+static bool
+check_texture_buffer_range(struct gl_context *ctx,
+   struct gl_buffer_object *bufObj,
+   GLintptr offset, GLsizeiptr size,
+   const char *caller)
+{
+   /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+* Textures (PDF page 245):
+*"An INVALID_VALUE error is generated if offset is negative, if
+*size is less than or equal to zero, or if offset + size is greater
+*than the value of BUFFER_SIZE for the buffer bound to target."
+*/
+   if (offset < 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset=%d < 0)", caller,
+  (int) offset);
+  return false;
+   }
+
+   if (size <= 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d <= 0)", caller,
+  (int) size);
+  return false;
+   }
+
+   if (offset + size > bufObj->Size) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "%s(offset=%d + size=%d > buffer_size=%d)", caller,
+  (int) offset, (int) size, (int) bufObj->Size);
+  return false;
+   }
+
+   /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+* Textures (PDF page 245):
+*"An INVALID_VALUE error is generated if offset is not an integer
+*multiple of the value of TEXTURE_BUFFER_OFFSET_ALIGNMENT."
+*/
+   if (offset % ctx->Const.TextureBufferOffsetAlignment) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "%s(invalid offset alignment)", caller);
+  return false;
+   }
+
+   return true;
+}
+
+
 /** GL_ARB_texture_buffer_object */
 void GLAPIENTRY
 _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
@@ -5336,23 +5386,15 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
   return;
}
 
-   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
-   if (bufObj) {
-  if (offset < 0 ||
-  size <= 0 ||
-  (offset + size) > bufObj->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexBufferRange");
+   if (buffer) {
+  bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBufferRange");
+  if (!bufObj)
  return;
-  }
-  if (offset % ctx->Const.TextureBufferOffsetAlignment) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexBufferRange(invalid offset alignment)");
+
+  if (!check_texture_buffer_range(ctx, bufObj, offset, size,
+  "glTexBufferRange"))
  return;
-  }
-   } else if (buffer) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange(buffer %u)",
-  buffer);
-  return;
+
} else {
 
   /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
@@ -5364,6 +5406,7 @@ _mesa_TexBufferRange(GLenum target, GLenum 
internalFormat, GLuint buffer,
*/
   offset = 0;
   size = 0;
+  bufObj = NULL;
}
 
texObj = _mesa_get_current_tex_object(ctx, target);
-- 
2.1.0

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


[Mesa-dev] [PATCH 7/7] main: Add entry point for TextureBufferRange.

2015-03-04 Thread Laura Ekstrand
v2: Review by Martin Peres
   - Get rid of difficult-to-follow code copied and pasted from
 the original TexBufferRange
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  8 +
 src/mesa/main/tests/dispatch_sanity.cpp|  1 +
 src/mesa/main/teximage.c   | 46 ++
 src/mesa/main/teximage.h   |  4 +++
 4 files changed, 59 insertions(+)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 2fe1638..86c00f9 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -21,6 +21,14 @@
   

 
+   
+  
+  
+  
+  
+  
+   
+

   
   
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index c14ad32..6dddb81 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -987,6 +987,7 @@ const struct function gl_core_functions_possible[] = {
{ "glTextureStorage2DMultisample", 45, -1 },
{ "glTextureStorage3DMultisample", 45, -1 },
{ "glTextureBuffer", 45, -1 },
+   { "glTextureBufferRange", 45, -1 },
 
/* GL_EXT_polygon_offset_clamp */
{ "glPolygonOffsetClampEXT", 11, -1 },
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 2b981ff..1766123 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5463,6 +5463,52 @@ _mesa_TextureBuffer(GLuint texture, GLenum 
internalFormat, GLuint buffer)
   bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
 }
 
+void GLAPIENTRY
+_mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
+ GLintptr offset, GLsizeiptr size)
+{
+   struct gl_texture_object *texObj;
+   struct gl_buffer_object *bufObj;
+
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (buffer) {
+  bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
+  "glTextureBufferRange");
+  if (!bufObj)
+ return;
+
+  if (!check_texture_buffer_range(ctx, bufObj, offset, size,
+  "glTextureBufferRange"))
+ return;
+
+   } else {
+
+  /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+   * Textures (PDF page 254):
+   *"If buffer is zero, then any buffer object attached to the buffer
+   *texture is detached, the values offset and size are ignored and
+   *the state for offset and size for the buffer texture are reset to
+   *zero."
+   */
+  offset = 0;
+  size = 0;
+  bufObj = NULL;
+   }
+
+   /* Get the texture object by Name. */
+   texObj = _mesa_lookup_texture_err(ctx, texture, "glTextureBufferRange");
+   if (!texObj)
+  return;
+
+   if (!check_texture_buffer_target(ctx, texObj->Target,
+   "glTextureBufferRange"))
+  return;
+
+   _mesa_texture_buffer_range(ctx, texObj, internalFormat,
+  bufObj, offset, size, "glTextureBufferRange");
+}
+
 
 static GLboolean
 is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat)
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index db6b648..0ce4a30 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -409,6 +409,10 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, 
GLuint buffer,
 extern void GLAPIENTRY
 _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer);
 
+extern void GLAPIENTRY
+_mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
+ GLintptr offset, GLsizeiptr size);
+
 
 extern void GLAPIENTRY
 _mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
-- 
2.1.0

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


[Mesa-dev] [PATCH 0/7] v2 of Tex[ture]Buffer[Range] functions

2015-03-04 Thread Laura Ekstrand
This divides a major rework of Tex[ture]Buffer[Range] into multiple patches as
recommended by Anuj Phogat.

Laura Ekstrand (7):
  main: Add utility function _mesa_lookup_bufferobj_err.
  main: Use _mesa_lookup_bufferobj_err to simplify
Tex[ture]Buffer[Range].
  main: Refactor _mesa_texture_buffer_range.
  main: Cosmetic changes for Texture Buffers.
  main: Add check_texture_buffer_range.
  main: Add check_texture_buffer_target.
  main: Add entry point for TextureBufferRange.

 src/mapi/glapi/gen/ARB_direct_state_access.xml |   8 +
 src/mesa/main/bufferobj.c  |  19 ++
 src/mesa/main/bufferobj.h  |   4 +
 src/mesa/main/tests/dispatch_sanity.cpp|   1 +
 src/mesa/main/teximage.c   | 241 ++---
 src/mesa/main/teximage.h   |  10 +-
 6 files changed, 210 insertions(+), 73 deletions(-)

-- 
2.1.0

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


Re: [Mesa-dev] [PATCH v2 6/6] i965: Don't write past the end of the application supplied buffer

2015-03-04 Thread Jan Vesely
On Wed, 2015-03-04 at 09:55 -0800, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Both the AMD and Intel APIs provide a dataSize parameter, and this
> function would merrily ignore it.  Neither API specifies what to do when
> the buffer isn't big enough.  I take the easy route of writing all the
> complete bits of data that will fit.  With more complete specs, we could
> probably do something different.
> 
> I noticed this while looking into an unused parameter warning.  The
> warning was actually useful!
> 
> brw_performance_monitor.c: In function 'brw_get_perf_monitor_result':
> brw_performance_monitor.c:1261:37: warning: unused parameter 'data_size' 
> [-Wunused-parameter]
>  GLsizei data_size,
>  ^
> 
> v2: Fix checks to include offset in the calculation.  Noticed by Jan.
> 
> Signed-off-by: Ian Romanick 
> Cc: Kenneth Graunke 
> Cc: Jan Vesely 
> ---
>  src/mesa/drivers/dri/i965/brw_performance_monitor.c | 19 ---
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c 
> b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
> index 6c31d4c..2c8cd49 100644
> --- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c
> +++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
> @@ -1264,6 +1264,7 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
>  {
> struct brw_context *brw = brw_context(ctx);
> struct brw_perf_monitor_object *monitor = brw_perf_monitor(m);
> +   const GLuint *const data_end = (GLuint *)((uint8_t *) data + data_size);
>  
> DBG("GetResult(%d)\n", m->Name);
> brw_dump_perf_monitors(brw);
> @@ -1309,9 +1310,11 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
>   if (counter < 0 || !BITSET_TEST(m->ActiveCounters[group], counter))
>  continue;
>  
> - data[offset++] = group;
> - data[offset++] = counter;
> - data[offset++] = monitor->oa_results[i];
> + if (data + offset + 3 <= data_end) {
> +data[offset++] = group;
> +data[offset++] = counter;
> +data[offset++] = monitor->oa_results[i];
> + }
>}
>  
>clean_bookend_bo(brw);
> @@ -1335,10 +1338,12 @@ brw_get_perf_monitor_result(struct gl_context *ctx,
>  
>for (int i = 0; i < num_counters; i++) {
>   if (BITSET_TEST(m->ActiveCounters[PIPELINE_STATS_COUNTERS], i)) {
> -data[offset++] = PIPELINE_STATS_COUNTERS;
> -data[offset++] = i;
> -*((uint64_t *) (&data[offset])) = 
> monitor->pipeline_stats_results[i];
> -offset += 2;
> +if (data + offset + 4 <= data_end) {
> +   data[offset++] = PIPELINE_STATS_COUNTERS;
> +   data[offset++] = i;
> +   *((uint64_t *) (&data[offset])) = 
> monitor->pipeline_stats_results[i];
> +   offset += 2;
> +}
>   }
>}
> }

don't now anything about i965 driver, but the checks seem OK now
Reviewed-by : Jan Vesely 
-- 
Jan Vesely 


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Matt Turner
The SSSE3 swizzling code was written for fast uploads to the GPU and
assumed the destination was always 16-byte aligned. When we began using
this code for fast downloads as well we didn't do anything to account
for the fact that the destination pointer given by glReadPixels() or
glGetTexImage() is not guaranteed to be suitably aligned.

With SSSE3 enabled (at compile-time), some applications would crash when
an SSE aligned-store instruction tried to store to an unaligned
destination (or an assertion that the destination is aligned would
trigger).

To remedy this, tell intel_get_memcpy() whether we're uploading or
downloading so that it can select whether to assume the destination or
source is aligned, respectively.

Cc: 10.5 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
Tested-by: Uriy Zhuravlev  [v1]
Reviewed-by: Jason Ekstrand 
---
Benchmarks I should run?

 src/mesa/drivers/dri/i965/intel_pixel_read.c   |   3 +-
 src/mesa/drivers/dri/i965/intel_tex_image.c|   3 +-
 src/mesa/drivers/dri/i965/intel_tex_subimage.c |   3 +-
 src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 140 ++---
 src/mesa/drivers/dri/i965/intel_tiled_memcpy.h |  15 ++-
 5 files changed, 122 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c 
b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index df22a63..0972121 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -139,7 +139,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
rb->Format == MESA_FORMAT_R8G8B8X8_UNORM)
   return false;
 
-   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp,
+ INTEL_DOWNLOAD))
   return false;
 
if (!irb->mt ||
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c
index da42fdd..00bf9ce 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -408,7 +408,8 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
texImage->TexFormat == MESA_FORMAT_R8G8B8X8_UNORM)
   return false;
 
-   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp,
+ INTEL_DOWNLOAD))
   return false;
 
/* If this is a nontrivial texture view, let another path handle it 
instead. */
diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 4262f71..909ff25 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -118,7 +118,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Invert)
   return false;
 
-   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp))
+   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy, &cpp,
+ INTEL_UPLOAD))
   return false;
 
/* If this is a nontrivial texture view, let another path handle it 
instead. */
diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c 
b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
index f2b35cb..dcf0462 100644
--- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
+++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
@@ -60,42 +60,79 @@ static const uint32_t ytile_span = 16;
 static const uint8_t rgba8_permutation[16] =
{ 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };
 
-/* NOTE: dst must be 16 byte aligned */
-#define rgba8_copy_16(dst, src) \
-   *(__m128i *)(dst) = _mm_shuffle_epi8(\
-  (__m128i) _mm_loadu_ps((float *)(src)),   \
-  *(__m128i *) rgba8_permutation\
-   )
+/* NOTE: dst must be 16-byte aligned. src may be unaligned. */
+#define rgba8_copy_16_aligned_dst(dst, src)\
+   _mm_store_si128((__m128i *)(dst),   \
+   _mm_shuffle_epi8(_mm_loadu_si128((__m128i *)(src)), \
+*(__m128i *) rgba8_permutation))
+
+/* NOTE: src must be 16-byte aligned. dst may be unaligned. */
+#define rgba8_copy_16_aligned_src(dst, src)\
+   _mm_storeu_si128((__m128i *)(dst),  \
+_mm_shuffle_epi8(_mm_load_si128((__m128i *)(src)), \
+ *(__m128i *) rgba8_permutation))
 #endif
 
 /**
- * Copy RGBA to BGRA - swap R and B.
+ * Copy RGBA to BGRA - swap R and B, with the destination 16-byte aligned.
  */
 static inline void *
-rgba8_copy(void *dst, const void *src, size_t bytes)
+rgba8_copy_aligned_dst(void *dst, const void *src, size_t bytes)
 {
uint8_t *d = dst;
uint8_t const *s = src;
 
 #ifdef __SSSE3__
-   /* Fast copying for t

Re: [Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Jason Ekstrand
On Wed, Mar 4, 2015 at 4:56 PM, Matt Turner  wrote:

> The SSSE3 swizzling code was written for fast uploads to the GPU and
> assumed the destination was always 16-byte aligned. When we began using
> this code for fast downloads as well we didn't do anything to account
> for the fact that the destination pointer given by glReadPixels() or
> glGetTexImage() is not guaranteed to be suitably aligned.
>
> With SSSE3 enabled (at compile-time), some applications would crash when
> an SSE aligned-store instruction tried to store to an unaligned
> destination (or an assertion that the destination is aligned would
> trigger).
>
> To remedy this, tell intel_get_memcpy() whether we're uploading or
> downloading so that it can select whether to assume the destination or
> source is aligned, respectively.
>
> Cc: 10.5 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
> Tested-by: Uriy Zhuravlev  [v1]
> Reviewed-by: Jason Ekstrand 
> ---
> Benchmarks I should run?
>

I'm not worried about it.  Maybe changing from aligned to unaligned reads
makes more or less of a difference than changing writes.


>
>  src/mesa/drivers/dri/i965/intel_pixel_read.c   |   3 +-
>  src/mesa/drivers/dri/i965/intel_tex_image.c|   3 +-
>  src/mesa/drivers/dri/i965/intel_tex_subimage.c |   3 +-
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 140
> ++---
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.h |  15 ++-
>  5 files changed, 122 insertions(+), 42 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> index df22a63..0972121 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> @@ -139,7 +139,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
> rb->Format == MESA_FORMAT_R8G8B8X8_UNORM)
>return false;
>
> -   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp))
> +   if (!intel_get_memcpy(rb->Format, format, type, &mem_copy, &cpp,
> + INTEL_DOWNLOAD))
>return false;
>
> if (!irb->mt ||
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c
> b/src/mesa/drivers/dri/i965/intel_tex_image.c
> index da42fdd..00bf9ce 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> @@ -408,7 +408,8 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context
> *ctx,
> texImage->TexFormat == MESA_FORMAT_R8G8B8X8_UNORM)
>return false;
>
> -   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp))
> +   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp,
> + INTEL_DOWNLOAD))
>return false;
>
> /* If this is a nontrivial texture view, let another path handle it
> instead. */
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> index 4262f71..909ff25 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> @@ -118,7 +118,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
> packing->Invert)
>return false;
>
> -   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp))
> +   if (!intel_get_memcpy(texImage->TexFormat, format, type, &mem_copy,
> &cpp,
> + INTEL_UPLOAD))
>return false;
>
> /* If this is a nontrivial texture view, let another path handle it
> instead. */
> diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> index f2b35cb..dcf0462 100644
> --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> @@ -60,42 +60,79 @@ static const uint32_t ytile_span = 16;
>  static const uint8_t rgba8_permutation[16] =
> { 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };
>
> -/* NOTE: dst must be 16 byte aligned */
> -#define rgba8_copy_16(dst, src) \
> -   *(__m128i *)(dst) = _mm_shuffle_epi8(\
> -  (__m128i) _mm_loadu_ps((float *)(src)),   \
> -  *(__m128i *) rgba8_permutation\
> -   )
> +/* NOTE: dst must be 16-byte aligned. src may be unaligned. */
> +#define rgba8_copy_16_aligned_dst(dst, src)\
> +   _mm_store_si128((__m128i *)(dst),   \
> +   _mm_shuffle_epi8(_mm_loadu_si128((__m128i *)(src)), \
> +*(__m128i *) rgba8_permutation))
> +
> +/* NOTE: src must be 16-byte aligned. dst may be unaligned. */
> +#define rgba8_copy_16_aligned_src(dst, src)\
> +   _mm_storeu_si128((__m128i *)(dst),  \
> +_mm_shuffle_epi8(_mm_load_si128((__m128i *)(src)), \
> + *(__m128i *) rgba8_permutat

Re: [Mesa-dev] [PATCH 1/3] Revert "common: Fix PBOs for 1D_ARRAY."

2015-03-04 Thread Jason Ekstrand
Series is
Reviewed-by: Jason Ekstrand 

On Wed, Mar 4, 2015 at 3:15 PM, Emil Velikov 
wrote:

> On 4 March 2015 at 17:22, Neil Roberts  wrote:
> > This reverts commit 546aba143d13ba3f993ead4cc30b2404abfc0202.
> >
> > I think the changes to the calls to glBlitFramebuffer from this patch
> > are no different to what it was doing previously because it used to
> > set height to 1 before doing the blits. However it was introducing
> > some problems with the blit for layer 0 because this was no longer
> > special cased. It didn't fix problems with the yoffset which needs to
> > be interpreted as a slice offset. I think a better solution would be
> > to modify the original if statement to cope with the yoffset.
> >
> Neil, if others agree with this revert can you cc stable. Seems that
> the offending commit already has the tag, plus I've already picked it
> up :-\
>

That's ok.  Just add this series to stable once it gets pushed too.
--Jason


>
> Cc: "10.5" 
>
> Thanks
> Emil
> ___
> 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


Re: [Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 5:07 PM, Jason Ekstrand  wrote:
> On Wed, Mar 4, 2015 at 4:56 PM, Matt Turner  wrote:
>> @@ -357,16 +394,22 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1,
>> uint32_t x2, uint32_t x3,
>>if (mem_copy == memcpy)
>>   return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
>> xtile_height,
>>   dst, src, src_pitch, swizzle_bit,
>> memcpy);
>> -  else if (mem_copy == rgba8_copy)
>> +  else if (mem_copy == rgba8_copy_aligned_dst)
>>   return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
>> xtile_height,
>> - dst, src, src_pitch, swizzle_bit,
>> rgba8_copy);
>> + dst, src, src_pitch, swizzle_bit,
>> + rgba8_copy_aligned_dst);
>> +  else
>> + unreachable("not reached");
>
>
> I'm not sure what I think about the unreachable here.  The original versions
> of the *_faster functions would work regardless of what memcpy you passed
> in.

Well, yeah, but there were only two. :)

> The *_faster was only to force the compiler to inline the universe in
> the case where we knew some parameters.  Adding unreachable changes that.

Oh, I didn't know what you meant, until I realized that the if-elseif
is supposed to fall through to another function call in the case that
mem_copy wasn't matched.

At the very least I should split that out into a separate patch. Using
unreachable(), if it's safe, cuts more than 1k of text:

   text   databssdechex filename
   9663  0  0   9663   25bf .libs/intel_tiled_memcpy.o
   8215  0  0   8215   2017 .libs/intel_tiled_memcpy.o

I'll drop the unreachable()s from this patch.

> That said, we never call them with anything other than memcpy or
> rgba8_copy_aligned_* so it's probably ok.  I think I'm ok with it with or
> without the unreachable()'s.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

2015-03-04 Thread Jason Ekstrand
On Wed, Mar 4, 2015 at 5:28 PM, Matt Turner  wrote:

> On Wed, Mar 4, 2015 at 5:07 PM, Jason Ekstrand 
> wrote:
> > On Wed, Mar 4, 2015 at 4:56 PM, Matt Turner  wrote:
> >> @@ -357,16 +394,22 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1,
> >> uint32_t x2, uint32_t x3,
> >>if (mem_copy == memcpy)
> >>   return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
> >> xtile_height,
> >>   dst, src, src_pitch, swizzle_bit,
> >> memcpy);
> >> -  else if (mem_copy == rgba8_copy)
> >> +  else if (mem_copy == rgba8_copy_aligned_dst)
> >>   return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
> >> xtile_height,
> >> - dst, src, src_pitch, swizzle_bit,
> >> rgba8_copy);
> >> + dst, src, src_pitch, swizzle_bit,
> >> + rgba8_copy_aligned_dst);
> >> +  else
> >> + unreachable("not reached");
> >
> >
> > I'm not sure what I think about the unreachable here.  The original
> versions
> > of the *_faster functions would work regardless of what memcpy you passed
> > in.
>
> Well, yeah, but there were only two. :)
>
> > The *_faster was only to force the compiler to inline the universe in
> > the case where we knew some parameters.  Adding unreachable changes that.
>
> Oh, I didn't know what you meant, until I realized that the if-elseif
> is supposed to fall through to another function call in the case that
> mem_copy wasn't matched.
>
> At the very least I should split that out into a separate patch. Using
> unreachable(), if it's safe, cuts more than 1k of text:
>
>text   databssdechex filename
>9663  0  0   9663   25bf .libs/intel_tiled_memcpy.o
>8215  0  0   8215   2017 .libs/intel_tiled_memcpy.o
>
> I'll drop the unreachable()s from this patch.
>

Fine with me.  In any case, my R-B still applies.
--Jason


>
> > That said, we never call them with anything other than memcpy or
> > rgba8_copy_aligned_* so it's probably ok.  I think I'm ok with it with or
> > without the unreachable()'s.
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] New stable-branch 10.4 candidate pushed

2015-03-04 Thread Matt Turner
On Wed, Mar 4, 2015 at 4:53 AM, Emil Velikov  wrote:
> Trivial merge conflicts
> ---
> Here are the commits where I manually merged conflicts, so these might
> merit additional review:
>
> commit a598a9bdfe9f5d0ed35ca89a55cf74a2b678e8e1
> Author: Matt Turner 
>
> mesa: Correct backwards NULL check.
>
> (cherry picked from commit 491d42135ad0e5670756216154f2ba9fc79d4ba7)

Again looks like I tagged something for 10.4 that doesn't apply.

This one needs to be reverted (we've changed it so that if length is
NULL, dereference it!)

If we want to apply fixes for GetProgramBinary, we need 201b9c18,
4fd8b301, and f591712e first.

I'd revert this commit, cherry-pick those just mentioned and then
cherry-pick 491d42135 on top of that.

>
> commit 39ae85732d29906ea2a16dfdfc77f8e5dbed5853
> Author: Eduardo Lima Mitev 
>
> mesa: Fix error validating args for TexSubImage3D
>
> (cherry picked from commit 2aa71e9485a5a062b1bd2dd8bdc081a8fa4c873d)

Looks like we're only applying half of this commit. I'm not sure what
the right thing to do is. I might just drop it?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Reserve more batch space to accomodate Gen6 perfmonitors.

2015-03-04 Thread Anuj Phogat
On Wed, Mar 4, 2015 at 3:46 PM, Kenneth Graunke  wrote:
> Ben noticed that I said each PIPE_CONTROL was 4 DWords, but it's
> actually 5 DWords on Gen6-7.  We've been reserving insufficient space
> for performance monitoring on Sandybridge, which means it would likely
> break if you used that functionality.  (Thankfully, no one does...)
>
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/intel_batchbuffer.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> We should probably Cc this to stable unless we delete the broken
> performance monitoring code altogether.
>
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h 
> b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> index 7bdd836..5a16456 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
> @@ -22,12 +22,12 @@ extern "C" {
>   *   - Disabling OA counters on Gen6+ (3 DWords = 12 bytes)
>   *   - Ending MI_REPORT_PERF_COUNT on Gen5+, plus associated PIPE_CONTROLs:
>   * - Two sets of PIPE_CONTROLs, which become 3 PIPE_CONTROLs each on SNB,
> - *   which are 4 DWords each ==> 2 * 3 * 4 * 4 = 96 bytes
> + *   which are 5 DWords each ==> 2 * 3 * 5 * 4 = 120 bytes
>   * - 3 DWords for MI_REPORT_PERF_COUNT itself on Gen6+.  ==> 12 bytes.
>   *   On Ironlake, it's 6 DWords, but we have some slack due to the lack 
> of
>   *   Sandybridge PIPE_CONTROL madness.
>   */
> -#define BATCH_RESERVED 146
> +#define BATCH_RESERVED 152
>
>  struct intel_batchbuffer;
>
> --
> 2.2.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


[Mesa-dev] [PATCH 02/12] mesa: include stdio.h where needed

2015-03-04 Thread Brian Paul
Instead of relying on glapi.h or some other header to provide it.
---
 src/mesa/main/blit.c  | 1 +
 src/mesa/main/debug.c | 1 +
 src/mesa/main/dlist.h | 2 +-
 src/mesa/main/errors.c| 1 +
 src/mesa/main/execmem.c   | 1 +
 src/mesa/main/framebuffer.c   | 2 +-
 src/mesa/main/imports.c   | 1 +
 src/mesa/main/texobj.c| 1 +
 src/mesa/main/texstate.c  | 1 +
 src/mesa/main/varray.c| 1 +
 src/mesa/main/version.c   | 1 +
 src/mesa/math/m_vector.c  | 1 +
 src/mesa/program/prog_statevars.c | 1 +
 src/mesa/tnl/t_draw.c | 2 ++
 src/mesa/tnl/t_vb_render.c| 1 +
 src/mesa/tnl/t_vertex.c   | 1 +
 src/mesa/vbo/vbo_exec_array.c | 1 +
 src/mesa/vbo/vbo_exec_draw.c  | 1 +
 src/mesa/vbo/vbo_rebase.c | 1 +
 src/mesa/vbo/vbo_save_loopback.c  | 1 +
 src/mesa/vbo/vbo_split_copy.c | 2 ++
 src/mesa/x86/gen_matypes.c| 2 ++
 22 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
index 2898723..0694466 100644
--- a/src/mesa/main/blit.c
+++ b/src/mesa/main/blit.c
@@ -28,6 +28,7 @@
  */
 
 #include 
+#include 
 
 #include "context.h"
 #include "enums.h"
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 4522114..eda4937 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -23,6 +23,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include 
 #include "mtypes.h"
 #include "attrib.h"
 #include "colormac.h"
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index 6189632..a121467 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -32,7 +32,7 @@
 #ifndef DLIST_H
 #define DLIST_H
 
-
+#include 
 #include "main/mtypes.h"
 
 
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 33c1730..8ffbf41 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -29,6 +29,7 @@
 
 
 #include 
+#include 
 #include "errors.h"
 #include "enums.h"
 #include "imports.h"
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index 7267cf8..3a13385 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -31,6 +31,7 @@
  */
 
 
+#include 
 #include "imports.h"
 
 
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 5df1ecc..4f7736a 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -29,7 +29,7 @@
  * ushorts, uints, etc.
  */
 
-
+#include 
 #include "glheader.h"
 #include "imports.h"
 #include "blend.h"
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 752cf5a..a7ffe22 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -42,6 +42,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include 
 #include 
 #include "c99_math.h"
 #include "imports.h"
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index d5aa620..e018ab9 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -28,6 +28,7 @@
  */
 
 
+#include 
 #include "bufferobj.h"
 #include "colortab.h"
 #include "context.h"
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 78ae7d2..0a7f983 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -28,6 +28,7 @@
  * Texture state handling.
  */
 
+#include 
 #include "glheader.h"
 #include "bufferobj.h"
 #include "colormac.h"
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 3db9e06..42e7f89 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -24,6 +24,7 @@
  */
 
 
+#include 
 #include   /* for PRId64 macro */
 
 #include "glheader.h"
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 4951891..8e0c3ef 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -23,6 +23,7 @@
  */
 
 
+#include 
 #include "imports.h"
 #include "mtypes.h"
 #include "version.h"
diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c
index ff42396..831f953 100644
--- a/src/mesa/math/m_vector.c
+++ b/src/mesa/math/m_vector.c
@@ -26,6 +26,7 @@
  * New (3.1) transformation code written by Keith Whitwell.
  */
 
+#include 
 
 #include "main/glheader.h"
 #include "main/imports.h"
diff --git a/src/mesa/program/prog_statevars.c 
b/src/mesa/program/prog_statevars.c
index 4cde744..57b25a7 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -29,6 +29,7 @@
  */
 
 
+#include 
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/blend.h"
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index be3f059..60265d6 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -25,6 +25,8 @@
  *Keith Whitwell 
  */
 
+#include 
+
 #include "main/glheader.h"
 #include "main/bufferobj.h"
 #include "main/condrender.h"
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index a090c48..4960ac0 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -38,6 +38,7 @@
  */
 
 
+#in

[Mesa-dev] [PATCH 05/12] nouveau: include stdio.h where needed

2015-03-04 Thread Brian Paul
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 +
 src/mesa/drivers/dri/nouveau/nouveau_driver.c  | 1 +
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index e1bb7e8..a049d9b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -25,6 +25,7 @@
  */
 
 #include 
+#include 
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_bufferobj.h"
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index c1f8672..7f31b28 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include 
 #include "main/mtypes.h"
 #include "main/fbobject.h"
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index b9ae959..153f18e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include "nouveau_driver.h"
-- 
1.9.1

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


[Mesa-dev] [PATCH 07/12] st/mesa: include stdio.h where needed

2015-03-04 Thread Brian Paul
---
 src/mesa/state_tracker/st_atom.c   | 1 +
 src/mesa/state_tracker/st_cb_texture.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 8cc6af2..f0fe11f 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -26,6 +26,7 @@
  **/
 
 
+#include 
 #include "main/glheader.h"
 #include "main/context.h"
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 0525e87..a8b19a1 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -25,6 +25,7 @@
  * 
  **/
 
+#include 
 #include "main/bufferobj.h"
 #include "main/enums.h"
 #include "main/fbobject.h"
-- 
1.9.1

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


[Mesa-dev] [PATCH 03/12] glsl: include stdio.h where needed

2015-03-04 Thread Brian Paul
---
 src/glsl/s_expression.cpp   | 1 +
 src/glsl/standalone_scaffolding.cpp | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp
index 2928a4d..7eaa491 100644
--- a/src/glsl/s_expression.cpp
+++ b/src/glsl/s_expression.cpp
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include "s_expression.h"
 
 s_symbol::s_symbol(const char *str, size_t n)
diff --git a/src/glsl/standalone_scaffolding.cpp 
b/src/glsl/standalone_scaffolding.cpp
index ad0d75b..6f5a27f 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -30,6 +30,7 @@
 #include "standalone_scaffolding.h"
 
 #include 
+#include 
 #include 
 #include "util/ralloc.h"
 
-- 
1.9.1

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


[Mesa-dev] [PATCH 04/12] dri/common: include stdio.h where needed

2015-03-04 Thread Brian Paul
---
 src/mesa/drivers/dri/common/utils.c | 1 +
 src/mesa/drivers/dri/common/xmlconfig.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index ccdc971..bb22107 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c 
b/src/mesa/drivers/dri/common/xmlconfig.c
index 6357e92..2b284cc 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -28,6 +28,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
1.9.1

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


[Mesa-dev] [PATCH 10/12] st/osmesa: include stdio.h

2015-03-04 Thread Brian Paul
---
 src/gallium/state_trackers/osmesa/osmesa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 4e2b2e0..2d5d096 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -49,6 +49,7 @@
  */
 
 
+#include 
 #include "GL/osmesa.h"
 
 #include "glapi/glapi.h"  /* for OSMesaGetProcAddress below */
-- 
1.9.1

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


[Mesa-dev] [PATCH 01/12] mesa: include c11/threads.h in mtypes.h

2015-03-04 Thread Brian Paul
Let's directly include c11/threads.h instead of relying on glapi.h
to provide it.
---
 src/mesa/main/mtypes.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6e99773..efeee8b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -36,6 +36,7 @@
 
 #include  /* uint32_t */
 #include 
+#include "c11/threads.h"
 
 #include "main/glheader.h"
 #include "main/config.h"
-- 
1.9.1

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


  1   2   >