mesa.git
8 years agovc4: Add dumping for VC4_PACKET_LOAD/STORE_FULL_RES_TILE_BUFFER.
Eric Anholt [Tue, 23 Jun 2015 00:34:24 +0000 (17:34 -0700)]
vc4: Add dumping for VC4_PACKET_LOAD/STORE_FULL_RES_TILE_BUFFER.

8 years agovc4: Don't try to CSE color reads.
Eric Anholt [Wed, 24 Jun 2015 01:08:49 +0000 (18:08 -0700)]
vc4: Don't try to CSE color reads.

It returns a new value for each sample in the TLB.  We've already avoided
trying to get the same index's color multiple times at the vc4_program.c
level, so we're not losing anything by doing this.

8 years agovc4: Make a helper for TLB color writes, too.
Eric Anholt [Wed, 24 Jun 2015 01:04:00 +0000 (18:04 -0700)]
vc4: Make a helper for TLB color writes, too.

We've done so for all the other QIR instruction generation in this file.

8 years agovc4: Pull the blending operation out to a separate function.
Eric Anholt [Wed, 24 Jun 2015 00:53:07 +0000 (17:53 -0700)]
vc4: Pull the blending operation out to a separate function.

It's fairly separate from the rest of the TLB operations at frag end time,
and we'll need to run it multiple times to support MSAA blending.

8 years agovc4: Clarify size calculation for Z/S writes.
Eric Anholt [Mon, 22 Jun 2015 18:45:27 +0000 (11:45 -0700)]
vc4: Clarify size calculation for Z/S writes.

It's the same value for loads and stores, because they're basically the
same packet.

8 years agovc4: Add an "args" temporary for RCL setup.
Eric Anholt [Mon, 22 Jun 2015 20:14:57 +0000 (13:14 -0700)]
vc4: Add an "args" temporary for RCL setup.

8 years agovc4: Reuse (and extend) the packet.h sizes for dumping.
Eric Anholt [Tue, 23 Jun 2015 00:31:24 +0000 (17:31 -0700)]
vc4: Reuse (and extend) the packet.h sizes for dumping.

8 years agovc4: Fix printfs for blit fallbacks.
Eric Anholt [Sat, 20 Jun 2015 22:30:19 +0000 (15:30 -0700)]
vc4: Fix printfs for blit fallbacks.

8 years agotgsi_to_nir: Fix translation of TXF on MSAA targets.
Eric Anholt [Tue, 23 Jun 2015 18:02:12 +0000 (11:02 -0700)]
tgsi_to_nir: Fix translation of TXF on MSAA targets.

Noticed while trying to add GL_ARB_texture_multisample support to vc4.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965/fs: Get rid of an unused variable in emit_barrier()
Jason Ekstrand [Tue, 23 Jun 2015 22:39:42 +0000 (15:39 -0700)]
i965/fs: Get rid of an unused variable in emit_barrier()

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Remove the brw_context from the visitors
Jason Ekstrand [Tue, 23 Jun 2015 00:17:56 +0000 (17:17 -0700)]
i965: Remove the brw_context from the visitors

As of this commit, nothing actually needs the brw_context.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/vec4_vs: Add an explicit use_legacy_snorm_formula flag
Jason Ekstrand [Tue, 23 Jun 2015 00:30:23 +0000 (17:30 -0700)]
i965/vec4_vs: Add an explicit use_legacy_snorm_formula flag

This way we can stop doing is_gles3 checks inside of the compiler.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/vec4: Turn some _mesa_problem calls into asserts
Jason Ekstrand [Tue, 23 Jun 2015 00:17:51 +0000 (17:17 -0700)]
i965/vec4: Turn some _mesa_problem calls into asserts

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/vs: Pass the current set of clip planes through run() and run_vs()
Jason Ekstrand [Sat, 20 Jun 2015 00:29:42 +0000 (17:29 -0700)]
i965/vs: Pass the current set of clip planes through run() and run_vs()

Previously, these were pulled out of the GL context conditionally based on
whether we were running ff/ARB or a GLSL program.  Now, we just pass them
in so that the visitor doesn't have to grab them itself.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/fs: Add a do_rep_send flag to run_fs
Jason Ekstrand [Sat, 20 Jun 2015 00:25:28 +0000 (17:25 -0700)]
i965/fs: Add a do_rep_send flag to run_fs

