mesa.git
11 years agodocs: bump supported shading language version
Chris Forbes [Sun, 24 Nov 2013 04:44:06 +0000 (17:44 +1300)]
docs: bump supported shading language version

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agost/mesa: respect higher GLSL levels. (v2)
Dave Airlie [Tue, 22 Oct 2013 08:06:37 +0000 (09:06 +0100)]
st/mesa: respect higher GLSL levels. (v2)

Limit the max glsl version level to what the state tracker supports.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl: Improve error message when attemping assignment to unsized array
Timothy Arceri [Tue, 19 Nov 2013 21:42:19 +0000 (08:42 +1100)]
glsl: Improve error message when attemping assignment to unsized array

V2: Return after error to avoid cascading error messages and
removed redundant "to" from error message

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: enable GL_AMD_vertex_shader_layer extension for gen7+
Jordan Justen [Wed, 27 Mar 2013 20:58:52 +0000 (13:58 -0700)]
intel: enable GL_AMD_vertex_shader_layer extension for gen7+

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoradeonsi: implement MSAA for CIK
Marek Olšák [Wed, 20 Nov 2013 12:48:19 +0000 (13:48 +0100)]
radeonsi: implement MSAA for CIK

There are also some changes to the printfs.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: enable 2D tiling on CIK
Marek Olšák [Wed, 20 Nov 2013 12:35:03 +0000 (13:35 +0100)]
radeonsi: enable 2D tiling on CIK

libdrm does the DRM version check and decides if 2D tiling is used.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: initialize gl_renderbuffer::Depth in core
Marek Olšák [Wed, 20 Nov 2013 00:47:36 +0000 (01:47 +0100)]
mesa: initialize gl_renderbuffer::Depth in core

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965/fs: Make the first pre-allocation heuristic be the post heuristic.
Eric Anholt [Tue, 19 Nov 2013 21:07:12 +0000 (13:07 -0800)]
i965/fs: Make the first pre-allocation heuristic be the post heuristic.

I recently made us try two different things that tried to reduce register
pressure so that we would be more likely to allocate successfully.  But
now that we have the logic for trying two, we can make the first thing we
try be the normal, not-prioritizing-register-pressure heuristic.

This means one less scheduling pass in the common case of that heuristic
not producing spills, plus the best schedule we know how to produce, if
that one happens to succeed.  This is important, because our register
allocation produces a lot of possibly avoidable dependencies for the
post-register-allocation schedule, despite ra_set_allocate_round_robin().

GLB2.7: 1.04127% +/- 0.732461% fps improvement (n=31)
nexuiz: No difference (n=5)
lightsmark: 0.838512% +/- 0.300147% fps improvement (n=86)
minecraft apitrace: No difference (n=15)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Remove the ralloc canary on release builds.
Eric Anholt [Fri, 22 Nov 2013 07:29:56 +0000 (23:29 -0800)]
mesa: Remove the ralloc canary on release builds.

The canary is basically just to give a better debugging message when you
ralloc_free() something that wasn't rallocated.  Reduces maximum memory
usage of apitrace replay of the dota2 demo by 60MB on my 64-bit system (so
half that on a real 32-bit dota2 environment).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix streamed state dumping/annotation after the blorp-flush change.
Eric Anholt [Wed, 20 Nov 2013 00:00:28 +0000 (16:00 -0800)]
i965: Fix streamed state dumping/annotation after the blorp-flush change.

I think I was thinking of the batch command packet cache when I pasted
this in, but this counter is only used for dumping out streamed state for
INTEL_DEBUG=batch and for putting annotations in our aub files.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Let driconf clamp_max_samples affect context version
Chad Versace [Thu, 7 Nov 2013 03:52:11 +0000 (19:52 -0800)]
i965: Let driconf clamp_max_samples affect context version

Commit 2f89662 added the driconf option 'clamp_max_samples'.  In that
commit, the option did not alter the context version. The neglect to
alter the context version is a fatal issue for some apps.

For example, consider running Chromium with clamp_max_samples=0.
Pre-patch, Mesa creates a GL 3.0 context but clamps GL_MAX_SAMPLES to
0. This violates the GL 3.0 spec, which requires GL_MAX_SAMPLES >= 4.
The spec violation causes WebGL context creation to fail in many
scenarios because Chromium correctly assumes that a GL 3.0 context
supports at least 4 samples.

Since the driconf option was introduced largely for Chromium, the issue
really needs fixing.

This patch fixes calculation of the context version to respect the
post-clamped value of GL_MAX_SAMPLES. This in turn fixes WebGL on
Chromium when clamp_max_samples=0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Share code between intel_quantize_num_samples and clamp_max_samples
Chad Versace [Thu, 7 Nov 2013 03:40:25 +0000 (19:40 -0800)]
i965: Share code between intel_quantize_num_samples and clamp_max_samples

clamp_max_samples() and intel_quantize_num_samples() each maintained
their own list of which MSAA modes the hardware supports. This patch
removes the duplication by making intel_quantize_num_samples() use the
same list as clamp_max_samples(), the list maintained in
brw_supported_msaa_modes().

By removing the duplication, we prevent the scenario where someone
updates one list but forgets to update the other.

Move function `brw_context.c:static brw_supported_msaa_modes()` to
`intel_screen.c:(non-static) intel_supported_msaa_modes()` and patch
intel_quantize_num_samples() to use the list returned by that function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Terminate brw_supported_msaa_modes() list with -1, not 0
Chad Versace [Fri, 15 Nov 2013 16:21:30 +0000 (08:21 -0800)]
i965: Terminate brw_supported_msaa_modes() list with -1, not 0

