mesa.git
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>
10 years agomesa: Rewrite shader-based texture image state updates.
Eric Anholt [Thu, 24 Apr 2014 07:57:54 +0000 (00:57 -0700)]
mesa: Rewrite shader-based texture image state updates.

Instead of walking 6 shader stages for each of the 96 combined texture
image units, now we just walk the samplers used in each shader stage.

With cairo-perf-trace on Xephyr with glamor, I'm seeing a -6.50518% +/-
2.55601% effect on runtime (n=22) since the "drop _EnabledUnits" change.
No significant performance difference on an apitrace of minecraft (n=442).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Split the shader texture update logic from fixed function.
Eric Anholt [Wed, 23 Apr 2014 23:27:56 +0000 (16:27 -0700)]
mesa: Split the shader texture update logic from fixed function.

I want to avoid walking the entire long array texture image units, but the
obvious way to do so means walking program samplers, and thus hitting the
units in a random order.

This change replaces the previous behavior of only setting up the fallback
texture for a fragment shader with setting up the fallback texture for any
shader that's missing a complete texture of the right target in its unit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Finish removing the _ReallyEnabled field.
Eric Anholt [Thu, 24 Apr 2014 01:21:11 +0000 (18:21 -0700)]
mesa: Finish removing the _ReallyEnabled field.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon: Drop the remaining driver usage of _ReallyEnabled.
Eric Anholt [Wed, 23 Apr 2014 23:37:03 +0000 (16:37 -0700)]
radeon: Drop the remaining driver usage of _ReallyEnabled.

This is kind of ugly, but I think it's worth it to finish off the last
consumers of _ReallyEnabled.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoswrast: Drop remaining use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:21:57 +0000 (17:21 -0700)]
swrast: Drop remaining use of _ReallyEnabled.

The _MaxEnabledTexImageUnit check assures us that Unit[0].Current != NULL.
This is the last consumer of _ReallyEnabled outside of the radeons.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogallium: Drop use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:21:30 +0000 (17:21 -0700)]
gallium: Drop use of _ReallyEnabled.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop _ReallyEnabled usage from ff_fragment_shader.
Eric Anholt [Thu, 24 Apr 2014 00:20:53 +0000 (17:20 -0700)]
mesa: Drop _ReallyEnabled usage from ff_fragment_shader.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi915: Drop use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:19:41 +0000 (17:19 -0700)]
i915: Drop use of _ReallyEnabled.

We can just look at _Current's target.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Replace use of _ReallyEnabled as a boolean with use of _Current.
Eric Anholt [Thu, 24 Apr 2014 00:14:26 +0000 (17:14 -0700)]
mesa: Replace use of _ReallyEnabled as a boolean with use of _Current.

I'm probably not the only person that has tried to kill _ReallyEnabled.
This does the mechanical part of the work, and cleans _ReallyEnabled from
i965.

I think that using _Current makes texture management clearer: You can't
have multiple targets in use in the same texture image unit at the same
time, because there's just that one pointer.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).
Eric Anholt [Wed, 23 Apr 2014 23:32:39 +0000 (16:32 -0700)]
mesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).

I'm going to try to delete _ReallyEnabled, which is this weird bitfield
with either 0 or 1 bits set with just the reference to _Current.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop dead last_ReallyEnabled fields from drivers.
Eric Anholt [Wed, 23 Apr 2014 23:43:20 +0000 (16:43 -0700)]
mesa: Drop dead last_ReallyEnabled fields from drivers.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop _EnabledUnits.
Eric Anholt [Wed, 23 Apr 2014 22:30:27 +0000 (15:30 -0700)]
mesa: Drop _EnabledUnits.

The field wasn't really valid, since we've got more than 32 units now.  It
turns out it was mostly just used for checking != 0, or checking for fixed
function coordinates, though.

v2: Fix mis-conversion in xm_line.c (caught by Ken).

Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoswrast: Just use _EnabledCoordUnits for figuring out which texcoords to build.
Eric Anholt [Wed, 23 Apr 2014 22:45:50 +0000 (15:45 -0700)]
swrast: Just use _EnabledCoordUnits for figuring out which texcoords to build.

