platform/upstream/mesa.git
10 years agoglsl: add lowering passes for carry/borrow
Ilia Mirkin [Tue, 29 Apr 2014 03:13:08 +0000 (23:13 -0400)]
glsl: add lowering passes for carry/borrow

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Eliminate gl_shader_program::InternalSeparateShader
Ian Romanick [Thu, 27 Mar 2014 17:29:30 +0000 (10:29 -0700)]
mesa: Eliminate gl_shader_program::InternalSeparateShader

This was a work-around to allow linking a program with only a fragment
shader in a GLES context.  Now that we have GL_EXT_separate_shader_objects
in GLES contexts, we can just use that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Enable GL_EXT_separate_shader_objects for OpenGL ES
Ian Romanick [Wed, 26 Mar 2014 20:11:44 +0000 (13:11 -0700)]
mesa: Enable GL_EXT_separate_shader_objects for OpenGL ES

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Sort the list of extensions
Ian Romanick [Wed, 26 Mar 2014 18:43:32 +0000 (11:43 -0700)]
glsl: Sort the list of extensions

ARB, OES, then everything else.  If there's ever a KHR shading language
extension, it should go between ARB and OES.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects
Ian Romanick [Wed, 26 Mar 2014 18:25:16 +0000 (11:25 -0700)]
mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects

I don't know of any applications that actually use it.  Now that Mesa
supports GL_ARB_separate_shader_objects in all drivers, this extension
is just cruft.

The entrypoints for the extension remain in the XML.  This is done so
that a new libGL will continue to provide dispatch support for old
drivers that try to expose this extension.

Future patches will add OpenGL ES GL_EXT_separate_shader_objects, but
that's a different thing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Enable GL_ARB_separate_shader_objects by default
Ian Romanick [Sat, 29 Jun 2013 02:39:28 +0000 (19:39 -0700)]
mesa/sso: Enable GL_ARB_separate_shader_objects by default

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agosso: Add display list support for ARB_separate_shader_objects new functions
Ian Romanick [Tue, 29 Apr 2014 23:24:24 +0000 (16:24 -0700)]
sso: Add display list support for ARB_separate_shader_objects new functions

With this patch, the piglit arb_separate_shader_object-dlist test
passes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Modify cross_validate_outputs_to_inputs to match using explicit locations
Ian Romanick [Wed, 2 Oct 2013 19:39:29 +0000 (12:39 -0700)]
linker: Modify cross_validate_outputs_to_inputs to match using explicit locations

This will be used for GL_ARB_separate_shader_objects.  That extension
not only allows separable shaders to rendezvous by location, but it also
allows traditionally linked shaders to rendezvous by location.  The spec
says:

    36. How does the behavior of input/output interface matching differ
        between separable programs and non-separable programs?

        RESOLVED: The rules for matching individual variables or block
        members between stages are identical for separable and
        non-separable programs, with one exception -- matching variables
        of different type with the same location, as discussed in issue
        34, applies only to separable programs.

        However, the ability to enforce matching requirements differs
        between program types.  In non-separable programs, both sides of
        an interface are contained in the same linked program.  In this
        case, if the linker detects a mismatch, it will generate a link
        error.

v2: Make sure consumer_inputs_with_locations is initialized when
consumer is NULL.  Noticed by Chia-I.

v3: Rebase on removal of ir_variable::user_location.

v4: Replace a (stale) FINISHME with some good explanation comments from
Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Sort shader I/O variables into a canonical order
Ian Romanick [Tue, 11 Feb 2014 23:38:23 +0000 (15:38 -0800)]
linker: Sort shader I/O variables into a canonical order

v2: Rebase on removal of ir_variable::user_location.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Allow geometry shader without vertex shader for separable programs
Ian Romanick [Fri, 24 Jan 2014 02:26:29 +0000 (18:26 -0800)]
linker: Allow geometry shader without vertex shader for separable programs

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Assign varying locations for separable programs
Ian Romanick [Fri, 14 Feb 2014 20:10:27 +0000 (12:10 -0800)]
linker: Assign varying locations for separable programs

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agolinker: Allow consumer stage or producer stage to be NULL
Ian Romanick [Fri, 14 Feb 2014 20:08:53 +0000 (12:08 -0800)]
linker: Allow consumer stage or producer stage to be NULL

When linking a separable program that contains only a fragment shader,
the producer will be NULL.  Similar cases will exist with geometry
shaders and, eventually, tessellation shaders.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Refactor code that gets an input matching an output
Ian Romanick [Thu, 3 Oct 2013 01:01:13 +0000 (18:01 -0700)]
linker: Refactor code that gets an input matching an output

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Exit when the shader IR contains an interface block instance
Ian Romanick [Wed, 2 Oct 2013 22:57:03 +0000 (15:57 -0700)]
glsl: Exit when the shader IR contains an interface block instance

