mesa.git
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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.

10 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>
10 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>
10 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>
10 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.

10 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.

10 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().

10 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.

10 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.

10 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.

10 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.

10 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.

10 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().

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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

10 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

10 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

10 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>
10 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>
10 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>
10 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>
10 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>
10 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

10 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

10 years agost/egl: Flush resources before presentation
Martin Andersson [Thu, 26 Dec 2013 09:33:28 +0000 (10:33 +0100)]
st/egl: Flush resources before presentation

Fixes wayland regression on r600g due to fast clear introduced by commit
edbbfac6.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agodri: set yInverted default to GL_TRUE
Tapani Pälli [Wed, 8 Jan 2014 13:17:59 +0000 (15:17 +0200)]
dri: set yInverted default to GL_TRUE

yInverted is used by EGL_NOK_texture_from_pixmap to indicate that
window system rendering is y-inverted compared to OpenGL texture
representation. This extension is only known to be used with X11
window system where sane default is GL_TRUE.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73371

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl_dri2: call dri2_add_configs_for_visuals after extensions set
Tapani Pälli [Wed, 8 Jan 2014 13:17:58 +0000 (15:17 +0200)]
egl_dri2: call dri2_add_configs_for_visuals after extensions set

dri2_add_config makes decisions based on NOK_texture_from_pixmap so
it needs to be enabled before calling dri2_add_configs_for_visuals.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agomesa: Set the correct error in _mesa_BeginConditionalRender
Ian Romanick [Thu, 9 Jan 2014 22:08:55 +0000 (14:08 -0800)]
mesa: Set the correct error in _mesa_BeginConditionalRender

Piglit was recently changed to expect the correct error code (piglit
commit 271b998), so it started failing on Mesa.  This corrects that
failing and adds some spec quotations to justify the errrors set.

The code was rearranged a little bit to match the order listed in the
spec.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Delete duplicate write_timestamp function.
Kenneth Graunke [Wed, 11 Dec 2013 22:55:45 +0000 (14:55 -0800)]
i965: Delete duplicate write_timestamp function.

brw_queryobj.c needs a version of write_timestamp that works on all
generations for the QueryCounter() driver hook.  So there's no point in
duplicating it in gen6_queryobj.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Fix clears of layered framebuffers with mismatched layer counts.
Paul Berry [Tue, 7 Jan 2014 14:29:47 +0000 (06:29 -0800)]
i965: Fix clears of layered framebuffers with mismatched layer counts.

