mesa.git
11 years agollvmpipe: more fixes for integer color buffers
Roland Scheidegger [Sun, 13 Jan 2013 01:20:13 +0000 (17:20 -0800)]
llvmpipe: more fixes for integer color buffers

Cast back the fake floats to ints, and make sure we don't try to do scaling
in format conversion (which only makes sense with normalized values).
Also need to disable blending and alpha test (as per spec) for such buffers.
This makes fbo-blending from the piglit ext_texture_integer tests work for most
formats (some crash, and the luminance and intensity variants have the GB or
GBA channels respectively wrong).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: trivial code and comment cleanup.
Roland Scheidegger [Sun, 13 Jan 2013 01:09:04 +0000 (17:09 -0800)]
llvmpipe: trivial code and comment cleanup.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix using wrong format with MRT in blend code
Roland Scheidegger [Sun, 13 Jan 2013 01:07:37 +0000 (17:07 -0800)]
llvmpipe: fix using wrong format with MRT in blend code

We were passing in the rt index however this was always 0 for non-independent
blend case. (The format was only actually used to decide if the color mask
covered all channels so this went unnoticed and was discovered by accident.)
Additionally, there was a second problem because we do fixups in the key based
on color buffer format we cannot use non-independent blend anyway as the fixed
up values would never get used.
So always turn non-independent blending into independent.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa/es3: Don't check dimensions in _mesa_es3_error_check_format_and_type
Ian Romanick [Wed, 16 Jan 2013 23:34:49 +0000 (15:34 -0800)]
mesa/es3: Don't check dimensions in _mesa_es3_error_check_format_and_type

Filtering of DEPTH_COMPONENT and DEPTH_STENCIL for TEXTURE_3D is already
done in texture_error_check because these combinations aren't allowed on
desktop GL either.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agomesa: Don't allow DEPTH_STENCIL for 3D textures
Ian Romanick [Wed, 16 Jan 2013 23:34:26 +0000 (15:34 -0800)]
mesa: Don't allow DEPTH_STENCIL for 3D textures

Just like DEPTH_COMPONENT.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoswrast: fix assorted bugs in software blit code
Brian Paul [Thu, 17 Jan 2013 15:59:13 +0000 (08:59 -0700)]
swrast: fix assorted bugs in software blit code

1. The loop over dest buffers in blit_linear() needed a null pointer
check.  Fixes https://bugs.freedesktop.org/show_bug.cgi?id=59499

2. The code to grab the drawRb's format needs to be inside the drawing loop.

3. An equality test was using = instead of == thus messing up a
renderbuffer attachment texture pointer.  This lead to memory
corruption and a crash at exit.

Finally, fix a capitalization error NumDrawBuffers -> numDrawBuffers
and change type to unsigned to fix signed/unsigned comparison warnings.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoradeonsi: Actually keep track if we are using depth textures for samplers.
Michel Dänzer [Wed, 5 Dec 2012 17:35:22 +0000 (18:35 +0100)]
radeonsi: Actually keep track if we are using depth textures for samplers.

20-odd more piglits.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: Fix Z24 texture formats.
Michel Dänzer [Tue, 15 Jan 2013 10:46:40 +0000 (11:46 +0100)]
radeonsi: Fix Z24 texture formats.

About half a dozen more piglits.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: Set SPI_SHADER_COL_FORMAT to what the pixel shader actually exports.
Michel Dänzer [Fri, 21 Dec 2012 14:39:26 +0000 (15:39 +0100)]
radeonsi: Set SPI_SHADER_COL_FORMAT to what the pixel shader actually exports.

Instead of deriving it from the colour buffer formats only.

Fixes a number of piglit tests which export depth from the pixel shader.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: Use proper hardware format for stencil texturing.
Michel Dänzer [Fri, 11 Jan 2013 18:51:09 +0000 (19:51 +0100)]
radeonsi: Use proper hardware format for stencil texturing.

Fixes piglit 'spec/ARB_depth_buffer_float/fbo-clear-formats stencil' crash.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: Enable tiling for depth/stencil resources.
Michel Dänzer [Thu, 17 Jan 2013 15:31:58 +0000 (16:31 +0100)]
radeonsi: Enable tiling for depth/stencil resources.

Enabling it for all resources still seems to cause problems, but depth/stencil
buffers are always accessed with tiling by the DB block.

Also, stick to 1D tiling for now. Getting 2D tiling to work properly will
require substantial changes in libdrm_radeon and possibly the kernel as well.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: Consolidate calculation of tile mode index.
Michel Dänzer [Thu, 13 Dec 2012 13:32:56 +0000 (14:32 +0100)]
radeonsi: Consolidate calculation of tile mode index.

Apart from the obvious cleanup, this makes sure all blocks use the same tiling
mode for accessing the resource.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agonvc0: add support for accelerated video decoding through the dedicated engines
Maarten Lankhorst [Sun, 2 Dec 2012 11:07:35 +0000 (12:07 +0100)]
nvc0: add support for accelerated video decoding through the dedicated engines

Currently the use of external firmware is required, with kernel and
userspace firmware needed for all Fermi cards except nvd9. Kepler and nvd9
should only require kernel firmware.

11 years agoradeonsi: Pass texture type to sampling intrinsics.
Michel Dänzer [Fri, 30 Nov 2012 10:38:24 +0000 (11:38 +0100)]
radeonsi: Pass texture type to sampling intrinsics.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agonvc0: add space checks to clear functions
Maarten Lankhorst [Thu, 17 Jan 2013 11:35:38 +0000 (12:35 +0100)]
nvc0: add space checks to clear functions

Thanks to calim for helping me find and fix the issue.

11 years agonv50: add space checks to clear functions, and respect depth
Maarten Lankhorst [Thu, 17 Jan 2013 11:33:34 +0000 (12:33 +0100)]
nv50: add space checks to clear functions, and respect depth