While writing the link_varyings::single_interface_input test, I
discovered that populate_consumer_input_sets assumes that all shader
interface blocks have been lowered to discrete variables.  Since there
is a pass that does this, it is a reasonable assumption.  It was,
however, non-obvious.  Make the code fail when it encounters such a
thing, and add a test to verify that behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl/tests: Add first simple tests of populate_consumer_input_sets
Ian Romanick [Wed, 2 Oct 2013 22:44:14 +0000 (15:44 -0700)]
glsl/tests: Add first simple tests of populate_consumer_input_sets

Four initial tests:

* Create an IR list with a single input variable and verify that
  variable is the only thing in the hash tables.

* Same as the previous test, but use a built-in variable
  (gl_ClipDistance) with an explicit location set.

* Create an IR list with a single input variable from an interface block
  and verify that variable is the only thing in the hash tables.

* Create an IR list with a single input variable and a single input
  variable from an interface block.  Verify that each is the only thing
  in the proper hash tables.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agolinker: Refactor code that builds hash tables of varyings during linking
Ian Romanick [Wed, 2 Oct 2013 22:39:45 +0000 (15:39 -0700)]
linker: Refactor code that builds hash tables of varyings during linking

I want to make some changes to this code, but first I want to make some
unit tests for it... so that I can capture the pre- and
post-invariants.  Pulling the code out into its own function in a
non-anonymous namespace enables that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Fix saving the program pipeline state
Ian Romanick [Wed, 26 Mar 2014 01:34:31 +0000 (18:34 -0700)]
meta: Fix saving the program pipeline state

This code was broken in some odd ways before.  Too much state was being
saved, it was being restored in the wrong order, and in the wrong way.
The biggest problem was that the pipeline object was restored before
restoring the programs attached to the default pipeline.

Fixes a regression in the glean texgen test.

v3: Fairly significant re-write.  I think it's much cleaner now, and it
avoids a bug with some meta ops that use shaders (reported by Chia-I).

v4: Check Pipeline.Current against NULL instead of Pipeline.Default.
Suggested by Chia-I.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agomesa/sso: Refactor new function _mesa_bind_pipeline
Ian Romanick [Wed, 26 Mar 2014 01:19:42 +0000 (18:19 -0700)]
mesa/sso: Refactor new function _mesa_bind_pipeline

Pull most of the guts out of _mesa_BindPipeline into a new utility
function that can be use elsewhere (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Make lower_packed_varyings work with explicit locations
Ian Romanick [Sun, 27 Apr 2014 21:16:48 +0000 (14:16 -0700)]
linker: Make lower_packed_varyings work with explicit locations

Don't do anything with variables that have explicitly assigned
locations.  This is also how built-in varyings are handled.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Remove varying "base" parameters
Ian Romanick [Sun, 27 Apr 2014 00:45:35 +0000 (17:45 -0700)]
glsl: Remove varying "base" parameters

In February 2013 Paul unified the values used for shader stage outputs
and shader stage inputs.  See commits 8a076c5f0^..eed6baf76.  Since that
time, the location_base parameters are always VARYING_SLOT_VAR0.
Instead of passing that around, just hard code it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Constify parameter to a couple varying_matches methods
Ian Romanick [Thu, 13 Feb 2014 00:35:57 +0000 (16:35 -0800)]
glsl: Constify parameter to a couple varying_matches methods

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoclover: Add a stub implementation of clCreateImage() v3
Tom Stellard [Wed, 30 Apr 2014 19:57:24 +0000 (12:57 -0700)]
clover: Add a stub implementation of clCreateImage() v3

Now that we are uisng the OpenCL 1.2 headers, applications expect all
the OpenCL 1.2 functions to be implemented.

This fixes linking errors with the piglit CL tests.

v2:
  - Use c++ features
  - Fix error code handling

v3:
  - Move <iostream> into api/util.hpp
  - Fix indentation

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agodocs: Add missing ARB_gpu_shader5 subfeature to GL3.txt
Chris Forbes [Fri, 2 May 2014 05:09:13 +0000 (17:09 +1200)]
docs: Add missing ARB_gpu_shader5 subfeature to GL3.txt

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agodocs: Mark ARB_multi_bind as done
Fredrik Höglund [Mon, 18 Nov 2013 17:53:23 +0000 (18:53 +0100)]
docs: Mark ARB_multi_bind as done

...and update relnotes.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Enable ARB_multi_bind
Fredrik Höglund [Fri, 15 Nov 2013 19:07:30 +0000 (20:07 +0100)]
mesa: Enable ARB_multi_bind

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindImageTextures
Fredrik Höglund [Fri, 17 Jan 2014 17:37:06 +0000 (18:37 +0100)]
mesa: Implement glBindImageTextures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindVertexBuffers
Fredrik Höglund [Fri, 15 Nov 2013 19:01:07 +0000 (20:01 +0100)]
mesa: Implement glBindVertexBuffers

v2: Use the user provided offset and stride when the buffer ID is zero.

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2)
10 years agomesa: Implement glBindBuffersRange
Fredrik Höglund [Fri, 15 Nov 2013 18:57:41 +0000 (19:57 +0100)]
mesa: Implement glBindBuffersRange

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindBuffersBase
Fredrik Höglund [Fri, 15 Nov 2013 18:56:07 +0000 (19:56 +0100)]
mesa: Implement glBindBuffersBase

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add _mesa_set_transform_feedback_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:53:29 +0000 (19:53 +0100)]
mesa: Add _mesa_set_transform_feedback_binding()

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Refactor set_ubo_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:51:02 +0000 (19:51 +0100)]
mesa: Refactor set_ubo_binding()