This simplifies the loop logic in a subsqequent patch that refactors
intel_quantize_num_samples() to use brw_supported_msaa_modes().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/mesa: simplify writemask for emitting fog result
Brian Paul [Thu, 21 Nov 2013 22:07:25 +0000 (15:07 -0700)]
st/mesa: simplify writemask for emitting fog result

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: fix indentation in ffvertex_prog.c
Brian Paul [Thu, 21 Nov 2013 20:08:40 +0000 (13:08 -0700)]
mesa: fix indentation in ffvertex_prog.c

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi: Prevent emission of instructions with empty writemask.
José Fonseca [Thu, 21 Nov 2013 13:11:30 +0000 (13:11 +0000)]
tgsi: Prevent emission of instructions with empty writemask.

These degenerate instructions can often be emitted by state trackers
when the semantics of instructions don't match precisely.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: Rework calls to ureg_emit_insn().
José Fonseca [Thu, 21 Nov 2013 13:02:14 +0000 (13:02 +0000)]
tgsi: Rework calls to ureg_emit_insn().

Mere syntactical change.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: Add a section with recommended reading for llvmpipe development.
José Fonseca [Thu, 21 Nov 2013 17:52:50 +0000 (17:52 +0000)]
docs: Add a section with recommended reading for llvmpipe development.

Several of links the were contributed by Keith Whitwell and Roland Scheidegger.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: (trivial) disable new accurate origin calculation
Roland Scheidegger [Fri, 22 Nov 2013 11:28:46 +0000 (11:28 +0000)]
llvmpipe: (trivial) disable new accurate origin calculation

It looks like there's some bugs in it...

11 years agometa: Move declaration before code.
Vinson Lee [Fri, 22 Nov 2013 04:24:05 +0000 (20:24 -0800)]
meta: Move declaration before code.

Fixes MSVC build.

meta.c(2411) : error C2143: syntax error : missing ';' before 'type'
meta.c(2411) : error C2143: syntax error : missing ')' before 'type'
meta.c(2411) : error C2065: 'layer' : undeclared identifier
meta.c(2411) : error C2059: syntax error : ')'
meta.c(2411) : error C2143: syntax error : missing ';' before '{'
meta.c(2413) : error C2065: 'layer' : undeclared identifier
meta.c(2415) : error C2065: 'layer' : undeclared identifier

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: Implement GL_FRAMEBUFFER_ATTACHMENT_LAYERED query.
Paul Berry [Wed, 20 Nov 2013 05:17:19 +0000 (21:17 -0800)]
mesa: Implement GL_FRAMEBUFFER_ATTACHMENT_LAYERED query.

From section 6.1.18 (Renderbuffer Object Queries) of the GL 3.2 spec,
under the heading "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
is TEXTURE, then":

    If pname is FRAMEBUFFER_ATTACHMENT_LAYERED, then params will
    contain TRUE if an entire level of a three-dimesional texture,
    cube map texture, or one-or two-dimensional array texture is
    attached. Otherwise, params will contain FALSE.

Fixes piglit tests:
- spec/!OpenGL 3.2/layered-rendering/framebuffer-layered-attachments
- spec/!OpenGL 3.2/layered-rendering/framebuffertexture-defaults

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
v2: Don't include "EXT" in the error message, since this query only
makes sensen in context versions that have adopted
glGetFramebufferAttachmentParameteriv().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Fix texture target validation for glFramebufferTexture()
Paul Berry [Wed, 20 Nov 2013 05:47:04 +0000 (21:47 -0800)]
mesa: Fix texture target validation for glFramebufferTexture()

Previously we were using the code path for validating
glFramebufferTextureLayer().  But glFramebufferTexture() allows
additional texture types.

Fixes piglit tests:
- spec/!OpenGL 3.2/layered-rendering/gl-layer-cube-map
- spec/!OpenGL 3.2/layered-rendering/framebuffertexture

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
v2: Clarify comment above framebuffer_texture().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Fix fast clear of depth buffers.
Paul Berry [Wed, 20 Nov 2013 02:51:48 +0000 (18:51 -0800)]
i965: Fix fast clear of depth buffers.

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes the fast depth clear path.

Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-depth".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Fix blorp clear of layered framebuffers.
Paul Berry [Tue, 19 Nov 2013 20:58:02 +0000 (12:58 -0800)]
i965: Fix blorp clear of layered framebuffers.

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes the blorp clear path for color buffers.

Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-color".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: refactor blorp clear code in preparation for layered clears.
Paul Berry [Tue, 19 Nov 2013 18:42:59 +0000 (10:42 -0800)]
i965: refactor blorp clear code in preparation for layered clears.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agometa: fix meta clear of layered framebuffers
Paul Berry [Tue, 19 Nov 2013 21:31:20 +0000 (13:31 -0800)]
meta: fix meta clear of layered framebuffers

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes meta clears to properly clear all layers of a layered
framebuffer attachment.  We accomplish this by adding a geometry
shader to the meta clear program which sets gl_Layer to a uniform
value.  When clearing a layered framebuffer, we execute in a loop,
setting the uniform to point to each layer in turn.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Track number of layers in layered framebuffers.
Paul Berry [Tue, 19 Nov 2013 23:55:51 +0000 (15:55 -0800)]
mesa: Track number of layers in layered framebuffers.

In order to properly clear layered framebuffers, we need to know how
many layers they have.  The easiest way to do this is to record it in
the gl_framebuffer struct when we check framebuffer completeness.

This patch replaces the gl_framebuffer::Layered boolean with a
gl_framebuffer::NumLayers integer, which is 0 if the framebuffer is
not layered, and equal to the number of layers otherwise.

