mesa.git
8 years agogbm: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:50:08 +0000 (02:50 +0000)]
gbm: use the loader util lib

Additionally this commit removes the following exported functions

   _gbm_udev_device_new_from_fd()
   _gbm_fd_get_device_name()
   _gbm_log()

All three were erroneously marked as exported since their inception.
Neither of them has ever been a part of the API thus there should be
no users of them.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglx: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:24:43 +0000 (02:24 +0000)]
glx: use the loader util lib

v2
* Set logger to ErrorMessageF. Spotted by Kristian

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoloader: introduce the loader util lib
Emil Velikov [Fri, 10 Jan 2014 23:36:16 +0000 (23:36 +0000)]
loader: introduce the loader util lib

All the various window system integration layers duplicate roughly the
same code for figuring out device and driver name, pci-id's, etc.  Which
is sad.  So extract it out into a loader util lib.

v2 (Emil)
* Separate the introduction of libloader from the code de-duplication.
* Strip out non-pci devices support.
* Add scons + Android build system support.
* Add VISIBILITY_CFLAGS to avoid exporting the loader funcs.

v3 (Emil)
* PIPE_OS_ANDROID is undefined at this scope, use ANDROID
* Make sure we define _EGL_NO_DRM when building only swrast

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Remove CACHED_BATCH support altogether.
Kenneth Graunke [Mon, 26 Aug 2013 20:11:21 +0000 (13:11 -0700)]
i965: Remove CACHED_BATCH support altogether.

Using an unoptimized variant of glamor spending 50% of its CPU time in
brw_draw_prims() (and hitting the cache *very* frequently):

    N           Min           Max        Median           Avg        Stddev
x 200         29200         40500         34900         34750     958.43256
+ 200         31000         40300         34700         34622     916.35941
No difference proven at 95.0% confidence

Similarly, no difference on GLB2.7:

    N           Min           Max        Median           Avg        Stddev
x  63          64.1         71.36         70.69     70.113175     1.6782026
+  63          63.6         71.18         70.75     70.223651     1.6044186
No difference proven at 95.0% confidence

v2: Rebase on master (by anholt)
v3: Add a missing BEGIN_BATCH(3) to aa_line_parameters -- CACHED_BATCH
    didn't have the asserts about batchbuffer usage that ADVANCE_BATCH
    does, so we started assertion failing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoi965: Replace 8-wide and 16-wide with SIMD8 and SIMD16.
Eric Anholt [Tue, 12 Nov 2013 23:33:27 +0000 (15:33 -0800)]
i965: Replace 8-wide and 16-wide with SIMD8 and SIMD16.

Those are the terms used in the docs, and think "n-wide" was something I
just happened to say.  Note that shader-db needs updating for the
INTEL_DEBUG=fs parsing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Stop doing our optimization on a copy of the GLSL IR.
Eric Anholt [Thu, 28 Nov 2013 08:48:57 +0000 (00:48 -0800)]
i965: Stop doing our optimization on a copy of the GLSL IR.

The original intent was that we'd keep a driver-private copy, and there
would be the normal copy for swrast to make use of without the tuning (or
anything more invasive we might do) specific to i965.  Only, we don't
generate swrast code any more, because swrast can't render current shaders
anyway.  Thus, our private copy is rather a waste, and we can just do our
backend-specific operations on the linked shader.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agos/Tungsten Graphics/VMware/
José Fonseca [Fri, 17 Jan 2014 16:27:50 +0000 (16:27 +0000)]
s/Tungsten Graphics/VMware/

Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agotrace: Re-license trace.xsl under MIT license.
José Fonseca [Fri, 17 Jan 2014 16:15:18 +0000 (16:15 +0000)]
trace: Re-license trace.xsl under MIT license.

I was the sole author, as Tungsten Graphics employee, which was since
then acquired by VMware Inc.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agosvga: fix crash when clearing null color buffer
Brian Paul [Thu, 16 Jan 2014 21:53:27 +0000 (13:53 -0800)]
svga: fix crash when clearing null color buffer

Fixes regression since 9baa45f78b8ca7d66280e36009b6a685055d7cd6
but some of the piglit fbo-drawbuffers-none tests still don't
pass.

v2: use the right pointer type for 'h'

Reviewed-by: José Fonseca <jfonseca@vmware.com>
8 years agollvmpipe: handle NULL color buffer pointers
Brian Paul [Thu, 16 Jan 2014 02:09:56 +0000 (18:09 -0800)]
llvmpipe: handle NULL color buffer pointers

Fixes regression from 9baa45f78b8ca7d66280e36009b6a685055d7cd6

v2: incorporate a few small changes suggested by Roland.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agosoftpipe: handle NULL color buffer pointers
Brian Paul [Thu, 16 Jan 2014 01:24:02 +0000 (17:24 -0800)]
softpipe: handle NULL color buffer pointers