Make set_ubo_binding() just update the binding, and move the code
that does validation, flushes the vertices etc. into a new
bind_uniform_buffer() function.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add helper functions for looking up multiple buffers
Fredrik Höglund [Fri, 15 Nov 2013 18:47:20 +0000 (19:47 +0100)]
mesa: Add helper functions for looking up multiple buffers

v2: Document the difference between _mesa_lookup_bufferobj() and
    _mesa_multi_bind_lookup_bufferobj().
v3: Don't create the buffer objects when they don't exist.

Reviewed-by: Brian Paul <brianp@vmware.com> (v2)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
10 years agomesa: Refactor set_atomic_buffer_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:45:43 +0000 (19:45 +0100)]
mesa: Refactor set_atomic_buffer_binding()

Make set_atomic_buffer_binding() just update the binding, and move
the code that does validation, flushes the vertices etc. into a new
bind_atomic_buffer() function.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindTextures
Fredrik Höglund [Fri, 15 Nov 2013 18:43:01 +0000 (19:43 +0100)]
mesa: Implement glBindTextures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add a texUnit parameter to dd_function_table::BindTexture
Fredrik Höglund [Thu, 23 Jan 2014 13:02:24 +0000 (14:02 +0100)]
mesa: Add a texUnit parameter to dd_function_table::BindTexture

This is for glBindTextures(), since it doesn't change the active
texture unit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add helper functions for looking up multiple textures
Fredrik Höglund [Fri, 17 Jan 2014 17:35:31 +0000 (18:35 +0100)]
mesa: Add helper functions for looking up multiple textures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindSamplers
Fredrik Höglund [Fri, 15 Nov 2013 18:41:11 +0000 (19:41 +0100)]
mesa: Implement glBindSamplers

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Add infrastructure for ARB_multi_bind
Fredrik Höglund [Wed, 13 Nov 2013 18:02:10 +0000 (19:02 +0100)]
glapi: Add infrastructure for ARB_multi_bind

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add functions for doing unlocked hash table lookups
Fredrik Höglund [Wed, 13 Nov 2013 17:46:03 +0000 (18:46 +0100)]
mesa: Add functions for doing unlocked hash table lookups

This patch adds functions for locking/unlocking the mutex, along with
_mesa_HashLookupLocked() and _mesa_HashInsertLocked()
that do lookups and insertions without locking the mutex.

These functions will be used by the ARB_multi_bind entry points to
avoid locking/unlocking the mutex for each binding point.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Optimize unbind_texobj_from_texunits()
Fredrik Höglund [Tue, 12 Nov 2013 16:34:35 +0000 (17:34 +0100)]
mesa: Optimize unbind_texobj_from_texunits()

The texture can only be bound to the index that corresponds to its
target, so there is no need to loop over all possible indices
for every unit and checking if the texture is bound to it.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add a _BoundTextures field in gl_texture_unit
Fredrik Höglund [Tue, 12 Nov 2013 16:28:12 +0000 (17:28 +0100)]
mesa: Add a _BoundTextures field in gl_texture_unit

This will be used by glBindTextures() when unbinding textures,
to avoid having to loop over all the targets.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Store the target index in gl_texture_object
Fredrik Höglund [Tue, 12 Nov 2013 16:23:05 +0000 (17:23 +0100)]
mesa: Store the target index in gl_texture_object

This will be used by glBindTextures() so we don't have to look it up
for each texture.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix the file comment for intel_image.h
Eric Anholt [Tue, 29 Apr 2014 22:31:16 +0000 (15:31 -0700)]
i965: Fix the file comment for intel_image.h

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Rename intel_regions.h to something more appropriate now.
Eric Anholt [Tue, 29 Apr 2014 22:30:15 +0000 (15:30 -0700)]
i965: Rename intel_regions.h to something more appropriate now.

We had the EGLimage structure laying around in intel_regions.h, but now
it's the only thing left in the file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Delete the intel_regions.c code.
Eric Anholt [Fri, 25 Apr 2014 20:50:10 +0000 (13:50 -0700)]
i965: Delete the intel_regions.c code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop region usage from DRI2 winsys-allocated buffers.
Eric Anholt [Fri, 25 Apr 2014 20:44:41 +0000 (13:44 -0700)]
i965: Drop region usage from DRI2 winsys-allocated buffers.