Thanks to calim for helping me find and fix the issue.

11 years agost/mesa: a couple fixes for st_BlitFramebuffer()
Brian Paul [Wed, 16 Jan 2013 15:41:01 +0000 (08:41 -0700)]
st/mesa: a couple fixes for st_BlitFramebuffer()

1. Loop over multiple destination color buffers.  If we set
glDrawBuffers(GL_FRONT_AND_BACK) we need to loop over multiple color
buffers, blitting to each.

2. Add checks for null src/dst surface pointers.  This fixes a crash
in the piglit fbo-missing-attachment-blit test.
See bug http://bugs.freedesktop.org/show_bug.cgi?id=59450

Reviewed-by: Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agost/mesa: simplify some src/dst surface setup in BlitFramebuffer
Brian Paul [Wed, 16 Jan 2013 15:47:55 +0000 (08:47 -0700)]
st/mesa: simplify some src/dst surface setup in BlitFramebuffer

Use the renderbuffer attachment pointers that we grabbed earlier.

Reviewed-by: Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agometa: add 'f' suffix to floats to silence some MSVC warnings
Brian Paul [Wed, 16 Jan 2013 15:25:43 +0000 (08:25 -0700)]
meta: add 'f' suffix to floats to silence some MSVC warnings

11 years agomesa: add missing ASSERT_OUTSIDE_BEGIN_END() in _mesa_GetInternalformativ()
Brian Paul [Wed, 16 Jan 2013 15:19:13 +0000 (08:19 -0700)]
mesa: add missing ASSERT_OUTSIDE_BEGIN_END() in _mesa_GetInternalformativ()

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agobuild: Make src/gtest before src/mesa
Matt Turner [Mon, 14 Jan 2013 22:38:01 +0000 (14:38 -0800)]
build: Make src/gtest before src/mesa

Fixes a make check problem where libgtest.la wasn't build before tests
that want to link with it.

11 years agoFix mapi code generator for out-of-tree build
Jon TURNEY [Mon, 14 Jan 2013 15:35:05 +0000 (15:35 +0000)]
Fix mapi code generator for out-of-tree build

Use os.path.join() rather than hand-rolling it, so path is correct if
sys.argv[0] returns an absolute path.

(According to the python documentation, it's platform dependent whether
sys.argv[0] is a full pathname or not.  It probably also depends on how
the process was started...)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agonvc0: Add support for video buffer
Maarten Lankhorst [Sun, 2 Dec 2012 11:07:35 +0000 (12:07 +0100)]
nvc0: Add support for video buffer

11 years agovl/video_buffer: fix up surface ordering for the interlaced case
Maarten Lankhorst [Tue, 18 Dec 2012 12:17:22 +0000 (13:17 +0100)]
vl/video_buffer: fix up surface ordering for the interlaced case

It seems the other code expects surface[0..1] to be the luma field in interlaced case.

See for example vdpau/surface.c vlVdpVideoSurfaceClear and vlVdpVideoSurfacePutBitsYCbCr.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agovl/compositor: fix weave shader bugs
Maarten Lankhorst [Tue, 18 Dec 2012 12:13:01 +0000 (13:13 +0100)]
vl/compositor: fix weave shader bugs

Writemask was XY instead of YZ (thanks to calim for spotting it).

The pixel calculation resulted in the pixel always being off by one.
If y was .5:

y' = round(y) + 0.5 = 1.5

Fixing this also means the LRP function has to swap the pixels it, since
it's now the other way around for top/bottom.

WIth these fixes only chroma for top and bottom pixel rows are wrongly interpolated
in my test program:

--- nvidia
+++ nouveau
@@ -1,4 +1,4 @@
-YCbCr[0] = 00c080
+YCbCr[0] = 00b070
 YCbCr[1] = 00b070
 YCbCr[2] = 029050
 YCbCr[3] = 207050
@@ -61,4 +61,4 @@
 YCbCr[60] = 0c5070
 YCbCr[61] = c05090
 YCbCr[62] = 0e70b0
-YCbCr[63] = e080c0
+YCbCr[63] = e070b0

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agomesa: add new formatquery.c file to SConscript file to fix build
Brian Paul [Wed, 16 Jan 2013 15:18:33 +0000 (08:18 -0700)]
mesa: add new formatquery.c file to SConscript file to fix build

11 years agoradeonsi/vdpau: remove nonsense state tracker dep
Christian König [Wed, 16 Jan 2013 14:15:38 +0000 (15:15 +0100)]
radeonsi/vdpau: remove nonsense state tracker dep

Added with automake conversion, but makes no sense at all.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agoglapi: Remove duplicate ARB_base_instance from gl_API.xml
Ian Romanick [Wed, 16 Jan 2013 07:20:02 +0000 (23:20 -0800)]
glapi: Remove duplicate ARB_base_instance from gl_API.xml

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: Enable GL_ARB_internalformat_query
Ian Romanick [Sat, 1 Dec 2012 19:06:31 +0000 (11:06 -0800)]
intel: Enable GL_ARB_internalformat_query

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Add driver method to determine the possible sample counts
Ian Romanick [Sat, 1 Dec 2012 19:05:00 +0000 (11:05 -0800)]
mesa: Add driver method to determine the possible sample counts

Use this method in _mesa_GetInternalformativ for both GL_SAMPLES and
GL_NUM_SAMPLE_COUNTS.

v2: internalFormat may not be color renderable by the driver, so zero
can be returned as a sample count.  Require that drivers supporting the
extension provide a QuerySamplesForFormat function.  The later was
suggested by Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Add dispatch and extension XML for GL_ARB_internalformat_query
Ian Romanick [Fri, 30 Nov 2012 20:43:58 +0000 (12:43 -0800)]
mesa: Add dispatch and extension XML for GL_ARB_internalformat_query

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Add extension tracking bit for GL_ARB_internalformat_query
Ian Romanick [Fri, 30 Nov 2012 20:42:59 +0000 (12:42 -0800)]
mesa: Add extension tracking bit for GL_ARB_internalformat_query