Fixes regression from 9baa45f78b8ca7d66280e36009b6a685055d7cd6

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agollvmpipe: fix large point rasterization with point_quad_rasterization
Roland Scheidegger [Fri, 17 Jan 2014 01:12:20 +0000 (02:12 +0100)]
llvmpipe: fix large point rasterization with point_quad_rasterization

The whole round-pointsize-to-int stuff must only be done with GL legacy
rules (no point_quad_rasterization) or all the wrong edges are lit up.
This was previously in a private branch (d3d pointsprite test complains
loudly otherwise) and got lost in a merge. However, it should certainly
apply to GL point sprite rasterization as well.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agogallium: add bits for clipping points as tris (d3d-style)
Roland Scheidegger [Thu, 9 Jan 2014 15:55:22 +0000 (16:55 +0100)]
gallium: add bits for clipping points as tris (d3d-style)

OpenGL does whole-point clipping, that is a large point is either fully
clipped or fully unclipped (the latter means it may extend beyond the
viewport as long as the center is inside the viewport). d3d9 (d3d10 has
no large points) however requires points to be clipped after they are
expanded to a rectangle. (Note some IHVs are known to ignore GL rules at
least with some hw/drivers.)
Hence add a rasterizer bit indicating which way points should be clipped
(some drivers probably will always ignore this), and add the draw interaction
this requires. Drivers wanting to support this and using draw must support
large points on their own as draw doesn't implement vp clipping on the
expanded points (it potentially could but the complexity doesn't seem
warranted), and the driver needs to do viewport scissoring on such points.

Conflicts:

src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_state_derived.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agomesa: fix GL_COLOR_SUM enum for drivers without ARB_vertex_program
Ilia Mirkin [Thu, 16 Jan 2014 18:13:28 +0000 (13:13 -0500)]
mesa: fix GL_COLOR_SUM enum for drivers without ARB_vertex_program

Commit c13970808 (mesa: GL_EXT_secondary_color is not optional) changed

CHECK_EXTENSION2(EXT_secondary_color, ARB_vetex_program, cap)

to

CHECK_EXTENSION(ARB_vertex_program, cap)

However CHECK_EXTENSION2 checks that either extension is available, not
both. Remove the extension check entirely since the intent was for it to
always be enabled.

v2: Fix glGet*(GL_COLOR_SUM) too.  Suggested by Ian.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org>
8 years agollvmpipe: do constant buffer bounds checking in shaders
Zack Rusin [Thu, 19 Dec 2013 00:16:07 +0000 (19:16 -0500)]
llvmpipe: do constant buffer bounds checking in shaders

It's possible to bind a smaller buffer as a constant buffer, than
what the shader actually uses/requires. This could cause nasty
crashes. This patch adds the architecture to pass the maximum
allowable constant buffer index to the jit to let it make
sure that the constant buffer indices are always within bounds.
The behavior follows the d3d10 spec, which says the overflow
should always return all zeros, and overflow is only defined
as access beyond the size of the currently bound buffer. Accesses
beyond the declared shader constant register size are not
considered an overflow and expected to return garbage but consistent
garbage (we follow the behavior which some wlk tests expect which
is to return the actual values from the bound buffer).

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agonv50, nvc0: initialize ctx->sample_mask to ~0
Ilia Mirkin [Sun, 12 Jan 2014 20:01:29 +0000 (15:01 -0500)]
nv50, nvc0: initialize ctx->sample_mask to ~0

Commit 95bf222603b (cso_context: Fix cso_context::sample_mask initial
value.) fixed the cso sample mask to be initialized to ~0. The cso code
is also careful not to needlessly call set_sample_mask, so we ended up
with the ctx->sample_mask never being set. This broke a number of
EXT_framebuffer_multisample piglit tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa/main: Free ctx->DrawIndirectBuffer during teardown
Aaron Watry [Thu, 2 Jan 2014 17:18:09 +0000 (11:18 -0600)]
mesa/main: Free ctx->DrawIndirectBuffer during teardown

ctx->DrawIndirectBuffer wasn't being free'd in _mesa_free_buffer_objects

With this patch, "valgrind --leak-check=full glxgears" on evergreen (CEDAR)
now shows:

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 70,228 bytes in 651 blocks
        suppressed: 0 bytes in 0 blocks

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agost/dri: prevent leak of dri option default values
Aaron Watry [Wed, 18 Dec 2013 20:40:49 +0000 (14:40 -0600)]
st/dri: prevent leak of dri option default values

v2: Change comment style

CC: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeon: Move gfx/dma cs cleanup to r600_common_context_cleanup
Aaron Watry [Tue, 7 Jan 2014 20:45:41 +0000 (14:45 -0600)]
radeon: Move gfx/dma cs cleanup to r600_common_context_cleanup