v2: Fix bad pointer on unreference (caught by Chad)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965: Drop a funny assert about mt pitch.
Eric Anholt [Fri, 25 Apr 2014 22:18:14 +0000 (15:18 -0700)]
i965: Drop a funny assert about mt pitch.

I slipped this in in the region->pitch change from pixels to bytes, but I
don't see any reason for it any more -- the libdrm code doesn't appear to
divide pitch by a cpp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix intel_bufferobj_buffer range for blit drawpixels.
Eric Anholt [Fri, 25 Apr 2014 22:14:47 +0000 (15:14 -0700)]
i965: Fix intel_bufferobj_buffer range for blit drawpixels.

If the stride wasn't width*cpp, we wouldn't track how much of the src is
busy, and allow a subdata into the end to proceed unsynchronized.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop use of intel_region from miptrees.
Eric Anholt [Fri, 25 Apr 2014 20:29:41 +0000 (13:29 -0700)]
i965: Drop use of intel_region from miptrees.

Note: region->width/height used to reflect the total_width/height padding
of separate stencil, though mt->total_width didn't.  region->width/height
was being used in EGL images, where the padded value would have been the
wrong one, so I converted them to use rb->Width/Height.

v2: Drop debug printf that slipped in (caught by Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Replace the region in DRIimage with just a BO pointer and stride.
Eric Anholt [Fri, 25 Apr 2014 19:14:34 +0000 (12:14 -0700)]
i965: Replace the region in DRIimage with just a BO pointer and stride.

Regions aren't refcounted safely for multithreaded applications, and
they're not terribly useful wrappers of a BO, so I'm trying to remove
them.

Even the stride I added here could probably be reduced to use of an
existing field in the __DRIimageRec, but I want this to be as mechanical
of a change as possible.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Make intel_set_texture_region just take a BO and pitch.
Eric Anholt [Fri, 25 Apr 2014 20:18:48 +0000 (13:18 -0700)]
i965: Make intel_set_texture_region just take a BO and pitch.

I want to do this to get the region removed from DRI images.  However, it
does mean that we won't share the intel_region between the rb and the
texture for texture_from_pixmap.  I think that's fine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Stop making a pointless region for DRI2 to just throw it away.
Eric Anholt [Fri, 25 Apr 2014 19:38:01 +0000 (12:38 -0700)]
i965: Stop making a pointless region for DRI2 to just throw it away.

I noticed that we were doing this while changing the DRI3 path to not use
regions, which involved changing the signature of
intel_update_winsys_renderbuffer_miptree() this way.

v2: Replace my comment with Chad's version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop the global GEM name from regions.
Eric Anholt [Fri, 25 Apr 2014 19:21:11 +0000 (12:21 -0700)]
i965: Drop the global GEM name from regions.

Once a buffer has been named, drm_intel_bo_flink() is just a getter.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop the tiling argument to intel_miptree_create_for_bo.
Eric Anholt [Fri, 25 Apr 2014 19:10:57 +0000 (12:10 -0700)]
i965: Drop the tiling argument to intel_miptree_create_for_bo.

The drm function to get the tiling is just a getter storing the two
pointers, so we don't need to go out of our way to avoid it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop pointless cast of texObj to intelObj.
Eric Anholt [Fri, 25 Apr 2014 18:47:13 +0000 (11:47 -0700)]
i965: Drop pointless cast of texObj to intelObj.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move intel_region_get_aligned_offset() to be a miptree function.
Eric Anholt [Fri, 25 Apr 2014 18:36:38 +0000 (11:36 -0700)]
i965: Move intel_region_get_aligned_offset() to be a miptree function.

All the consumers are doing it on a miptree.

v2: fix a silly duplicated dereference (review by Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1)
10 years agoi965: Move intel_region_get_tile_masks() to be a miptree function.
Eric Anholt [Fri, 25 Apr 2014 18:20:57 +0000 (11:20 -0700)]
i965: Move intel_region_get_tile_masks() to be a miptree function.

All the consumers are doing it on a miptree.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix another broken offset-aligned-to-tile test.
Eric Anholt [Fri, 25 Apr 2014 18:19:05 +0000 (11:19 -0700)]
i965: Fix another broken offset-aligned-to-tile test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix offset-aligned-to-tile test in dma_buf import.
Eric Anholt [Fri, 25 Apr 2014 18:17:41 +0000 (11:17 -0700)]
i965: Fix offset-aligned-to-tile test in dma_buf import.

v1 of the patch got pushed, insted of the v2 that I had reviewed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Reuse intel_miptree_get_tile_offsets().
Eric Anholt [Fri, 25 Apr 2014 18:26:27 +0000 (11:26 -0700)]
i965: Reuse intel_miptree_get_tile_offsets().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agomesa: move declarations before code in texstore.c
Brian Paul [Thu, 1 May 2014 19:05:19 +0000 (13:05 -0600)]
mesa: move declarations before code in texstore.c

To fix MSVC build.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Fix format of private renderbuffers
Ville Syrjälä [Thu, 24 Apr 2014 11:11:44 +0000 (14:11 +0300)]
i965: Fix format of private renderbuffers

intel_alloc_renderbuffer_storage() will clobber rb->Format which was
already set up by intel_create_renderbuffer(). This causes the driver
to potentially create the depth buffer in the wrong format.

In practice this makes the depth buffer Z24 even if the visual has
depthBits==16.

The incorrect depth buffer format doesn't seem to cause any actual
problems in i965, but it seems like we should fix it anyway. I see
Z16 has been more or less deprecated in the driver except the for
the depthBits==16 case. But if we want to use Z24 even in that
case (not sure it's really legal?) it would look better if the
code made that decision explicitly rather than relying on the
format to get magically overwritten by the renderbuffer code.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agoi915: Don't advertise Z formats in TextureFormatSupported on gen2
Ville Syrjälä [Thu, 24 Apr 2014 11:11:43 +0000 (14:11 +0300)]
i915: Don't advertise Z formats in TextureFormatSupported on gen2

Gen2 doesn't support texturing from Z formats, so state as much.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agoi915: Fix format of private renderbuffers
Ville Syrjälä [Thu, 24 Apr 2014 11:11:42 +0000 (14:11 +0300)]
i915: Fix format of private renderbuffers

intel_alloc_renderbuffer_storage() will clobber rb->Format which was
already set up by intel_create_renderbuffer(). This causes the driver
to potentially create the depth buffer in the wrong format.

Long time ago things worked by accident because
_mesa_choose_tex_format() checked for ARB_depth_texture
and thus returned MESA_FORMAT_NONE on gen2 hardware. Somehow
that ended up working when depthBits==16 because the driver
would then pick DEPTH_FRMT_16_FIXED. Not sure how, but things
also seemed to work with depthBits==24.

Things started to go more sideways at:
 commit 6ae473221a53d8bcb584021483c5328797c6b67c
 Author: Eric Anholt <eric@anholt.net>
 Date:   Mon Apr 22 16:04:25 2013 -0700

    intel: Fold the one last function intel_tex_format.c into the caller.

since that caused intel_miptree_create_layout() to divide by zero
when encoutering MESA_FORMAT_NONE (bw==0). So after this
commit things were broken enough that many applications wouldn't even
run.

Things got a bit better at:
 commit c245efe7e8247ba0c845dee7b77e63fdbfc7e1b3
 Author: Eric Anholt <eric@anholt.net>
 Date:   Thu Mar 21 09:50:45 2013 -0700

    mesa: Remove extension checking from ChooseTexFormat.

since now _mesa_choose_tex_format() would return MESA_FORMAT_X8_Z24
for GL_DEPTH_COMPONENT due to i915 erroneosly claiming that
MESA_FORMAT_X8_S24 (and others) are supported texture formats even
on gen2 hardware. So now the the div-by-zero was gone, but now the
driver would pick DEPTH_FRMT_24_FIXED_8_OTHER even when
depthBits==16 which caused rendering problems.

If we prevent rb->Format from getting clobbered for the depth buffer
things work much better. This makes the spinning title text visible
again in chromium-bsu at 16bpp, for example.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agomesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()
Anuj Phogat [Fri, 21 Mar 2014 18:19:42 +0000 (11:19 -0700)]
mesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()

Fixes a crash in Khronos OpenGL CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV
Anuj Phogat [Fri, 21 Mar 2014 18:16:00 +0000 (11:16 -0700)]
mesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV

V2: Follow the new naming convention for unpack functions.
    Use double precision for converting Z24 to a float.
V3: Unpack stencil value to most significant byte.
    Use 'struct z32f_x24s8' type.
V4: Unpack stencil value to least significant byte.
    Add a comment to clarify stencil packing.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add new helper function _mesa_unpack_depth_stencil_row()
Anuj Phogat [Fri, 21 Mar 2014 18:05:55 +0000 (11:05 -0700)]
mesa: Add new helper function _mesa_unpack_depth_stencil_row()

This patch makes non-functional changes in the code. New helper
function added here will make it easier to support more data
types in the following patches.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Remove redundant if checks in _mesa_texstore_xx_xx() functions
Anuj Phogat [Thu, 20 Mar 2014 19:16:40 +0000 (12:16 -0700)]
mesa: Remove redundant if checks in _mesa_texstore_xx_xx() functions

This patch contains non-functional changes. Assertion checks made
earlier in the functions make the if checks redundant. So, remove
the if checks and unindent the code in if block.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions
Anuj Phogat [Fri, 21 Mar 2014 20:07:13 +0000 (13:07 -0700)]
mesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions

_mesa_texstore_z24_s8() and _mesa_texstore_z32f_x24s8() are capable of
handling GL_DEPTH_STENCIL format. So, allow it in both the functions.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add missing types in _mesa_texstore_xx_xx() functions
Anuj Phogat [Fri, 21 Mar 2014 19:55:19 +0000 (12:55 -0700)]
mesa: Add missing types in _mesa_texstore_xx_xx() functions

Depth-stencil teture targets are allowed to use source data of type
GL_UNSIGNED_INT_24_8_EXT and GL_FLOAT_32_UNSIGNED_INT_24_8_REV.

Fixes few crashes in Khronos OpenGL CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix crash in do_blit_readpixels()
Anuj Phogat [Wed, 19 Mar 2014 18:55:50 +0000 (11:55 -0700)]
i965: Fix crash in do_blit_readpixels()

Fixes a crash in Khronos CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()
Anuj Phogat [Tue, 18 Mar 2014 23:52:24 +0000 (16:52 -0700)]
mesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()

From OpenGL 4.0 spec, page 306:
   "Calling GetTexImage with a format of STENCIL_INDEX
    causes the error INVALID_ENUM."

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add entry for extension ARB_texture_stencil8
Anuj Phogat [Tue, 18 Mar 2014 23:49:03 +0000 (16:49 -0700)]
mesa: Add entry for extension ARB_texture_stencil8

V2: Alphabetize the new entry

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions
Anuj Phogat [Mon, 10 Feb 2014 22:12:40 +0000 (14:12 -0800)]
glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions

Link error conditions added in previous patch are equally applicable
to GL_ARB_fragment_coord_conventions implementation. Extension's spec
says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that program
    that have a static use of gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must have
    the same set of qualifiers."

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Link error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Wed, 5 Feb 2014 23:01:58 +0000 (15:01 -0800)]
glsl: Link error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch causes the shader link to fail if we have multiple fragment
shaders with conflicting layout qualifiers for gl_FragCoord.

V2: Restructure the code and add conditions to correctly handle the
    following case:

fragment shader 1:
layout(origin_upper_left) in vec4 gl_FragCoord;
void main()
{
    foo();
    gl_FragColor = gl_FragData;
}

fragment shader 2:
layout(pixel_center_integer) in vec4 gl_FragCoord;
void foo()
{
}

V3:
Allow linking in the following case:
fragment shader 1:
void main()
{
    foo();
    gl_FragColor = gl_FragCoord;
}

fragment shader 2:
in vec4 gl_FragCoord;
void foo()
{
   ...
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs uses gl_FragCoord before first redeclaration
Anuj Phogat [Fri, 21 Feb 2014 02:32:25 +0000 (18:32 -0800)]
glsl: Compile error if fs uses gl_FragCoord before first redeclaration

Section 4.3.8.1, page 39 of GLSL 1.50 spec says:
  "Within any shader, the first redeclarations of gl_FragCoord
   must appear before any use of gl_FragCoord."

GLSL compiler should generate an error in following case:

vec4 p = gl_FragCoord;
layout(origin_upper_left) in vec4 gl_FragCoord;

void main()
{
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Tue, 4 Feb 2014 18:38:18 +0000 (10:38 -0800)]
glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch makes the glsl compiler to generate an error if we have a
fragment shader defined with conflicting layout qualifier declarations
for gl_FragCoord. For example:

layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
layout(pixel_center_integer) in vec4 gl_FragCoord;

void main()
{
}

V2: Some code refactoring for better readability.
    Add compiler error conditions for redeclarations like:

layout(origin_upper_left) in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

and

in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

V3: Simplify function is_conflicting_fragcoord_redeclaration()
V4: Check for null pointer before doing strcmp(var->name, "gl_FragCoord").

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0
Anuj Phogat [Sat, 29 Mar 2014 00:44:59 +0000 (17:44 -0700)]
mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0

In OpenGL 3.1 attribute 0 becomes non-magic, just like in
OpenGL ES 2.0. Earlier versions of OpenGL used attribute 0
exclusively for vertex position.

V2: Add a utility function _mesa_attr_zero_aliases_vertex() in
    varray.h

Fixes 4 Khronos OpenGL CTS failures:
glGetVertexAttrib
depth24_basic
depth24_precision
rgb8_rgba8_rgb

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Fix querying location of nth element of an array variable
Anuj Phogat [Wed, 2 Apr 2014 20:01:43 +0000 (13:01 -0700)]
mesa: Fix querying location of nth element of an array variable

This patch makes changes to the behavior of glGetAttribLocation(),
glGetFragDataLocation() and glGetFragDataIndex() functions.

Code changes handle a case described in following example:

shader program:
layout(location = 1)in vec4[4] a;
void main()
{
}

Currently, glGetAttribLocation("a") returns 1.
glGetAttribLocation("a[i]"), where i = {0, 1, 2, 3}, returns -1.
But the expected locations for array elements are: 1, 2, 3 and 4
respectively.

This clarification came up with the addition of
ARB_program_interface_query to OpenGL 4.3.

From Page 326 (page 347 of the PDF) of OpenGL 4.3 spec:
   "Otherwise, the command is equivalent to

    GetProgramResourceLocation(program, PROGRAM_INPUT, name);"

And, From Page 101 (page 122 of the PDF) of OpenGL 4.3 spec:

   "A string provided to GetProgramResourceLocation or
    GetProgramResourceLocationIndex is considered to match an active
    variable if

    • the string exactly matches the name of the active variable;
    • if the string identifies the base name of an active array, where
      the string would exactly match the name of the variable if the
      suffix "[0]" were appended to the string; or
    • if the string identifies an active element of the array, where
      the string ends with the concatenation of the "[" character, an
      integer (with no "+" sign, extra leading zeroes, or whitespace)
      identifying an array element, and the "]" character, the integer
      is less than the number of active elements of the array variable,
      and where the string would exactly match the enumerated name of
      the array if the decimal integer were replaced with zero."

V2: Simplify get_matching_index() function.
    Add relevant text from OpenGL spec in commit message.

Fixes failures in Khronos OpenGL CTS tests:
explicit_attrib_location_room
draw_instanced_max_vertex_attribs

Proprietary linux drivers of NVIDIA (331.49) matches the behavior
expected by OpenGL 4.3 spec.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Allow overlapping locations for vertex input attributes
Anuj Phogat [Wed, 5 Mar 2014 01:03:28 +0000 (17:03 -0800)]
glsl: Allow overlapping locations for vertex input attributes

Currently overlapping locations of input variables are not allowed for all
the shader types in OpenGL and OpenGL ES.

From OpenGL ES 3.0 spec, page 56:
   "Binding more than one attribute name to the same location is referred
    to as aliasing, and is not permitted in OpenGL ES Shading Language
    3.00 vertex shaders. LinkProgram will fail when this condition exists.
    However, aliasing is possible in OpenGL ES Shading Language 1.00 vertex
    shaders."

Taking in to account what different versions of OpenGL and OpenGL ES specs
say about aliasing:
   - It is allowed only on vertex shader input attributes in OpenGL (2.0 and
     above) and OpenGL ES 2.0.
   - It is explictly disallowed in OpenGL ES 3.0.

Fixes Khronos CTS failing test:
explicit_attrib_location_vertex_input_aliased.test
See more details about this at below mentioned khronos bug.

V2: Fix the case where location exceeds the maximum allowed attribute
    location.
V3: Simplify the condition added in V2.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: Khronos #9609
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/drisw: fix memory leak when destroying screen.
Roland Scheidegger [Wed, 30 Apr 2014 23:04:31 +0000 (01:04 +0200)]
glx/drisw: fix memory leak when destroying screen.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallivm: fix 2 leaks in disassembly code
Roland Scheidegger [Wed, 30 Apr 2014 22:31:47 +0000 (00:31 +0200)]
gallivm: fix 2 leaks in disassembly code

don't leak the MCSubtargetInfo (not really big, was already fixed with
llvm master) and TargetMachine (big). While this is only used for debugging
the leak is large enough to get you into trouble in some cases.
Tested with llvm 3.1 and master.
Before (llvm 3.1), GALLIVM_DEBUG=asm glxgears:
==14152== LEAK SUMMARY:
==14152==    definitely lost: 105,228 bytes in 20 blocks
==14152==    indirectly lost: 347,252 bytes in 261 blocks
==14152==      possibly lost: 866,625 bytes in 1,453 blocks
==14152==    still reachable: 7,344,677 bytes in 6,494 blocks
==14152==         suppressed: 0 bytes in 0 blocks

After:
==13799== LEAK SUMMARY:
==13799==    definitely lost: 3,108 bytes in 6 blocks
==13799==    indirectly lost: 0 bytes in 0 blocks
==13799==      possibly lost: 804,143 bytes in 1,429 blocks
==13799==    still reachable: 7,314,267 bytes in 6,473 blocks
==13799==         suppressed: 0 bytes in 0 blocks

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Move declaration to top of block.
José Fonseca [Thu, 1 May 2014 09:00:10 +0000 (10:00 +0100)]
mesa: Move declaration to top of block.

To fix MSVC build.  Trivial.

10 years agoosmesa: Fix typo in _MaxEnabledTexImageUnit.
José Fonseca [Thu, 1 May 2014 08:55:20 +0000 (09:55 +0100)]
osmesa: Fix typo in _MaxEnabledTexImageUnit.

10 years agoi965/vec4: Port untyped atomic message support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:33:45 +0000 (19:33 -0700)]
i965/vec4: Port untyped atomic message support to Broadwell.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4: Port untyped surface reads support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:22:33 +0000 (19:22 -0700)]
i965/vec4: Port untyped surface reads support to Broadwell.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Port untyped atomic message support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:47:38 +0000 (18:47 -0700)]
i965/fs: Port untyped atomic message support to Broadwell.