Though, I'm tempted to always expose this extension when
GL_ARB_framebuffer_object is exposed.  In that case, it would share the same
enable bit.

v2: Correctly sort extension names.  Suggested by Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Add skeleton implementation of glGetInternalformativ
Ian Romanick [Fri, 30 Nov 2012 20:41:50 +0000 (12:41 -0800)]
mesa: Add skeleton implementation of glGetInternalformativ

This is for the GL_ARB_internalformat_query extension and GLES 3.0.

v2: Generate GL_INVALID_OPERATION if the extension is not supported.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agometa: Move loop variable declaration outside for loop.
Vinson Lee [Wed, 16 Jan 2013 02:03:25 +0000 (18:03 -0800)]
meta: Move loop variable declaration outside for loop.

Fixes build with MSVC.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: move declarations before code to fix MSVC build
Brian Paul [Wed, 16 Jan 2013 00:02:30 +0000 (17:02 -0700)]
mesa: move declarations before code to fix MSVC build

11 years agomesa: Round float param in glTexparameterf() to nearest integer
Anuj Phogat [Mon, 7 Jan 2013 05:00:11 +0000 (10:30 +0530)]
mesa: Round float param in glTexparameterf() to nearest integer

OpenGL 4.2 specification suggests rounding the float data to nearest
integer when the type of internal state is integer. Out of range floats
should be clamped to {INT_MIN, INT_MAX}. This is not specified anywhere
in gl/gles spec but below test expects this behavior.  This patch makes
gles3 conformance sgis_texture_lod_basic_getter.test pass.

A GL spec bug will be raised to include clamping of out of range floats.

V2: Round float to nearest integer for all cases where
_mesa_Texparameterf() converts float param to int. Use the same block of
float to int conversion code for GL_TEXTURE_SWIZZLE_{R,G,B,A}_EXT cases
as well.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Add support to allow blitting to multiple color draw buffers
Anuj Phogat [Wed, 12 Dec 2012 04:17:47 +0000 (20:17 -0800)]
mesa: Add support to allow blitting to multiple color draw buffers

This patch fixes a blitting case when drawAttachment->Texture ==
readAttachment->Texture. It was causing an assertion failure in
intel_miptree_attach_map() with gles3 conformance test case:
framebuffer_blit_functionality_minifying_blit

Number of changes in this file look scary. But most of them are caused
by introducing a big for loop to support rendering to multiple color
draw buffers.

V2: Fixed a case when number of draw buffer attachments are zero.
V3: Put a for loop in blit_nearest() and blit_linear() functions in to
    support blitting to multiple color draw buffers.
V4: Remove variable declaration in for loop to avoid MSVC compilation
    issues.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Add error checking in _mesa_BlitFramebuffer() for MRTs
Anuj Phogat [Wed, 12 Dec 2012 04:17:47 +0000 (20:17 -0800)]
mesa: Add error checking in _mesa_BlitFramebuffer() for MRTs

This patch adds required error checking in _mesa_BlitFramebuffer() when
blitting to multiple color render targets. It also fixes a case when
blitting to a framebuffer with renderbuffer/texture attached to
GL_COLOR_ATTACHMENT{i} (where i!=0). Earlier it skips color blitting if
nothing is found attached to GL_COLOR_ATTACHMENT0.

V2: Fixed a case when number of draw buffer attachments are zero.
V3: Do compatible_color_datatypes() and compatible_resolve_formats()
    check for all the draw renderbuffers in fbobject.c. Fix debug code
    at bottom of _mesa_BlitFramebuffer() to handle MRTs. Combine error
    checking code for linear blits with other color blit error checking.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Fix GL error generation in _mesa_GetFramebufferAttachmentParameteriv()
Anuj Phogat [Wed, 12 Dec 2012 04:08:13 +0000 (20:08 -0800)]
mesa: Fix GL error generation in _mesa_GetFramebufferAttachmentParameteriv()

This allows query on default framebuffer in
glGetFramebufferAttachmentParameteriv() for gles3. Fixes unexpected GL
errors in gles3 conformance test case:
framebuffer_blit_functionality_multisampled_to_singlesampled_blit

V2: Use _mesa_is_gles3() check to restrict allowed attachment types to
specific APIs.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: Support blitting to multiple color draw buffers
Anuj Phogat [Wed, 12 Dec 2012 03:36:05 +0000 (19:36 -0800)]
intel: Support blitting to multiple color draw buffers

This patch enables blitting to multiple color attachments of a
framebuffer.  It also fixes a case when blitting to a framebuffer with
renderbuffer/texture attached to non-zero attachment point
i.e. GL_COLOR_ATTACHMENT{1, 2, ...}.  Earlier we were incorrectly
blitting to GL_COLOR_ATTACHMENT0 by default.

V2: Use intel_copy_texsubimage() for blitting only if all the color
attachments can blit using it.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agometa: Add functionality to do _mesa_meta_BlitFrameBuffer() using glsl
Anuj Phogat [Wed, 28 Nov 2012 20:55:55 +0000 (12:55 -0800)]
meta: Add functionality to do _mesa_meta_BlitFrameBuffer() using glsl

This patch rewrites _mesa_meta_BlitFrameBuffer() function to add support
for blitting with GLSL/GLSL ES shaders. These changes were required to
support glBlitFrameBuffer() in gles3. This patch, along with other
patches in this series, make 16 failing framebuffer_blit test cases in
gles3 conformance pass.

V2: Properly handle flipped blits for source and destination
    renderbuffer / textures. Add support for GL_TEXTURE_RECTANGLE in
    _mesa_meta_BlitFrameBuffer. Create a temp depth texture to support
    depth buffer blitting.