The radeonsi code was not cleaning up either of these items leading to
leaked memory.

v2: Move cleanup to r600_common_context_cleanup instead of duplicating
    the logic for SI

CC: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: Eliminate parameters to dd_function_table::Scissor
Ian Romanick [Tue, 5 Nov 2013 22:22:30 +0000 (14:22 -0800)]
mesa: Eliminate parameters to dd_function_table::Scissor

The i830 and i915 drivers used them, but they didn't really need to.
They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Eliminate parameters to dd_function_table::DepthRange
Ian Romanick [Tue, 5 Nov 2013 22:16:05 +0000 (14:16 -0800)]
mesa: Eliminate parameters to dd_function_table::DepthRange

No driver uses them.  They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Eliminate parameters to dd_function_table::Viewport
Ian Romanick [Tue, 5 Nov 2013 22:01:31 +0000 (14:01 -0800)]
mesa: Eliminate parameters to dd_function_table::Viewport

No driver uses them.  They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoradeon: Remove dead code
Ian Romanick [Tue, 5 Nov 2013 20:38:22 +0000 (12:38 -0800)]
radeon: Remove dead code

A future patch will rename some of the fields of gl_viewport_attrib, and
I don't want to update dead code that I can't test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Dave Airlie <airlied@redhat.com>
8 years agoi915: Remove spurious calls to DepthRange
Ian Romanick [Tue, 5 Nov 2013 22:34:03 +0000 (14:34 -0800)]
i915: Remove spurious calls to DepthRange

For both i830 and i915, the driver DepthRange function just calls
intelCalcViewport.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Eric Anholt <eric@anholt.net>
8 years agomesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLES
Ian Romanick [Tue, 14 Jan 2014 21:41:19 +0000 (13:41 -0800)]
mesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLES

The ES and desktop GL specs diverge here.  Yay!

In desktop OpenGL, the driver can perform online compression of
uncompressed texture data.  GL_NUM_COMPRESSED_TEXTURE_FORMATS and
GL_COMPRESSED_TEXTURE_FORMATS give the application a list of formats
that it could ask the driver to compress with some expectation of
quality.  The GL_ARB_texture_compression spec calls this "suitable for
general-purpose usage."  As noted above, this means
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT is not included in the list.

In OpenGL ES, the driver never performs compression.
GL_NUM_COMPRESSED_TEXTURE_FORMATS and GL_COMPRESSED_TEXTURE_FORMATS give
the application a list of formats that the driver can receive from the
application.  It is the *complete* list of formats.  The
GL_EXT_texture_compression_s3tc spec says:

    "New State for OpenGL ES 2.0.25 and 3.0.2 Specifications

        The queries for NUM_COMPRESSED_TEXTURE_FORMATS and
        COMPRESSED_TEXTURE_FORMATS include COMPRESSED_RGB_S3TC_DXT1_EXT,
        COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
        and COMPRESSED_RGBA_S3TC_DXT5_EXT."

Note that the addition is only to the OpenGL ES specification!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
See-also: http://lists.freedesktop.org/archives/mesa-dev/2013-October/047439.html
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
8 years agoscons: add new shaderimage.c file to the build
Brian Paul [Wed, 15 Jan 2014 16:17:04 +0000 (09:17 -0700)]
scons: add new shaderimage.c file to the build

8 years agoclover: Fix clover::keys and ::values to deal with r-value references properly.
Francisco Jerez [Tue, 14 Jan 2014 21:03:57 +0000 (22:03 +0100)]
clover: Fix clover::keys and ::values to deal with r-value references properly.

Returning a reference is incorrect if the specified pair was a
temporary -- Instead of that, use decltype() to deduce the correct
return type qualifiers.  Fixes a crash in clCreateProgramWithBinary().

Reported-and-tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
8 years agoclover: Don't try to build programs created from a binary again.
Francisco Jerez [Tue, 14 Jan 2014 20:55:29 +0000 (21:55 +0100)]
clover: Don't try to build programs created from a binary again.

According to the spec it's allowed to call clBuildProgram() on a
program created from a user-specified binary.  We don't need to do
anything to build the program in that case.

Reported-and-tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
8 years agoclover: Add missing fields to the clover::module serialization code.
Francisco Jerez [Tue, 14 Jan 2014 20:53:57 +0000 (21:53 +0100)]
clover: Add missing fields to the clover::module serialization code.

Tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
8 years agoclover: Store map result into a temporary vector in clCreateProgramWithBinary.
Francisco Jerez [Tue, 14 Jan 2014 20:47:46 +0000 (21:47 +0100)]
clover: Store map result into a temporary vector in clCreateProgramWithBinary.

This avoids the inefficient multiple evaluation of the map result in
the code below.  It should cause no functional changes.

Tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
8 years agodocs: Mark ARB_shader_image_load_store as work in progress.
Francisco Jerez [Mon, 25 Nov 2013 00:24:32 +0000 (16:24 -0800)]
docs: Mark ARB_shader_image_load_store as work in progress.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Validate image units when the texture state changes.
Francisco Jerez [Sat, 23 Nov 2013 03:58:10 +0000 (19:58 -0800)]
mesa: Validate image units when the texture state changes.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Unbind deleted textures from the shader image units.
Francisco Jerez [Sat, 23 Nov 2013 03:54:47 +0000 (19:54 -0800)]
mesa: Unbind deleted textures from the shader image units.

From ARB_shader_image_load_store:

   If a texture object bound to one or more image units is deleted by
   DeleteTextures, it is detached from each such image unit, as though
   BindImageTexture were called with <unit> identifying the image unit
   and <texture> set to zero.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add image parameter queries for ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 18:11:59 +0000 (10:11 -0800)]
mesa: Add image parameter queries for ARB_shader_image_load_store.

v2: Fix off-by-one error in index parameter bound checking.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add ARB_shader_image_load_store to the extension table.
Francisco Jerez [Sat, 23 Nov 2013 03:47:22 +0000 (19:47 -0800)]
mesa: Add ARB_shader_image_load_store to the extension table.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agoglapi: Update dispatch XML files for ARB_shader_image_load_store.
Francisco Jerez [Fri, 22 Nov 2013 23:55:09 +0000 (15:55 -0800)]
glapi: Update dispatch XML files for ARB_shader_image_load_store.

And uncomment the relevant lines of the dispatch sanity test.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Implement the GL entry points defined by ARB_shader_image_load_store.
Francisco Jerez [Fri, 22 Nov 2013 23:56:34 +0000 (15:56 -0800)]
mesa: Implement the GL entry points defined by ARB_shader_image_load_store.

v2: Name image format classes consistently, fix array and 3D teximage
    selection with layered = GL_FALSE, make sure that the
    user-specified layer is less than the number of texture layers,
    add some asserts.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add MESA_FORMAT_SIGNED_RG88 and _RG1616.
Francisco Jerez [Sat, 23 Nov 2013 03:49:58 +0000 (19:49 -0800)]
mesa: Add MESA_FORMAT_SIGNED_RG88 and _RG1616.

Including pack/unpack and texstore code.  ARB_shader_image_load_store
requires support for the GL_RG8_SNORM and GL_RG16_SNORM formats, which
map to MESA_FORMAT_SIGNED_GR88 and MESA_FORMAT_SIGNED_GR1616 on
little-endian hosts, and MESA_FORMAT_SIGNED_RG88 and
MESA_FORMAT_SIGNED_RG1616 respectively on big-endian hosts -- only the
former were already present, add support for the latter.

Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add MESA_FORMAT_ABGR2101010.
Francisco Jerez [Sat, 23 Nov 2013 03:49:29 +0000 (19:49 -0800)]
mesa: Add MESA_FORMAT_ABGR2101010.

Including pack/unpack and texstore code.  This texture format is a
requirement for ARB_shader_image_load_store.

Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add driver interface for ARB_shader_image_load_store.
Francisco Jerez [Sat, 23 Nov 2013 05:16:06 +0000 (21:16 -0800)]
mesa: Add driver interface for ARB_shader_image_load_store.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Add state data structures required for ARB_shader_image_load_store.
Francisco Jerez [Sat, 23 Nov 2013 05:15:26 +0000 (21:15 -0800)]
mesa: Add state data structures required for ARB_shader_image_load_store.

v2: Increase MAX_IMAGE_UNITS to what i965 wants and add a separate
    MAX_IMAGE_UNIFORMS define, clarify a couple of comments.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
8 years agomesa: Define helper function to get the number of texture layers.
Francisco Jerez [Sat, 7 Dec 2013 22:35:04 +0000 (23:35 +0100)]
mesa: Define helper function to get the number of texture layers.

And to check if it can have layers at all.  This will be used by the
implementation of ARB_shader_image_load_store.

v2: Fix constness of texobj argument, use assert and return reasonable
    default rather than calling unreachable() in default switch case.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: use signed temporary variable to store _ColorDrawBufferIndexes
Emil Velikov [Wed, 15 Jan 2014 11:39:24 +0000 (11:39 +0000)]
st/mesa: use signed temporary variable to store _ColorDrawBufferIndexes

The temporary variable used to store _ColorDrawBufferIndexes must be
signed (GLint), otherwise the following conditional will be incorrectly
evaluated. Leading to crashes in the driver/mesa or accessing/writing
to arbitrary memory location. The bug dates back to 2009.

Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoautomake: include the git sha in the opengl version string for oot builds
Emil Velikov [Mon, 13 Jan 2014 01:56:39 +0000 (01:56 +0000)]
automake: include the git sha in the opengl version string for oot builds