v2: Fix SIMD mode comment (caught by Eric Anholt).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Port untyped surface read support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:32:52 +0000 (18:32 -0700)]
i965/fs: Port untyped surface read support to Broadwell.

v2: Drop unused num_components variable; fix SIMD Mode comment
    (caught by Eric Anholt).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Set fs_inst::header_present for untyped atomics/surface reads.
Kenneth Graunke [Fri, 18 Apr 2014 17:22:13 +0000 (10:22 -0700)]
i965/fs: Set fs_inst::header_present for untyped atomics/surface reads.

The brw_eu_emit.c code manually forces the header present bit when
used in align1 (scalar) mode.  So, this has no effect currently.

However, it is nice to have fs_inst::header_present reflect reality.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Disassemble atomic operations and other DP:DC1 stuff on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:07:09 +0000 (19:07 -0700)]
i965: Disassemble atomic operations and other DP:DC1 stuff on Broadwell.

This is similar to what Eric did for Gen7 a little while ago; it also
has support for untyped surface reads.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Implement the create_raw_surface() hook on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:51:02 +0000 (18:51 -0700)]
i965: Implement the create_raw_surface() hook on Broadwell.

Otherwise we crash when setting up atomic buffer objects.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Drop mark_surface_used from gen8 generators.
Kenneth Graunke [Fri, 18 Apr 2014 02:25:16 +0000 (19:25 -0700)]
i965: Drop mark_surface_used from gen8 generators.