Previously, Mesa enforced the following rule (from
ARB_geometry_shader4's list of criteria for framebuffer completeness):

  * If any framebuffer attachment is layered, all attachments must have
    the same layer count.  For three-dimensional textures, the layer count
    is the depth of the attached volume.  For cube map textures, the layer
    count is always six.  For one- and two-dimensional array textures, the
    layer count is simply the number of layers in the array texture.
    { FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB }

However, when ARB_geometry_shader4 was adopted into GL 3.2, this rule
was dropped; GL 3.2 permits different attachments to have different
layer counts.  This patch brings Mesa in line with GL 3.2.

In order to ensure that layered clears properly clear all layers, we
now have to keep track of the maximum number of layers in a layered
framebuffer.

Fixes the following piglit tests in spec/!OpenGL 3.2/layered-rendering:
- clear-color-all-types 1d_array mipmapped
- clear-color-all-types 1d_array single_level
- clear-color-mismatched-layer-count
- framebuffer-layer-count-mismatch

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agomain: check texture target when validating layered framebuffers.
Paul Berry [Wed, 20 Nov 2013 03:01:37 +0000 (19:01 -0800)]
main: check texture target when validating layered framebuffers.

From section 4.4.4 (Framebuffer Completeness) of the GL 3.2 spec:

    If any framebuffer attachment is layered, all populated
    attachments must be layered. Additionally, all populated color
    attachments must be from textures of the same target.

We weren't checking that the attachments were from textures of the
same target.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoi965/gen6/blorp: Remove redundant HiZ workaround
Chad Versace [Tue, 24 Dec 2013 01:49:21 +0000 (17:49 -0800)]
i965/gen6/blorp: Remove redundant HiZ workaround

Commit 1a92881 added extra flushes to fix a HiZ hang in
WebGL Google Maps. With the extra flushes emitted by the previous two
patches, the flushes added by 1a92881 are redundant.

Tested with the same criteria as in 1a92881: by zooming in and out
continuously for 2 hours on Sandybridge Chrome OS (codename
Stumpy) without a hang.

CC: Kenneth Graunke <kenneth@whitecape.org>
CC: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965/gen6/blorp: Set need_workaround_flush at top of blorp
Chad Versace [Tue, 24 Dec 2013 01:48:45 +0000 (17:48 -0800)]
i965/gen6/blorp: Set need_workaround_flush at top of blorp

Unconditionally set brw->need_workaround_flush at the top of gen6 blorp
state emission.

The art of emitting workaround flushes on Sandybridge is mysterious and
not fully understood. Ken and I believe that
intel_emit_post_sync_nonzero_flush() may be required when switching from
regular drawing to blorp.  This is an extra safety measure to prevent
undiscovered difficult-to-diagnose gpu hangs.

I verified that on ChromeOS, pre-patch, need_workaround_flush was not
set at the top of blorp, as Paul expected. To verify, I inserted the
following debug code at the top of gen6_blorp_exec(), restarted the ui,
and inspected the logs in /var/log/ui. The abort gets triggered so early
that the browser never appears on the display.

    static void
    gen6_blorp_exec(...)
    {
        if (!brw->need_workaround_flush) {
            fprintf(stderr, "chadv: %s:%d\n", __FILE__, __LINE__);
            abort();
        }
        ...
    }

CC: Kenneth Graunke <kenneth@whitecape.org>
CC: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965/gen6/blorp: Set need_workaround_flush immediately after primitive
Chad Versace [Tue, 24 Dec 2013 01:46:51 +0000 (17:46 -0800)]
i965/gen6/blorp: Set need_workaround_flush immediately after primitive

This patch makes the workaround code in gen6 blorp follow the pattern
established in the regular draw path. It shouldn't result in any
behavioral change.

On gen6, there are two places where we emit 3D_CMD_PRIM: brw_emit_prim()
and gen6_blorp_emit_primitive().  brw_emit_prim() sets
need_workaround_flush immediately after emitting the primitive, but
blorp does not. Blorp sets need_workaround_flush at the bottom of
brw_blorp_exec().

This patch moves the need_workaround_flush from brw_blorp_exec() to
gen6_blorp_emit_primitive().  There is no need to set
need_workaround_flush in gen7_blorp_emit_primitive() because the
workaround applies only to gen6.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agodocs: Import 10.0.2 release notes, add news item.
Carl Worth [Thu, 9 Jan 2014 20:05:28 +0000 (12:05 -0800)]
docs: Import 10.0.2 release notes, add news item.

10 years agomesa: add missing SNORM formats in _mesa_base_fbo_format()
Brian Paul [Wed, 8 Jan 2014 16:05:29 +0000 (09:05 -0700)]
mesa: add missing SNORM formats in _mesa_base_fbo_format()

We weren't handling the LUMINANCE_SNORM, LUMINANCE_ALPHA_SNORM and
INTENSITY_SNORM cases.  Note that adding these cases here does not
require a driver to support rendering to these surface types.  If
the driver can't do it we'll report an incomplete framebuffer.

NVIDIA doesn't support GL_EXT_texture_snorm but their driver
accepts these formats in glRenderBufferStorage().

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agomesa: remove dead geom shader code
Brian Paul [Tue, 7 Jan 2014 23:13:56 +0000 (16:13 -0700)]
mesa: remove dead geom shader code

I doubt the swrast-based drivers will ever support GS.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodocs: minor updates to VMware SVGA3D driver page
Brian Paul [Tue, 7 Jan 2014 17:50:21 +0000 (10:50 -0700)]
docs: minor updates to VMware SVGA3D driver page

Signed-off-by: Brian Paul <brianp@vmware.com>
10 years agomesa: check bits per channel for GL_RGBA_SIGNED_COMPONENTS_EXT query
Brian Paul [Tue, 7 Jan 2014 16:05:27 +0000 (09:05 -0700)]
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.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=73096
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: check for MESA_FORMAT_RGB9_E5_FLOAT in _mesa_is_format_signed()
Brian Paul [Tue, 7 Jan 2014 16:05:03 +0000 (09:05 -0700)]
mesa: check for MESA_FORMAT_RGB9_E5_FLOAT in _mesa_is_format_signed()

This packed floating point format only stores positive values.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=73096
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/mesa: fix breakage from gl_constant::Program[] change
Brian Paul [Thu, 9 Jan 2014 17:57:22 +0000 (10:57 -0700)]
st/mesa: fix breakage from gl_constant::Program[] change

10 years agomesa: Use functions to convert gl_shader_stage to PROGRAM enum or pipe target.
Paul Berry [Wed, 8 Jan 2014 19:09:58 +0000 (11:09 -0800)]
mesa: Use functions to convert gl_shader_stage to PROGRAM enum or pipe target.

Suggested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
v2: Improve assert message.

10 years agomain: Change init_program_limits() to use gl_shader_stage.
Paul Berry [Wed, 8 Jan 2014 18:32:18 +0000 (10:32 -0800)]
main: Change init_program_limits() to use gl_shader_stage.

This allows the caller to execute it in a loop rather than
hand-rolling a separate call for each stage.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Index into ctx->Const.Program[] rather than using ad-hoc code.
Paul Berry [Wed, 8 Jan 2014 18:17:01 +0000 (10:17 -0800)]
glsl: Index into ctx->Const.Program[] rather than using ad-hoc code.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Index into ctx->Const.Program[] rather than using ad-hoc code.
Paul Berry [Wed, 8 Jan 2014 18:17:01 +0000 (10:17 -0800)]
mesa: Index into ctx->Const.Program[] rather than using ad-hoc code.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: replace ctx->Const.{Vertex,Fragment,Geomtery}Program with an array.
Paul Berry [Wed, 8 Jan 2014 18:00:28 +0000 (10:00 -0800)]
mesa: replace ctx->Const.{Vertex,Fragment,Geomtery}Program with an array.

These are replaced with
ctx->Const.Program[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}].  In
patches to follow, this will allow us to replace a lot of ad-hoc logic
with a variable index into the array.