V3: Remove unsupported / redundant shader code. Add an assertion to make
    sure that we don't use rectangle texture in ES. Put API guard on
    glTexEnvi().
V4: For gles3: Don't use ReadPixels or CopyTexImage2D to blit depth
    buffer.  gles3 spec says for CopyTexImage2D that "color buffer
    components can be dropped during the conversion to internalformat,
    but new components cannot be added." So, use the internal format of
    read renderbuffer to create texture for color buffer blitting.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
11 years agomesa: Fix GL error generation in glBlitFramebuffer()
Anuj Phogat [Mon, 7 Jan 2013 23:55:31 +0000 (15:55 -0800)]
mesa: Fix GL error generation in glBlitFramebuffer()

V2:
If mask has GL_STENCIL_BUFFER_BIT set, the depth formats for
readRenderBuffer and drawRenderBuffer must match unless one of the two
buffers doesn't have depth, in which case it's not blitted, so the
format check should be ignored.  Same comment goes for stencil formats
in depth renderbuffers if mask has GL_DEPTH_BUFFER_BIT set.

v3 (Kayden): Refactor code to be a bit more readable.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.
Kenneth Graunke [Tue, 18 Dec 2012 21:26:04 +0000 (13:26 -0800)]
mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.

Nothing was explicitly checking this.

v2: Update GL3 spec reference.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
11 years agomesa: Handle GL_BACK correctly for ES 3.0 in glDrawBuffers().
Kenneth Graunke [Tue, 18 Dec 2012 21:26:03 +0000 (13:26 -0800)]
mesa: Handle GL_BACK correctly for ES 3.0 in glDrawBuffers().

In ES 3.0, when calling glDrawBuffers() on the window system
framebuffer, the only valid targets are GL_NONE or GL_BACK.  Since there
is no stereo rendering in ES 3.0, this is a single buffer, unlike
desktop where it may be two (and thus isn't allowed).

For single-buffered configs, GL_BACK ironically means the front (and
only) buffer.  I'm not sure that it matters, however, as ES shouldn't
have front buffer rendering in the first place.

Fixes es3conform framebuffer_blit_coverage_default_draw_buffer_binding.

v2: Update GLES3 spec reference.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
11 years agoegl/dri2: Fix typo in the previous commit
Ian Romanick [Tue, 15 Jan 2013 22:17:46 +0000 (14:17 -0800)]
egl/dri2: Fix typo in the previous commit

I didn't notice this due to a noobed piglit run.  It wasn't previously
noticed because the patch was only run on a driver that supported GLES3.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agolibgl-gdi: Avoid hangs on DLL_PROCESS_DETACH.
Rob Schneider [Tue, 15 Jan 2013 19:49:12 +0000 (11:49 -0800)]
libgl-gdi: Avoid hangs on DLL_PROCESS_DETACH.

At process exit DLL_PROCESS_DETACH is signaled to DllMain(), where then
a final cleanup is triggered.  In stw_cleanup() code is triggered that
tries to communicate a shutdown to the spawned threads -- however at
that time those threads have already been terminated by the OS and so
the process hangs.

v2: skip stw_cleanup_thread() too

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoegl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR
Chad Versace [Tue, 20 Nov 2012 21:43:11 +0000 (13:43 -0800)]
egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR

Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:
    * piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
    * gles3conform, revision 19700, when runnning GL3Tests with -fbo

This plumbing is added in order to comply with the EGL_KHR_create_context
spec. According to the EGL_KHR_create_context spec, it is illegal to call
eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose
EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The
pertinent
portion of the spec is quoted below; the key word is "respectively".

  * If <config> is not a valid EGLConfig, or does not support the
    requested client API, then an EGL_BAD_CONFIG error is generated
    (this includes requesting creation of an OpenGL ES 1.x, 2.0, or
    3.0 context when the EGL_RENDERABLE_TYPE attribute of <config>
    does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or
    EGL_OPENGL_ES3_BIT_KHR respectively).

To create this patch, I searched for all the ES2 bit plumbing by calling
`git grep "ES2_BIT\|DRI_API_GLES2" src/egl`, and then at each location
added a case for ES3.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: Expose support for DRI_API_GLES3
Chad Versace [Thu, 22 Nov 2012 00:55:43 +0000 (16:55 -0800)]
intel: Expose support for DRI_API_GLES3

If the hardware/driver combo supports GLES3, then set the GLES3 bit in
intel_screen's bitmask of supported DRI API's.  Neither the EGL nor GLX
layer uses the bit yet.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agodri: Define enum __DRI_API_GLES3
Chad Versace [Tue, 20 Nov 2012 21:27:14 +0000 (13:27 -0800)]
dri: Define enum __DRI_API_GLES3

This enum corresponds to EGL_OPENGL_ES3_BIT_KHR.
Neither the GLX nor EGL layer use the enum yet.

I don't like the GLES bits. I'd prefer that all GLES APIs be exposed
through a single API bit, as is done in GLX_EXT_create_context_es_profile.
But, we need this GLES3 enum in order to do the plumbing necessary to
correctly support EGL_OPENGL_ES3_BIT_KHR as required by the
EGL_KHR_create_context spec.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: Move validation of context version into intelInitContext
Chad Versace [Thu, 22 Nov 2012 00:22:19 +0000 (16:22 -0800)]
intel: Move validation of context version into intelInitContext

Each driver (i830, i915, i965) used independent but similar code to
validate the requested context version. With the rececnt arrival of GLES3,
that logic has needed an update. Rather than apply identical updates to
each drivers validation code, let's just move the validation into the
shared routine intelInitContext.

This refactor required some incidental changes to functions
i830CreateContext and intelInitContext. For each function, this patch:
    - Adds context version parameters to the signature.
    - Adds a DRI_CTX_ERROR out param to the signature.
    - Sets the DRI_CTX_ERROR at each early return.

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: Set screen's api mask according to hw capabilities (v3)
Chad Versace [Wed, 21 Nov 2012 23:08:27 +0000 (15:08 -0800)]
intel: Set screen's api mask according to hw capabilities (v3)

Before this patch, intelInitScreen2 set DRIScreen::api_mask with the hacky
heuristic below:

    if (gen >= 3)
        api_mask = GL | GLES1 | GLES2;
    else
        api_mask = 0;

This hack was likely broken on gen2 (i830), but I don't care enough to
properly investigate. It appears that every EGLConfig on i830 has
EGL_RENDERABLE_TYPE=0, and thus eglCreateContext will never succeed.
Anyway, moving on to living drivers...

With the arrival of EGL_OPENGL_ES3_BIT_KHR, this heuristic is now
insufficient. We must enable the GLES3 bit if and only if the driver is
capable of creating a GLES3 context. This requires us to determine the
maximum supported context version supported by the hardware/driver for
each api *during initialization of intel_screen*.

Therefore, this patch adds four new fields to intel_screen which indicate
the maximum supported context version for each api:
  max_gl_core_version
  max_gl_compat_version
  max_gl_es1_version
  max_gl_es2_version

The api mask is now correctly set as:

    api_mask = GL;
    if (max_gl_es1_version > 0)
        api_mask |= GLES1;
    if (max_gl_es2_version > 0)
        api_mask |= GLES2;

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

v2:
  - Replace the if-tree on gen with a switch, for Ian.
  - Unconditionally enable the DRI_API_OPENGL bit, for Ian.

v3:
  - Drop max gl version to 1.4 on gen3 if !has_occlusion_query,
    because occlusion queries entered core in 1.5. For Ian.

v4:
  - Drop ES2 version back to 2.0 due to rebase (Ian).

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick.intel.com>
11 years agomesa: Return INVALID_ENUM for glReadPixels(..., GL_DEPTH_*, ...) on ES 3
Matt Turner [Fri, 30 Nov 2012 23:07:54 +0000 (15:07 -0800)]
mesa: Return INVALID_ENUM for glReadPixels(..., GL_DEPTH_*, ...) on ES 3

I'm not sure if this is the correct fix. The
_mesa_es_error_check_format_and_type function (used above in the ES 1
and 2 cases) was originally added for glTexImage checking and allows
GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8 combinations. Using it in ES 3
causes other tests to regress.

Fixes es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Return INVALID_OPERATION when type is known but not allowed
Matt Turner [Fri, 30 Nov 2012 23:07:18 +0000 (15:07 -0800)]
mesa: Return INVALID_OPERATION when type is known but not allowed

INVALID_ENUM is for when the type is simply not known.

Fixes part of es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow HALF_FLOAT in glVertexAttribPointer for GLES3
Matt Turner [Thu, 29 Nov 2012 05:45:19 +0000 (21:45 -0800)]
mesa: Allow HALF_FLOAT in glVertexAttribPointer for GLES3

Fixes es3conform's half_float_max_vertex_dimensions and
half_float_textures tests.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Reject texture-only formats as renderbuffer formats in ES 3
Matt Turner [Tue, 20 Nov 2012 21:45:03 +0000 (13:45 -0800)]
mesa: Reject texture-only formats as renderbuffer formats in ES 3

ES 3 specifies some formats as texture-only (i.e., not available for
renderbuffers).

See the "Required Texture Formats" section (pg 126) of the ES 3 spec.

v2: Allow RED and RG float rendering in core profiles The check used to
be (version > 30) || (compat profile w/extensions).  Just deleting
<version > 30) broke 3.0+ core profiles.