Acked-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agomesa: use signed temporary variable to store _ColorDrawBufferIndexes
Emil Velikov [Sun, 12 Jan 2014 22:42:05 +0000 (22:42 +0000)]
mesa: use signed temporary variable to store _ColorDrawBufferIndexes

_ColorDrawBufferIndexes is defined as GLint* and using a GLuint*
will result in the first part of the conditional to be evaluated to
true always.

Unintentionally introduced by the following commit, this will result
in a driver segfault if one is using an old version of the piglit test

    bin/clearbuffer-mixed-format -auto -fbo

commit 03d848ea1003abefd8fe51a5b4a780527cd852af
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Wed Dec 4 00:27:20 2013 +0100

    mesa: fix interpretation of glClearBuffer(drawbuffer)

    This corresponding piglit tests supported this incorrect behavior instead of
    pointing at it.

Cc: Marek Olšák <marek.olsak@amd.com>
Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agonouveau: add framebuffer validation callback
Ilia Mirkin [Wed, 15 Jan 2014 00:50:33 +0000 (19:50 -0500)]
nouveau: add framebuffer validation callback

Fixes assertions when trying to attach textures to fbs with formats not
supported by the render engines.

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

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoclover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.
Francisco Jerez [Tue, 14 Jan 2014 20:38:11 +0000 (21:38 +0100)]
clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.

8 years agoi965: Emit 3DSTATE_VF on Broadwell too.
Kenneth Graunke [Tue, 12 Nov 2013 02:30:32 +0000 (18:30 -0800)]
i965: Emit 3DSTATE_VF on Broadwell too.

It's not just for Haswell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoi965: Disable workaround flush for push constants on Broadwell.
Kenneth Graunke [Sat, 9 Nov 2013 06:21:29 +0000 (22:21 -0800)]
i965: Disable workaround flush for push constants on Broadwell.

If it wasn't necessary for Haswell, it's likely not to be necessary for
Broadwell either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoi965: Enable native ETC texture support on Broadwell.
Kenneth Graunke [Thu, 19 Dec 2013 23:15:01 +0000 (15:15 -0800)]
i965: Enable native ETC texture support on Broadwell.

Broadwell, like Baytrail, has native ETC texture support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoilo: handle NULL renderbuffers correctly
Chia-I Wu [Tue, 14 Jan 2014 08:02:34 +0000 (16:02 +0800)]
ilo: handle NULL renderbuffers correctly

Renderbuffers may be NULL since 9baa45f78b8ca7d66280e36009b6a685055d7cd6.

8 years agoilo: disable HiZ for misaligned levels
Chia-I Wu [Tue, 14 Jan 2014 06:51:51 +0000 (14:51 +0800)]
ilo: disable HiZ for misaligned levels

We need to disable HiZ for non-8x4 aligned levels, except for level 0, layer
0.  For the very first layer we can adjust Width and Height fields of
3DSTATE_DEPTH_BUFFER to make it aligned.

Specifically, add ILO_TEXTURE_HIZ and set the flag only for properly aligned
levels.  ilo_texture_can_enable_hiz() is updated to check for the flag.

In tex_layout_validate(), align the depth bo to 8x4 so that we can adjust
Width/Height of 3DSTATE_DEPTH_BUFFER without introducing out-of-bound access.

Finally in rectlist blitter, add the ability to adjust 3DSTATE_DEPTH_BUFFER.

8 years agoilo: use a helper to determine if HiZ is enabled
Chia-I Wu [Tue, 14 Jan 2014 05:50:12 +0000 (13:50 +0800)]
ilo: use a helper to determine if HiZ is enabled

Add ilo_texture_can_enable_hiz and replace all checks for tex->hiz.bo by calls
to ilo_texture_can_enable_hiz().

8 years agoilo: decide on hiz first in texture allocation
Chia-I Wu [Sun, 12 Jan 2014 17:03:15 +0000 (01:03 +0800)]
ilo: decide on hiz first in texture allocation

Add tex_layout_init_hiz() before tex_layout_init_format() to decide whether
HiZ should be enabled.

On GEN6, because of layer offsetting, HiZ is enabled only when the texture is
non-mipmapped and non-array.  PIPE_USAGE_STAGING is also taken as a hint to
disable HiZ.

8 years agoilo: emit gen7_wa_pipe_control_wm_max_threads_stall on Haswell
Chia-I Wu [Fri, 10 Jan 2014 05:46:08 +0000 (13:46 +0800)]
ilo: emit gen7_wa_pipe_control_wm_max_threads_stall on Haswell

Rename the workaround, as it is for 3DSTATE_PS instead of 3DSTATE_WM, and emit
it on Haswell too.

This does not fix any app, but an assertion failure.

8 years agoilo: use HALIGN_4 on GEN7 for depth buffers
Chia-I Wu [Tue, 14 Jan 2014 07:15:07 +0000 (15:15 +0800)]
ilo: use HALIGN_4 on GEN7 for depth buffers

