summaryrefslogtreecommitdiff
path: root/src/mesa
AgeCommit message (Collapse)AuthorFilesLines
2014-01-25mesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLESIan Romanick1-0/+37
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> (cherry picked from commit 0a75909b3f554b20c9672fc72efbc4f6ec3ce4ea)
2014-01-25st/mesa: use signed temporary variable to store _ColorDrawBufferIndexesEmil Velikov1-1/+1
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> (cherry picked from commit bfcf78c1101a1cbcdd9a479722203047c8d6c26a)
2014-01-25mesa: use signed temporary variable to store _ColorDrawBufferIndexesEmil Velikov1-1/+1
_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> (cherry picked from commit 10368e1446e3b537c1dc4cb536994a4d01cfd2f0)
2014-01-25i965: Ensure that all necessary state is re-emitted if we run out of aperture.Paul Berry3-0/+21
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> (cherry picked from commit fb6d9798a0c6eefd512f5b0f19eed34af8f4f257)
2014-01-25st/mesa: use sRGB formats for MSAA resolving if destination is sRGBMarek Olšák1-0/+32
Copied from the i965 driver, including the big comment. Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org> (cherry picked from commit 4e549ddb500cf677b6fa16d9ebdfa67cc23da097)
2014-01-09i965: Don't do the temporary-and-blit-copy for INVALIDATE_RANGE maps.Eric Anholt1-1/+2
We definitely want to fall through to the unsynchronized map case, instead of wasting bandwidth on a copy. Prevents a -43.2407% +/- 1.06113% (n=49) performance regression on aa10perf when teaching glamor to provide the GL_INVALIDATE_RANGE_BIT information. This is a performance fix, which I usually wouldn't cherry-pick to stable. But this was really was just a bug in the code, its presence would discourage developers from giving us the best information they can, and I think we've got fairly high confidence in the unsynchronized map path already. Cc: 10.0 9.2 <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit f46563fe1c8a5560e4de0adf03e3d8770b7fc734)
2014-01-09i965: Fix handling of MESA_pack_invert in blit (PBO) readpixels.Eric Anholt1-1/+3
Fixes piglit GL_MESA_pack_invert/readpixels and GPU hangs with glamor and cairo-gl. Cc: 10.0 9.2 <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> (cherry picked from commit e186b927b8254ce62e0d47db90d16cd4253b3db5)
2014-01-09i965: fold offset into coord for textureOffset(gsampler2DRect)Chris Forbes1-1/+1
The hardware is broken with nonzero texel offsets and unnormalized coordinates; instead of doing correct offsetting, we get garbage. This just extends the existing workaround for ir_txf and ir_tg4+gsampler2DRect to also consider ir_tex+gsampler2DRect. Fixes broken rendering in 'tesseract' when 'mesa_texrectoffset_bug' is not enabled; also fixes the new piglit test 'tests/spec/glsl-1.30/execution/fs-textureOffset-Rect'. Has been broken ~forever; suggesting including this in only 10.0 because the lowering pass doesn't exist in 9.2 or earlier so would require quite a different patch. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: Lee Salzman <lsalzman@gmail.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 9e99735f301ebf85f8d0bfdce2bad441a5aac7f8)
2014-01-09swrast: fix delayed texel buffer allocation regression for OpenMPAndreas Fänger1-0/+12
Commit 9119269ca14ed42b51c7d8e2e662500311b29fa3 moved the texel buffer allocation to _swrast_texture_span(), however, when compiled with OpenMP support this code already runs multi-threaded so a critical section is required to prevent multiple allocations and rendering errors. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 2a0fb946e147f5482c93702fbf46ffdf5208f57c)
2014-01-09mesa: implement missing glGet(GL_RGBA_SIGNED_COMPONENTS_EXT) queryBrian Paul4-0/+71
This is part of the GL_EXT_packed_float extension. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> (cherry picked from commit 3486f6f31b8cdb01e480cfbd8814c1e4222d26b0 Also squashed in a subsequent bug fix: mesa: check for MESA_FORMAT_RGB9_E5_FLOAT in _mesa_is_format_signed() This packed floating point format only stores positive values. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Roland Scheidegger <sroland@vmware.com> (cherry picked from commit 0fc8d7c66e08c295b701586afdc1f6d86eb8a514) Also squashed in a second, subsequent bug fix: mesa: check bits per channel for GL_RGBA_SIGNED_COMPONENTS_EXT query If a channel has zero bits it's not signed. v2: also check for luminance and intensity format bits. Bruce Merry's proposed piglit test hits the luminance case. Reviewed-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit d046fd731ab192dceee0916323dd718b78df5976) Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=73096 Cc: 10.0 <mesa-stable@lists.freedesktop.org> Conflicts: src/mesa/main/get.c
2014-01-02i965/gen6: Fix HiZ hang in WebGL Google MapsChad Versace1-0/+15
Emitting flushes before depth and hiz resolves at the top of blorp's state emission fixes the hang. Marchesin and I found the fix experimentally, as opposed to adhering to a documented hardware workaround. A more minimal fix likely exists, but this gets the job done. Fixes HiZ hangs in the new WebGL Google maps on Sandybridge Chrome OS. Tested by zooming in and out continuously for 2 hours. This patch is based on https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/8bc07bb70163c3706fb4ba5f980e57dc942f56dd CC: mesa-stable@lists.freedesktop.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70740 Signed-off-by: Stéphane Marchesin <marcheu@chromium.org> Signed-off-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit 1a928816a1b717201f3b3cc998a42731b280e6ba)
2014-01-02st/mesa: fix glClear with multiple colorbuffers and different formatsMarek Olšák1-24/+10
Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org> (cherry picked from commit 0612005aa66f211753f44bb4ffdfdcc9316281ac)
2014-01-02st/mesa: use pipe_sampler_view_release()Jonathan Liu1-1/+1
This fixes a crash where old_view->context was already freed in the pipe_sampler_view_reference function contained in src/gallium/auxiliary/utils/u_inlines.h. As a result, the sampler_view_destroy function pointer contained 0xfeeefeee indicating freed heap memory. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 670be71bd801fea876f7512865ed5f54340da9be)
2014-01-02i915: Add support for gl_FragData[0] reads.Henri Verbeet1-0/+1
Similar to 556a47a2621073185be83a0a721a8ba93392bedb, without this reading from gl_FragData[0] would cause a software fallback. Bugzilla: https://bugs.winehq.org/show_bug.cgi?id=33964 Signed-off-by: Henri Verbeet <hverbeet@gmail.com> Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit b094b3b9f4c7b40056c31e3480ab7dc530da56e7)
2014-01-02i965: Fix 3DSTATE_PUSH_CONSTANT_ALLOC_PS packet creation.Kenneth Graunke1-1/+1
When adding geometry shader support, we accidentally reversed the size and offset parameters. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 51c9cfc296318760aab421a79da727acd0e36311)
2014-01-02mesa: Fix error code generation in glBeginConditionalRender()Anuj Phogat1-1/+3
This patch changes the error condition to satisfy below statement from OpenGL 4.3 core specification: "An INVALID_OPERATION error is generated if id is the name of a query object with a target other SAMPLES_PASSED, ANY_SAMPLES_PASSED, or ANY_SAMPLES_PASSED_CONSERVATIVE, or if id is the name of a query currently in progress." Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 7a73c6acb0a4f5f049795f73a54a08a6dbe166ed)
2014-01-02dri_util: Don't assume __DRIcontext->driverPrivate is a gl_contextKristian Høgsberg14-10/+34
The driverPrivate pointer is opaque to the driver and we can't assume it's a struct gl_context in dri_util.c. Instead provide a helper function to set the struct gl_context flags from the incoming DRI context flags. v2 (idr): Modify the other classic drivers to also use driContextSetFlags. I ran all the piglit GLX_ARB_create_context tests with i965 and classic swrast without regressions. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1] Reviewed-by: Eric Anholt <eric@anholt.net> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1 on Gallium nouveau] Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 38366c0c6e715314367b15680702e382d5c46a4a)
2014-01-02mesa: fix interpretation of glClearBuffer(drawbuffer)Marek Olšák1-6/+25
This corresponding piglit tests supported this incorrect behavior instead of pointing at it. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org> (cherry picked from commit 03d848ea1003abefd8fe51a5b4a780527cd852af)
2013-12-12swrast: fix readback regression since inversion fixDave Airlie1-1/+1
This readback from the frontbuffer with swrast was broken, that bug just made it more obviously broken, this fixes it by inverting the sub image gets. Also fixes a few other piglits. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72327 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72325 (for 9.2 the patches this depends on were asked to be backported separately in an email). Cc: "9.2" "10.0" mesa-stable@lists.fedoraproject.org Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 0b16042377a6981ff9bba92387889524a3547b3f)
2013-12-09dri megadriver_stub: add compatibility for older DRI loadersJordan Justen1-0/+126
To help the transition period when DRI loaders are being updated to support the newer __driDriverExtensions_foo mechanism, we populate __driDriverExtensions with the extensions returned by __driDriverExtensions_foo during a library contructor function. We find the driver foo's name by using the dladdr function which gives the path of the dynamic library's name that was being loaded. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Keith Packard <keithp@keithp.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 4859d492b25cba61f43bb883d878d6388be742be)
2013-12-06mesa: don't leak performance monitors on context destroyIlia Mirkin3-0/+23
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 267679be84de5bc9d2bd0fccb1712bc5cddb6be7)
2013-12-06i965: Add extra-alignment for non-msrt fast color clear for all hw (v2)Chad Versace1-24/+11
The BSpec states that the aligment for the non-msrt clear rectangle must be doubled; the BSpec does not restricit the workaround to specific hardware. Commit 9a1a67b applied the workaround to Haswell GT3. Commit 8b659ce expanded the workaround to all Haswell variants. This commit expands it to all hardware. No Piglit regressions on Ivybridge 0x0166. No fixes either. I know no Ivybridge nor Baytrail bug related to this workaround. However, the BSpec says the extra alignment is required, so let's do it. v2: Apply to all hardware, not just gen7. CC: "9.2, 10.0" <mesa-stable@lists.freedesktop.org> CC: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Paul Berry <stereotype441@gmail.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com> (cherry picked from commit 998018d7be1380f055fb577b0782004657cc9509)
2013-12-06i965/hsw: Apply non-msrt fast color clear w/a to all HSW GTsChad Versace1-6/+12
Pre-patch, the workaround was applied to only HSW GT3. However, the workaround also fixes render corruption on the HSW GT1 Chromebook, codenamed Falco. Also, update the BSpec quote that discusses the workaround to reflect the latest BSpec. The BSpec states that the workaround is required for Ivybridge and Baytrail as well as Haswell. But, we apply the workaround to only Haswell because (a) we suspect that is the only hardware where it is actually required and (b) we haven't yet validated the workaround for the other hardware. CC: "9.2, 10.0" <mesa-stable@lists.freedesktop.org> CC: Anuj Phogat <anuj.phogat@gmail.com> OTC-Tracker: CHRMOS-812 Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Chad Versace <chad.versace@linux.intel.com> (cherry picked from commit 8b659cef3a244b1acdbbca0beb704a66b6bc2fbc)
2013-12-06i965/gen6: Fix multisample resolve blits for luminance/intensity 32F formats.Paul Berry1-0/+15
On gen6, multisamble resolve blits use the SAMPLE message to blend together the 4 samples for each texel. For some reason, SAMPLE doesn't blend together the proper samples when the source format is L32_FLOAT or I32_FLOAT, resulting in blocky artifacts. To work around this problem, sample from the source surface using R32_FLOAT. This shouldn't affect rendering correctness, because when doing these resolve blits, the destination format is R32_FLOAT, so the channel replication done by L32_FLOAT and I32_FLOAT is unnecessary. Fixes piglit tests on Sandy Bridge: - spec/ARB_texture_float/multisample-formats 2 GL_ARB_texture_float - spec/ARB_texture_float/multisample-formats 4 GL_ARB_texture_float No piglit regressions on Sandy Bridge. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70601 Cc: Kenneth Graunke <kenneth@whitecape.org> Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit c4cf487315f1f5375534f1677177983fa496d577)
2013-11-28i965: Always reserve binding table space for at least one render target.Kenneth Graunke1-1/+4
In brw_update_renderbuffer_surfaces(), if there are no color draw buffers, we always set up a null render target at surface index 0 so we have something to use with the FB write marking the end of thread. However, when we recently began computing surface indexes dynamically, we failed to reserve space for it. This meant that the first texture would be assigned surface index 0, and our closing FB write would clobber the texture. Fixes Piglit's EXT_packed_depth_stencil/fbo-blit-d24s8 test on Gen4-5, which regressed as of commit 4e5306453da6a1c076309e543ec92d999e02f67a ("i965/fs: Dynamically set up the WM binding table offsets.") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70605 Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Tested-by: lu hua <huax.lu@intel.com> Cc: "10.0" mesa-stable@lists.freedesktop.org (cherry picked from commit c4815f6cd6f659acd361f1b4cf63473a46ca7de9)
2013-11-28dri: Allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in driCreateContextAttribsIan Romanick1-2/+4
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 73e9aa9e3f73d69ce4f0b68e74702d67842a230c)
2013-11-28i965: Only enable __DRI2_ROBUSTNESS if kernel support is availableIan Romanick3-19/+40
This is a squash of the following two cherry-picked patches: i965: Only enable __DRI2_ROBUSTNESS if kernel support is available Rather than always advertising the extension but failing to create a context with reset notifiction, just don't advertise it. I don't know why it didn't occur to me to do it this way in the first place. NOTE: Kristian requested that I provide a follow-up for master that dynamically generates the list of DRI extensions instead of selected between two hardcoded lists. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Suggested-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 9b1c68638d8096304d3c4e0cceb97bb4dc61acc5) and i965: Properly reject __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS when __DRI2_ROBUSTNESS is not enabled Only allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in brwCreateContext if intelInitScreen2 also enabled __DRI2_ROBUSTNESS (thereby enabling GLX_ARB_create_context). This fixes a regression in the piglit test "glx/GLX_ARB_create_context/invalid flag" v2: Remove commented debug code. Noticed by Jordan. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reported-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 53a65e547c0bf769fff48b4ccb41d1477daa70de)
2013-11-26i965/gs: Set GS prog_data to NULL if there is no GS program.Paul Berry1-0/+7
The previous commit fixes a bug wherein we would incorrectly refer to stale geometry shader prog_data when no geometry shader was active. This patch reduces the likelihood of that sort of bug occurring in the future by setting prog_data to NULL whenever there is no GS program. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit 37bdde1087584f4c1839e14db75c157b83246ebd)
2013-11-26i965/gs: Properly skip GS binding table upload when no GS active.Paul Berry1-1/+1
Previously, in brw_gs_upload_binding_table(), we checked whether brw->gs.prog_data was NULL in order to determine whether a geometry shader was active. This didn't work: brw->gs.prog_data starts off as NULL, but it is set to non-NULL when a geometry shader program is built, and then never set to NULL again. As a result, if we called brw_gs_upload_binding_table() while there was no geometry shader active, but a geometry shader had previously been active, it would refer to a stale (and possibly freed) prog_data structure. This patch fixes the problem by modifying brw_gs_upload_binding_table() to use the proper technique to determine whether a geometry shader is active: by checking whether brw->geometry_program is NULL. This fixes the crash reported in comment 2 of bug 71870 (the incorrect rendering remains, however). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870 Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit 2714ca81b9bad3dec3894fac97f34502c80b1697)
2013-11-26i965: Use __attribute__((flatten)) on fast tiled teximage code.Kenneth Graunke1-2/+8
The fast tiled texture upload code does not compile with GCC 4.8's -Og optimization flag. memcpy() has the always_inline attribute set. This poses a problem, since {x,y}tile_copy_faster calls it indirectly via {x,y}tile_copy, and {x,y}tile_copy normally aren't inlined at -Og. Using __attribute__((flatten)) tells GCC to inline every function call inside the function, which I believe was the author's intent. Fix suggested by Alexander Monakov. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Cc: mesa-stable@lists.freedesktop.org (cherry picked from commit ad542a10c5f2284c05036f1df8ce5b69bea66e50)
2013-11-23i965: Fix streamed state dumping/annotation after the blorp-flush change.Eric Anholt1-1/+0
I think I was thinking of the batch command packet cache when I pasted this in, but this counter is only used for dumping out streamed state for INTEL_DEBUG=batch and for putting annotations in our aub files. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit 5891f981452c1c5ed45b5a7e5fe54a9884ced2b6)
2013-11-23mesa: Implement GL_FRAMEBUFFER_ATTACHMENT_LAYERED query.Paul Berry1-0/+12
From section 6.1.18 (Renderbuffer Object Queries) of the GL 3.2 spec, under the heading "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE, then": If pname is FRAMEBUFFER_ATTACHMENT_LAYERED, then params will contain TRUE if an entire level of a three-dimesional texture, cube map texture, or one-or two-dimensional array texture is attached. Otherwise, params will contain FALSE. Fixes piglit tests: - spec/!OpenGL 3.2/layered-rendering/framebuffer-layered-attachments - spec/!OpenGL 3.2/layered-rendering/framebuffertexture-defaults Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> v2: Don't include "EXT" in the error message, since this query only makes sensen in context versions that have adopted glGetFramebufferAttachmentParameteriv(). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit ec79c05cbfb7c68fbef7447e1744423c00f26654)
2013-11-23mesa: Fix texture target validation for glFramebufferTexture()Paul Berry1-12/+47
Previously we were using the code path for validating glFramebufferTextureLayer(). But glFramebufferTexture() allows additional texture types. Fixes piglit tests: - spec/!OpenGL 3.2/layered-rendering/gl-layer-cube-map - spec/!OpenGL 3.2/layered-rendering/framebuffertexture Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> v2: Clarify comment above framebuffer_texture(). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit af1471dc04cc89822bab2c253c808880dd47c25a)
2013-11-23i965: Fix fast clear of depth buffers.Paul Berry1-2/+10
From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec: When the Clear or ClearBuffer* commands are used to clear a layered framebuffer attachment, all layers of the attachment are cleared. This patch fixes the fast depth clear path. Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-depth". Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (cherry picked from commit 08315233509f1fa7dc1e877aed2a8517296cf86e)
2013-11-23i965: Fix blorp clear of layered framebuffers.Paul Berry1-7/+19
From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec: When the Clear or ClearBuffer* commands are used to clear a layered framebuffer attachment, all layers of the attachment are cleared. This patch fixes the blorp clear path for color buffers. Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-color". Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (cherry picked from commit c1019670ea89505ea7411629c052d662c8eb6be6)
2013-11-23i965: refactor blorp clear code in preparation for layered clears.Paul Berry1-53/+66
Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (cherry picked from commit 1ec5365429b46a39a06186092502c8e66fb4140e)
2013-11-23mesa: Track number of layers in layered framebuffers.Paul Berry5-6/+21
In order to properly clear layered framebuffers, we need to know how many layers they have. The easiest way to do this is to record it in the gl_framebuffer struct when we check framebuffer completeness. This patch replaces the gl_framebuffer::Layered boolean with a gl_framebuffer::NumLayers integer, which is 0 if the framebuffer is not layered, and equal to the number of layers otherwise. v2: Remove gl_framebuffer::Layered and make gl_framebuffer::NumLayers always have a defined value. Fix factor of 6 error in the number of layers in a cube map array. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 95140740ad1c6cd8a34002c307556f5c49a34589)
2013-11-23mesa: enable GL_TEXTURE_LOD_BIAS set/getTapani Pälli1-8/+8
Earlier comments suggest this was removed from GL core spec but it is still there. Enabling makes 'texture_lod_bias_getter' Khronos conformance tests pass, also removes some errors from Metro Last Light game which is using this API. v2: leave NOTE comment (Ian) Cc: "9.0 9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> (cherry picked from commit 7e61b44dcd6175579f60d8ff2f703a6c83e33d27)
2013-11-23mesa/swrast: fix inverted front buffer rendering with old-school swrastDave Airlie1-2/+2
I've no idea when this broke, but we have some people who wanted it fixed, so here's my attempt. reproducer, run readpix with swrast hit f, or run trival tri -sb things are upside down, after this patch they aren't. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62142 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66213 Cc: <mesa-stable@lists.freedesktop.org>" Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit a43b49dfb13dc7e6d2d6d7ceee892077038d7102)
2013-11-23i965: Link -ldl after libmesa.laMatt Turner1-1/+1
DLOPEN_LIBS is part of DRI_LIB_DEPS. Cc: "10.0" <mesa-stable@lists.freedesktop.org>" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71512 Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 1f9092958d365c94af825c3b3b6664688c27b5a1)
2013-11-23st/mesa: fix GL_FEEDBACK mode inverted Y coordinate bugBrian Paul1-2/+4
We need to check the drawbuffer's orientation before inverting Y coordinates. Fixes piglit feedback tests when running with the -fbo option. Cc: "9.2" "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commit 15d8e05e1e98a9bfd5a365d0fda222668f24261f)
2013-11-23i965/vec4: Fix broken IR annotation in debug output.Paul Berry1-1/+0
Commit 70953b5 (i965: Initialize all member variables of vec4_instruction on construction) inadvertently added a line to the vec4_instruction constructor setting this->ir to NULL, wiping out the previously set value. As a result, ever since then, the output of INTEL_DEBUG=vs and INTEL_DEBUG=gs has been missing IR annotations. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 60b1a118e123493624324ae191d05870e95968f3)
2013-11-23i965/gen7: Emit workaround flush when changing GS enable state.Paul Berry7-22/+72
v2: Don't go to extra work to avoid extraneous flushes. (Previous experiments in the kernel have suggested that flushing the pipeline when it is already empty is extremely cheap). Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 7dfb4b2d00ddb8e5ee24d4c58eb9415dc4ccc21c)
2013-11-23i965: Add missing break in SHADER_OPCODE_GEN7_SCRATCH_READ case.Vinson Lee1-0/+2
Fixes "Missing break in switch" defect reported by Coverity. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit b570c4229fe9c621b56bb9475d77a344039444d4)
2013-11-15i965: Fix vertical alignment for multisampled buffers.Paul Berry1-4/+7
From the Sandy Bridge PRM, Vol 1 Part 1 7.18.3.4 (Alignment Unit Size): j [vertical alignment] = 4 for any render target surface is multisampled (4x) From the Ivy Bridge PRM, Vol 4 Part 1 2.12.2.1 (SURFACE_STATE for most messages), under the "Surface Vertical Alignment" heading: This field is intended to be set to VALIGN_4 if the surface was rendered as a depth buffer, for a multisampled (4x) render target, or for a multisampled (8x) render target, since these surfaces support only alignment of 4. Back in 2012 when we added multisampling support to the i965 driver, we forgot to update the logic for computing the vertical alignment, so we were often using a vertical alignment of 2 for multisampled buffers, leading to subtle rendering errors. Note that the specs also require a vertical alignment of 4 for all Y-tiled render target surfaces; I plan to address that in a separate patch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53077 Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit b4c3b833ec8ec6787658ea90365ff565cd8846c7)
2013-11-15main: Fix MaxUniformComponents for geometry shaders.Paul Berry1-1/+1
For both vertex and fragment shaders we default MaxUniformComponents to 4 * MAX_UNIFORMS. It makes sense to do this for geometry shaders too; if back-ends have different limits they can override them as necessary. Fixes piglit test: spec/glsl-1.50/built-in constants/gl_MaxGeometryUniformComponents Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (cherry picked from commit 46e9f78efcb6ccc25ea59d83624aaa5077254a85)
2013-11-15mesa: Fix derived vertex state not being updated in glCallList()Fredrik Höglund1-6/+16
AEcontext::NewState is not always set when the vertex array state is changed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71492 Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit ff353c218a1ab1fd3fb797a4780612ec4b0451d8)
2013-11-15dri: Change value param to unsignedIan Romanick4-4/+4
This silences some compiler warnings in i915 and i965. See also 75982a5. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit a15a19f0d1b024f5f18f1dfe878ae8d399e38469)
2013-11-15i965: Use drm_intel_get_aperture_sizes instead of hard-coded 2GiBIan Romanick1-3/+7
Systems with little physical memory installed will report less than 2GiB, and some systems may (hypothetically?) have a larger address space for the GPU. My IVB still reports 1534. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit cb6182bdfa7c8a5a773ec21112886f742df99840)
2013-11-15i915: Use drm_intel_get_aperture_sizes instead of drmAgpSizeIan Romanick1-2/+6
Send the zombie back to the grave before it infects the townsfolk. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 9fe108db0942ebf41cd1cce0ca6a6444901fbb0a)