st/dri: Check for kernel support before enabling fd sharing v2

The dri2 state tracker is checking for driver support before enabling
dri2ImageExtension version 7. This commit adds a check that also the
kernel driver supports fd sharing through prime.

Note that this adds a libdrm dependency on dri2.c.

v2: Removed unnecessary clamping of bool expression

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
configure.ac: remove -fcolor-diagnostics from LLVM flags

When LLVM is build with Clang, "llvm-config --cxxflags" contains the
-fcolor-diagnostics flag. It is not recognized by gcc and the build
fails. Fix by removing the flag.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
clover: Add parameter checks to clCreateBuffer.

v2: Use fewer if statements and functional tricks instead of single-use method,
    suggested by Francisco Jerez.
    Squash two small patches into one.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
clover: Append buffers that use CL_MEM_USE_HOST_PTR.

Specs say it's legal for implementations to use internal copies, and
the write synchronization seems to work.  Fixes clCreateBuffer
(together with previous patches) and buffer-flags piglits.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Francisco Jerez <currojerez@riseup.net>
mesa: Add infrastructure for GL_ARB_clear_buffer_object

 - add xml file for extension
 - add reference in gl_API.xml
 - add pointer to device driver function table (dd.h)
 - update dispatch_sanity.cpp

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Make validate_texbuffer_format function available externally

 - change storage class from static to extern
 - rename validate_texbuffer_format to _mesa_validate_texbuffer_format

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Modify format validation to check for extension not context version

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: get_texbuffer_format(): differentiate between core and compat context

alpha, lumincance and intensity formats are illegal in a core context.
Add a check to return MESA_FORMAT_NONE if one of those is requested within
a core context.

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Add bufferobj_range_mapped function

Add function to test if the buffer is already mapped and if so,
if the mapped range overlaps the given range.
Modify the _mesa_InvalidateBufferSubData function to use
the new function.

Enable buffer_object_subdata_range_good() to use bufferobj_range_mapped

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Modify get_buffer() to allow for a variable error code

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Implement functions for clear_buffer_object extensions

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: plug in default buffer object driver functions

In particular, this plugs in the new ClearBufferSubData() fallback
driver function.
Add ARB_clear_buffer_object to list of supported extensions

Reviewed-by: Brian Paul <brianp@vmware.com>
Modify release notes to include ARB_clear_buffer_object extension

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Cleanup mesa/main/bufferobj.h

Column wrapping and space between lines.

Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: 78-column wrapping in extensions.c
mesa: add API/extension checks for 3-component texture buffer formats

The GL_RGB32F, GL_RGB32UI and GL_RGB32I texture buffer formats are
only supposed to be allowed if the GL_ARB_texture_buffer_object_rgb32
extension is supported.  Note that the texture buffer extensions
require a core profile.  This patch adds those checks.

Fixes the soon-to-be-added
arb_clear_buffer_object-negative-bad-internalformat piglit test.
mesa: Change save_attrib_data() to return boolean

Change save_attrib_data() to return true/false depending on success.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Verify memory allocations success in _mesa_PushClientAttrib

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Verify memory allocations success in _mesa_PushAttrib

Check for malloc() returning null to fix Klocwork warnings.
Minor clean-ups by BrianP.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>