mesa.git
10 years agomesa: Generate GL_INVALID_OPERATION for unsupported DSA TexStorage functions
Ian Romanick [Wed, 18 Dec 2013 22:43:19 +0000 (14:43 -0800)]
mesa: Generate GL_INVALID_OPERATION for unsupported DSA TexStorage functions

We have to make the functions available to work around a GLEW bug (see
comments already in the code), but if an application calls one of these
functions we should still generate GL_INVALID_OPERATION.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Silence many unused parameter warnings
Ian Romanick [Wed, 18 Dec 2013 22:39:26 +0000 (14:39 -0800)]
mesa: Silence many unused parameter warnings

main/texstorage.c: In function '_mesa_alloc_texture_storage':
main/texstorage.c:240:53: warning: unused parameter 'width' [-Wunused-parameter]
main/texstorage.c:241:37: warning: unused parameter 'height' [-Wunused-parameter]
main/texstorage.c:241:53: warning: unused parameter 'depth' [-Wunused-parameter]
main/texstorage.c: In function '_mesa_TextureStorage1DEXT':
main/texstorage.c:464:34: warning: unused parameter 'texture' [-Wunused-parameter]
main/texstorage.c:464:50: warning: unused parameter 'target' [-Wunused-parameter]
main/texstorage.c:464:66: warning: unused parameter 'levels' [-Wunused-parameter]
main/texstorage.c:465:34: warning: unused parameter 'internalformat' [-Wunused-parameter]
main/texstorage.c:466:35: warning: unused parameter 'width' [-Wunused-parameter]
main/texstorage.c: In function '_mesa_TextureStorage2DEXT':
main/texstorage.c:473:34: warning: unused parameter 'texture' [-Wunused-parameter]
main/texstorage.c:473:50: warning: unused parameter 'target' [-Wunused-parameter]
main/texstorage.c:473:66: warning: unused parameter 'levels' [-Wunused-parameter]
main/texstorage.c:474:34: warning: unused parameter 'internalformat' [-Wunused-parameter]
main/texstorage.c:475:35: warning: unused parameter 'width' [-Wunused-parameter]
main/texstorage.c:475:50: warning: unused parameter 'height' [-Wunused-parameter]
main/texstorage.c: In function '_mesa_TextureStorage3DEXT':
main/texstorage.c:483:34: warning: unused parameter 'texture' [-Wunused-parameter]
main/texstorage.c:483:50: warning: unused parameter 'target' [-Wunused-parameter]
main/texstorage.c:483:66: warning: unused parameter 'levels' [-Wunused-parameter]
main/texstorage.c:484:34: warning: unused parameter 'internalformat' [-Wunused-parameter]
main/texstorage.c:485:35: warning: unused parameter 'width' [-Wunused-parameter]
main/texstorage.c:485:50: warning: unused parameter 'height' [-Wunused-parameter]
main/texstorage.c:485:66: warning: unused parameter 'depth' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoi965: Ignore 'centroid' interpolation qualifier in case of persample shading
Anuj Phogat [Wed, 15 Jan 2014 18:23:02 +0000 (10:23 -0800)]
i965: Ignore 'centroid' interpolation qualifier in case of persample shading

This patch handles the use of 'centroid' qualifier with 'in' variables
in a fragment shader when persample shading is enabled. Per sample
shading for the whole fragment shader can be enabled by:
glEnable(GL_SAMPLE_SHADING) or using {gl_SamplePosition, gl_SampleID}
builtin variables in fragment shader. Explaining it below in more
detail.

/* Enable sample shading using OpenGL API */
glEnable(GL_SAMPLE_SHADING);
glMinSampleShading(1.0);

Example fragment shader:
in vec4 a;
centroid in vec4 b;
main()
{
  ...
}

Variable 'a' will be interpolated at sample location. But, what
interpolation should we use for variable 'b' ?

ARB_sample_shading recommends interpolation at sample position for
all the variables. GLSL 400 (and earlier) spec says that:

"When an interpolation qualifier is used, it overrides settings
established through the OpenGL API."
But, this text got deleted in later versions of GLSL.

NVIDIA's and AMD's proprietary linux drivers (at OpenGL 4.3)
interpolates at sample position. This convinces me to use
the similar approach on intel hardware.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoi965: Use sample barycentric coordinates with per sample shading
Anuj Phogat [Mon, 6 Jan 2014 21:59:18 +0000 (13:59 -0800)]
i965: Use sample barycentric coordinates with per sample shading

Current implementation of arb_sample_shading doesn't set 'Barycentric
Interpolation Mode' correctly. We use pixel barycentric coordinates
for per sample shading. Instead we should select perspective sample
or non-perspective sample barycentric coordinates.

It also enables using sample barycentric coordinates in case of a
fragment shader variable declared with 'sample' qualifier.
e.g. sample in vec4 pos;

A piglit test to verify the implementation has been posted on piglit
mailing list for review.

V2: Do not interpolate all the 'in' variables at sample position
    if fragment shader uses 'sample' qualifier with one of them.
    For example we have a fragment shader:
    #version 330
    #extension ARB_gpu_shader5: require
    sample in vec4 a;
    in vec4 b;
    main()
    {
      ...
    }

    Only 'a' should be sampled at sample location, not 'b'.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoi965: Add an option to ignore sample qualifier