v2: Remove gl_framebuffer::Layered and make gl_framebuffer::NumLayers
always have a defined value.  Fix factor of 6 error in the number of
layers in a cube map array.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agonvc0: inform kernel about buffers that screen_create touches
Ben Skeggs [Fri, 22 Nov 2013 01:34:13 +0000 (11:34 +1000)]
nvc0: inform kernel about buffers that screen_create touches

Prevents a GPU page fault if somehow the uniform bo gets evicted
before the screen_create pushbuf has been submitted.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agoradeonsi/compute: Fix LDS size calculation
Tom Stellard [Thu, 22 Aug 2013 15:22:58 +0000 (11:22 -0400)]
radeonsi/compute: Fix LDS size calculation

We need to include the number of LDS bytes allocated by the state tracker.

CC: "10.0" <mesa-stable@lists.freedesktop.org>
11 years agor600g/compute: Add a work-around for flushing issues on Cayman
Tom Stellard [Wed, 20 Nov 2013 03:05:52 +0000 (22:05 -0500)]
r600g/compute: Add a work-around for flushing issues on Cayman

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
https://bugs.freedesktop.org/show_bug.cgi?id=69321

CC: "10.0" <mesa-stable@lists.freedesktop.org>
11 years agoglsl: Fix interstage uniform interface block link error detection.
Paul Berry [Fri, 15 Nov 2013 22:23:45 +0000 (14:23 -0800)]
glsl: Fix interstage uniform interface block link error detection.

Previously, we checked for interstage uniform interface block link
errors in validate_interstage_interface_blocks(), which is only called
on pairs of adjacent shader stages.  Therefore, we failed to detect
uniform interface block mismatches between non-adjacent shader stages.

Before the introduction of geometry shaders, this wasn't a problem,
because the only supported shader stages were vertex and fragment
shaders, therefore they were always adjacent.  However, now that we
allow a program to contain vertex, geometry, and fragment shaders,
that is no longer the case.

Fixes piglit test "skip-stage-uniform-block-array-size-mismatch".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: Rename validate_interstage_interface_blocks() to
validate_interstage_inout_blocks() to reflect the fact that it no
longer validates uniform blocks.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
v3: Make validate_interstage_inout_blocks() skip uniform blocks.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Fix cross-version linking between VS and GS.
Paul Berry [Wed, 20 Nov 2013 01:48:02 +0000 (17:48 -0800)]
glsl: Fix cross-version linking between VS and GS.

Previously, when attempting to link a vertex shader and a geometry
shader that use different GLSL versions, we would sometimes generate a
link error due to the implicit declaration of gl_PerVertex being
different between the two GLSL versions.

This patch fixes that problem by only requiring interface block
definitions to match when they are explicitly declared.

Fixes piglit test "shaders/version-mixing vs-gs".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: In the interface_block_definition constructor, move the assignment
to explicitly_declared after the existing if block.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Prohibit illegal mixing of redeclarations inside/outside gl_PerVertex.
Paul Berry [Thu, 14 Nov 2013 00:53:18 +0000 (16:53 -0800)]
glsl: Prohibit illegal mixing of redeclarations inside/outside gl_PerVertex.

From section 7.1 (Built-In Language Variables) of the GLSL 4.10
spec:

    Also, if a built-in interface block is redeclared, no member of
    the built-in declaration can be redeclared outside the block
    redeclaration.

We have been regarding this text as a clarification to the behaviour
established for gl_PerVertex by GLSL 1.50, so we apply it regardless
of GLSL version.

This patch enforces the rule by adding an enum to ir_variable to track
how the variable was declared: implicitly, normally, or in an
interface block.

Fixes piglit tests:
- gs-redeclares-pervertex-out-after-global-redeclaration.geom
- vs-redeclares-pervertex-out-after-global-redeclaration.vert
- gs-redeclares-pervertex-out-after-other-global-redeclaration.geom
- vs-redeclares-pervertex-out-after-other-global-redeclaration.vert
- gs-redeclares-pervertex-out-before-global-redeclaration
- vs-redeclares-pervertex-out-before-global-redeclaration

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: Don't set "how_declared" redundantly in builtin_variables.cpp.
Properly clone "how_declared".

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Enable the AMD_performance_monitor extension on Gen5+.
Kenneth Graunke [Wed, 13 Nov 2013 23:42:57 +0000 (15:42 -0800)]
i965: Enable the AMD_performance_monitor extension on Gen5+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Take "bookend" OA snapshots at the start/end of each batch.
Kenneth Graunke [Wed, 13 Nov 2013 23:36:29 +0000 (15:36 -0800)]
i965: Take "bookend" OA snapshots at the start/end of each batch.

Unfortunately, our hardware only has one set of aggregating performance
counters shared between all 3D programs, and their values are not saved
or restored by hardware contexts.  Also, at least on Sandybridge and
Ivybridge, the counters lose their values if the GPU goes to sleep.

To work around both of these problems, we have to snapshot the
performance counters at the beginning and end of each batch, similar to
how we handle query objects on platforms that don't support hardware
contexts.  I call these "bookend" snapshots.

Since there can be multiple performance monitors active at a time, we
store the bookend snapshots in a global BO, shared by all monitors.

For monitors that span multiple batches, acquiring results involves
adding up three segments:

   BeginPerfMonitor   --> End of Batch 1    ("head")
   Start of Batch 2   --> End of Batch 2
                      ...                   ("middle")
   Start of Batch N-1 --> End of Batch N-1
   Start of Batch N   --> EndPerfMonitor    ("tail")