_EnabledUnits is all of the first 32 image units that are used by fixed
function or programs, while _EnabledCoordUnits is just which fixed function
fragment shader texcoords need to be generated.  This is a theoretical bugfix
in the case of a vertex shader texturing from large texture image unit number
(we'd end up flagging something other than a VARYING_SLOT_TEXn as needing to
be generated), but it's actually just motivated by trying to kill
_EnabledUnits.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi915: Redo texture unit walking on i830.
Eric Anholt [Wed, 23 Apr 2014 22:35:27 +0000 (15:35 -0700)]
i915: Redo texture unit walking on i830.

We now know what the max unit is in the context state.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/vec4: Remove 'mul_arg' from try_emit_mad().
Matt Turner [Mon, 28 Apr 2014 17:30:50 +0000 (10:30 -0700)]
i965/vec4: Remove 'mul_arg' from try_emit_mad().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Remove 'mul_arg' from try_emit_mad().
Matt Turner [Tue, 1 Apr 2014 23:42:36 +0000 (16:42 -0700)]
i965/fs: Remove 'mul_arg' from try_emit_mad().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: change invalid texture swizzle error to GL_INVALID_ENUM
Brian Paul [Thu, 24 Apr 2014 20:44:03 +0000 (14:44 -0600)]
mesa: change invalid texture swizzle error to GL_INVALID_ENUM

The original GL_EXT_texture_swizzle extensions said GL_INVALID_OPERATION
was to be generated when the an invalid swizzle was passed to
glTexParameter().  But in OpenGL 3.3 and later, the error should be
GL_INVALID_ENUM.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agotranslate_sse: Use the correct buffer index in this fast path.
Andreas Hartmetz [Sun, 13 Apr 2014 20:29:35 +0000 (22:29 +0200)]
translate_sse: Use the correct buffer index in this fast path.

It is possible that there are multiple input buffers but only one is
relevant for translation. Then there will be only a single translation
group, which might need to source data from a buffer index != 0.

Fixes wrong vertex shader inputs as observed while debugging with an
application and driver combination that requires translation of a
vertex attribute in a non-trivial set of attributes and input buffers.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoclover: Query drivers for max clock frequency
Tom Stellard [Fri, 18 Apr 2014 14:28:41 +0000 (16:28 +0200)]
clover: Query drivers for max clock frequency

Igor Gnatenko:

v2: PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY instead of
    PIPE_COMPUTE_MAX_CLOCK_FREQUENCY

Bruno Jiménez:

  v3: Drivers report clock in Mhz

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoradeon/compute: Implement PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY
Tom Stellard [Fri, 18 Apr 2014 14:28:40 +0000 (16:28 +0200)]
radeon/compute: Implement PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY

Igor Gnatenko:
  v2: in define RADEON_INFO_MAX_SCLK use 0x1a instead of 0x19 (upstream changes)

Bruno Jiménez:
  v3: Convert the frequency to MHz from kHz after getting it in
  'do_winsys_init'

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogallium: Add PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY
Tom Stellard [Fri, 18 Apr 2014 15:35:59 +0000 (17:35 +0200)]
gallium: Add PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY

Bruno Jiménez:
  v2: Updated the docs
  v3: Remove trailing comma

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoi965: Fix a few base addresses on Broadwell.
Kenneth Graunke [Sun, 27 Apr 2014 05:54:36 +0000 (22:54 -0700)]
i965: Fix a few base addresses on Broadwell.

We intended to set these 64-bit addresses to 0, and set the enable bit.
But, I accidentally placed the DWord with the high bits first, when it
should have been second.

This generally worked out, by luck - presumably General State Base
Address is initially zero, and ends up remaining that way in our
contexts since we bungled the "modify enable" bit.