The comment was no longer true since 6642381e7513926b847d6bc10bf590e1c0c54859.

8 years agoilo: OOM for HiZ is fatal on GEN6
Chia-I Wu [Tue, 14 Jan 2014 05:34:29 +0000 (13:34 +0800)]
ilo: OOM for HiZ is fatal on GEN6

On GEN6, HiZ and Separate Stencil Buffer must be enabled at the same time.

8 years agoilo: fix a HiZ bo leakage
Chia-I Wu [Tue, 14 Jan 2014 05:33:22 +0000 (13:33 +0800)]
ilo: fix a HiZ bo leakage

Dereference the HiZ bo when the texture is destroyed.

8 years agoilo: simplify ilo_texture_set_slice_flags()
Chia-I Wu [Fri, 10 Jan 2014 05:50:52 +0000 (13:50 +0800)]
ilo: simplify ilo_texture_set_slice_flags()

Call ilo_texture_get_slice() for the last slice so that we can get rid of the
duplicated assert().

8 years agoegl-static: Fix build error.
Vinson Lee [Mon, 13 Jan 2014 23:51:50 +0000 (15:51 -0800)]
egl-static: Fix build error.

Fix build regression introduced with commit
786af2f963925df2c2a6fb60b29a83e8340f03c7.

egl_pipe.c:46:38: fatal error: radeonsi/radeonsi_public.h: No such file or directory
 #include "radeonsi/radeonsi_public.h"
                                      ^

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73578
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
8 years agoradeonsi: Rename the commonly occurring rscreen variable.
Andreas Hartmetz [Sat, 11 Jan 2014 15:01:11 +0000 (16:01 +0100)]
radeonsi: Rename the commonly occurring rscreen variable.

The "r" stands for R600.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename the commonly occurring rctx/r600 variables.
Andreas Hartmetz [Sat, 11 Jan 2014 15:00:50 +0000 (16:00 +0100)]
radeonsi: Rename the commonly occurring rctx/r600 variables.

The "r" stands for R600.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600_trace_emit->si_trace_emit.
Andreas Hartmetz [Sat, 11 Jan 2014 14:59:13 +0000 (15:59 +0100)]
radeonsi: Rename r600_trace_emit->si_trace_emit.

I had previously considered that unsafe.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename R600->SI in some remaining defines.
Andreas Hartmetz [Sat, 11 Jan 2014 14:56:47 +0000 (15:56 +0100)]
radeonsi: Rename R600->SI in some remaining defines.

I had previously considered that unsafe.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename radeonsi->si remaining identifiers in si_uvd.c.
Andreas Hartmetz [Tue, 7 Jan 2014 02:18:42 +0000 (03:18 +0100)]
radeonsi: Rename radeonsi->si remaining identifiers in si_uvd.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifiers in si_state_draw.c.
Andreas Hartmetz [Tue, 7 Jan 2014 02:18:25 +0000 (03:18 +0100)]
radeonsi: Rename r600->si remaining identifiers in si_state_draw.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifiers in si_resource.c.
Andreas Hartmetz [Tue, 7 Jan 2014 02:14:05 +0000 (03:14 +0100)]
radeonsi: Rename r600->si remaining identifiers in si_resource.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifiers in si_query.c.
Andreas Hartmetz [Tue, 7 Jan 2014 02:12:19 +0000 (03:12 +0100)]
radeonsi: Rename r600->si remaining identifiers in si_query.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifiers in si_pipe.c.
Andreas Hartmetz [Tue, 7 Jan 2014 02:07:55 +0000 (03:07 +0100)]
radeonsi: Rename r600->si remaining identifiers in si_pipe.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifier in si_hw_context.c.
Andreas Hartmetz [Tue, 7 Jan 2014 01:59:28 +0000 (02:59 +0100)]
radeonsi: Rename r600->si remaining identifier in si_hw_context.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename radeonsi->si remaining identifiers in si_compute.c.
Andreas Hartmetz [Tue, 7 Jan 2014 01:53:26 +0000 (02:53 +0100)]
radeonsi: Rename radeonsi->si remaining identifiers in si_compute.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si remaining identifiers in si_blit.c.
Andreas Hartmetz [Tue, 7 Jan 2014 01:51:35 +0000 (02:51 +0100)]
radeonsi: Rename r600->si remaining identifiers in si_blit.c.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for functions in si_pipe.h.
Andreas Hartmetz [Tue, 7 Jan 2014 01:40:22 +0000 (02:40 +0100)]
radeonsi: Rename r600->si for functions in si_pipe.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for functions in si.h.
Andreas Hartmetz [Tue, 7 Jan 2014 01:14:42 +0000 (02:14 +0100)]
radeonsi: Rename r600->si for functions in si.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for functions in si_resource.h.
Andreas Hartmetz [Tue, 7 Jan 2014 01:05:57 +0000 (02:05 +0100)]
radeonsi: Rename r600->si for functions in si_resource.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for structs in si_resource.h.
Andreas Hartmetz [Tue, 7 Jan 2014 00:55:08 +0000 (01:55 +0100)]
radeonsi: Rename r600->si for structs in si_resource.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for structs in si.h.
Andreas Hartmetz [Tue, 7 Jan 2014 00:51:30 +0000 (01:51 +0100)]
radeonsi: Rename r600->si for structs in si.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Rename r600->si for structs in si_pipe.h.
Andreas Hartmetz [Sat, 11 Jan 2014 14:47:07 +0000 (15:47 +0100)]
radeonsi: Rename r600->si for structs in si_pipe.h.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Apply si_* file naming scheme.
Andreas Hartmetz [Sat, 4 Jan 2014 17:44:33 +0000 (18:44 +0100)]
radeonsi: Apply si_* file naming scheme.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoUse AC_PATH_TOOL instead of AC_PATH_PROG for llvm-config.
Michał Górny [Sat, 28 Dec 2013 14:22:09 +0000 (15:22 +0100)]
Use AC_PATH_TOOL instead of AC_PATH_PROG for llvm-config.