Anuj Phogat [Mon, 13 Jan 2014 20:26:55 +0000 (12:26 -0800)]
i965: Add an option to ignore sample qualifier

This will be useful in my next patch which depends on a functionality
of _mesa_get_min_invocations_per_fragment() to ignore the sample
qualifier (prog->IsSample) based on a flag passed to it.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agomesa/x86: Remove dead read_rgba_span_x86.h.
Matt Turner [Sun, 12 Jan 2014 04:37:51 +0000 (20:37 -0800)]
mesa/x86: Remove dead read_rgba_span_x86.h.

Dead since 304f7a13.

10 years agoi965/fs: Optimize LRP with x == y into a MOV.
Matt Turner [Fri, 10 Jan 2014 04:57:36 +0000 (20:57 -0800)]
i965/fs: Optimize LRP with x == y into a MOV.

total instructions in shared programs: 1487331 -> 1485988 (-0.09%)
instructions in affected programs:     45638 -> 44295 (-2.94%)
GAINED:                                7
LOST:                                  0

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Optimize open-coded lrp into lrp.
Jordan Justen [Mon, 4 Nov 2013 18:23:24 +0000 (10:23 -0800)]
glsl: Optimize open-coded lrp into lrp.

total instructions in shared programs: 1498191 -> 1487051 (-0.74%)
instructions in affected programs:     669388 -> 658248 (-1.66%)
GAINED:                                1
LOST:                                  0

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Enable AOS optimizations for the geometry shader.
Matt Turner [Fri, 3 Jan 2014 22:52:55 +0000 (14:52 -0800)]
i965: Enable AOS optimizations for the geometry shader.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Vectorize multiple scalar assignments
Matt Turner [Sat, 21 Dec 2013 19:28:05 +0000 (11:28 -0800)]
glsl: Vectorize multiple scalar assignments

Reduces vertex shader instruction counts in DOTA2 by 6.42%, L4D2 by
4.61%, and CS:GO by 5.71%.