Fixes es3conform's color_buffer_unsupported_format test.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Fix default value of BUFFER_ACCESS_FLAGS.
Kenneth Graunke [Sun, 18 Nov 2012 05:23:28 +0000 (21:23 -0800)]
mesa: Fix default value of BUFFER_ACCESS_FLAGS.

According to both the GL 3.0 and ES 3.0 specifications (table 2.7 for GL
and table 2.8 for ES), the default value of BUFFER_ACCESS_FLAGS is
supposed to be zero.

Note that there are two related quantities: the obsolete BUFFER_ACCESS
enum and the new BUFFER_ACCESS_FLAGS bitfield.

BUFFER_ACCESS can only be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE;
BUFFER_ACCESS_FLAGS can easily represent all three via GL_MAP_WRITE_BIT,
GL_MAP_READ_BIT, and their logical or.  It also supports more flags.

Thus, Mesa only stores the bitfield, and simply computes the old enum
when queried, via simplified_access_mode(bufObj->AccessFlags).

The tricky part is that, while BUFFER_ACCESS_FLAGS defaults to 0,
BUFFER_ACCESS defaults to GL_READ_WRITE for desktop [GL 3.0, table 2.8]
and GL_WRITE_ONLY_OES for ES [the GL_EXT_map_buffer_range extension].

Mesa tried to implement this by setting the default AccessFlags to
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT on desktop, and GL_MAP_WRITE_BIT on
ES.  But in all specifications, it needs to be 0.