With the exception of the changes to mtypes.h, this patch was
generated entirely by the command:

    find src -type f '(' -iname '*.c' -o -iname '*.cpp' -o -iname '*.py' \
    -o -iname '*.y' ')' -print0 | xargs -0 sed -i \
    -e 's/Const\.VertexProgram/Const.Program[MESA_SHADER_VERTEX]/g' \
    -e 's/Const\.GeometryProgram/Const.Program[MESA_SHADER_GEOMETRY]/g' \
    -e 's/Const\.FragmentProgram/Const.Program[MESA_SHADER_FRAGMENT]/g'

Suggested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agollvmpipe: Honour pipe_rasterizer::point_quad_rasterization.
José Fonseca [Wed, 8 Jan 2014 17:19:41 +0000 (17:19 +0000)]
llvmpipe: Honour pipe_rasterizer::point_quad_rasterization.

Commit eda21d2a3010d9fc5a68b55a843c5e44b2abf8dd fixed the rasterization
of points for Direct3D but ended up breaking the rasterization of OpenGL
non-sprite points, in particular conform's pntrast.c test.

The only way to get both working is to properly honour
pipe_rasterizer::point_quad_rasterization, and follow the weird OpenGL
rule when it is false.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoi965: Don't do the temporary-and-blit-copy for INVALIDATE_RANGE maps.
Eric Anholt [Tue, 24 Dec 2013 23:11:54 +0000 (15:11 -0800)]
i965: Don't do the temporary-and-blit-copy for INVALIDATE_RANGE maps.

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>
10 years agoi965: Fix handling of MESA_pack_invert in blit (PBO) readpixels.
Eric Anholt [Mon, 23 Dec 2013 20:11:25 +0000 (12:11 -0800)]
i965: Fix handling of MESA_pack_invert in blit (PBO) readpixels.

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>
10 years agoi965: Fix incorrect bounds tracking for blit readpixels's GPU access.
Eric Anholt [Mon, 23 Dec 2013 09:56:26 +0000 (01:56 -0800)]
i965: Fix incorrect bounds tracking for blit readpixels's GPU access.

While incorrect, it probably wouldn't affect anyone ever: You'd have to do
an appropriately-formatted readpixels into a PBO, then overwrite the tail
end of the updated area of the PBO with glBufferSubData(), and you
wouldn't get appropriate synchronization.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Use SET_FIELD to safety check our x/y offsets in blits.
Eric Anholt [Mon, 23 Dec 2013 09:48:09 +0000 (01:48 -0800)]
i965: Use SET_FIELD to safety check our x/y offsets in blits.

The earlier assert made sure that our math didn't exceed our bounds, but
this makes sure that we don't overflow from the high bits X into the low
bits of Y.  We've already put checks in intel_miptree_blit(), but I've
wanted to expand the type in our protoype from short to uint32_t, and we
could get in trouble with intel_emit_linear_blit() if we did.

v2: Add Ken's comment about the funny language extension used.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> (v1)
10 years agoi965: Add an assert for when SET_FIELD's value exceeds the field size.
Eric Anholt [Mon, 23 Dec 2013 09:39:42 +0000 (01:39 -0800)]
i965: Add an assert for when SET_FIELD's value exceeds the field size.

This was one of the things we always wanted to do to this, to make it more
useful than just (value << FIELD_MASK).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Add a safety check for emitting blits.
Eric Anholt [Mon, 23 Dec 2013 09:26:56 +0000 (01:26 -0800)]
i965: Add a safety check for emitting blits.

With all of the flipping and pitch twiddling and miptree layout involved
in our blits, there are lots of ways for us to scribble outside of a
buffer.  Put in a check that we're not about to do so.

This catches a bug that glamor was running into.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>