Previously, we were pulling it from brw->do_rep_send

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965: Pull calls to get_shader_time_index out of the visitor
Jason Ekstrand [Fri, 19 Jun 2015 22:40:09 +0000 (15:40 -0700)]
i965: Pull calls to get_shader_time_index out of the visitor

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965: Use a single index per shader for shader_time.
Jason Ekstrand [Fri, 19 Jun 2015 21:46:03 +0000 (14:46 -0700)]
i965: Use a single index per shader for shader_time.

Previously, each shader took 3 shader time indices which were potentially
at arbirary points in the shader time buffer.  Now, each shader gets a
single index which refers to 3 consecutive locations in the buffer.  This
simplifies some of the logic at the cost of having a magic 3 a few places.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965: Add compiler options to brw_compiler
Jason Ekstrand [Thu, 16 Apr 2015 22:28:17 +0000 (15:28 -0700)]
i965: Add compiler options to brw_compiler

This creates the options at screen cration time and then we just copy them
into the context at context creation time.  We also move is_scalar to the
brw_compiler structure.

We also end up manually setting some values that the core would have set by
default for us.  Fortunately, there are only two non-zero shader compiler
option defaults that we aren't overriding anyway so this isn't a big deal.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/fs: Plumb compiler debug logging through brw_compiler
Jason Ekstrand [Tue, 23 Jun 2015 00:01:22 +0000 (17:01 -0700)]
i965/fs: Plumb compiler debug logging through brw_compiler

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/fs: Do the no16 perf logging directly in fs_visitor::no16()
Jason Ekstrand [Mon, 22 Jun 2015 23:32:06 +0000 (16:32 -0700)]
i965/fs: Do the no16 perf logging directly in fs_visitor::no16()

While we're at it, we'll drop the note about 10-20% performance loss.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/fs: Make no16 non-variadic
Jason Ekstrand [Mon, 22 Jun 2015 23:30:04 +0000 (16:30 -0700)]
i965/fs: Make no16 non-variadic

We never used the fact that it was variadic anyway.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Move INTEL_DEBUG variable parsing to screen creation time
Jason Ekstrand [Fri, 17 Apr 2015 00:39:13 +0000 (17:39 -0700)]
i965: Move INTEL_DEBUG variable parsing to screen creation time

v2: Do bufmgr set_debug and set_aub_dump at screen time as well.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Remove the dependance on brw_context from the generators
Jason Ekstrand [Thu, 16 Apr 2015 21:34:04 +0000 (14:34 -0700)]
i965: Remove the dependance on brw_context from the generators

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Plumb compiler debug logging through a function pointer in brw_compiler
Jason Ekstrand [Thu, 16 Apr 2015 21:13:52 +0000 (14:13 -0700)]
i965: Plumb compiler debug logging through a function pointer in brw_compiler

v2 (Ken): Make shader_debug_log a printf-like function.
v3 (Jason): Add a void * to pass the brw_context through

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add a va_args variant of _mesa_gl_debug().
Kenneth Graunke [Sat, 18 Apr 2015 19:23:33 +0000 (12:23 -0700)]
mesa: Add a va_args variant of _mesa_gl_debug().

This will be useful for wrapper functions.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965: Replace some instances of brw->gen with devinfo->gen
Jason Ekstrand [Sat, 20 Jun 2015 00:19:38 +0000 (17:19 -0700)]
i965: Replace some instances of brw->gen with devinfo->gen

8 years agoi965: Initialize backend_shader::mem_ctx in its constructor.
Matt Turner [Mon, 22 Jun 2015 18:42:15 +0000 (11:42 -0700)]
i965: Initialize backend_shader::mem_ctx in its constructor.

We were initializing it in each subclasses' constructors for some
reason.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Assert that the GL primitive isn't out of range.
Matt Turner [Mon, 22 Jun 2015 18:20:32 +0000 (11:20 -0700)]
i965: Assert that the GL primitive isn't out of range.

Coverity sees the if (mode >= BRW_PRIM_OFFSET (128)) test and assumes
that the else-branch might execute for mode to up 127, which out be out
of bounds.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/cfg: Assert that cur_do/while/if pointers are non-NULL.
Matt Turner [Mon, 22 Jun 2015 18:09:49 +0000 (11:09 -0700)]
i965/cfg: Assert that cur_do/while/if pointers are non-NULL.