total instructions in shared programs: 1500153 -> 1498191 (-0.13%)
instructions in affected programs:     59919 -> 57957 (-3.27%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add parameter to .equals() to ignore an IR type.
Matt Turner [Thu, 2 Jan 2014 00:52:32 +0000 (16:52 -0800)]
glsl: Add parameter to .equals() to ignore an IR type.

Only implemented for ir_swizzles currently, but perhaps will be useful
for other IR types in the future.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: rename PreferDP4 to OptimizeForAOS.
Matt Turner [Fri, 3 Jan 2014 22:48:53 +0000 (14:48 -0800)]
mesa: rename PreferDP4 to OptimizeForAOS.

This flag was really just a proxy for determining whether the backend
was vector (AOS) or scalar (SOA). It will be used to apply a future
optimization only for vector backends.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/fs: Print the maximum register pressure.
Matt Turner [Sun, 15 Dec 2013 02:37:16 +0000 (18:37 -0800)]
i965/fs: Print the maximum register pressure.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Show register pressure in dump_instructions() output.
Kenneth Graunke [Mon, 5 Aug 2013 06:34:01 +0000 (23:34 -0700)]
i965/fs: Show register pressure in dump_instructions() output.

Dumping the number of live registers at each IP allows us to see
register pressure and identify any local maxima.  This should
aid in debugging passes designed to reduce register pressure, as
well as optimizations that suddenly trigger spilling.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Compute the number of live registers at each IP.
Kenneth Graunke [Mon, 5 Aug 2013 06:27:14 +0000 (23:27 -0700)]
i965: Compute the number of live registers at each IP.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Call opt_peephole_sel later in the optimization loop.
Matt Turner [Mon, 16 Dec 2013 04:07:05 +0000 (20:07 -0800)]
i965/fs: Call opt_peephole_sel later in the optimization loop.

Calling it after value numbering (added in the next commit) prevents
some instruction count regressions.

total instructions in shared programs: 1524387 -> 1523905 (-0.03%)
instructions in affected programs:     13112 -> 12630 (-3.68%)
GAINED:                                0
LOST:                                  3

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Calculate interference better in register_coalesce.
Matt Turner [Sun, 15 Dec 2013 23:39:29 +0000 (15:39 -0800)]
i965/fs: Calculate interference better in register_coalesce.

Previously we simply considered two registers whose live ranges
overlapped to interfere. Cases such as

   set A     ------
   ...             |
   mov B, A  --    |
   ...         | B | A
   use B     --    |
   ...             |
   use A     ------

would be considered to interfere, even though B is an unmodified copy of
A whose live range fit wholly inside that of A.

If no writes to A or B occur between the mov B, A and the use of B then
we can safely coalesce them.

Instead of removing MOV instructions, we make them NOPs and remove them
at once after the main pass is finished in order to avoid recomputing
live intervals (which are needed to perform the previous step).

total instructions in shared programs: 1543768 -> 1513077 (-1.99%)
instructions in affected programs:     951563 -> 920872 (-3.23%)
GAINED:                                46
LOST:                                  22

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Support coalescing registers of size > 1.
Matt Turner [Wed, 11 Dec 2013 00:04:27 +0000 (16:04 -0800)]
i965/fs: Support coalescing registers of size > 1.

total instructions in shared programs: 1550048 -> 1549880 (-0.01%)
instructions in affected programs:     1896 -> 1728 (-8.86%)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Assert that var < num_vars.
Matt Turner [Sun, 8 Dec 2013 00:22:08 +0000 (16:22 -0800)]
i965/fs: Assert that var < num_vars.

Helped to track down a problem in a version of the next commit.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Add a comment explaining how register coalescing works.
Matt Turner [Wed, 11 Dec 2013 00:05:19 +0000 (16:05 -0800)]
i965/fs: Add a comment explaining how register coalescing works.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Add and use MAX_SAMPLER_MESSAGE_SIZE definition.
Matt Turner [Wed, 11 Dec 2013 00:22:56 +0000 (16:22 -0800)]
i965/fs: Add and use MAX_SAMPLER_MESSAGE_SIZE definition.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Add STRINGIFY macro.
Matt Turner [Wed, 11 Dec 2013 00:21:16 +0000 (16:21 -0800)]
mesa: Add STRINGIFY macro.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/fs: Fix the example about overwriting uniforms in SIMD16.
Matt Turner [Sat, 7 Dec 2013 20:59:59 +0000 (12:59 -0800)]
i965/fs: Fix the example about overwriting uniforms in SIMD16.

mov takes only a single source argument. Example instruction
inexplicably changed from add to mov in commit f10f5e49.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Print reg_offset for vgrf of size > 1 in dump_instruction().
Matt Turner [Wed, 4 Dec 2013 23:01:16 +0000 (15:01 -0800)]
i965: Print reg_offset for vgrf of size > 1 in dump_instruction().

Previously we wouldn't print the +0 for the first part of a VGRF of size
greater than 1.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Match unnamed record types across stages.
Grigori Goronzy [Tue, 26 Nov 2013 23:15:06 +0000 (00:15 +0100)]
glsl: Match unnamed record types across stages.

Unnamed record types are assigned to separate types per stage, e.g. if

uniform struct { ... } a;

is defined in both vertex and fragment shader, two separate types will
result with different names. When linking the shader, this results in a
type conflict. However, there is no reason why this should not be
allowed according to GLSL specifications. Compare and match record types
when linking shader stages to avoid this conflict.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoglsl: Extract function for record comparisons.
Grigori Goronzy [Tue, 26 Nov 2013 23:15:05 +0000 (00:15 +0100)]
glsl: Extract function for record comparisons.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodocs: remove some ancient README.* files
Brian Paul [Fri, 17 Jan 2014 16:18:32 +0000 (08:18 -0800)]
docs: remove some ancient README.* files

None of this info is relevant anymore.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agosvga: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
Brian Paul [Fri, 17 Jan 2014 02:32:47 +0000 (18:32 -0800)]
svga: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

Fixes several colorbuffer tests, including piglit "fbo-drawbuffers-none"
for "gl_FragColor" and "glDrawPixels" cases.

v2: rework patch to only avoid creating extra shader variants when
TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS is not specified.  Per Jose.
Use a write_color0_to_n_cbufs key field to replicate color0 to N
color buffers only when N > 0 and WRITES_ALL_CBUFS is set.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: rename color output variables
Brian Paul [Fri, 17 Jan 2014 02:05:00 +0000 (18:05 -0800)]
svga: rename color output variables

Just to be bit more readable.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: fix clearing for null color buffers
Brian Paul [Fri, 17 Jan 2014 02:01:57 +0000 (18:01 -0800)]
svga: fix clearing for null color buffers

Fixes piglit "fbo-drawbuffers-none glClear" test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: add missing TYPE_DOUBLEN_2 cases in get.c
Brian Paul [Tue, 21 Jan 2014 16:18:13 +0000 (08:18 -0800)]
mesa: add missing TYPE_DOUBLEN_2 cases in get.c

The new TYPE_DOUBLEN_2 type was added in 0e60d850 but the code to
return values of that type wasn't completed.

Fixes conform's default state test.  glGetFloatv(GL_DEPTH_RANGE)
wasn't returning anything.

v2: remove stray 'break' statements.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoi965: Modify some error messages to refer to "vec4" instead of "vs".
Paul Berry [Sat, 23 Mar 2013 14:22:08 +0000 (07:22 -0700)]
i965: Modify some error messages to refer to "vec4" instead of "vs".

These messages are in code that is shared between the VS and GS
back-ends, so use the terminology "vec4" to avoid confusion.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Add GS support to INTEL_DEBUG=shader_time.
Paul Berry [Fri, 17 Jan 2014 22:42:48 +0000 (14:42 -0800)]
i965: Add GS support to INTEL_DEBUG=shader_time.

Previously, time spent in geometry shaders would be counted as part of
the vertex shader time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodraw: fix points with negative w coords for d3d style point clipping
Roland Scheidegger [Tue, 21 Jan 2014 16:47:08 +0000 (17:47 +0100)]
draw: fix points with negative w coords for d3d style point clipping

Even with depth clipping disabled, vertices which have negative w coords
must be discarded. And since we don't have a proper guardband implementation
yet (relying on driver to handle all values except infs/nans in rasterization
for such points) we need to kill them off manually (as they can end up with
coordinates inside viewport otherwise).

v2: use 0.0f instead of 0 (spotted by Brian).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoi965: Reserve space for "Vertex Count" in GS outputs.
Kenneth Graunke [Wed, 6 Nov 2013 00:55:06 +0000 (16:55 -0800)]
i965: Reserve space for "Vertex Count" in GS outputs.

v2: Also increment ir->offset in the GS visitor, rather than at the
    final assembly generation stage (requested by Paul).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965: Update blitter code for 48-bit addresses.
Kenneth Graunke [Sun, 13 Jan 2013 00:12:38 +0000 (16:12 -0800)]
i965: Update blitter code for 48-bit addresses.

v2: Rebase on Eric's SET_FIELD changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> [v1]
10 years agoi965: Update PIPE_CONTROL packet lengths for Broadwell.
Kenneth Graunke [Wed, 11 Dec 2013 23:54:07 +0000 (15:54 -0800)]
i965: Update PIPE_CONTROL packet lengths for Broadwell.

On Broadwell, PIPE_CONTROL needs an extra DWord to accomodate the
48-bit addressing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Re-combine the Gen4-5 and Gen6+ write_depth_count functions.
Kenneth Graunke [Thu, 12 Dec 2013 08:44:11 +0000 (00:44 -0800)]
i965: Re-combine the Gen4-5 and Gen6+ write_depth_count functions.

Now that we have a helper function that handles the PIPE_CONTROL
variations between the various platforms, these are basically the same.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Create a helper function for emitting PIPE_CONTROL writes.
Kenneth Graunke [Tue, 14 Jan 2014 00:00:18 +0000 (16:00 -0800)]
i965: Create a helper function for emitting PIPE_CONTROL writes.

There are a lot of places that use PIPE_CONTROL to write a value to a
buffer (either an immediate write, TIMESTAMP, or PS_DEPTH_COUNT).
Creating a single function to do this seems convenient.

As part of this refactor, we now set the PPGTT/GTT selection bit
correctly on Gen7+.  Previously, we set bit 2 of DW2 on all platforms.
This is correct for Sandybridge, but actually part of the address on
Ivybridge and later!

Broadwell will also increase the length of these packets by 1; with the
refactoring, we should have to adjust that in substantially fewer
places, giving us confidence that we've hit them all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Use full-length PIPE_CONTROL packets for workaround writes.
Kenneth Graunke [Wed, 11 Dec 2013 23:25:58 +0000 (15:25 -0800)]
i965: Use full-length PIPE_CONTROL packets for workaround writes.

I believe that PIPE_CONTROL uses the length field to decide whether to
do 32-bit or 64-bit writes.  A length of 4 would do a 32-bit write,
while a length of 5 would do a 64-bit write.  (I haven't verified this,
though.)

For workaround writes, we don't care what value gets written, or how
much data.  We're only writing something because hardware bugs mandate
that do so.  So using a 64-bit write should be fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Emit full-length PIPE_CONTROLs for (non-write) flushes.
Kenneth Graunke [Wed, 11 Dec 2013 23:22:26 +0000 (15:22 -0800)]
i965: Emit full-length PIPE_CONTROLs for (non-write) flushes.

The PIPE_CONTROL packet actually has 5 DWords on Gen6+:
1. Header
2. Flags
3. Address
4. Immediate Data: Lower DWord
5. Immediate Data: Upper DWord

We just never emitted the last one.  While it appears to work, it's
probably safer to emit the entire thing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Create a helper function for emitting PIPE_CONTROL flushes.
Kenneth Graunke [Wed, 11 Dec 2013 22:44:45 +0000 (14:44 -0800)]
i965: Create a helper function for emitting PIPE_CONTROL flushes.

These days, we need to emit PIPE_CONTROL flushes all over the place.
Being able to do that via a single function call seems convenient.

Broadwell will also increase the length of these packets by 1; with the
refactoring, we should have to do this in substantially fewer places.

v2: Add back forgotten intel_emit_post_sync_nonzero_flush (caught by
    Eric Anholt).  Drop unlikely() from BLT_RING check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Fix MI_STORE_REGISTER_MEM for Broadwell.
Kenneth Graunke [Mon, 18 Nov 2013 18:10:07 +0000 (10:10 -0800)]
i965: Fix MI_STORE_REGISTER_MEM for Broadwell.

It now takes a 48-bit address.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Introduce an OUT_RELOC64 macro.
Kenneth Graunke [Tue, 5 Nov 2013 00:55:26 +0000 (16:55 -0800)]
i965: Introduce an OUT_RELOC64 macro.

Broadwell uses 48-bit addresses.  The first DWord is the low 32 bits,
and the second DWord is the high 16 bits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Use the new drm_intel_bo offset64 field.
Kenneth Graunke [Mon, 13 Jan 2014 22:32:56 +0000 (14:32 -0800)]
i965: Use the new drm_intel_bo offset64 field.

libdrm 2.4.52 introduces a new 'uint64_t offset64' field, intended to
replace the old 'unsigned long offset' field.  To preserve ABI, libdrm
continues to store the presumed offset in both locations.

On Broadwell, a 64-bit kernel may place BOs at "high" (> 4G) addresses.
However, with a 32-bit userspace, the 'unsigned long offset' field will
only be 32-bit, which is not large enough to hold this value.  We need
to use a proper uint64_t (like the kernel does).

Technically, a lot of this code doesn't affect Broadwell, so we could
leave it using the old field.  But it makes sense to just switch to the
new, properly typed field.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agobuild: Require libdrm 2.4.52 for Intel.
Kenneth Graunke [Mon, 20 Jan 2014 18:46:53 +0000 (10:46 -0800)]
build: Require libdrm 2.4.52 for Intel.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Delete intel_batchbuffer_emit_reloc_fenced.
Kenneth Graunke [Mon, 13 Jan 2014 23:01:35 +0000 (15:01 -0800)]
i965: Delete intel_batchbuffer_emit_reloc_fenced.

Nothing in i965 uses it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi915: Silence warning: unused parameter warning in intel_bufferobj_buffer
Ian Romanick [Mon, 23 Dec 2013 04:05:50 +0000 (20:05 -0800)]
i915: Silence warning: unused parameter warning in intel_bufferobj_buffer

intel_buffer_objects.c: In function 'old_intel_bufferobj_buffer':
intel_buffer_objects.c:471:17: warning: unused parameter 'flag' [-Wunused-parameter]

The parameter hasn't been used since the i915 and i965 drivers had their
breakup.  i965 got the flags, and i915 got to cry itself to sleep.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi915: Ensure that intel_bufferobj_map_range meets alignment guarantees
Ian Romanick [Fri, 20 Dec 2013 20:58:41 +0000 (12:58 -0800)]
i915: Ensure that intel_bufferobj_map_range meets alignment guarantees

Not actually tested, but the changes are identical to the i965 changes
that are tested.

v2: Remove MAX2(64, ...).  Suggested by Ken (in the i965 version of this
patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Siavash Eliasi <siavashserver@gmail.com>
10 years agoi965: Ensure that intel_bufferobj_map_range meets alignment guarantees
Ian Romanick [Fri, 20 Dec 2013 20:42:33 +0000 (12:42 -0800)]
i965: Ensure that intel_bufferobj_map_range meets alignment guarantees

No piglit regressions on IVB.

With minor tweaks to the arb_map_buffer_alignment-map-invalidate-range
test (disable the extension check, set alignment to 64 instead of
querying), the i965 driver would fail the test without this patch (as
predicted by Eric).  With this patch, it passes.

v2: Remove MAX2(64, ...).  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Siavash Eliasi <siavashserver@gmail.com>
10 years agodocs: Note that GL_ARB_viewport_array is done on i965
Ian Romanick [Sat, 11 Jan 2014 00:07:55 +0000 (16:07 -0800)]
docs: Note that GL_ARB_viewport_array is done on i965

At least for GEN7+, anyway.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Enable ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:15:19 +0000 (13:15 -0700)]
i965: Enable ARB_viewport_array

v2 (idr): Only enable the extension on GEN7+ w/core profile because it
requires geometry shaders.

v3 (idr): Add some casting to fix setting of ViewportBounds.Min.
Negating an unsigned value, then casting to float doesn't do what you
might think it does.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Consider all viewports before enabling guardband clipping
Ian Romanick [Wed, 8 Jan 2014 20:14:49 +0000 (12:14 -0800)]
i965: Consider all viewports before enabling guardband clipping

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Consider only the scissor rectangle for viewport 0 for clears
Ian Romanick [Fri, 17 Jan 2014 23:28:23 +0000 (15:28 -0800)]
i965: Consider only the scissor rectangle for viewport 0 for clears

noop_scissor (correctly) only examines the scissor rectangle for
viewport 0.  Therefore, it should only be called when that scissor
rectangle is enabled.

v2: Remove spurious change to radeon code.  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Set all the supported scissor rectangles for GEN7
Ian Romanick [Wed, 8 Jan 2014 20:14:11 +0000 (12:14 -0800)]
i965: Set all the supported scissor rectangles for GEN7

Currently MaxViewports is still 1, so this won't affect any change.

v2: Minor code reformatting suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Refactor bounding-box calculation out of _mesa_update_draw_buffer_bounds
Ian Romanick [Wed, 8 Jan 2014 20:10:41 +0000 (12:10 -0800)]
mesa: Refactor bounding-box calculation out of _mesa_update_draw_buffer_bounds

Drivers that currently use _Xmin and friends to set their scissor
rectangle will need to use this code directly once they are updated for
GL_ARB_viewport_array.

v2: Use different bit-test idiom and fix mixed tabs and spaces.  Both
were suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Set all the supported viewports for GEN7
Ian Romanick [Wed, 6 Nov 2013 06:50:02 +0000 (22:50 -0800)]
i965: Set all the supported viewports for GEN7

Currently MaxViewports is still 1, so this won't affect any change.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Emit writes to viewport index
Ian Romanick [Tue, 5 Nov 2013 20:19:23 +0000 (12:19 -0800)]
i965: Emit writes to viewport index

This variable is handled in a fashion identical to gl_Layer.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Set the maximum VPIndex
Ian Romanick [Fri, 10 Jan 2014 21:43:24 +0000 (13:43 -0800)]
i965: Set the maximum VPIndex

At various stages the hardware clamps the gl_ViewportIndex to these
values.  Setting them to zero effectively makes gl_ViewportIndex be
ignored.  This is acutally useful in blorp (so that we don't have to
modify all of the viewport / scissor state).

v2: Use INTEL_MASK to create GEN6_CLIP_MAX_VP_INDEX_MASK.  Suggested by
Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add ARB_viewport_array plumbing
Courtney Goeltzenleuchter [Thu, 14 Nov 2013 17:10:47 +0000 (10:10 -0700)]
mesa: Add ARB_viewport_array plumbing

Define API connections to extension entry points added in previous
commits. Update entry points to use floating point arguments as
required by the extension.
Add get tokens for ARB_viewport_array state.

v2: Include review feedback.

v3 (idr): Fix 'make check'.  Add missing Get infrastructure (some was
culled from other pathces).

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Add gl_ViewportIndex built-in variable
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 18:11:39 +0000 (11:11 -0700)]
glsl: Add gl_ViewportIndex built-in variable