This should help with cross-compiling and multilib when $CHOST-specific
llvm-config is expected rather than build host default one.

It will help us a bit in Gentoo where we've started using
i686-pc-linux-gnu-llvm-config for 32-bit multilib LLVM.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73100
CC: "10.0" <mesa-stable@lists.freedesktop.org>
8 years agoconfigure: Disable xvmc by default
Tom Stellard [Mon, 6 Jan 2014 02:49:03 +0000 (18:49 -0800)]
configure: Disable xvmc by default

The xvmc unit tests are failing on r300g and r600g.

Reviewed-by: Vinson Lee <vlee@freedesktop.org>
8 years agoglsl: Remove exec_list iterators now that nothing uses them.
Kenneth Graunke [Fri, 22 Nov 2013 11:42:06 +0000 (03:42 -0800)]
glsl: Remove exec_list iterators now that nothing uses them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Replace iterators in ir_reader.cpp with ad-hoc list walking.
Kenneth Graunke [Sat, 11 Jan 2014 01:08:33 +0000 (17:08 -0800)]
glsl: Replace iterators in ir_reader.cpp with ad-hoc list walking.

These can't use foreach_list since they want to skip over the first few
list elements.  Just doing the ad-hoc list walking isn't too bad.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Use a new foreach_two_lists macro for walking two lists at once.
Kenneth Graunke [Sat, 11 Jan 2014 00:39:17 +0000 (16:39 -0800)]
glsl: Use a new foreach_two_lists macro for walking two lists at once.

When handling function calls, we often want to walk through the list of
formal parameters and list of actual parameters at the same time.
(Both are guaranteed to be the same length.)

Previously, we used a pattern of:

   exec_list_iterator 1st_iter = <1st list>.iterator();
   foreach_iter(exec_list_iterator, 2nd_iter, <2nd list>) {
      ...
      1st_iter.next();
   }

This was awkward, since you had to manually iterate through one of
the two lists.

This patch introduces a foreach_two_lists macro which safely walks
through two lists at the same time, so you can simply do:

   foreach_two_lists(1st_node, <1st list>, 2nd_node, <2nd list>) {
      ...
   }

v2: Rename macro from foreach_list2 to foreach_two_lists, as suggested
    by Ian Romanick.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Statically cast parameter exec_node to ir_variable.
Kenneth Graunke [Sat, 11 Jan 2014 00:13:54 +0000 (16:13 -0800)]
glsl: Statically cast parameter exec_node to ir_variable.

Formal function parameters are always ir_variable objects, not an
arbitrary ir_instruction.  So there's no need to dynamically cast here.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Cast ir_call parameters to ir_rvalue, not ir_instruction.
Kenneth Graunke [Sat, 23 Nov 2013 17:51:52 +0000 (09:51 -0800)]
glsl: Cast ir_call parameters to ir_rvalue, not ir_instruction.

A function call's parameters are always rvalues.  ir_rvalue may not
always be a subclass of ir_instruction in the future, so we should use
the right one.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Replace foreach_iter and iter.remove() with foreach_list_safe.
Kenneth Graunke [Sat, 11 Jan 2014 00:46:26 +0000 (16:46 -0800)]
glsl: Replace foreach_iter and iter.remove() with foreach_list_safe.

foreach_list_safe allows you to safely remove the current node.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Convert piles of foreach_iter to foreach_list_safe.
Kenneth Graunke [Fri, 22 Nov 2013 10:10:15 +0000 (02:10 -0800)]
glsl: Convert piles of foreach_iter to foreach_list_safe.