Coverity sees that the functions immediately below the new assertions
dereference these pointers, but is unaware that an ENDIF always follows
an IF, etc.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agomesa: Delete unused ICEIL().
Matt Turner [Sat, 20 Jun 2015 03:40:15 +0000 (20:40 -0700)]
mesa: Delete unused ICEIL().

Can't find any uses of it in git history.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/fs: Don't mess up stride for uniform integer multiplication.
Matt Turner [Mon, 22 Jun 2015 17:59:33 +0000 (10:59 -0700)]
i965/fs: Don't mess up stride for uniform integer multiplication.

If the stride is 0, the source is a uniform and we should not modify the
stride.

Cc: "10.6" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91047
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoegl/x11: Remove duplicate call to dri2_x11_add_configs_for_visuals
Boyan Ding [Sat, 13 Jun 2015 07:33:20 +0000 (15:33 +0800)]
egl/x11: Remove duplicate call to dri2_x11_add_configs_for_visuals

The call to dri2_x11_add_configs_for_visuals (previously
dri2_add_configs_for_visuals) was moved downwards in commit f8c5b8a1,
but appeared again in its original position after its rename in
d019cd81. Remove it.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoi965/gen9: Don't use encrypted MOCS
Ben Widawsky [Wed, 17 Jun 2015 22:50:13 +0000 (15:50 -0700)]
i965/gen9: Don't use encrypted MOCS

On gen9+ MOCS is an index into a table. It is 7 bits, and AFAICT, bit 0 is for
doing encrypted reads.

I don't recall how I decided to do this for BXT. I don't know this patch was
ever needed, since it seems nothing is broken today on SKL. Furthermore, this
patch may no longer be needed because of the ongoing changes with MOCS setup. It
is what is being used/tested, so it's included in the series.

The chosen values are the old values left shifted. That was also an arbitrary
choice.

v2: Use shift in MOCS to make it clear what we're doing. (Ken)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonv50,nvc0: make sure to pushbuf_refn before putting bo into pushbuf_data
Ilia Mirkin [Sun, 21 Jun 2015 23:03:35 +0000 (19:03 -0400)]
nv50,nvc0: make sure to pushbuf_refn before putting bo into pushbuf_data

Without first running the bo through pushbuf_refn, the nouveau drm
library will have uninitialized structures regarding this bo, and will
insert incorrect data.

This fixes supertuxkart 0.9 crash on start (where it ends up doing a lot
of indirect draws).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
8 years agonvc0: always put all tfb bufs into bufctx
Ilia Mirkin [Sun, 21 Jun 2015 19:00:16 +0000 (15:00 -0400)]
nvc0: always put all tfb bufs into bufctx

Since we clear the TFB bufctx binding point above, we need to put all of
the active tfb's back in, even if they haven't changed since last time.
Otherwise the tfb may get moved into sysmem and the underlying mapping
will generate write errors.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
8 years agoglsl: binding point is a texture unit, which is a combined space
Ilia Mirkin [Tue, 23 Jun 2015 04:16:59 +0000 (00:16 -0400)]
glsl: binding point is a texture unit, which is a combined space

This fixes compilation failures in Dota 2 Reborn where a texture unit
binding point was used that was numerically higher than the max
per stage.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
8 years agoandroid: egl: do not link against libglapi
Emil Velikov [Fri, 19 Jun 2015 18:35:19 +0000 (19:35 +0100)]
android: egl: do not link against libglapi

The only reason we touch glapi is to dlopen it in order to:
 - make sure that the unresolved _glapi* symbols in the dri modules are
provided.
 - fetch glFlush() and use it at various stages in the dri2 driver.

Cc: Chih-Wei Huang <cwhuang@linux.org.tw>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agogbm: do not (over)link against libglapi.so
Emil Velikov [Fri, 19 Jun 2015 18:22:38 +0000 (19:22 +0100)]
gbm: do not (over)link against libglapi.so

The whole of GBM does not rely on even a single symbol from the GL
dispatch library, unsuprisingly. The only need for it comes from the
unresolved symbols in the DRI modules, which are now correctly handled
with Frank's commit.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agogbm: dlopen libglapi so gbm_create_device works
Frank Henigman [Thu, 6 Nov 2014 21:29:26 +0000 (16:29 -0500)]
gbm: dlopen libglapi so gbm_create_device works