v2 (idr): Fix copy-and-paste bug... s/LAYER/VIEWPORT/

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Add extension infrastructure for ARB_viewport_array
Ian Romanick [Wed, 8 Jan 2014 16:32:03 +0000 (08:32 -0800)]
glsl: Add extension infrastructure for ARB_viewport_array

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add varying slot for viewport index
Ian Romanick [Tue, 5 Nov 2013 20:18:43 +0000 (12:18 -0800)]
mesa: Add varying slot for viewport index

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add new viewport and depth-range entry points for GL_ARB_viewport_array
Courtney Goeltzenleuchter [Thu, 14 Nov 2013 17:06:59 +0000 (10:06 -0700)]
mesa: Add new viewport and depth-range entry points for GL_ARB_viewport_array

v2 (idr): Use set_viewport_no_notify / set_depth_range_no_notify (and
manually notify the driver) instead of calling _mesa_set_viewporti /
_mesa_set_depthrangei.  Refactor bodies of _mesa_ViewportIndexed and
_mesa_ViewportIndexedv into a shared function.  Remove spurious CLAMP
calls in _mesa_DepthRangeArrayv and _mesa_DepthRangeIndexed.

v3 (idr): Add some missing return-statements after calls to _mesa_error.

v4 (idr): Only perform the ViewportBounds.Min / ViewportBounds.Max
clamping in set_viewport_no_notify if GL_ARB_viewport_array is enabled.
Otherwise the driver may not have set ViewportBounds, and the clamping
will do bad things.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add new scissor entry points for GL_ARB_viewport_array
Courtney Goeltzenleuchter [Tue, 12 Nov 2013 19:58:40 +0000 (12:58 -0700)]
mesa: Add new scissor entry points for GL_ARB_viewport_array