Francisco made brw_mark_surface_used a freestanding function in
commit a32817f3c248125fb537c3a915566445e5600d45.  We should use it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Add support for fs_inst::force_writemask_all on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 16:56:43 +0000 (09:56 -0700)]
i965/fs: Add support for fs_inst::force_writemask_all on Broadwell.

This must not have existed when I wrote the original code.  The atomic
operation header setup code uses this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Actually emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS.
Kenneth Graunke [Tue, 29 Apr 2014 21:29:28 +0000 (14:29 -0700)]
i965: Actually emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS.

For platforms using hardware contexts (currently Gen6+), we failed to
emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS, instead emitting MI_NOOP
for both.

During one of the context initialization reordering patches, we
accidentally moved brw_init_state before we set brw->CMD_PIPELINE_SELECT
and brw->CMD_VF_STATISTICS.  So, when brw_init_state uploaded initial
GPU state (brw_init_state -> brw_upload_initial_gpu_state ->
brw_upload_invariant_state), these would be 0 (MI_NOOP).

Storing the commands in the context is not worthwhile.  We have many
generation checks in our state upload code, and for platforms with
hardware contexts, this only gets called once per GL context anyway.
The cost is negligable, and it's easy to botch context creation
ordering.

This may fix hangs on Gen6+ when using the media pipeline.

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
10 years agoi965: Don't enable reset notification support on Gen4-5.
Kenneth Graunke [Wed, 12 Mar 2014 08:43:40 +0000 (01:43 -0700)]
i965: Don't enable reset notification support on Gen4-5.