Dri driver libs are not linked to pull in libglapi so gbm_create_device()
fails when it tries to dlopen them (unless the application is linked
with something that does pull in libglapi, like libGL).
Until dri drivers can be fixed properly, dlopen libglapi before trying
to dlopen them.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Frank Henigman <fjhenigman@google.com>
[Emil Velikov: Drop misleading bugzilla link, mention that libname differs]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoconfigure: drop unused variable GBM_BACKEND_DIRS
Emil Velikov [Fri, 19 Jun 2015 16:48:30 +0000 (17:48 +0100)]
configure: drop unused variable GBM_BACKEND_DIRS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoconfigure: error out when building libEGL without shared-glapi
Emil Velikov [Fri, 19 Jun 2015 16:46:41 +0000 (17:46 +0100)]
configure: error out when building libEGL without shared-glapi

The latter is a hard requirement and without it we'll error out later
on in the build.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoconfigure: error out when building backend-less libEGL
Emil Velikov [Fri, 19 Jun 2015 16:44:02 +0000 (17:44 +0100)]
configure: error out when building backend-less libEGL

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agodrivers/x11: drop unneeded HAVE_X11_DRIVER check
Emil Velikov [Fri, 19 Jun 2015 16:37:18 +0000 (17:37 +0100)]
drivers/x11: drop unneeded HAVE_X11_DRIVER check

Already handled in the Makefile which includes the drivers/x11 subdir.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoconfigure: allow building shared-glapi powered libgl-xlib
Emil Velikov [Fri, 19 Jun 2015 18:43:23 +0000 (19:43 +0100)]
configure: allow building shared-glapi powered libgl-xlib

Cc: Brian Paul <brianp@vmware.com>
Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
8 years agotargets/libgl-xlib: fix the build against shared_glapi
Emil Velikov [Fri, 19 Jun 2015 16:30:13 +0000 (17:30 +0100)]
targets/libgl-xlib: fix the build against shared_glapi

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
8 years agodrivers/x11: fix the build against shared_glapi
Emil Velikov [Fri, 19 Jun 2015 16:28:25 +0000 (17:28 +0100)]
drivers/x11: fix the build against shared_glapi

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoconfigure: warn about shared_glapi & xlib-glx only when both are set
Emil Velikov [Fri, 19 Jun 2015 16:19:46 +0000 (17:19 +0100)]
configure: warn about shared_glapi & xlib-glx only when both are set

Printing out the message when shared_glapi is disabled only leads to
confusion.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoglapi: remap_helper.py: remove unused argument 'es'
Emil Velikov [Thu, 18 Jun 2015 22:30:34 +0000 (23:30 +0100)]
glapi: remap_helper.py: remove unused argument 'es'

Identical to the previous commit - unused by neither the Autotools,
Android or SCons build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoglapi: gl_table.py: remove unused variable 'es'
Emil Velikov [Thu, 18 Jun 2015 22:28:05 +0000 (23:28 +0100)]
glapi: gl_table.py: remove unused variable 'es'

None of the three build systems ever set it, as such we can clear things
up a bit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoegl: Use the loader_open_device() helper to do open with CLOEXEC
Derek Foreman [Wed, 17 Jun 2015 16:28:51 +0000 (11:28 -0500)]
egl: Use the loader_open_device() helper to do open with CLOEXEC

We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code.

This also replaces a couple of opens that didn't properly do CLOEXEC.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoglx: Use loader_open_device() helper
Derek Foreman [Wed, 17 Jun 2015 16:28:50 +0000 (11:28 -0500)]
glx: Use loader_open_device() helper

We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code here.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoloader: Rename drm_open_device() to loader_open_device() and share it
Derek Foreman [Wed, 17 Jun 2015 16:28:49 +0000 (11:28 -0500)]
loader: Rename drm_open_device() to loader_open_device() and share it

This is already our common idiom for opening files with CLOEXEC and
it's a little ugly, so let's share this one implementation.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoegl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak
Derek Foreman [Wed, 17 Jun 2015 16:28:48 +0000 (11:28 -0500)]
egl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak

Replacing dup() with fcntl F_DUPFD_CLOEXEC creates the duplicate
file descriptor with CLOEXEC so it won't be leaked to child
processes if the process fork()s later.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agodraw,tgsi: Assume TGSI_PROPERTY_GS_INVOCATIONS default of 1.
Jose Fonseca [Tue, 23 Jun 2015 11:18:06 +0000 (12:18 +0100)]
draw,tgsi: Assume TGSI_PROPERTY_GS_INVOCATIONS default of 1.