v2 (idr): Use set_scissor_no_notify (and manually notify the driver)
instead of calling _mesa_set_scissori.  Refactory bodies of
_mesa_ScissorIndexed and _mesa_ScissorIndexedv into a shared function.
Perform parameter validation in the same order in all three functions.
Pull MaxViewports comparison fix (in _mesa_ScissorArrayv) from the next
patch to this patch.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add custom get function for SCISSOR_TEST to _mesa_IsEnabledi
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:22:39 +0000 (13:22 -0700)]
mesa: Add custom get function for SCISSOR_TEST to _mesa_IsEnabledi

Now that the scissor enable state is a bitfield need a custom function
to extract the correct value from gl_context.  Modeled
Scissor.EnableFlags after Color.BlendEnabled.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add new get entrypoints for ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:25:32 +0000 (13:25 -0700)]
mesa: Add new get entrypoints for ARB_viewport_array

v2 (idr): Fix several "comparison between signed and unsigned integer
expressions" warnings.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Change parameter to _mesa_set_viewport to float
Ian Romanick [Wed, 8 Jan 2014 16:52:00 +0000 (08:52 -0800)]
mesa: Change parameter to _mesa_set_viewport to float

This matches the expectations of GL_ARB_viewport_array and the storage
type where the values will land.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Restore all scissor state
Ian Romanick [Thu, 9 Jan 2014 23:44:58 +0000 (15:44 -0800)]
meta: Restore all scissor state

