mesa.git
12 years agoegl_dri2: NULL check for EGLNativeWindowType
Elvis Lee [Wed, 11 Jul 2012 02:13:51 +0000 (11:13 +0900)]
egl_dri2: NULL check for EGLNativeWindowType

Some application calls eglCreateWindowSurface with
EGLNativeWindowType parameter having zero value. It causes SEGV
and disturbs error handling like EGL_NO_SURFACE.

Signed-off-by: Elvis Lee <kwangwoong.lee@lge.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoFix building mesa with assembly enabled since a112ca5d
Jon TURNEY [Mon, 16 Jul 2012 20:14:43 +0000 (21:14 +0100)]
Fix building mesa with assembly enabled since a112ca5d

a112ca5d rather crassly smashed all the compiler flags together into AM_CFLAGS.
Separate them out the way they were before, putting pre-processor flags into
AM_CPPFLAGS, so assembly source gets preprocessed with the correct pre-processor
flags as well.

Also, remove unneeded CFLAGS from AM_CFLAGS, and CXXFLAGS from AM_CXXFLAGS

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Brian Paul <brianp@vmware.com>
12 years agointel: Fix build broken by ETC1 patch
Chad Versace [Mon, 16 Jul 2012 21:29:24 +0000 (14:29 -0700)]
intel: Fix build broken by ETC1 patch

I suck at resolving merge conflicts and broke the build in a5a34b1.
This patch adds the missing field intel_mipmap_tree::wraps_etc1.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agointel: Enable GL_OES_compressed_ETC1_RGB8_texture
Chad Versace [Tue, 19 Jun 2012 01:25:25 +0000 (18:25 -0700)]
intel: Enable GL_OES_compressed_ETC1_RGB8_texture

Enable it for all hardware.

No current hardware supports ETC1, so this patch implements it by
translating the ETC1 data to RGBX data during the call to
glCompressedTexImage2D(). For details, see the doxygen for
intel_mipmap_tree::wraps_etc1.

Passes the Piglit test spec/OES_compressed_ETC1_RGB8_texture/miptree and
the ETC1 test in the GLES2 conformance suite.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agomesa: Add function for decoding ETC1 textures
Chad Versace [Tue, 10 Jul 2012 23:34:27 +0000 (16:34 -0700)]
mesa: Add function for decoding ETC1 textures

Add function _mesa_etc1_unpack_rgba8888. It is intended to be used by
glCompressedTexSubImage2D to decode ETC1 textures into RGBA.

CC: Chia-I <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agogallium/util, mesa: Refactor etc1 unpack function
Chad Versace [Tue, 10 Jul 2012 23:23:39 +0000 (16:23 -0700)]
gallium/util, mesa: Refactor etc1 unpack function

Move the body of util_etc1_rgb8_unpack_rgba_unorm8 into a new function
that can be shared between gallium and dri drivers,
texcompress_etc_tmp.h:etc1_unpack_rgba8888.

CC: Chia-I <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agogbm: Rename gbm_bo_get_pitch to gbm_bo_get_stride
Kristian Høgsberg [Mon, 16 Jul 2012 19:08:13 +0000 (15:08 -0400)]
gbm: Rename gbm_bo_get_pitch to gbm_bo_get_stride

We use pitch for 'pixels per row' and stride for 'bytes per row' pretty
consistently in mesa and most other places, so rename the gbm API.

12 years agogbm: Add new gbm_bo_import entry point
Kristian Høgsberg [Fri, 13 Jul 2012 15:19:24 +0000 (11:19 -0400)]
gbm: Add new gbm_bo_import entry point

This generalizes and replaces gbm_bo_create_for_egl_image.  gbm_bo_import
will create a gbm_bo from either an EGLImage or a struct wl_buffer.

12 years agollvmpipe: destroy setup variants on context destruction
Roland Scheidegger [Mon, 18 Jun 2012 18:37:34 +0000 (20:37 +0200)]
llvmpipe: destroy setup variants on context destruction

lp_delete_setup_variants() used to be called in garbage collection,
but this no longer exists hence the setup shaders never got freed.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agollvmpipe: Unified common code between AoS and SoA blending.
James Benton [Tue, 3 Jul 2012 16:01:14 +0000 (17:01 +0100)]
llvmpipe: Unified common code between AoS and SoA blending.

Added a new file lp_bld_blend.c for the common code.
Merged and added some simple optimisations.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agointel: Don't call _mesa_get_format_bytes for MESA_FORMAT_NONE
Kristian Høgsberg [Mon, 16 Jul 2012 14:54:30 +0000 (10:54 -0400)]
intel: Don't call _mesa_get_format_bytes for MESA_FORMAT_NONE

When we don't intend to texture from or render to a __DRIimage we
use __DRI_IMAGE_FORMAT_NONE.  In that case, we just create the __DRIimage
to reference the underlying buffer, and will create usable __DRIimages
from it using createSubImage later.