If the shader doesn't specify number of invocations, assume one.

This fixes geometry shaders on state trackers other than Mesa (and
probably graw tests too.)

Trivial.

8 years agoglsl: Specify the shader stage in linker errors due to too many in/outputs.
Jose Fonseca [Fri, 19 Jun 2015 12:53:46 +0000 (13:53 +0100)]
glsl: Specify the shader stage in linker errors due to too many in/outputs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agodocs: update GL3 with softpipe/llvmpipe gpu_shader5 pieces.
Dave Airlie [Tue, 23 Jun 2015 05:55:30 +0000 (15:55 +1000)]
docs: update GL3 with softpipe/llvmpipe gpu_shader5 pieces.

This just updates the bits I've added in the previous few patches.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodraw/gallivm: add invocation ID support for llvmpipe.
Dave Airlie [Mon, 22 Jun 2015 03:59:25 +0000 (13:59 +1000)]
draw/gallivm: add invocation ID support for llvmpipe.

This extends the draw code to add support for invocations.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodraw/tgsi: implement geom shader invocation support.
Dave Airlie [Wed, 20 May 2015 00:32:32 +0000 (10:32 +1000)]
draw/tgsi: implement geom shader invocation support.

This is just for softpipe, llvmpipe won't work without
some changes.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: handle indirect sampler arrays. (v2)
Dave Airlie [Wed, 27 May 2015 08:37:17 +0000 (18:37 +1000)]
tgsi: handle indirect sampler arrays. (v2)

This is required for ARB_gpu_shader5 support in softpipe.

v2: add support to txd/txf/txq paths.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Allow vec2/vec3/vec4 instructions in the select peephole pass.
Kenneth Graunke [Wed, 10 Jun 2015 07:52:07 +0000 (00:52 -0700)]
nir: Allow vec2/vec3/vec4 instructions in the select peephole pass.

These are basically just moves, so they should be safe as well.

When disabling i965's GLSL IR level scalarizer (channel expressions)
pass, I started seeing NIR code like this:

        if ssa_21 {
                block block_1:
                /* preds: block_0 */
                vec4 ssa_120 = vec4 ssa_82, ssa_83, ssa_84, ssa_30
                /* succs: block_3 */
        } else {
                block block_2:
                /* preds: block_0 */
                /* succs: block_3 */
        }
        block block_3:
        /* preds: block_1 block_2 */
        vec4 ssa_33 = phi block_1: ssa_120, block_2: ssa_2

Previously, the GLSL IR scalarizer pass would break the vec4 into a
series of fmovs, which were allowed by the peephole pass.  But with
the vec4 operation, they were not.  We want to keep getting selects.

Normal i965 on Broadwell:
instructions in affected programs:     200 -> 176 (-12.00%)
helped:                                4

With brw_fs_channel_expressions() disabled:
instructions in affected programs:     1832 -> 1646 (-10.15%)
helped:                                30

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agoi965: Add and fix comments in brw_vue_map.c.
Kenneth Graunke [Fri, 15 May 2015 16:58:42 +0000 (09:58 -0700)]
i965: Add and fix comments in brw_vue_map.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965: Split VUE map handling out of brw_vs.c into brw_vue_map.c.
Kenneth Graunke [Fri, 15 May 2015 16:54:23 +0000 (09:54 -0700)]
i965: Split VUE map handling out of brw_vs.c into brw_vue_map.c.

This was originally only used by the vertex shader, but it's now used by
the geometry shader as well, and will also eventually be used for
tessellation control and evaluation shaders.

I suspect it will be easier to find in a file named after the concept.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/gen9: Implement Push Constant Buffer workaround
Ben Widawsky [Thu, 4 Jun 2015 04:35:51 +0000 (21:35 -0700)]
i965/gen9: Implement Push Constant Buffer workaround

This implements a workaround (exact excerpt as a comment in the code). The docs
specify [clearly, after you struggle for a while] that the offset isn't relative
to state base. This actually makes sense. This fixes hangs on SKL.

Buffer #0 is meant to be used for normal uniforms.
Buffer #1 is typically used for gather constants when using RS.
Buffer #1-#3 could be used to push a bunch of UBO data which would just be
  somewhere in memory, and not relative to the dynamic state.