Monitors that refer to bookend BO snapshots are considered "unresolved".
We delay resolving them (and adding up deltas to obtain the results) as
long as possible to avoid blocking on mapping monitor->oa_bo.

We can also run out of space in the bookend BO, at which point we have
to resolve all unresolved monitors.  Then we can throw away the
snapshots and begin writing at the beginning of the buffer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Reserve batchbuffer space for a closing MI_REPORT_PERF_COUNT.
Kenneth Graunke [Tue, 22 Oct 2013 18:21:43 +0000 (11:21 -0700)]
i965: Reserve batchbuffer space for a closing MI_REPORT_PERF_COUNT.

In order to use the Observability Architecture effectively, we'll need
to take snapshots of the OA counters via MI_REPORT_PERF_COUNT at the
start and end of each batch.

Experimentation reveals that we need to flush before and after each
MI_REPORT_PERF_COUNT to get working values.  For simplicitly, I chose to
use intel_batchbuffer_emit_mi_flush(), which unfortunately expands to
triple pipe controls on Sandybridge.

We may want to start computing per-generation reserved batch space to
avoid the insanity of Sandybridge's PIPE_CONTROL cost.  That said, much
of this cost existed before I rewrote the query object support to use
hardware contexts, so it's at least not entirely new.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add some plumbing for gathering OA results.
Kenneth Graunke [Wed, 13 Nov 2013 23:13:59 +0000 (15:13 -0800)]
i965: Add some plumbing for gathering OA results.

Currently, this only considers the monitor start and end snapshots.
This is woefully insufficient, but allows me to add a bunch of the
infrastructure now and flesh it out later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Start and stop OA counters as necessary.
Kenneth Graunke [Sun, 3 Nov 2013 03:58:10 +0000 (20:58 -0700)]
i965: Start and stop OA counters as necessary.

We need to start OA at the beginning of each batch where monitors are
active.  OACONTROL isn't part of the hardware context, so to avoid
leaving counters enabled for other applications, we turn them off at the
end of the batch too.

We also need to start them at BeginPerfMonitor time (unless they've
already been started).  We stop them when the monitor last ends as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add functions to start and stop the OA counters.
Kenneth Graunke [Wed, 13 Nov 2013 21:14:46 +0000 (13:14 -0800)]
i965: Add functions to start and stop the OA counters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add #defines for the OACONTROL register and fields.
Kenneth Graunke [Wed, 27 Mar 2013 21:46:05 +0000 (14:46 -0700)]
i965: Add #defines for the OACONTROL register and fields.

We'll need to write this register to start/stop performance counters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Take OA counter snapshots at Begin/EndPerfMonitor time.
Kenneth Graunke [Sun, 3 Nov 2013 03:16:58 +0000 (20:16 -0700)]
i965: Take OA counter snapshots at Begin/EndPerfMonitor time.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add a function to emit the MI_REPORT_PERF_COUNT packet.
Kenneth Graunke [Sun, 3 Nov 2013 01:48:18 +0000 (18:48 -0700)]
i965: Add a function to emit the MI_REPORT_PERF_COUNT packet.

MI_REPORT_PERF_COUNT writes a snapshot of the Observability Architecture
counters to a buffer.  Exactly how it works varies between generations:
Ironlake requires two packets, Sandybridge has to use GGTT, and Ivybridge
and later use PPGTT.

v2: Assert that we didn't use more space than we reserved (suggested
    by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Track the number of monitors that need OA counters.
Kenneth Graunke [Sun, 3 Nov 2013 02:44:49 +0000 (19:44 -0700)]
i965: Track the number of monitors that need OA counters.

Using the OA counters requires some per-batch work.  When starting and
ending a batch, it's useful to know whether any monitors are actually
interested in OA data.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Enumerate Observability Architecture counters on Gen5+.
Kenneth Graunke [Sun, 3 Nov 2013 02:10:19 +0000 (19:10 -0700)]
i965: Enumerate Observability Architecture counters on Gen5+.

In addition to listing the counter names, we include several "remap"
tables.  Confusingly, counters are documented with names like "A23",
are written to some buffer offset other than 23, and exposed by core
Mesa under a counter ID that is different still.

The first is inevitable; MI_REPORT_PERF_COUNT writes certain counters to
fixed locations in the buffer.  The latter could be avoided, but core
Mesa uses the "Counters" array index as the ID for a counter.  We could
do remapping there, but it would just complicate the core Mesa code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Expose pipeline statistics registers via performance monitors.
Kenneth Graunke [Thu, 31 Oct 2013 23:27:01 +0000 (16:27 -0700)]
i965: Expose pipeline statistics registers via performance monitors.

This is fairly simple:
- At BeginPerfMonitor time, take an opening snapshot.
- At EndPerfMonitor time, take a closing snapshot.
- The first time the application asks for results, subtract the two and
  store that value.  Then free the BO containing the snapshots.
- On subsequent requests for the results, just return the saved value.
- On reset, throw away the results.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Enumerate the pipeline statistics register counters on Gen6+.
Kenneth Graunke [Thu, 31 Oct 2013 23:02:35 +0000 (16:02 -0700)]
i965: Enumerate the pipeline statistics register counters on Gen6+.

For now, we only support these on Gen6+, since that's what currently
uses hardware contexts.  When we add Ironlake hardware context support,
we can add pipeline statistics register support for that as well.

In theory, we could support pipeline statistics counters even without
hardware contexts, but it would be annoyingly painful.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Initialize performance monitor Groups/NumGroups.
Kenneth Graunke [Thu, 31 Oct 2013 23:00:23 +0000 (16:00 -0700)]
i965: Initialize performance monitor Groups/NumGroups.