Previously the restore code would enable all scissor rectangles if any
scissor rectangles were enabled on entry to meta.  When there is only
one scissor rectangle, this is fine.  As soon as a driver supports
multiple viewports, this will be a problem.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Set all scissor rects
Ian Romanick [Wed, 6 Nov 2013 17:11:08 +0000 (09:11 -0800)]
mesa: Set all scissor rects

In _mesa_Scissor, make sure that ctx->Driver.Scissor is only called once
instead of once per scissor rectangle.

v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the
driver may not set ctx->Const.MaxViewports yet.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Set all viewports from _mesa_Viewport and _mesa_DepthRange
Ian Romanick [Wed, 6 Nov 2013 06:40:38 +0000 (22:40 -0800)]
mesa: Set all viewports from _mesa_Viewport and _mesa_DepthRange

In _mesa_Viewport and _mesa_DepthRange, make sure that
ctx->Driver.Viewport is only called once instead of once per viewport or
depth range.

v2: Make _mesa_DepthRange actually set all of the depth ranges (instead
of just index 0).  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Restore all the viewports in _mesa_PopAttrib
Ian Romanick [Wed, 8 Jan 2014 03:12:16 +0000 (19:12 -0800)]
mesa: Restore all the viewports in _mesa_PopAttrib

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Restore all the scissor rectangles in _mesa_PopAttrib
Ian Romanick [Wed, 8 Jan 2014 03:06:59 +0000 (19:06 -0800)]
mesa: Restore all the scissor rectangles in _mesa_PopAttrib

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Initialize all the viewports
Ian Romanick [Wed, 6 Nov 2013 06:36:38 +0000 (22:36 -0800)]
mesa: Initialize all the viewports