This patch moves that logic into simplified_access_mode(): when
AccessFlags == 0, it now returns GL_READ_WRITE for desktop and
GL_WRITE_ONLY for ES 1/2.  (BUFFER_ACCESS doesn't exist on ES 3.0,
so it's irrelevant there.)

With that in place, it changes the AccessFlags default to 0.

Fixes three es3conform tsets:
- copy_buffer_defaults
- map_buffer_range_modify_indices
- pixel_buffer_object_default_parameters

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Rework crazy error code rules in glDrawBuffers().
Kenneth Graunke [Fri, 16 Nov 2012 22:52:01 +0000 (14:52 -0800)]
mesa: Rework crazy error code rules in glDrawBuffers().

Perhaps most importantly, this patch adds comments quoting the relevant
spec paragraphs above each error condition.

It also makes three changes:
- For FBOs, GL_COLOR_ATTACHMENTm where m >= MaxDrawBuffers is supposed
  to generate INVALID_OPERATION (not INVALID_ENUM).
- Constants that refer to multiple buffers (such as FRONT, BACK, LEFT,
  RIGHT, and FRONT_AND_BACK) are supposed to generate INVALID_OPERATION,
  not INVALID_ENUM.
- In ES 3.0, for FBOs, buffers[i] must be NONE or GL_COLOR_ATTACHMENTi
  or else INVALID_OPERATION occurs.  (This is a new restriction.)

Fixes es3conform's draw-buffers-api test.

v2: The error path was missing a "return" like all the other error
paths.  Also, we may as well call it glDrawBuffers in the error message
since the ARB suffix doesn't exist in ES 3.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Force even an empty query to flush all previous queries.
Carl Worth [Thu, 13 Dec 2012 23:23:10 +0000 (15:23 -0800)]
i965: Force even an empty query to flush all previous queries.

The specification requires that query results are processed in order, (when
one query result is returned, all previous query of the same type must also be
available). The implementation was failing this requirement in the case of
BeginQuery and EndQuery with no intervening drawing, (the result would be made
available immediately without flushing previous queries).

This fixes the following es3conform test:

occlusion_query_query_order

as well as the following piglit test:

occlusion_query_order

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agometa: Allow meta operations to pause/resume an active occlusion query
Carl Worth [Thu, 13 Dec 2012 19:15:03 +0000 (11:15 -0800)]
meta: Allow meta operations to pause/resume an active occlusion query

This allows for avoiding the occlusion query erroneously accumulating results
during the meta operation. This functionality is made conditional on a new
MESA_META_OCCLUSION_QUERY bit so that meta-operations which should generate
fragments can continue to get the current behavior.

The implementation of glClear is specifically augmented to request the flag
since glClear is specified to not generate fragments.

This fixes the following es3conform tests:

occlusion_query_draw_occluded.test
  occlusion_query_clear
occlusion_query_custom_framebuffer
occlusion_query_stencil_test
occlusion_query_discarded_fragments

As well as the following piglit test:

occlusion_query_meta_no_fragments

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoqueryobj: Add EverBound flag, making ISQuery() return false before BeginQuery()
Carl Worth [Thu, 13 Dec 2012 20:47:56 +0000 (12:47 -0800)]
queryobj: Add EverBound flag, making ISQuery() return false before BeginQuery()

This flag allows for the specified behavior that GenQueries reserves a name,
but does not associate an object with it until BeginQuery. We allocate the
object immediately with the new EverBound flag set to false, and then set the
flag to true at the time of BeginQuery.

This allows us to implement a conformant IsQuery function by checking the
state of the new EverBound flag.

This fixes the following es3conform tests:

occlusion_query_genqueries
occlusion_query_is_query_nonzero

and the following piglit test:

occlusion_query_lifetime

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoUpdate comment to specify actual text being referenced from the specification.
Carl Worth [Mon, 17 Dec 2012 21:38:39 +0000 (13:38 -0800)]
Update comment to specify actual text being referenced from the specification.

The reference to "correct, see spec" was a bit too vague to be useful,
(particularly since the language being referenced here changes between OpenGL
3.1 and OpenGL 4.3).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agodocs: minor updates to VMware guest driver docs
Brian Paul [Tue, 15 Jan 2013 20:00:09 +0000 (13:00 -0700)]
docs: minor updates to VMware guest driver docs

The DRM's --enable-vmwgfx-experimental-api flag isn't needed anymore.

11 years agor300g: fix and cleanup flushing before clearing CMASK, ZMASK, and HIZ
Marek Olšák [Mon, 14 Jan 2013 00:38:51 +0000 (01:38 +0100)]
r300g: fix and cleanup flushing before clearing CMASK, ZMASK, and HIZ

11 years agor300g: implement MSAA compression and fast MSAA color clear
Marek Olšák [Sat, 12 Jan 2013 02:29:40 +0000 (03:29 +0100)]
r300g: implement MSAA compression and fast MSAA color clear

These are optimizations which make MSAA a lot faster.

The MSAA work is complete with this commit.  (except for enablement of AA
optimizations for RGBA16F, for which a patch is ready and waiting until
the kernel CS checker fix lands)

MSAA can't be made any faster as far as hw programming is concerned.

The catch is only one process and one colorbuffer can use the optimizations
at a time.  There usually is only one MSAA colorbuffer, so it shouldn't be
an issue.

Also, there is a limit on the size of MSAA colorbuffer resolution in terms
of megapixels.  If the limit is surpassed, the AA optimizations are disabled.
The limit is:
- 1 Mpix on low-end and some mid-level chipsets (1024x768 and 1280x720)
- 2 Mpix on some mid-level chipsets (1600x1200 and 1920x1080)
- 3 or 4 Mpix on high-end chipsets (2048x1536 or 2560x1600, respectively)
It corresponds to the number of raster pipes (= GB pipes) available, each pipe
can hold 1 Mpix of AA compression data.

If it's enabled, the driver prints to stdout:
  radeon: Acquired access to AA optimizations.

11 years agogallium/util: add a half float array to util_color
Marek Olšák [Fri, 11 Jan 2013 15:45:54 +0000 (16:45 +0100)]
gallium/util: add a half float array to util_color

For convenient packing into half floats.

11 years agoRevert "targets/opencl: Link against libgallium.la instead of libgallium.a"
Tom Stellard [Mon, 14 Jan 2013 17:20:53 +0000 (17:20 +0000)]
Revert "targets/opencl: Link against libgallium.la instead of libgallium.a"

This reverts commit 4148a29ed83d1d85bff3d4e40e847128011c3f20.

This is a work-around for bug:
https://bugs.freedesktop.org/show_bug.cgi?id=59334

We really should be linking against libgallium.la instead of
libgallium.a, but until we can figure why linking against libgallium.la
causes runtime failures in clover we will continue to link against
libgallium.a

Acked-by: Andreas Boll <andreas.boll.dev@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
11 years agost/mesa: use a generic varying to pass the clear color to the FS
Marek Olšák [Mon, 14 Jan 2013 16:17:20 +0000 (17:17 +0100)]
st/mesa: use a generic varying to pass the clear color to the FS

The color varying may have reduced precision or be even clamped.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: fix glClear with MRT by making the FS write to all cbufs
Marek Olšák [Mon, 14 Jan 2013 16:07:58 +0000 (17:07 +0100)]
gallium/util: fix glClear with MRT by making the FS write to all cbufs

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix InternalFormat for Z24X8 window-system buffers
Marek Olšák [Mon, 14 Jan 2013 07:40:18 +0000 (08:40 +0100)]
st/mesa: fix InternalFormat for Z24X8 window-system buffers

This probably doesn't fix anything, but it's good to be consistent.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: remove dead conditional in Clear
Marek Olšák [Mon, 14 Jan 2013 07:20:42 +0000 (08:20 +0100)]
st/mesa: remove dead conditional in Clear

I think the conditional always evaluates to false.

If I understand the code in core Mesa correctly, depthBits or stencilBits
is 0 if the depth or stencil renderbuffer is NULL, respectively.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: simplify conditionals in Clear
Marek Olšák [Mon, 14 Jan 2013 07:16:18 +0000 (08:16 +0100)]
st/mesa: simplify conditionals in Clear

just check depth and stencil separately, the outcome is the same

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix glClear with different colormask for each colorbuffer
Marek Olšák [Mon, 14 Jan 2013 06:18:00 +0000 (07:18 +0100)]
st/mesa: fix glClear with different colormask for each colorbuffer

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: remove PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE
Marek Olšák [Mon, 14 Jan 2013 05:58:52 +0000 (06:58 +0100)]
gallium: remove PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: always assume separate depth and stencil clear is supported
Marek Olšák [Mon, 14 Jan 2013 05:57:28 +0000 (06:57 +0100)]
st/mesa: always assume separate depth and stencil clear is supported

All drivers implement it now.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosoftpipe: implement separate depth-stencil clear
Marek Olšák [Mon, 14 Jan 2013 05:45:50 +0000 (06:45 +0100)]
softpipe: implement separate depth-stencil clear

The CAP is going away.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agolibgl-xlib: softpipe and llvmpipe aren't mutually exclusive at link time
Jon TURNEY [Sun, 13 Jan 2013 23:05:17 +0000 (23:05 +0000)]
libgl-xlib: softpipe and llvmpipe aren't mutually exclusive at link time

Since automake changes, softpipe and llvmpipe are mutually exclusive at link
time.  This doesn't make much sense to me as we can choose between them at
run-time using GALLIUM_DRIVER.

Creating library file: .libs/libGL.dll.a
.libs/xlib.o: In function `sw_screen_create_named':
/jhbuild/checkout/mesa/mesa/src/gallium/targets/libgl-xlib/../../../../src/gallium/auxiliary/target-helpers/inline_sw_helper.h:35:
undefined reference to `_softpipe_create_screen'

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agopack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case
Jordan Justen [Sun, 30 Dec 2012 08:40:00 +0000 (00:40 -0800)]
pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case

For floats, if GL_RGB is the source, then alpha should be set to
1.0F.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3
Jordan Justen [Fri, 28 Dec 2012 19:37:23 +0000 (11:37 -0800)]
glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3

This format is allowed by the GL_EXT_texture_type_2_10_10_10_REV
extension.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agocopyteximage: Use Driver's AllocTextureImageBuffer instead of TexImage
Jordan Justen [Sat, 12 Jan 2013 22:56:49 +0000 (14:56 -0800)]
copyteximage: Use Driver's AllocTextureImageBuffer instead of TexImage

Call Driver.AllocTextureImageBuffer rather than calling
Driver.TexImage with NULL data, format=GL_NONE and type=GL_NONE.

This avoids setting ctx->Unpack, which can lead to incorrectly
trying to upload data.

The GLES3 GTF program's packed_pixels_pbo test was triggering
an error for i965 with the previous code.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agocopyteximage: update signed vs. unsigned format matching
Jordan Justen [Fri, 28 Dec 2012 01:36:10 +0000 (17:36 -0800)]
copyteximage: update signed vs. unsigned format matching

Fixes issues with gles3-gtf

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoframebuffer: add _mesa_get_read_renderbuffer
Jordan Justen [Fri, 28 Dec 2012 18:55:33 +0000 (10:55 -0800)]
framebuffer: add _mesa_get_read_renderbuffer

This returns the current read renderbuffer for the specified
format type.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoteximage: use _mesa_es3_error_check_format_and_type for GLES3
Matt Turner [Thu, 6 Dec 2012 22:51:29 +0000 (14:51 -0800)]
teximage: use _mesa_es3_error_check_format_and_type for GLES3

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglformats: add _mesa_es3_error_check_format_and_type
Matt Turner [Thu, 6 Dec 2012 22:51:29 +0000 (14:51 -0800)]
glformats: add _mesa_es3_error_check_format_and_type

This function checks for ES3 compatible
format/type/internalFormat/dimension combinations.

[jordan.l.justen@intel.com: additional tweaks for gles3-gtf]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agofbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core
Jordan Justen [Thu, 27 Dec 2012 20:41:10 +0000 (12:41 -0800)]
fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core

v2:
 * Only allow on GL Legacy contexts

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agofbobject: add VERBOSE=api message for renderbuffer storage
Jordan Justen [Sat, 12 Jan 2013 22:19:30 +0000 (14:19 -0800)]
fbobject: add VERBOSE=api message for renderbuffer storage

Add API debug trace message for:
 * glRenderbufferStorage
 * glRenderbufferStorageMultisample

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agofbobject: add VERBOSE=api message for check framebuffer status
Jordan Justen [Sun, 13 Jan 2013 03:21:54 +0000 (19:21 -0800)]
fbobject: add VERBOSE=api message for check framebuffer status

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoutil: add new primitive types to pipe_prim_names[] array
Brian Paul [Tue, 15 Jan 2013 00:33:05 +0000 (17:33 -0700)]
util: add new primitive types to pipe_prim_names[] array

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/mesa: add some simple buffer/draw debug code
Brian Paul [Mon, 14 Jan 2013 22:18:13 +0000 (15:18 -0700)]
st/mesa: add some simple buffer/draw debug code

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agolibgl-xlib: link with -lrt
Brian Paul [Mon, 14 Jan 2013 17:17:48 +0000 (09:17 -0800)]
libgl-xlib: link with -lrt

Fixes a runtime error:

glxgears: symbol lookup error: /home/brian/mesa/lib/gallium/libGL.so.1: undefined symbol: clock_gettime

v2: use $(CLOCK_LIB) and $(PTHREAD_LIBS) per Andreas Boll.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agoi965: Avoid blending with destination alpha when RB format has no alpha bits
Carl Worth [Fri, 11 Jan 2013 15:15:18 +0000 (07:15 -0800)]
i965: Avoid blending with destination alpha when RB format has no alpha bits

The hardware does not support a render target without an alpha channel.
So when the user creates a render buffer with no alpha channel, there actually
is storage available for alpha internally. It requires special care to
avoid these unwanted alpha bits from causing any problems.

Specifically, when blending, and when the blend factors would read the
destination alpha values, this commit coerces the blend factors to instead be
either 0 or 1 as appropriate.

A similar fix was made for pre-gen6 hardware in commit eadd9b8e and this
commit shares the fixup function written by Ian then.

This commit the following es3conform test:

rgb8_rgba8_rgb

As well as the following piglit (sub) tests:

EXT_framebuffer_object/fbo-blending-formats/3
EXT_framebuffer_object/fbo-blending-formats/GL_RGB
EXT_framebuffer_object/fbo-blending-formats/GL_RGB8

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoegl/wayland: Implement EGL_EXT_buffer_age
Kristian Høgsberg [Fri, 14 Dec 2012 04:32:14 +0000 (23:32 -0500)]
egl/wayland: Implement EGL_EXT_buffer_age

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
11 years agoegl/wayland: Pull color buffers from dri2_surf->color_buffers pool
Kristian Høgsberg [Fri, 14 Dec 2012 04:30:45 +0000 (23:30 -0500)]
egl/wayland: Pull color buffers from dri2_surf->color_buffers pool

We used to keep the color buffers in the dri_buffers array and
swap __DRI_BUFFER_BACK_LEFT and __DRI_BUFFER_FRONT_LEFT around there
and swap third_buffer in in case we needed to triple buffer.  That
gets a little fidgety with all the swaps, so lets use the
color_buffers pool like the gbm platform does.  We track the color buffers,
their corresponding wl_buffer and locked status here and just plug
a free one into dri2_surf->buffers when we need to.

This is a nice clean-up in itself, but it also sets us up to track
buffer age in the color_buffers structs.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
11 years agogallium/svga: Make sure -std=gnu99 is set.
Johannes Obermayr [Sat, 12 Jan 2013 21:13:47 +0000 (22:13 +0100)]
gallium/svga: Make sure -std=gnu99 is set.

This is a work-around until configure.ac stops touching CFLAGS.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agobuild: Fix the documented default value of --with-gallium-drivers
Damien Lespiau [Mon, 14 Jan 2013 13:54:57 +0000 (13:54 +0000)]
build: Fix the documented default value of --with-gallium-drivers

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor300g: set a dummy vertex buffer in context_create
Marek Olšák [Mon, 14 Jan 2013 04:51:05 +0000 (05:51 +0100)]
r300g: set a dummy vertex buffer in context_create

so that the driver doesn't crash if an app doesn't set any vertex buffers.

11 years agor300g: fix MSAA resolve to an untiled texture
Marek Olšák [Sun, 13 Jan 2013 23:27:28 +0000 (00:27 +0100)]
r300g: fix MSAA resolve to an untiled texture

RB3D_DEBUG_CTL doesn't help, so I resolve to a tiled temporary texture and
then blitting it to the destination one, which we also do in other situations.

11 years agor300g: advertise MSAA support for the RGB10_A2 format on r500
Marek Olšák [Sat, 12 Jan 2013 03:44:37 +0000 (04:44 +0100)]
r300g: advertise MSAA support for the RGB10_A2 format on r500

It seems to be working just fine.

11 years agor300g: allow separate depth and stencil clear
Marek Olšák [Sat, 12 Jan 2013 12:59:48 +0000 (13:59 +0100)]
r300g: allow separate depth and stencil clear

The handling of the CAP is broken in st/mesa anyway. Let's just kill it.

This commit pretty much enables fast Z clear for FBOs with Z24S8.
The driver falls back to clearing with a quad if the fast clear cannot be
used. It can still do fast color clear, for example.

11 years agor300g: if both Z and stencil are present, they must be fast-cleared together
Marek Olšák [Sat, 12 Jan 2013 02:19:03 +0000 (03:19 +0100)]
r300g: if both Z and stencil are present, they must be fast-cleared together

11 years agor300g: allow HiZ with a 16-bit zbuffer
Marek Olšák [Fri, 13 May 2011 00:26:08 +0000 (02:26 +0200)]
r300g: allow HiZ with a 16-bit zbuffer