Since we don't support any counters, there are zero groups.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add macros for creating performance monitor counters and groups.
Kenneth Graunke [Thu, 31 Oct 2013 22:50:19 +0000 (15:50 -0700)]
i965: Add macros for creating performance monitor counters and groups.

The Observability Architecture counters are 32-bit unsigned values, and
the Pipeline Statistics Register counters are 64-bit unsigned values.

These convenience macros make it easy to create those types of counters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Periodically dump the list of monitors if INTEL_DEBUG=perfmon.
Kenneth Graunke [Sun, 3 Nov 2013 02:42:54 +0000 (19:42 -0700)]
i965: Periodically dump the list of monitors if INTEL_DEBUG=perfmon.

It's useful to see the state of all outstanding monitors; the start
of a new batch seems like a reasonable time to print them out.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add basic driver hooks and plumbing for AMD_performance_monitor.
Kenneth Graunke [Thu, 31 Oct 2013 22:42:09 +0000 (15:42 -0700)]
i965: Add basic driver hooks and plumbing for AMD_performance_monitor.

These stub functions will be filled out in later patches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add INTEL_DEBUG=perfmon support.
Kenneth Graunke [Thu, 31 Oct 2013 06:17:23 +0000 (23:17 -0700)]
i965: Add INTEL_DEBUG=perfmon support.

This will enable debugging printfs for the AMD_performance_monitor code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Move brw_emit_query_begin() to the render ring prelude.
Kenneth Graunke [Wed, 16 Oct 2013 02:32:53 +0000 (19:32 -0700)]
i965: Move brw_emit_query_begin() to the render ring prelude.

Without hardware contexts, the pipeline statistics registers are
free-running and include data from every 3D application running.

In order to find out the contributions of one particular context, we
need to take a snapshot at the start and end of each batch.

Previously, we emitted the PIPE_CONTROL necessary to capture
PS_DEPTH_COUNT when drawing primitives.  Special tracking ensured it
happened only on the first draw of the batch, rather than on every draw.

Moving this to brw_new_batch increases symmetry, since the final
snapshot has always been in brw_finish_batch, which is just a few lines
below.  It should be basically equivalent.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Introduce a "render ring prelude" hook.
Kenneth Graunke [Tue, 29 Oct 2013 03:10:40 +0000 (20:10 -0700)]
i965: Introduce a "render ring prelude" hook.

The new intel_batchbuffer_emit_render_ring_prelude() hook will be called
when switching from BLT or UNKNOWN_RING to RENDER_RING.  This provides a
place to emit state that should go at the start of each render ring
batch, with minimal overhead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Introduce an UNKNOWN_RING state.
Kenneth Graunke [Thu, 21 Nov 2013 22:07:12 +0000 (14:07 -0800)]
i965: Introduce an UNKNOWN_RING state.

When we first create a batch buffer, it's empty.  We don't actually
know what ring it will be targeted at until the first BEGIN_BATCH or
BEGIN_BATCH_BLT macro.

Previously, one could determine the state of the batch by checking
brw->batch.ring (blit vs. render) and brw->batch.used != 0 (known vs.
unknown).

This should be functionally equivalent, but the tri-state enum is a bit
clearer.

v2: Catch three explicit require_space callers (thanks to Carl and Eric).
v3: Split the boolean -> enum change from the UNKNOWN_RING change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Convert brw->batch.is_blit to a BLT_RING/RENDER_RING enum.
Kenneth Graunke [Mon, 28 Oct 2013 23:06:10 +0000 (16:06 -0700)]
i965: Convert brw->batch.is_blit to a BLT_RING/RENDER_RING enum.

Passing BLT_RING or RENDER_RING to batchbuffer functions is a lot more
obvious than passing true or false.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agollvmpipe: calculate more accurate interpolation value at origin
Roland Scheidegger [Wed, 20 Nov 2013 05:17:56 +0000 (05:17 +0000)]
llvmpipe: calculate more accurate interpolation value at origin