In these cases, we edit the list (or at least might be), so we use the
foreach_list_safe variant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Convert piles of foreach_iter to the newer foreach_list macro.
Kenneth Graunke [Fri, 22 Nov 2013 09:25:42 +0000 (01:25 -0800)]
glsl: Convert piles of foreach_iter to the newer foreach_list macro.

foreach_iter and exec_list_iterators have been deprecated for some time now;
we just hadn't ever bothered to convert code to the newer foreach_list
and foreach_list_safe macros.

In these cases, we aren't editing the list, so we can use foreach_list
rather than foreach_list_safe.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Ensure that all necessary state is re-emitted if we run out of aperture.
Paul Berry [Sat, 11 Jan 2014 02:56:14 +0000 (18:56 -0800)]
i965: Ensure that all necessary state is re-emitted if we run out of aperture.

Prior to this patch, if we ran out of aperture space during
brw_try_draw_prims(), we would rewind the batch buffer pointer
(potentially throwing some state that may have been emitted by
brw_upload_state()), flush the batch, and then try again.  However, we
wouldn't reset the dirty bits to the state they had before the call to
brw_upload_state().  As a result, when we tried again, there was a
danger that we wouldn't re-emit all the necessary state.  (Note: prior
to the introduction of hardware contexts, this wasn't a problem
because flushing the batch forced all state to be re-emitted).

This patch fixes the problem by leaving the dirty bits set at the end
of brw_upload_state(); we only clear them after we have determined
that we don't need to rewind the batch buffer.

Cc: 10.0 9.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agor600g: fix glClearBuffer by handling PIPE_CLEAR_COLORi flags correctly
Marek Olšák [Wed, 8 Jan 2014 12:56:30 +0000 (13:56 +0100)]
r600g: fix glClearBuffer by handling PIPE_CLEAR_COLORi flags correctly

also restructure the code

8 years agor600g: handle NULL colorbuffers correctly on R600-R700
Marek Olšák [Wed, 8 Jan 2014 17:13:24 +0000 (18:13 +0100)]
r600g: handle NULL colorbuffers correctly on R600-R700

8 years agor600g: handle NULL colorbuffers correctly on Evergreen
Marek Olšák [Wed, 8 Jan 2014 12:31:59 +0000 (13:31 +0100)]
r600g: handle NULL colorbuffers correctly on Evergreen

8 years agoradeonsi: handle NULL colorbuffers correctly
Marek Olšák [Wed, 8 Jan 2014 00:25:14 +0000 (01:25 +0100)]
radeonsi: handle NULL colorbuffers correctly

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/util: easy fixes for NULL colorbuffers
Marek Olšák [Wed, 8 Jan 2014 00:07:20 +0000 (01:07 +0100)]
gallium/util: easy fixes for NULL colorbuffers

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: bind NULL colorbuffers as specified by glDrawBuffers
Marek Olšák [Wed, 8 Jan 2014 00:09:15 +0000 (01:09 +0100)]
st/mesa: bind NULL colorbuffers as specified by glDrawBuffers

An example why it is required:

    Let's say there's a fragment shader writing to gl_FragData[0..1].
    The user calls: glDrawBuffers(2, {GL_NONE, GL_COLOR_ATTACHMENT0});

    That means gl_FragData[0] is unused and gl_FragData[1] is written
    to GL_COLOR_ATTACHMENT0.

st/mesa was skipping the GL_NONE draw buffer, therefore gl_FragData[0]
was written to GL_COLOR_ATTACHMENT0, which was wrong.

This commit fixes it, but drivers must also be fixed not to crash when
binding NULL colorbuffers. There is also a new set of piglit tests for this.

The MSAA state also had to be fixed not to crash when reading fb->cbufs[0].

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: handle GL_NONE draw buffers correctly in glClear
Marek Olšák [Wed, 8 Jan 2014 00:23:43 +0000 (01:23 +0100)]
mesa: handle GL_NONE draw buffers correctly in glClear

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: use sRGB formats for MSAA resolving if destination is sRGB
Marek Olšák [Tue, 7 Jan 2014 21:00:20 +0000 (22:00 +0100)]
st/mesa: use sRGB formats for MSAA resolving if destination is sRGB

Copied from the i965 driver, including the big comment.

Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org>
8 years agost/mesa: check depth and stencil writemask before clearing
Marek Olšák [Fri, 27 Dec 2013 18:10:03 +0000 (19:10 +0100)]
st/mesa: check depth and stencil writemask before clearing

8 years agost/mesa: always prefer pipe->clear over clear_with_quad (v2)
Marek Olšák [Fri, 6 Dec 2013 17:58:52 +0000 (18:58 +0100)]
st/mesa: always prefer pipe->clear over clear_with_quad (v2)

v2: clear depth and stencil together