NOTE: I've moved away from the ternary operator for the new gen9 conditions.
Admittedly it's probably not great to do this, but I really want to fix this all
up in the subsequent patch and doing it here makes that diff a lot nicer. I want
to split out the gen8/9 code to make the function a bit more readable, but to
keep this easily cherry-pickable I am doing this fix first. If we decide not to
merge the cleanup patch then I can revisit this.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Valtteri Rantala <Valtteri.rantala@intel.com>
8 years agomesa: use _mesa_lookup_enum_by_nr() in print_array()
Brian Paul [Mon, 22 Jun 2015 14:29:49 +0000 (08:29 -0600)]
mesa: use _mesa_lookup_enum_by_nr() in print_array()

Print GL_FLOAT, etc. instead of hex value.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoilo: emit 3DPRIMITIVE from gen6_3dprimitive_info
Chia-I Wu [Mon, 22 Jun 2015 06:27:19 +0000 (14:27 +0800)]
ilo: emit 3DPRIMITIVE from gen6_3dprimitive_info

It allows us to remove ilo_ib_state::draw_start_offset and
ILO_PRIM_RECTANGLES.  gen6_3d_translate_pipe_prim() is also replaced by
ilo_translate_draw_mode().

8 years agoilo: align vertex buffer size in buf_create()
Chia-I Wu [Mon, 22 Jun 2015 06:15:52 +0000 (14:15 +0800)]
ilo: align vertex buffer size in buf_create()

With ilo_format.[ch] moved out of core, the aligning of vertex buffers does
not belong to core anymore.

8 years agoilo: move ilo_format.[ch] out of core
Chia-I Wu [Mon, 22 Jun 2015 06:06:13 +0000 (14:06 +0800)]
ilo: move ilo_format.[ch] out of core

They provide PIPE_FORMAT_x to GEN6_FORMAT_x translation as well as some
convenient helpers.  Move them out of core.

8 years agoilo: add ilo_state_surface_valid_format()
Chia-I Wu [Mon, 22 Jun 2015 05:37:05 +0000 (13:37 +0800)]
ilo: add ilo_state_surface_valid_format()

Check if a surface format can be used for the specified access type.

8 years agoilo: add ilo_state_vf_valid_element_format()
Chia-I Wu [Mon, 22 Jun 2015 05:15:24 +0000 (13:15 +0800)]
ilo: add ilo_state_vf_valid_element_format()

Check if a surface format can be used as a VE format.

8 years agonvc0: use NV_VRAM_DOMAIN() macro
Alexandre Courbot [Fri, 17 Oct 2014 06:05:32 +0000 (15:05 +0900)]
nvc0: use NV_VRAM_DOMAIN() macro

Use the newly-introduced NV_VRAM_DOMAIN() macro to support alternative
VRAM domains for chips that do not have dedicated video memory.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agonouveau: support for custom VRAM domains
Alexandre Courbot [Fri, 17 Oct 2014 05:58:11 +0000 (14:58 +0900)]
nouveau: support for custom VRAM domains

Some GPUs (e.g. GK20A, GM20B) do not embed VRAM of their own and use
the system memory as a backend instead. For such systems, allocating
objects in VRAM results in errors since the kernel will not allow
VRAM objects allocations.

This patch adds a vram_domain member to struct nouveau_screen that can
optionally be initialized to an alternative domain to use for VRAM
allocations. If left untouched, NOUVEAU_BO_VRAM will be used for
systems that embed VRAM, and NOUVEAU_BO_GART will be used for VRAM-less
systems.

Code that uses GPU objects is then expected to use the NV_VRAM_DOMAIN()
macro in place of NOUVEAU_BO_VRAM to ensure correct behavior on
VRAM-less chips.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agoilo: add ilo_state_compute
Chia-I Wu [Sat, 20 Jun 2015 15:27:08 +0000 (23:27 +0800)]
ilo: add ilo_state_compute

Replace gen6_idrt_data with ilo_state_compute, which has a bunch of
validations and is now preferred.

8 years agor600g: ignore sampler views for now.
Dave Airlie [Mon, 22 Jun 2015 03:36:41 +0000 (13:36 +1000)]
r600g: ignore sampler views for now.

This fixes a regression in that r600 stopped working when
sampler views were pushed.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agofreedreno/ir3: pass sz to split_dest()
Rob Clark [Sat, 13 Jun 2015 13:14:31 +0000 (09:14 -0400)]
freedreno/ir3: pass sz to split_dest()