arekm reported that using Chrome with GPU acceleration enabled on GM45
triggered the hw_ctx != NULL assertion in brw_get_graphics_reset_status.

We definitely do not want to advertise reset notification support on
Gen4-5 systems, since it needs hardware contexts, and we never even
request a hardware context on those systems.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75723
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodoc: Add pointer to the Mesa Stable Queue page.
Carl Worth [Wed, 30 Apr 2014 23:27:03 +0000 (16:27 -0700)]
doc: Add pointer to the Mesa Stable Queue page.

Since this is now updated daily and looks to be useful.

10 years agoi965: Fix state flag comments on color_buffer_write_enabled() calls.
Eric Anholt [Fri, 25 Apr 2014 23:49:46 +0000 (16:49 -0700)]
i965: Fix state flag comments on color_buffer_write_enabled() calls.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop bogus state flag comment.
Eric Anholt [Fri, 25 Apr 2014 23:47:35 +0000 (16:47 -0700)]
i965: Drop bogus state flag comment.

This was introduced with the comment and code below it, though the code
only touches prog_data (CACHE_NEW_WM_PROG).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Track the number of samples in the drawbuffer.
Eric Anholt [Fri, 25 Apr 2014 23:39:18 +0000 (16:39 -0700)]
i965: Track the number of samples in the drawbuffer.

This keeps us from having to emit the nonpipelined state packet on every
FBO binding.

-4.42003% +/- 1.09961% effect on cairo-perf-trace runtime on glamor (n=110).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.
Eric Anholt [Fri, 25 Apr 2014 22:57:21 +0000 (15:57 -0700)]
mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.

No more walking 96*6 pointers looking to see if they're the current
texture, when we only use the first 2 out of 96 units.  -6.26002% +/-
1.87817% effect on cairo runtime on no-fbo-cache glamor (n=36).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>