v2: Fix MOCS shift on GSBA.  It should be 4, and I had 2.
    (Caught by Ben Widawsky.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
10 years agoclover: Stub implementation of CL 1.2 sub-devices.
EdB [Sun, 27 Apr 2014 17:23:25 +0000 (19:23 +0200)]
clover: Stub implementation of CL 1.2 sub-devices.

The implementation is basically a NOP but it conforms with OpenCL 1.2.

[ Francisco Jerez: Initialize property return buffer for
  CL_DEVICE_PARTITION_PROPERTIES, CL_DEVICE_PARTITION_TYPE,
  CL_DEVICE_PARTITION_AFFINITY_DOMAIN, and make the latter a scalar
  rather than a vector.  Some clean-up and code style fixes. ]

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Add clEnqueue{Marker, Barrier}WithWaitList.
EdB [Sat, 26 Apr 2014 17:11:09 +0000 (19:11 +0200)]
clover: Add clEnqueue{Marker, Barrier}WithWaitList.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Align kernel argument sizes to nearest power of 2
Jan Vesely [Fri, 25 Apr 2014 18:24:55 +0000 (14:24 -0400)]
clover: Align kernel argument sizes to nearest power of 2

v2: use a new variable for aligned size
    add comment
    make both vars const
    only use the aligned value in argument constructors
    fix comment typo

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Avoid warnings from references to deprecated CL 1.1 APIs.
Francisco Jerez [Sat, 26 Apr 2014 11:19:37 +0000 (13:19 +0200)]
clover: Avoid warnings from references to deprecated CL 1.1 APIs.

Acked-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Update OpenCL headers to version 1.2 from Khronos.
Francisco Jerez [Sat, 26 Apr 2014 10:14:59 +0000 (12:14 +0200)]
clover: Update OpenCL headers to version 1.2 from Khronos.

The C++ headers are *not* updated because they rely on CL 1.2 APIs
that we do not implement yet when the core CL 1.2 headers are present.

Acked-by: Tom Stellard <thomas.stellard@amd.com>
10 years agonvc0/ir: offset appears to come before the Z ref
Ilia Mirkin [Sun, 27 Apr 2014 00:29:47 +0000 (20:29 -0400)]
nvc0/ir: offset appears to come before the Z ref

Fixes textureGatherOffset when used with a shadow sampler. Also verified
against blob compiler with textureLodOffset manually (no piglit tests
for texture[Lod]Offset + shadow samplers).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa: remove unused #pragma export on/off lines
Brian Paul [Mon, 28 Apr 2014 22:00:58 +0000 (16:00 -0600)]
mesa: remove unused #pragma export on/off lines

PRAGMA_EXPORT_SUPPORTED is never defined.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77749
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agonv50/ir: change texture offsets to ValueRefs, allow nonconst
Ilia Mirkin [Sat, 26 Apr 2014 06:08:23 +0000 (02:08 -0400)]
nv50/ir: change texture offsets to ValueRefs, allow nonconst

This allows us to have non-constant offsets for textureGatherOffset and
textureGatherOffsets.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: do constant folding of extbf/insbf
Ilia Mirkin [Sat, 26 Apr 2014 22:44:19 +0000 (18:44 -0400)]
nvc0/ir: do constant folding of extbf/insbf

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for MUL_HI tgsi opcodes
Ilia Mirkin [Sat, 26 Apr 2014 04:38:39 +0000 (00:38 -0400)]
nvc0/ir: add support for MUL_HI tgsi opcodes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for new bitfield manipulation opcodes
Ilia Mirkin [Sat, 26 Apr 2014 02:40:42 +0000 (22:40 -0400)]
nvc0/ir: add support for new bitfield manipulation opcodes

This adds support for:

IBFE, UBFE, BFI, LSB, IMSB, UMSB, BREV, POPC

Which are all required for ARB_gs5 support.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agotgsi: add tgsi_exec support for new bit manipulation opcodes
Ilia Mirkin [Fri, 25 Apr 2014 05:44:19 +0000 (01:44 -0400)]
tgsi: add tgsi_exec support for new bit manipulation opcodes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium/util: add helpers for bitfield manipulation
Ilia Mirkin [Fri, 25 Apr 2014 22:07:41 +0000 (18:07 -0400)]
gallium/util: add helpers for bitfield manipulation

Add bitwise reversing and signed MSB helpers for software implementation
of the new TGSI opcodes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa/st: implement new bit manipulation opcodes
Ilia Mirkin [Fri, 25 Apr 2014 05:45:19 +0000 (01:45 -0400)]
mesa/st: implement new bit manipulation opcodes

Also pipe through [IU]MUL_HI, MAD, and lower ldexp. This provides
coverage of all new ARB_gpu_shader5 functions except uaddCarry,
usubBorrow and interpolateAt*.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium: add new opcodes for ARB_gs5 bit manipulation support
Ilia Mirkin [Fri, 25 Apr 2014 05:43:05 +0000 (01:43 -0400)]
gallium: add new opcodes for ARB_gs5 bit manipulation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoglx/drisw: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:52:26 +0000 (19:52 +0000)]
glx/drisw: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>