If we try to use _mesa_get_format_bytes() on MESA_FORMAT_NONE in
a debug build, we hit an assertion, so let's not do that.

12 years agoFix building glsl when using automake-1.12 after 68e04cc6
Jon TURNEY [Fri, 13 Jul 2012 21:29:03 +0000 (22:29 +0100)]
Fix building glsl when using automake-1.12 after 68e04cc6

Commit 68e04cc6 was tested using automake-1.11.  Unfortunately, automake-1.12
made a "slightly backward-incompatible change" in the use of yacc with C++, and
for a .yy file, the generated header file is now named .hh, not .h

To work with both, write our own rule for running yacc, which generates a
header file named .h, rather than using automake's rule.

Also, remove things from BUILD_SOURCES which don't need to be there

Also, update EXCLUDE rules in doxygen/glsl.doxy, for change of generated files
from .cpp -> .cc, and glsl_lexer.h has never existed.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
12 years agor600g: compute needed CS space for vertex buffers correctly
Marek Olšák [Sun, 15 Jul 2012 13:26:14 +0000 (15:26 +0200)]
r600g: compute needed CS space for vertex buffers correctly

12 years agor600g: don't check the R600_GLSL130 env var
Marek Olšák [Sat, 14 Jul 2012 20:28:26 +0000 (22:28 +0200)]
r600g: don't check the R600_GLSL130 env var

GLSL 1.3 has been enabled by default for quite a while.

12 years agor600g: fix DB decompression on evergreen
Jerome Glisse [Sat, 14 Jul 2012 21:05:03 +0000 (23:05 +0200)]
r600g: fix DB decompression on evergreen

Separated out of the hyperz patch by Marek with minor modifications.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
12 years agor600g: Emit vertex buffers using the same method as constant buffers
Tom Stellard [Thu, 12 Jul 2012 19:50:28 +0000 (19:50 +0000)]
r600g: Emit vertex buffers using the same method as constant buffers

Signed-off-by: Marek Olšák <maraeo@gmail.com>
12 years agor600g: Unify 3D and compute vertex buffer emission
Tom Stellard [Thu, 12 Jul 2012 19:50:27 +0000 (19:50 +0000)]
r600g: Unify 3D and compute vertex buffer emission

Signed-off-by: Marek Olšák <maraeo@gmail.com>
12 years agor600g: fix grammar constant_buffer -> constant_buffers
Marek Olšák [Sat, 14 Jul 2012 16:14:16 +0000 (18:14 +0200)]
r600g: fix grammar constant_buffer -> constant_buffers

12 years agoradeon/llvm: Fix CR/LF in AMDILSIDevice.h
Andreas Boll [Fri, 13 Jul 2012 16:35:22 +0000 (16:35 +0000)]
radeon/llvm: Fix CR/LF in AMDILSIDevice.h

12 years agoradeon/llvm: Clean up AMDILIntrinsicInfo.cpp
Tom Stellard [Fri, 13 Jul 2012 16:08:24 +0000 (16:08 +0000)]
radeon/llvm: Clean up AMDILIntrinsicInfo.cpp

12 years agoradeon/llvm: Coding style fixes
Tom Stellard [Fri, 13 Jul 2012 15:52:37 +0000 (15:52 +0000)]
radeon/llvm: Coding style fixes

12 years agoFix linking gallium drivers and with dricore after defadf2b1
Jon TURNEY [Fri, 13 Jul 2012 14:14:43 +0000 (15:14 +0100)]
Fix linking gallium drivers and with dricore after defadf2b1

Commit defadf2b1 erroneously tries to make gallium drivers link with libdricore
as a static library, not a shared library

Also, change uses of DRI_LIB_DEPS in gallium driver Makefiles to
GALLIUM_DRI_LIB_DEPS, so the libraries added are used in the linking the gallium
driver

Also, fix the path to the libdricore.so symlink, it's made in LIB_DIR, not in
the libdricore directory