For query_levels, we generate a getinfo with writemask of (z), which RA
will consider as size==3.  But we were still generating four fanouts.
Which meant that RA would see it as two different register classes,
depending on the path to definer.  Ie. on the getinfo instruction itself
it would see size==3, but when chasing back through the fanouts it would
see size==4.

Easiest way to solve that is to just generate the chain of neighboring
fanouts to have the correct size in the first place.

Note: we may eventually want split_dest() to take start/end or wrmask
instead, since really we only need size==1.  But RA is not clever enough
for that, query_levels is not that common, and the other two registers
that get allocated are never used so those register slots can be
immediately re-used.  So bunch of work for probably no real gain.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3/nir: add more opcodes
Rob Clark [Fri, 12 Jun 2015 18:27:44 +0000 (14:27 -0400)]
freedreno/ir3/nir: add more opcodes

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: only unminify txf coords on a3xx
Rob Clark [Mon, 8 Jun 2015 18:45:47 +0000 (14:45 -0400)]
freedreno/ir3: only unminify txf coords on a3xx

Seems like a4xx gets this right.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: remove int sampler shader variants
Rob Clark [Mon, 8 Jun 2015 18:23:49 +0000 (14:23 -0400)]
freedreno: remove int sampler shader variants

We get this information from NIR (which gets it from sview decl in tgsi
when translating from tgsi), so no need to maintain shader variants for
this.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: block reshuffling and loops!
Rob Clark [Tue, 9 Jun 2015 21:17:06 +0000 (17:17 -0400)]
freedreno/ir3: block reshuffling and loops!

This shuffles things around to allow the shader to have multiple basic
blocks.  We drop the entire CFG structure from nir and just preserve the
blocks.  At scheduling we know whether to schedule conditional branches
or unconditional jumps at the end of the block based on the # of block
successors.  (Dropping jumps to the following instruction, etc.)

One slight complication is that variables (load_var/store_var, ie.
arrays) are not in SSA form, so we have to figure out where to put the
phi's ourself.  For this, we use the predecessor set information from
nir_block.  (We could perhaps use NIR's dominance frontier information
to help with this?)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: a4xx encodes larger immed offset
Rob Clark [Mon, 1 Jun 2015 16:35:19 +0000 (12:35 -0400)]
freedreno/ir3: a4xx encodes larger immed offset

Without this, negative branch/jump offsets look like very large positive
offsets.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: simplify find_neighbors stop condition
Rob Clark [Mon, 25 May 2015 14:59:21 +0000 (10:59 -0400)]
freedreno/ir3: simplify find_neighbors stop condition

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: move inputs/outputs to shader
Rob Clark [Mon, 25 May 2015 14:30:54 +0000 (10:30 -0400)]
freedreno/ir3: move inputs/outputs to shader

These belong in the shader, rather than the block.  Mostly a lot of
churn and nothing too interesting.  But splitting this out from the
rest of ir3_block reshuffling to cut down the noise in the later
patch.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3/ra: use register_allocate
Rob Clark [Fri, 1 May 2015 16:21:12 +0000 (12:21 -0400)]
freedreno/ir3/ra: use register_allocate

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: introduce ir3_compiler object
Rob Clark [Sat, 23 May 2015 17:37:41 +0000 (13:37 -0400)]
freedreno/ir3: introduce ir3_compiler object

Right now, just provides a cleaner way to get at the gpu-id, given the
separation between compiler and context.  But we will need this also to
hold the reg-set for new register allocation.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: dump nocp option
Rob Clark [Sat, 25 Apr 2015 20:30:55 +0000 (16:30 -0400)]
freedreno/ir3: dump nocp option

No longer used, or even possible, with NIR frontend.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: silence warnings
Rob Clark [Tue, 9 Jun 2015 21:42:16 +0000 (17:42 -0400)]
freedreno/ir3: silence warnings

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: remove tgsi f/e
Rob Clark [Sat, 25 Apr 2015 14:22:49 +0000 (10:22 -0400)]
freedreno/ir3: remove tgsi f/e

Also remove ir3_flatten which was only used by tgsi f/e.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3/sched: convert to priority queue
Rob Clark [Thu, 30 Apr 2015 17:57:15 +0000 (13:57 -0400)]
freedreno/ir3/sched: convert to priority queue

Use a more standard priority-queue based scheduling algo.  It is simpler
and will make things easier once we have multiple basic blocks and flow
control.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: use standard list implementation
Rob Clark [Thu, 30 Apr 2015 15:38:43 +0000 (11:38 -0400)]
freedreno/ir3: use standard list implementation