v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the
driver may not set ctx->Const.MaxViewports yet.

v3: Handle all viewport entries in update_viewport_matrix and
_mesa_copy_context too.  This was previously in an earlier patch.
Having the code in the earlier patch could cause _mesa_copy_context to
access a matrix that hadn't been constructed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v2]
10 years agomesa: Add an index parameter to _mesa_set_scissor
Ian Romanick [Wed, 8 Jan 2014 03:06:17 +0000 (19:06 -0800)]
mesa: Add an index parameter to _mesa_set_scissor

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Refactor scissor rectangle setting even more
Ian Romanick [Mon, 9 Dec 2013 19:54:41 +0000 (11:54 -0800)]
mesa: Refactor scissor rectangle setting even more

Create an internal function that just writes data into the scissor
rectangle.  In future patches this will see more use because we only
want to call dd_function_table::Scissor once after setting all of the
scissor rectangles instead of once per scissor rectangle.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Refactor viewport setting even more
Ian Romanick [Wed, 6 Nov 2013 05:36:12 +0000 (21:36 -0800)]
mesa: Refactor viewport setting even more

Create an internal function that just writes data into the viewport.  In
future patches this will see more use because we only want to call
dd_function_table::Viewport once after setting all of the viewport
instead of once per viewport.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Refactor depth range setting even more
Ian Romanick [Wed, 6 Nov 2013 05:34:26 +0000 (21:34 -0800)]
mesa: Refactor depth range setting even more

Create an internal function that just writes data into the depth range.
In future patches this will see more use because we only want to call
dd_function_table::DepthRange once after setting all of the depth ranges
instead of once per depth range.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add an index parameter to _mesa_set_viewport
Ian Romanick [Wed, 8 Jan 2014 00:57:11 +0000 (16:57 -0800)]
mesa: Add an index parameter to _mesa_set_viewport

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Convert gl_context::Viewport to gl_context::ViewportArray
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Convert gl_context::Viewport to gl_context::ViewportArray

Only element 0 of the array is used anywhere at this time, so there
should be no changes.

v4: Split out from a single megapatch.  Suggested by Ken.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Converty gl_viewport_attrib::X, ::Y, ::Width, and ::Height to float
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Converty gl_viewport_attrib::X, ::Y, ::Width, and ::Height to float

v4: Split out from a single megapatch.  Suggested by Ken.  Also make
meta's save_state::ViewportX, ::ViewportY, ::ViewportW, and ::ViewportH
to match gl_viewport_attrib.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Convert gl_viewport_attrib::Near and ::Far to double
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Convert gl_viewport_attrib::Near and ::Far to double

v4: Split out from a single megapatch.  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Allow glGet of values that are 2 doubles
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Allow glGet of values that are 2 doubles

This will be used when the viewport near and far plane are stored as
doubles instead of as floats.

v4 (idr): Split out from a single megapatch.  Suggested by Ken.  Also
drop value_double_4.  It's never used anywhere in the patch series.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Move parameter validation from _mesa_set_viewport to _mesa_Viewport
Ian Romanick [Tue, 5 Nov 2013 23:36:13 +0000 (15:36 -0800)]
mesa: Move parameter validation from _mesa_set_viewport to _mesa_Viewport

Internal callers should do the right thing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Update gl_scissor_attrib to support ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 21:02:12 +0000 (14:02 -0700)]
mesa: Update gl_scissor_attrib to support ARB_viewport_array

Update Mesa and drivers to access updated gl_scissor_attrib.
Now have an enable bitfield and array of gl_scissor_rects.
Drivers have been updated to the new scissor enable state
attribute (gl_context.scissor.EnableFlags) but still treat it
as a single boolean which is okay as mesa will only use
bit 0 when communicating with a driver that does not support
ARB_viewport_array.

v2 (idr): Rebase fixes.

v3 (idr): Small code formatting fix suggsted by Ken.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add new constants related to GL_ARB_viewport_array
Ian Romanick [Tue, 7 Jan 2014 22:39:48 +0000 (14:39 -0800)]
mesa: Add new constants related to GL_ARB_viewport_array

These limits will be queryable by GL_MAX_VIEWPORTS,
GL_VIEWPORT_SUBPIXEL_BITS, and GL_VIEWPORT_BOUNDS_RANGE.  Drivers that
actually implement the extension must set values for these constants
that comply with the minimum-maximums from the spec.

Most of these changes were part of other patches.  They were separated out
because it make reordering of later patches easier.  Also, MaxViewports wasn't
set by that patch, and I completely overlooked it in review.  It's now obvious
that it's set. :)

v2 (idr): Split these changes out from the original patches.  Keep
MaxViewportWidth and MaxViewportHeight as GLuint.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add extension tracking bit for ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 20 Nov 2013 01:31:24 +0000 (18:31 -0700)]
mesa: Add extension tracking bit for ARB_viewport_array

v2 (idr): Split these changes out from the original patch.  Only
advertise GL_ARB_viewport_array in a core profile because it requires
geometry shaders.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodraw: use some cast wrappers in draw_pt_fetch_shade_pipeline*.c
Brian Paul [Mon, 20 Jan 2014 19:01:48 +0000 (11:01 -0800)]
draw: use some cast wrappers in draw_pt_fetch_shade_pipeline*.c

Trivial.