Also repair quoting of dricore settings of DRI_LIB_DEPS and GALLIUM_DRI_LIB_DEPS
variables so VERSION is interpolated in configure but TOP and LIB_DIR are
interpolated later (where they are known, but VERSION isn't)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
12 years agonouveau: implement missing timer query functionality
Christoph Bumiller [Thu, 12 Jul 2012 11:59:52 +0000 (13:59 +0200)]
nouveau: implement missing timer query functionality

12 years agowayland: Stop trying to use make rules from aclocal, just copy and paste
Kristian Høgsberg [Fri, 13 Jul 2012 15:06:32 +0000 (11:06 -0400)]
wayland: Stop trying to use make rules from aclocal, just copy and paste

Defeated by autotool, copy and paste to the rescue.

https://bugs.freedesktop.org/show_bug.cgi?id=51997
https://bugs.freedesktop.org/show_bug.cgi?id=51531

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agomesa/st: Generates TGSI that always recognizes INSTANCEID/VERTEXID as integers.
José Fonseca [Thu, 12 Jul 2012 19:44:02 +0000 (20:44 +0100)]
mesa/st: Generates TGSI that always recognizes INSTANCEID/VERTEXID as integers.

Tested by running piglit draw-instanced, and by forcing llvmpipe advertise no native
integer support, which now produces:

VERT
DCL IN[0]
DCL SV[0], INSTANCEID
DCL OUT[0], POSITION
DCL OUT[1], COLOR
DCL CONST[0..19]
DCL TEMP[0], LOCAL
DCL TEMP[1], LOCAL
DCL TEMP[2], LOCAL
DCL ADDR[0]
  0: U2F TEMP[0].x, SV[0]
  1: ARL ADDR[0].x, TEMP[0].xxxx
  2: MOV TEMP[1].xy, CONST[ADDR[0].x+8].xyxx
  3: ADD TEMP[2].x, IN[0].xxxx, TEMP[1].xxxx
  4: ADD TEMP[1].x, IN[0].yyyy, TEMP[1].yyyy
  5: MUL TEMP[2], CONST[16], TEMP[2].xxxx
  6: MAD TEMP[2], CONST[17], TEMP[1].xxxx, TEMP[2]
  7: MAD TEMP[2], CONST[18], IN[0].zzzz, TEMP[2]
  8: MAD TEMP[2], CONST[19], IN[0].wwww, TEMP[2]
  9: ARL ADDR[0].x, TEMP[0].xxxx
 10: MOV TEMP[1], CONST[ADDR[0].x]
 11: MOV OUT[0], TEMP[2]
 12: MOV OUT[1], TEMP[1]
 13: END

12 years agodraw,gallivm: Fix draw_get_shader_param.
José Fonseca [Thu, 12 Jul 2012 19:47:20 +0000 (20:47 +0100)]
draw,gallivm: Fix draw_get_shader_param.

- Use LLVM limits when LLVM is being used, instead of TGSI limits
- Provide draw_get_shader_param_no_llvm for when llvm is never used (softpipe)
- Eliminate several of the hacks around draw shader caps in several drivers

Unfortunately the hack for PIPE_MAX_VERTEX_SAMPLERS is still necessary.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agoDon't explicitly link libOsmesa with libmesa's dependency libglsl
Jon TURNEY [Sun, 8 Jul 2012 22:26:11 +0000 (23:26 +0100)]
Don't explicitly link libOsmesa with libmesa's dependency libglsl

The libmesa convenience library is linked with the libglsl convenience
library.  libOsmesa is linked with libmesa, and also directly with libglsl.
When using libtool, this gives rise to duplicate symbol errors.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoautomake: convert libglapi
Jon TURNEY [Fri, 29 Jun 2012 17:09:37 +0000 (18:09 +0100)]
automake: convert libglapi

* "configure substitutions are not allowed in _SOURCES variables" in automake,
so remove the AC_SUBST'ed GLAPI_ASM_SOURCES and instead use some AM_CONDITIONALS
to choose which asm sources are used

* Change GLAPI_LIB to point to the .la file in other Makefile.am files, and make a link
to the .a file for the convenience of other Makefiles which have not yet been converted
to automake

v2:
- Use AM_CPPFLAGS for cleaner build output
- EXTRA_SOURCES is not needed
- Remove libglapi.a compatibility link on clean

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoRename X86-64_API -> X86_64_API
Jon TURNEY [Tue, 13 Mar 2012 19:31:19 +0000 (19:31 +0000)]
Rename X86-64_API -> X86_64_API

automake doesn't allow hyphens in variable names

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoLink dri drivers with mesa or dricore libtool library
Jon TURNEY [Sun, 8 Jul 2012 11:19:24 +0000 (12:19 +0100)]
Link dri drivers with mesa or dricore libtool library

Now mesa/drivers/dri is converted to automake, we want to update DRI_LIB_DEPS
so that we link with the libmesa or libdricore libtool library, as appropriate.

However, this is complicated by the fact that gallium/targets is not (yet)
converted, so we can't share the DRI_LIB_DEPS autoconf variable with that anymore.

Add an additional autoconf variable GALLIUM_DRI_LIB_DEPS, which is now used in
gallium/targets/Makefile.dri, to link with the libdircore or libmesa native library.

v2: libdricore$VERSION.a needs to be libdricore$(VERSION).a

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoRemove unused MESA_MODULES autoconf variable
Jon TURNEY [Fri, 29 Jun 2012 14:29:15 +0000 (15:29 +0100)]
Remove unused MESA_MODULES autoconf variable

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoautomake: convert libmesa and libmesagallium
Jon TURNEY [Fri, 6 Jul 2012 23:51:52 +0000 (00:51 +0100)]
automake: convert libmesa and libmesagallium

* "configure substitutions are not allowed in _SOURCES variables" in automake, so instead of
MESA_ASM_FILES, use some AM_CONDITIONALS to choose which architecture's asm sources are used
in libmesa_la_SOURCES. (Can't remove MESA_ASM_FILES autoconf variable as it's still used in
sources.mak)

* Update to link with the .la file in other Makefile.am files, and make a link to the
.a file for the convenience of other Makefiles which have not yet been converted to automake

v2: Remove stray -static from LDFLAGS
v3: Remove .a compatibility link on clean

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoRename sparc/clip.S -> sparc/sparc_clip.S
Jon TURNEY [Fri, 6 Jul 2012 23:53:31 +0000 (00:53 +0100)]
Rename sparc/clip.S -> sparc/sparc_clip.S

Automake can't handle having both clip.S and clip.c, even though they have different paths

"src/mesa/Makefile.am: object `clip.lo' created by `$(SRCDIR)/sparc/clip.S' and `$(SRCDIR)/main/clip.c'"

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoautomake: convert libglsl
Jon TURNEY [Thu, 28 Jun 2012 22:15:48 +0000 (23:15 +0100)]
automake: convert libglsl

v2: Use AM_V_GEN to silence generated code rules. Add BUILT_SOURCES to CLEANFILES
v3:
- Fix an accidental // in a path
- Use automake make rules for lex/yacc rather than writing our own
- Update .gitignore appropriately
- Build a libglcpp convenience library rather than awkwardly including
the files in libglsl and delegating the generation
- Remove libglsl.a compatibility link on clean
v4:
- Automake's rules for lex/yacc make .cc if source is .ll or .yy, and apparently we
must use those extensions "because of scons", so update everywhere glsl_parser.cpp
-> glsl_parser.cc and glsl_lexer.cpp -> glsl_lexer.cc. This fixes 'make tarballs'
and building with dricore enabled.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agoautomake: convert libOSmesa
Laurent Carlier [Sun, 24 Jun 2012 07:51:27 +0000 (09:51 +0200)]
automake: convert libOSmesa

This also currently fix the installation of libOSmesa.

v2: Remove old Makefile, libOSmesa is now versioned, fix typos
v3: Keep config substitution alphabetized
v4: Update .gitignore
v5: Libraries will be in the builddir, not the srcdir.

Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
12 years agomesa,st/mesa: implement GL_RGB565 from ARB_ES2_compatibility
Marek Olšák [Thu, 12 Jul 2012 12:07:41 +0000 (14:07 +0200)]
mesa,st/mesa: implement GL_RGB565 from ARB_ES2_compatibility

This was not implemented, because the spec was changed just recently.

Everything has been in place already.

Gallium has PIPE_FORMAT_B5G6R5_UNORM, while Mesa has MESA_FORMAT_RGB565.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Move loop over texture units into brw_populate_sampler_prog_key.
Kenneth Graunke [Sat, 16 Jun 2012 20:50:03 +0000 (13:50 -0700)]
i965: Move loop over texture units into brw_populate_sampler_prog_key.

The whole reason I avoided this was because it might operate on a
brw_vertex_program or a brw_fragment_program.  However, that isn't a
problem: all we need is the gl_program base type.

This avoids awkwardly passing the loop counter 'i' as a parameter,
simplifies both callers, and also plumbs prog in place for future use.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Always emit alpha when nr_color_buffers == 0.
Kenneth Graunke [Thu, 12 Jul 2012 18:25:58 +0000 (11:25 -0700)]
i965: Always emit alpha when nr_color_buffers == 0.

If alpha-testing is enabled, we need to send alpha down the pipeline
even if nr_color_buffers == 0.  However, tracking whether alpha-testing
is enabled in the WM program key is expensive: it causes us to compile
multiple specializations of the same shader, using program cache space.

This patch removes the check for alpha-testing, and simply emits alpha
whenever nr_color_buffers == 0.  We believe this will also be necessary
for alpha-to-coverage, and it should add minimal overhead to an uncommon
case.  Saving the recompiles should more than make up the difference.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.
Kenneth Graunke [Mon, 2 Jul 2012 22:04:00 +0000 (15:04 -0700)]
i965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.

Previously we only did this pre-Gen6, and used pwrite on Gen6+.
In one workload, this cuts significant amount of overhead.

v2: Simplify the function based on Eric's suggestions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agogallivm: Use %.9g to print floats.
José Fonseca [Wed, 11 Jul 2012 19:23:52 +0000 (20:23 +0100)]
gallivm: Use %.9g to print floats.

So that we can see them in their full denormalized glory.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
12 years agoscons: Remove -ffast-math.
José Fonseca [Wed, 11 Jul 2012 19:20:28 +0000 (20:20 +0100)]
scons: Remove -ffast-math.

We rely on proper IEEE 754 behavior in too many places for this.

See also commit 2fdbbeca43e7b57095774e4228e6eea75a180fab with equivalent
change for autoconf.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
12 years agoscons: Also require recent XCB.
José Fonseca [Thu, 12 Jul 2012 20:13:10 +0000 (21:13 +0100)]
scons: Also require recent XCB.

And don't trip when it's not found -- simply skip building src/glx.

12 years agomesa: Require current libxcb.
Eric Anholt [Wed, 4 Jul 2012 18:58:40 +0000 (11:58 -0700)]
mesa: Require current libxcb.

Without that, people with buggy apps that looked at just the server
string for GLX_ARB_create_context would call this function that just
threw an error when you tried to make a context.  Google shows plenty
of complaints about this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoradeon/llvm: Don't use lp_build_swizzle_aos() for swizzles
Tom Stellard [Thu, 12 Jul 2012 14:41:39 +0000 (10:41 -0400)]
radeon/llvm: Don't use lp_build_swizzle_aos() for swizzles

This function assumes that lp_build_context::type is a vector type,
which is not true for r600 or radeonsi.

This fixes an assertion failure using glamor 2D accel.

12 years agoradeonsi: Dump TGSI code prior to doing TGSI->LLVM conversion.
Tom Stellard [Thu, 12 Jul 2012 14:40:47 +0000 (10:40 -0400)]
radeonsi: Dump TGSI code prior to doing TGSI->LLVM conversion.

This way if the conversion fails, we know what the TGSI shader looks
like.

12 years agoi965: Delete previous workaround for textureGrad with shadow samplers.
Kenneth Graunke [Tue, 10 Jul 2012 04:25:37 +0000 (21:25 -0700)]
i965: Delete previous workaround for textureGrad with shadow samplers.

It had many problems:
- The shadow comparison was done post-filtering.
- It required state-dependent recompiles whenever the comparison
  function changed.
- It didn't even work: many cases hit assertion failures.
- I never implemented it for the VS.

The new lowering pass which converts textureGrad to textureLod by
computing the LOD value works much better.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add a lowering pass to convert TXD to TXL by computing the LOD.
Kenneth Graunke [Mon, 9 Jul 2012 18:26:47 +0000 (11:26 -0700)]
i965: Add a lowering pass to convert TXD to TXL by computing the LOD.

Intel hardware doesn't natively support textureGrad with shadow
comparisons.  So we need to generate code to handle it somehow.

Based on the equations of page 205 of the OpenGL 3.0 specification,
it's possible to compute the LOD value that would be selected given the
gradient values.  Then, we can simply convert the TXD to a TXL.

Currently, this passes 34/46 of oglconform's shadow-grad subtests;
four cubemap tests are regressed.  We should investigate this in the
future.

v2: Apply abs() to the scalar case (thanks to Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl/ir_builder: Add a new swizzle_for_size() function.
Kenneth Graunke [Tue, 10 Jul 2012 03:59:29 +0000 (20:59 -0700)]
glsl/ir_builder: Add a new swizzle_for_size() function.

This swizzles away unwanted components, while preserving the order of
the ones that remain.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl/ir_builder: Add a generic constructor for unary expressions.
Kenneth Graunke [Mon, 9 Jul 2012 05:27:25 +0000 (22:27 -0700)]
glsl/ir_builder: Add a generic constructor for unary expressions.

I needed to compute logs and square roots in a patch I was working on,
and wanted to use the convenient interface.  We already have a similar
constructor for binops; adding one for unops seems reasonable.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl: Initialize coordinate to NULL in ir_texture constructor.
Kenneth Graunke [Mon, 9 Jul 2012 19:36:49 +0000 (12:36 -0700)]
glsl: Initialize coordinate to NULL in ir_texture constructor.

I ran into this while trying to create a TXS query, which doesn't have a
coordinate.  Since it didn't get initialized to NULL, a bunch of
visitors tried to access it and crashed.

Most of the time, this won't be a problem, but it's just a good idea.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agost/xorg: Fix build failure due to symbol clash.
José Fonseca [Thu, 12 Jul 2012 15:02:49 +0000 (16:02 +0100)]
st/xorg: Fix build failure due to symbol clash.

12 years agodocs: update relnotes-8.1 and GL3 status
Marek Olšák [Thu, 5 Jul 2012 13:34:42 +0000 (15:34 +0200)]
docs: update relnotes-8.1 and GL3 status

12 years agost/mesa: expose new transform feedback extensions
Marek Olšák [Sun, 18 Dec 2011 03:57:31 +0000 (04:57 +0100)]
st/mesa: expose new transform feedback extensions

12 years agomesa: add ARB_transform_feedback_instanced extension enable flag
Marek Olšák [Sun, 18 Dec 2011 03:54:00 +0000 (04:54 +0100)]
mesa: add ARB_transform_feedback_instanced extension enable flag

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: implement new DrawTransformFeedback functions
Marek Olšák [Sun, 18 Dec 2011 03:51:48 +0000 (04:51 +0100)]
mesa: implement new DrawTransformFeedback functions

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: implement display list support for new DrawTransformFeedback functions
Marek Olšák [Sun, 18 Dec 2011 03:20:42 +0000 (04:20 +0100)]
mesa: implement display list support for new DrawTransformFeedback functions

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: implement display list support for indexed query functions
Marek Olšák [Sun, 18 Dec 2011 03:06:29 +0000 (04:06 +0100)]
mesa: implement display list support for indexed query functions

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: implement indexed query functions from ARB_transform_feedback3
Marek Olšák [Sun, 18 Dec 2011 02:50:10 +0000 (03:50 +0100)]
mesa: implement indexed query functions from ARB_transform_feedback3

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: implement glGet queries and error handling for ARB_transform_feedback3
Marek Olšák [Sun, 18 Dec 2011 01:43:31 +0000 (02:43 +0100)]
mesa: implement glGet queries and error handling for ARB_transform_feedback3

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: implement ARB_transform_feedback3 in the linker
Marek Olšák [Sun, 18 Dec 2011 01:39:34 +0000 (02:39 +0100)]
glsl: implement ARB_transform_feedback3 in the linker

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglapi: add ARB_transform_feedback_instanced
Marek Olšák [Sun, 18 Dec 2011 02:04:11 +0000 (03:04 +0100)]
glapi: add ARB_transform_feedback_instanced

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglapi: add ARB_transform_feedback3
Marek Olšák [Sun, 18 Dec 2011 01:59:55 +0000 (02:59 +0100)]
glapi: add ARB_transform_feedback3

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agor600g: fix uploading non-zero mipmap levels of depth textures
Marek Olšák [Sun, 8 Jul 2012 01:18:48 +0000 (03:18 +0200)]
r600g: fix uploading non-zero mipmap levels of depth textures

This fixes piglit/depth-level-clamp.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: don't flush depth textures set as colorbuffers
Marek Olšák [Sun, 8 Jul 2012 01:10:37 +0000 (03:10 +0200)]
r600g: don't flush depth textures set as colorbuffers

The only case a depth buffer can be set as a color buffer is when flushing.

That wasn't always the case, but now this code isn't required anymore.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: don't set dirty_db_mask for a flushed depth texture
Marek Olšák [Sun, 8 Jul 2012 01:09:06 +0000 (03:09 +0200)]
r600g: don't set dirty_db_mask for a flushed depth texture

A flush depth texture is never set as a depth buffer and never flushed.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: flush depth textures bound to vertex shaders
Marek Olšák [Sun, 8 Jul 2012 00:14:18 +0000 (02:14 +0200)]
r600g: flush depth textures bound to vertex shaders

This was missing/broken. There are also minor code cleanups.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: do fine-grained depth texture flushing
Marek Olšák [Sat, 7 Jul 2012 23:54:24 +0000 (01:54 +0200)]
r600g: do fine-grained depth texture flushing

- maintain a mask of which mipmap levels are dirty (instead of one big flag)
- only flush what was requested at a given point and not the whole resource
  (most often only one level and one layer has to be flushed)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: remove is_flush from DSA state
Marek Olšák [Sat, 7 Jul 2012 17:33:11 +0000 (19:33 +0200)]
r600g: remove is_flush from DSA state

we can just update the state when decompressing, there's no need to add
additional info into the DSA state

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0
Marek Olšák [Sat, 7 Jul 2012 15:11:32 +0000 (17:11 +0200)]
r600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0

this will be useful for in-place DB decompression, otherwise should be harmless

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: move CB_SHADER_MASK setup into cb_misc_state
Marek Olšák [Sat, 7 Jul 2012 07:01:38 +0000 (09:01 +0200)]
r600g: move CB_SHADER_MASK setup into cb_misc_state

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: move MULTIWRITE setup into cb_misc_state for r6xx-r7xx
Marek Olšák [Sat, 7 Jul 2012 05:40:36 +0000 (07:40 +0200)]
r600g: move MULTIWRITE setup into cb_misc_state for r6xx-r7xx

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: move CB_TARGET_MASK setup into new cb_misc_state
Marek Olšák [Sat, 7 Jul 2012 05:15:04 +0000 (07:15 +0200)]
r600g: move CB_TARGET_MASK setup into new cb_misc_state

to remove some overhead from draw_vbo. This is a derived state.

BTW, I've got no idea how compute interacts with 3D here, but it should
use cb_misc_state, so that 3D and compute don't conflict.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agost/mesa: implement accelerated stencil blitting using shader stencil export
Marek Olšák [Mon, 9 Jul 2012 03:08:36 +0000 (05:08 +0200)]
st/mesa: implement accelerated stencil blitting using shader stencil export

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agost/mesa: set colormask to zero when blitting depth
Marek Olšák [Mon, 9 Jul 2012 00:23:22 +0000 (02:23 +0200)]
st/mesa: set colormask to zero when blitting depth

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blit: remove useless memset calls
Marek Olšák [Sun, 8 Jul 2012 23:50:31 +0000 (01:50 +0200)]
gallium/u_blit: remove useless memset calls

the structure is calloc'd.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blit: drop not-very-useful wrapper around util_blit_pixels_writemask
Marek Olšák [Sun, 8 Jul 2012 23:20:11 +0000 (01:20 +0200)]
gallium/u_blit: drop not-very-useful wrapper around util_blit_pixels_writemask

just rename it to util_blit_pixels

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blit: don't do two copies for non-2D textures
Marek Olšák [Sun, 8 Jul 2012 14:02:41 +0000 (16:02 +0200)]
gallium/u_blit: don't do two copies for non-2D textures

Because u_blit couldn't sample a 1D, 3D, CUBE and ARRAY texture, we created
a 2D texture holding a copy of one slice of the source texture (even for 1D).

Let's just do it right.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/util: move pipe_tex_to_tgsi_tex helper function into u_inlines
Marek Olšák [Sun, 8 Jul 2012 13:58:19 +0000 (15:58 +0200)]
gallium/util: move pipe_tex_to_tgsi_tex helper function into u_inlines

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blitter: accelerate stencil-only copying
Marek Olšák [Sat, 7 Jul 2012 22:06:27 +0000 (00:06 +0200)]
gallium/u_blitter: accelerate stencil-only copying

This doesn't seem to be used by anything yet, but better safe than sorry.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blitter: accelerate depth-stencil copying using shader stencil export
Marek Olšák [Sat, 7 Jul 2012 21:48:37 +0000 (23:48 +0200)]
gallium/u_blitter: accelerate depth-stencil copying using shader stencil export

This fixes stencil buffer write transfers on r600g.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium: add util_format_stencil_only helper function
Marek Olšák [Sat, 7 Jul 2012 21:23:49 +0000 (23:23 +0200)]
gallium: add util_format_stencil_only helper function

used for stencil sampler views.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_blitter: minify depth0 when initializing last_layer
Marek Olšák [Sat, 7 Jul 2012 21:06:15 +0000 (23:06 +0200)]
gallium/u_blitter: minify depth0 when initializing last_layer

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agogallium/u_gen_mipmap: accelerate depth texture mipmap generation
Marek Olšák [Sat, 7 Jul 2012 19:28:55 +0000 (21:28 +0200)]
gallium/u_gen_mipmap: accelerate depth texture mipmap generation

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agomesa: remove assertions that do not allow compressed 2D_ARRAY textures
Marek Olšák [Sun, 8 Jul 2012 17:24:37 +0000 (19:24 +0200)]
mesa: remove assertions that do not allow compressed 2D_ARRAY textures

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoi965/msaa: Enable CMS layout on Gen7 for the formats that support it.
Paul Berry [Fri, 6 Jul 2012 01:50:56 +0000 (18:50 -0700)]
i965/msaa: Enable CMS layout on Gen7 for the formats that support it.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Add CMS support to blorp.
Paul Berry [Tue, 3 Jul 2012 15:13:35 +0000 (08:13 -0700)]
i965/msaa: Add CMS support to blorp.

This patch updates the blorp engine to properly handle the case where
the surface being textured from uses Gen7's CMS MSAA layout.  The
following changes were necessary:

- Before reading color values from the surface, we need to read from
  the MCS buffer using the ld_mcs sampler message.  This is done by
  the mcs_fetch() function, and the result is stored in the mcs_data
  register.  This only needs to be done once per pixel, since the MCS
  value is shared between all samples belonging to a pixel.

- When reading color values from the surface, we need to use the
  ld2dms sampler message instead of the ld2dss message, and we need to
  provide the value read from the MCS buffer as an argument.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Add CMS-related sampler messages to brw_defines.h.
Paul Berry [Tue, 3 Jul 2012 18:51:42 +0000 (11:51 -0700)]
i965/msaa: Add CMS-related sampler messages to brw_defines.h.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Set SURFACE_STATE properly when CMS MSAA is in use.
Paul Berry [Tue, 3 Jul 2012 18:36:39 +0000 (11:36 -0700)]
i965/msaa: Set SURFACE_STATE properly when CMS MSAA is in use.

When a buffer using Gen7's CMS MSAA layout is bound to a texture or a
render target, the SURFACE_STATE structure needs to point to the MCS
buffer and to indicate its pitch.  This patch updates the functions
that emit SURFACE_STATE to handle CMS layout properly.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Add CMS MSAA settings to brw_structs.h.
Paul Berry [Tue, 3 Jul 2012 18:05:55 +0000 (11:05 -0700)]
i965/msaa: Add CMS MSAA settings to brw_structs.h.

Previously the DWORD used to control the CMS MSAA layout was just a
pad value, because we didn't use it.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Allocate MCS buffer when CMS MSAA is in use.
Paul Berry [Tue, 3 Jul 2012 15:35:54 +0000 (08:35 -0700)]
i965/msaa: Allocate MCS buffer when CMS MSAA is in use.

To implement Gen7's CMS MSAA layout, we need an extra buffer, the MCS
(Multisample Control Surface) buffer.  This patch introduces code for
allocating and deallocating the buffer, and storing a pointer to it in
the intel_mipmap_tree struct.

No functional change, since the CMS layout is not enabled yet.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Add an enum to describe MSAA layout.
Paul Berry [Wed, 4 Jul 2012 12:48:25 +0000 (05:48 -0700)]
i965/msaa: Add an enum to describe MSAA layout.

From the Ivy Bridge PRM, Vol 1 Part 1, p112:

    There are three types of multisampled surface layouts designated
    as follows:
      - IMS Interleaved Multisampled Surface
      - CMS Compressed Mulitsampled Surface
      - UMS Uncompressed Multisampled Surface

Previously, the i965 driver only used IMS and UMS formats, and
distinguished beetween them using the boolean
intel_mipmap_tree::msaa_is_interleaved.  To facilitate adding support
for the CMS format, this patch replaces that boolean (and other
booleans derived from it) with an enum
INTEL_MSAA_LAYOUT_{IMS,CMS,UMS}.  It also updates the terminology used
in comments throughout the driver to match the IMS/CMS/UMS terminology
used in the PRM.  CMS layout is not yet used.

The enum has a fourth possible value, INTEL_MSAA_LAYOUT_NONE, which is
used for non-multisampled surfaces.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/msaa: Move {rt,tex}_interleaved into blorp program key.
Paul Berry [Thu, 5 Jul 2012 17:28:24 +0000 (10:28 -0700)]
i965/msaa: Move {rt,tex}_interleaved into blorp program key.

On Gen6, MSAA buffers always use an interleaved layout and non-MSAA
buffers always use a non-interleaved layout, so it is not strictly
necessary to keep track of the layout of the texture and render target
surfaces in the blorp program key.  However, it is cleaner to do so,
since (a) it makes the blorp compiler less dependent on implicit
knowledge about how the GPU pipeline is configured, and (b) it paves
the way for implementing compressed multisampled surfaces in Gen7.

This patch won't cause any redundant compiles, because the layout of
the texture and render target surfaces depends on other parameters
that are already in the blorp program key.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agomapi: Move GL_NV_draw_buffers extension to es_EXT.xml
Kristian Høgsberg [Wed, 11 Jul 2012 03:15:28 +0000 (23:15 -0400)]
mapi: Move GL_NV_draw_buffers extension to es_EXT.xml

We don't generate public entrypoints for GLES extensions, so move the
GL_NV_draw_buffers definition from ARB_draw_buffers.xml to es_EXT.xml.
When the extension is defined in ARB_draw_buffers.xml, we end up with a
public entry point for it, but no prototype, which gives an error when
compiled with --disable-asm and --disable-shared-glapi.

Instead, just move the GLES extension to es_EXT.xml so this doesn't happen.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agoegl: Add EGL_WAYLAND_PLANE_WL attribute
Kristian Høgsberg [Thu, 5 Jul 2012 20:43:04 +0000 (16:43 -0400)]
egl: Add EGL_WAYLAND_PLANE_WL attribute

This lets us specify the plane to create the image for for multiplanar
wl_buffers.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agowayland-drm: Add protocol to create planar buffers
Kristian Høgsberg [Thu, 5 Jul 2012 20:27:05 +0000 (16:27 -0400)]
wayland-drm: Add protocol to create planar buffers

12 years agowayland-drm: Pass struct wl_drm_buffer to the driver
Kristian Høgsberg [Thu, 5 Jul 2012 18:19:48 +0000 (14:19 -0400)]
wayland-drm: Pass struct wl_drm_buffer to the driver

We're going to extend this to support multi-plane buffers, so pass this
to the driver so it can access the details.

12 years agointel: Implement __DRIimage::createSubImage and bump supported version to 5
Kristian Høgsberg [Thu, 5 Jul 2012 17:02:02 +0000 (13:02 -0400)]
intel: Implement __DRIimage::createSubImage and bump supported version to 5

We use the new miptree offset to pick out the sub-image when we bind
the EGLImage to a texture.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agointel: Add offset field to miptree
Kristian Høgsberg [Thu, 5 Jul 2012 03:09:14 +0000 (23:09 -0400)]
intel: Add offset field to miptree

This lets us specify an offset into the bo where the miptree starts,
which will let us set up a texture for a single plane in a planar buffer.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agointel: Add support for new __DRIimage formats
Kristian Høgsberg [Thu, 5 Jul 2012 16:13:06 +0000 (12:13 -0400)]
intel: Add support for new __DRIimage formats

12 years ago__DRIimage: version 5, add new formats and createSubImage
Kristian Høgsberg [Thu, 5 Jul 2012 02:56:09 +0000 (22:56 -0400)]
__DRIimage: version 5, add new formats and createSubImage

The additions in version 5 enables creating EGLImages for different planes
of a YUV buffer.  createImageFromName is still used to create the containing
__DRIimage, and createSubImage can then be used no that __DRIimage to create
__DRIimages that correspond to the y, u, and v planes (__DRI_IMAGE_FORMAT_R8)
or the uv planes (__DRI_IMAGE_FORMAT_RG88) for formats such as NV12 where
the u and v components are interleaved.  Packed formats such as YUYV etc
doesn't require any special treatment, we just sample those as a regular
ARGB texture.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>