Some rounding errors could crop up when calculating a0. Use a more accurate
method (barycentric interpolation essentially) to fix this, though to fix
the REAL problem (which is that our interpolation will give very bad results
with small triangles far away from the origin when they have steep gradients)
this does absolutely nothing (actually makes it worse). (To fix the real
problem, either would need to use a vertex corner (or some other point inside
the tri) as starting point value instead of fb origin and pass that down to
interpolation, or mimic what hw does, use barycentric interpolation (using
the coordinates extracted from the rasterizer edge functions) - maybe another
time.)
Some (silly) tests though really want a high accuracy at fb origin and don't
care much about anything else (Just. Don't. Ask.).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: remove special-case code for texkil w component
Brian Paul [Thu, 21 Nov 2013 00:07:31 +0000 (16:07 -0800)]
svga: remove special-case code for texkil w component

Not actually needed.  Fixes piglit ARB_fragment_program/kil-swizzle test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agogallium: Make TGSI_SEMANTIC_FOG register four-component wide.
José Fonseca [Wed, 20 Nov 2013 15:22:31 +0000 (15:22 +0000)]
gallium: Make TGSI_SEMANTIC_FOG register four-component wide.

D3D9 Shader Model 2 restricted the fog register to one component,
http://msdn.microsoft.com/en-us/library/windows/desktop/bb172945.aspx ,
but that restriction no longer exists in Shader Model 3, and several
WHCK tests enforce that.

So this change:
- lifts the single-component restriction TGSI_SEMANTIC_FOG
  from Gallium interface
- updates the Mesa state tracker to enforce output fog has (f, 0, 0, 1)
- draw module was updated to leave TGSI_SEMANTIC_FOG output registers
  alone

Several gallium drivers that are going out of their way to clear
TGSI_SEMANTIC_FOG components could be simplified in the future.

Thanks to Si Chen and Michal Krol for identifying the problem.

Testing done: piglit fogcoord-*.vpfp tests

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agotgsi_exec: Fix mask calculation for emit_kill_if.
José Fonseca [Wed, 20 Nov 2013 17:31:43 +0000 (17:31 +0000)]
tgsi_exec: Fix mask calculation for emit_kill_if.

Same as Si Chen's commit e7a5905d8a3960b0981750f8131e3af9acbfcdb8 for
tgsi_exec module.

Not actually tested, because softpipe is failing the test that caught
this bug due to unrelated issues.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agomesa: Use IROUND instead of roundf.
José Fonseca [Thu, 21 Nov 2013 13:56:00 +0000 (13:56 +0000)]
mesa: Use IROUND instead of roundf.

roundf is not available on MSVC.

11 years agomesa: enable GL_TEXTURE_LOD_BIAS set/get
Tapani Pälli [Wed, 20 Nov 2013 11:27:10 +0000 (13:27 +0200)]
mesa: enable GL_TEXTURE_LOD_BIAS set/get

Earlier comments suggest this was removed from GL core spec but it is
still there. Enabling makes 'texture_lod_bias_getter' Khronos
conformance tests pass, also removes some errors from Metro Last Light
game which is using this API.

v2: leave NOTE comment (Ian)

Cc: "9.0 9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
11 years agowinsys/radeon: cleanup virtual memory nonsense
Christian König [Tue, 19 Nov 2013 09:47:36 +0000 (10:47 +0100)]
winsys/radeon: cleanup virtual memory nonsense

The alignment of a virtual memory area must always be at least 4096 bytes.

It only worked because size was aligned to 4096 outside of the function.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agomesa: Update MESA_INFO to eliminate error
Courtney Goeltzenleuchter [Thu, 24 Oct 2013 19:13:57 +0000 (13:13 -0600)]
mesa: Update MESA_INFO to eliminate error

If a user set MESA_INFO and the OpenGL application uses a
3.0 or later context then the MESA_INFO debug output will have
an error when it queries for extensions using the deprecated
enum GL_EXTENSIONS. Passing context argument allows code
to return extension list directly regardless of profile.
Commit title updated as recommended by Kenneth Graunke.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Disable BLORP on Broadwell for now.
Kenneth Graunke [Thu, 29 Nov 2012 21:35:15 +0000 (13:35 -0800)]
i965: Disable BLORP on Broadwell for now.

BLORP is essential.  However, porting it to Gen8 is a huge amount of
work.  Disabling it for now allows us to proceed with basic hardware
enablement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Disable HiZ on Broadwell for now.
Kenneth Graunke [Sat, 15 Dec 2012 01:56:40 +0000 (17:56 -0800)]
i965: Disable HiZ on Broadwell for now.

HiZ is difficult to implement, and while it's essential for performance,
we don't need it right away for purposes of hardware enabling.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Claim OpenGL 3.3 support on Broadwell.
Kenneth Graunke [Fri, 1 Nov 2013 18:45:47 +0000 (11:45 -0700)]
i965: Claim OpenGL 3.3 support on Broadwell.

Bugs aside, basically everything ought to work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add device info structs for Broadwell.
Kenneth Graunke [Fri, 1 Nov 2013 18:44:09 +0000 (11:44 -0700)]
i965: Add device info structs for Broadwell.

As always, the chipset limits here are placeholders, rather than the
actual values.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Use more portable bash invocation construct.
Vinson Lee [Sat, 12 Oct 2013 01:33:08 +0000 (18:33 -0700)]
glsl: Use more portable bash invocation construct.

Fixes 'make check' on distros where bash is not at /bin/bash.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agogallivm: Ignore unknown file type in non-debug builds.
Vinson Lee [Wed, 20 Nov 2013 07:16:34 +0000 (23:16 -0800)]
gallivm: Ignore unknown file type in non-debug builds.

Fixes "Uninitialized pointer read" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglx: don't fail out when no configs if we have visuals
Dave Airlie [Mon, 18 Nov 2013 07:34:52 +0000 (17:34 +1000)]
glx: don't fail out when no configs if we have visuals

GLX 1.2 servers with no SGIX_fbconfigs exist (some citrix thing),
and we fail glxinfo completely in those cases.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa/swrast: fix inverted front buffer rendering with old-school swrast
Dave Airlie [Wed, 13 Nov 2013 02:53:52 +0000 (12:53 +1000)]
mesa/swrast: fix inverted front buffer rendering with old-school swrast

I've no idea when this broke, but we have some people who wanted it fixed,
so here's my attempt.

reproducer, run readpix with swrast hit f, or run trival tri -sb things are
upside down, after this patch they aren't.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62142
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66213

Cc: <mesa-stable@lists.freedesktop.org>"
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa: Fix setup of LocalParams array.
Eric Anholt [Mon, 18 Nov 2013 17:55:00 +0000 (09:55 -0800)]
mesa: Fix setup of LocalParams array.

i965 passed piglit, but swrast and gallium both segfaulted without this.
i965 happened to work because it never ran _mesa_load_state_parameters()
on the new program before the test called glProgramLocalParameter(), which
was allocating a LocalParams array for the fallback path.

v2: Since v1 threw away old localparams data, leaked old LocalParams
    memory, only fixed fragment programs, and I was dubious of my previous
    invariants already (nothing but program_parse.y will generate
    LocalParams, and only that one path of program_parse.y will), just
    late-allocate localparams at the other point of dereferencing them.
    This adds overhead to _mesa_load_state_parameter, which is
    uncomfortable, but I'm pretty sure that giant switch statement is
    super slow already.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71734
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoi965/test: Use unreachable() to silence warning.
Matt Turner [Mon, 18 Nov 2013 23:20:01 +0000 (15:20 -0800)]
i965/test: Use unreachable() to silence warning.

11 years agoi965: Link -ldl after libmesa.la
Matt Turner [Mon, 18 Nov 2013 23:19:15 +0000 (15:19 -0800)]
i965: Link -ldl after libmesa.la

DLOPEN_LIBS is part of DRI_LIB_DEPS.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71512
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add a pass to remove dead control flow.
Matt Turner [Wed, 30 Oct 2013 17:32:12 +0000 (10:32 -0700)]
i965: Add a pass to remove dead control flow.

Removes IF/ENDIF and IF/ELSE/ENDIF with no intervening instructions.

total instructions in shared programs: 1360393 -> 1360387 (-0.00%)
instructions in affected programs:     157 -> 151 (-3.82%)

(no change in vertex shaders)

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Make invalidate_live_intervals() a virtual method of backend_visitor.
Matt Turner [Mon, 11 Nov 2013 18:36:36 +0000 (10:36 -0800)]
i965: Make invalidate_live_intervals() a virtual method of backend_visitor.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vec4: Add invalidate_live_intervals method.
Matt Turner [Mon, 11 Nov 2013 18:33:46 +0000 (10:33 -0800)]
i965/vec4: Add invalidate_live_intervals method.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Don't emit SIMD16 BFI instructions.
Matt Turner [Sat, 16 Nov 2013 21:16:50 +0000 (13:16 -0800)]
i965/fs: Don't emit SIMD16 BFI instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Emit compressed 3-source instructions on Haswell.
Matt Turner [Sat, 16 Nov 2013 20:31:26 +0000 (12:31 -0800)]
i965/fs: Emit compressed 3-source instructions on Haswell.

For commit 4df56177 Paul discovered that the hardware restriction that
Align16 instructions cannot be compressed was lifted on Haswell. This
has prevented us from emitting compressed three-source instructions.

For added confirmation, the bspec lists a work around called
WaBreakSimd16TernaryInstructionsIntoSimd8 that hasn't been applicable
since very early Haswell silicon.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix disassembled names of BFI1 and BFI2 instructions.
Matt Turner [Sat, 16 Nov 2013 21:03:55 +0000 (13:03 -0800)]
i965: Fix disassembled names of BFI1 and BFI2 instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Use source's original type in register_coalesce().
Matt Turner [Fri, 15 Nov 2013 19:09:47 +0000 (11:09 -0800)]
i965/fs: Use source's original type in register_coalesce().

Previously, register_coalesce() would modify

   mov   vgrf1:f  vgrf2:f
   cmp   null     vgrf3:d  vgrf1:d

to be

   cmp   null     vgrf3:d  vgrf2:f

and incorrectly use vgrf2's type in the instruction that the mov was
coalesced into.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agou_gen_mipmap: Use untampered cubemap texture coords when generating mipmaps.
José Fonseca [Tue, 19 Nov 2013 18:54:53 +0000 (18:54 +0000)]
u_gen_mipmap: Use untampered cubemap texture coords when generating mipmaps.

It's not necessary to scale down cubemap texture coords when generating
mipmaps: we are doing a 2x minification therefore it's guaranteed that
the texture coords will always be at least 1 texel away of the edges.

Scaling down can actually be harmful, as it may cause artefacts when
generating mipmaps with nearest filtering.  Sample points will lie
exactly in the middle each 2x2 texels, so the scaling factor was causing
different texels to be take on each quadrant of the cube face.  This is
apparent with a 1x1 checkerboard pattern in the base mipmap level:
instead of next mipmap level receiving a constant color throughout the
face, it will have different colors for each quadrant of the face.

The behaviour for blits is left untouched for now, but the cubemap
texture coord scaling hack should be reconsidered eventually.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix GL_FEEDBACK mode inverted Y coordinate bug
Brian Paul [Tue, 19 Nov 2013 20:09:57 +0000 (13:09 -0700)]
st/mesa: fix GL_FEEDBACK mode inverted Y coordinate bug

We need to check the drawbuffer's orientation before inverting Y
coordinates.  Fixes piglit feedback tests when running with the
-fbo option.

Cc: "9.2" "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agogallivm: Fix mask calculation for emit_kill_if.
Si Chen [Thu, 14 Nov 2013 17:17:13 +0000 (09:17 -0800)]
gallivm: Fix mask calculation for emit_kill_if.

The exec_mask must be taken in consideration, just like emit_kill above.

The tgsi_exec module has the same bug and should be fixed in a future
change.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965/gen7: Disallow Y tiling of renderable surfaces with valign of 2.
Paul Berry [Wed, 13 Nov 2013 01:51:15 +0000 (17:51 -0800)]
i965/gen7: Disallow Y tiling of renderable surfaces with valign of 2.

Gen7 does not allow render targets to have a vertical alignment of 2.
So, when creating a surface, if its format is renderable, and its
vertical alignment is 2, force it to use X tiling.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7: Prefer vertical alignment of 4 when possible.
Paul Berry [Wed, 13 Nov 2013 01:16:25 +0000 (17:16 -0800)]
i965/gen7: Prefer vertical alignment of 4 when possible.

Gen6+ allows for color buffers to use a vertical alignment of either 4
or 2.  Previously we defaulted to 2.  This may have caused problems on
Gen7 because Y-tiled render targets are not allowed to use a vertical
alignment of 2.

This patch changes the vertical alignment to 4 on Gen7, except for the
few formats where a vertical alignment of 2 is required.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vec4: Fix broken IR annotation in debug output.
Paul Berry [Wed, 6 Nov 2013 05:44:13 +0000 (21:44 -0800)]
i965/vec4: Fix broken IR annotation in debug output.

Commit 70953b5 (i965: Initialize all member variables of
vec4_instruction on construction) inadvertently added a line to the
vec4_instruction constructor setting this->ir to NULL, wiping out the
previously set value.  As a result, ever since then, the output of
INTEL_DEBUG=vs and INTEL_DEBUG=gs has been missing IR annotations.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agosvga: improve check for 3D compressed textures
Brian Paul [Tue, 19 Nov 2013 15:54:17 +0000 (07:54 -0800)]
svga: improve check for 3D compressed textures

This is basically a a respin of f1dfcf4bce35e6796f873d9a00103b280da81e4c
per Jose's suggestion.

Just set the SVGA3dSurfaceFormatCaps flags for 3D and cube textures
when checking the texture format capabilities.  This will filter out
unsupported combinations like 3D+DXT.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglx/tests: Provide __glXGetCurrentContext() stub when needed
Jon TURNEY [Tue, 12 Nov 2013 22:54:35 +0000 (22:54 +0000)]
glx/tests: Provide __glXGetCurrentContext() stub when needed

Refine 8c533022.  Provide a stub __glXGetCurrentContext() function when
$(DEFINES) are such that it is not a macro.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
11 years agosvga: we don't supported 3D compressed textures
Brian Paul [Mon, 18 Nov 2013 22:50:33 +0000 (14:50 -0800)]
svga: we don't supported 3D compressed textures

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agost/mesa: pass correct pipe_texture_target to st_choose_format()
Brian Paul [Mon, 18 Nov 2013 22:51:43 +0000 (14:51 -0800)]
st/mesa: pass correct pipe_texture_target to st_choose_format()

We were always passing PIPE_TEXTURE_2D, but not all formats are
supported for all types of textures.  In particular, the driver may
not supported texture compression for all types of textures.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agor600g/compute: Fix handling of global buffers in r600_resource_copy_region()
Tom Stellard [Thu, 14 Nov 2013 15:28:09 +0000 (07:28 -0800)]
r600g/compute: Fix handling of global buffers in r600_resource_copy_region()

Global buffers do not have an associate cs_buf handle, so
we can't copy them using r600_copy_buffer()

https://bugs.freedesktop.org/show_bug.cgi?id=64226

Reviewed-by: Marek Ol????k <marek.olsak@amd.com>
CC: "10.0" <mesa-stable@lists.freedesktop.org>
11 years agogallium: Pass version scripts to linker using --version-script=
Tom Stellard [Tue, 12 Nov 2013 19:29:21 +0000 (11:29 -0800)]
gallium: Pass version scripts to linker using --version-script=

This fixes build failures with the gold linker.

CC: "10.0" <mesa-stable@lists.freedesktop.org>
11 years agoclover: Optionally return context's devices from clGetProgramInfo()
Tom Stellard [Fri, 15 Nov 2013 23:50:34 +0000 (15:50 -0800)]
clover: Optionally return context's devices from clGetProgramInfo()

The spec allows clGetProgramInfo() to return information about either
the devices associated with the program or the devices associated
with the context.  If there are no devices associated with the program,
then we return devices associated with the context.

https://bugs.freedesktop.org/show_bug.cgi?id=52171

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
CC: "10.0" <mesa-stable@lists.freedesktop.org>
11 years agoi965/gen7: Emit workaround flush when changing GS enable state.
Paul Berry [Tue, 5 Nov 2013 04:06:48 +0000 (20:06 -0800)]
i965/gen7: Emit workaround flush when changing GS enable state.

v2: Don't go to extra work to avoid extraneous flushes.  (Previous
experiments in the kernel have suggested that flushing the pipeline
when it is already empty is extremely cheap).

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoosmesa: add missing comma
Brian Paul [Mon, 18 Nov 2013 16:14:48 +0000 (09:14 -0700)]
osmesa: add missing comma

11 years agoosmesa: add support for postprocess filters
Brian Paul [Sat, 16 Nov 2013 20:55:50 +0000 (13:55 -0700)]
osmesa: add support for postprocess filters

Add new OSMesaPostprocess() function to allow using the gallium
postprocessing filters.  This only works for OSMesa with gallium
drivers, not the legacy swrast OSMesa.

Bump OSMESA_MAJOR/MINOR_VERSION numbers to 10.0

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agopostprocess: document the pp_init() function.
Brian Paul [Sat, 16 Nov 2013 20:55:50 +0000 (13:55 -0700)]
postprocess: document the pp_init() function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agopostprocess: move #defines to filters.h
Brian Paul [Sat, 16 Nov 2013 20:55:50 +0000 (13:55 -0700)]
postprocess: move #defines to filters.h

They're not needed in postprocess.h

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agopostprocess: refactor header files, etc
Brian Paul [Sat, 16 Nov 2013 20:55:50 +0000 (13:55 -0700)]
postprocess: refactor header files, etc

Move private data structures and function prototypes out of the
public postprocess.h header file.
Create a pp_private.h for the shared, private data structures, functions.
Remove pp_program.h header.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>