Use standard list_head double-linked list and related iterators,
helpers, etc, rather than weird combo of instruction array and next
pointers depending on stage.  Now block has an instrs_list.  In
certain stages where we want to remove and re-add to the blocks list
we just use list_replace() to copy the list to a new list_head.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: drop dot graph dumping
Rob Clark [Thu, 30 Apr 2015 14:10:14 +0000 (10:10 -0400)]
freedreno/ir3: drop dot graph dumping

At least for now.. right now the instruction and instruction list
printing should suffice, and the re-working of ir3_block would require
a lot of changes in that code.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: more builder helpers
Rob Clark [Sat, 25 Apr 2015 15:05:27 +0000 (11:05 -0400)]
freedreno/ir3: more builder helpers

Use ir3_MOV() builder in a couple of spots, rather than open-coding the
instruction construction.  Also add ir3_NOP() builder and use that
instead of open coding.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium/ttn: add missing SNE
Rob Clark [Thu, 30 Apr 2015 19:20:03 +0000 (15:20 -0400)]
gallium/ttn: add missing SNE

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoutil/list: add list_first/last_entry
Rob Clark [Wed, 29 Apr 2015 12:38:45 +0000 (08:38 -0400)]
util/list: add list_first/last_entry

I need an easier way to get at head/tail in ir3.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium/ttn: add texture-type support
Rob Clark [Mon, 8 Jun 2015 18:09:09 +0000 (14:09 -0400)]
gallium/ttn: add texture-type support

v2: rebased on using SVIEW to hold type information

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoglsl_to_tgsi: add SVIEW decl support
Rob Clark [Mon, 8 Jun 2015 17:20:30 +0000 (13:20 -0400)]
glsl_to_tgsi: add SVIEW decl support

Freedreno needs sampler type information to deal with int/uint textures.
To accomplish this, start creating sampler-view declarations, as
suggested here:

 http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html

create a sampler-view with index matching the sampler, to encode the
texture type (ie. SINT/UINT/FLOAT).  Ie:

   DCL SVIEW[n], 2D, UINT
   DCL SAMP[n]
   TEX OUT[1], IN[1], SAMP[n]

For tgsi texture instructions which do not take an explicit SVIEW
argument, the SVIEW index is implied by the SAMP index.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoutil/blitter (and friends): generate appropriate SVIEW decls
Rob Clark [Thu, 11 Jun 2015 00:02:55 +0000 (20:02 -0400)]
util/blitter (and friends): generate appropriate SVIEW decls

Some hardware needs to know the sampler type.  Update the blit related
shaders to include SVIEW decl.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoutil/pstipple: updates for SVIEW decls
Rob Clark [Thu, 11 Jun 2015 00:01:11 +0000 (20:01 -0400)]
util/pstipple: updates for SVIEW decls

To allow for shaders which use SVIEW decls for TEX* instructions, we
need to preserve the constraint that the shader either has no SVIEW's or
it has one matching SVIEW for each SAMP.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agodraw: updates to support SVIEW decls
Rob Clark [Wed, 10 Jun 2015 23:59:20 +0000 (19:59 -0400)]
draw: updates to support SVIEW decls

To allow for shaders which use SVIEW decls for TEX* instructions, we
need to preserve the constraint that the shader either has no SVIEW's or
it has one matching SVIEW for each SAMP.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agotgsi/transform: add support for SVIEW decls
Rob Clark [Wed, 10 Jun 2015 23:51:32 +0000 (19:51 -0400)]
tgsi/transform: add support for SVIEW decls

TODO single return_type (use enum)

v2: single return_type arg, and use enum

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agotgsi: update docs for SVIEW usage with TEX* instructions
Rob Clark [Wed, 10 Jun 2015 23:49:55 +0000 (19:49 -0400)]
tgsi: update docs for SVIEW usage with TEX* instructions

Based on mailing list discussion here:

http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agomesa: Back out an accidental change I had in a VC4 commit.
Eric Anholt [Sat, 20 Jun 2015 22:02:50 +0000 (15:02 -0700)]
mesa: Back out an accidental change I had in a VC4 commit.

This was a hack as part of debugging some glamor-on-GLES2 behavior that
ended up being an xserver bug.  I suspect we can just flip this extension
on for GLES2, but the spec says it requires 3.1.