10 years agodraw: whitespace and formatting fixes in draw_pt_fetch_shade_pipeline*.c
Brian Paul [Mon, 20 Jan 2014 19:00:32 +0000 (11:00 -0800)]
draw: whitespace and formatting fixes in draw_pt_fetch_shade_pipeline*.c

Trivial.

10 years agodraw: fix incorrect vertex size computation in LLVM drawing code
Brian Paul [Mon, 20 Jan 2014 18:57:20 +0000 (10:57 -0800)]
draw: fix incorrect vertex size computation in LLVM drawing code

We were calling draw_total_vs_outputs() too early.  The call to
draw_pt_emit_prepare() could result in the vertex size changing.
So call draw_total_vs_outputs() after draw_pt_emit_prepare().

This fix would seem to be needed for the non-LLVM code as well,
but it's not obvious.  Instead, I added an assertion there to
try to catch this problem if it were to occur there.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72926
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodocs: note reduced display list memory usage in 10.1 relnotes
Brian Paul [Wed, 15 Jan 2014 01:34:22 +0000 (17:34 -0800)]
docs: note reduced display list memory usage in 10.1 relnotes

10 years agodraw: clean up d3d style point clipping
Roland Scheidegger [Fri, 17 Jan 2014 18:39:19 +0000 (19:39 +0100)]
draw: clean up d3d style point clipping

Instead of skipping x/y clipping completely if there's point_tri_clip points
use guard band clipping. This should be easier (previously we could not disable
generating the x/y bits in the clip mask for llvm path, hence requiring custom
clip path), and it also allows us to enable this for tris-as-points more easily
too (this would require custom tri clip filtering too otherwise). Moreover,
some unexpected things could have happen if there's a NaN or just a huge number
in some tri-turned-point, as the driver's rasterizer would need to deal with it
and that might well lead to undefined behavior in typical rasterizers (which
need to convert these numbers to fixed point). Using a guardband should hence
be more robust, while "usually" guaranteeing the same results. (Only "usually"
because unlike hw guardbands draw guardband is always just twice the vp size,
hence small vp but large points could still lead to different results.)
Unfortunately because the clipmask generated is completely unaffected by guard
band clipping, we still need a custom clip stage for points (but not for tris,
as the actual clipping there takes guard band into account).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoswrast: check for null/-1 when mapping renderbuffers
Brian Paul [Mon, 20 Jan 2014 16:06:35 +0000 (08:06 -0800)]
swrast: check for null/-1 when mapping renderbuffers

Fixes fbo-drawbuffers-none crash (but test still fails).
https://bugs.freedesktop.org/show_bug.cgi?id=73757

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosoftpipe: fix crash when accessing null colorbuffer
Brian Paul [Mon, 20 Jan 2014 15:59:25 +0000 (07:59 -0800)]
softpipe: fix crash when accessing null colorbuffer

Fixes piglit fbo-missing-attachment-blit test.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73755

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/vdpau: s/surface/resource/ to fix compiler warning
Brian Paul [Mon, 20 Jan 2014 15:51:25 +0000 (07:51 -0800)]
st/vdpau: s/surface/resource/ to fix compiler warning

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoi915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".
José Fonseca [Mon, 20 Jan 2014 14:15:04 +0000 (14:15 +0000)]
i915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".

These are components which were originally developed by Tungsten Graphics,
which was in turn acquired by VMware, but are de facto now being maintained
by third-party contributors of the Mesa open-source community.

This matches what's reported by swrast driver and a few other components.

Suggested by Ian Romanick.

10 years agologger: Remove unused variable.
José Fonseca [Mon, 20 Jan 2014 13:58:11 +0000 (13:58 +0000)]
logger: Remove unused variable.

Silences gcc "unused variable ‘buf’" warning.

Trivial.

10 years agologger: s/\<log\>/log_/
José Fonseca [Mon, 20 Jan 2014 13:57:12 +0000 (13:57 +0000)]
logger: s/\<log\>/log_/

Currently the MSVC build is broken because of conflicting definitions of
'log' function.  I didn't investigate thoroughly, but I suspect the
it is conflicting standard math.h's log.

log_ is admittedly not a great name, but it is better than a broken build.
A better one can be used in a follow-on build.

10 years agoi965/blorp: reduce the scope of the explicit compression control
Topi Pohjolainen [Fri, 20 Dec 2013 09:12:31 +0000 (11:12 +0200)]
i965/blorp: reduce the scope of the explicit compression control

By highlighting these special cases makes it clearer to switch
to the fs-generator as the wider scoped compression control
settings used in the current implementation can be simply
dropped.

No regressions on IVB (piglit quick + unit tests).

v2 (Ian): typo in a comment

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/blorp: remove dependency to compression control state
Topi Pohjolainen [Thu, 12 Dec 2013 16:32:10 +0000 (18:32 +0200)]
i965/blorp: remove dependency to compression control state

Effectively only the mask control bit gets altered for the single
addition in question and hence there is no real need to use a
fresh state control level for it -- that is more useful when
multiple intructions share the same mask and compression settings.

This is a preparation step for removing the explicit compression
control modifiers in the blit compiler. After this patch there
are no nested state control levels making the constant nature of
the compression settings more apparent.

No regressions on IVB (piglit quick + unit tests).

v2 (Matt, Ian): use temporary variable instead of assigning
                directly on the same line with a function call.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>