mesa.git
10 years agoi965: Fix the region's pitch condition to use blitter
Anuj Phogat [Wed, 8 Jan 2014 01:46:45 +0000 (17:46 -0800)]
i965: Fix the region's pitch condition to use blitter

intelEmitCopyBlit uses a signed 16-bit integer to represent
buffer pitch, so it can only handle buffer pitches < 32k.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: add switch case for MESA_SHADER_COMPUTE
Brian Paul [Tue, 25 Feb 2014 19:38:45 +0000 (12:38 -0700)]
glsl: add switch case for MESA_SHADER_COMPUTE

To fix warning about unhandled enum value.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agometa: Use a #define for the vector type to avoid %svec4 everywhere.
Kenneth Graunke [Sat, 22 Feb 2014 03:15:10 +0000 (19:15 -0800)]
meta: Use a #define for the vector type to avoid %svec4 everywhere.

By adding "#define gvec4 %svec4" to the top of our fragment shader, we
can write generic code without needing to specialize it to vec4, ivec4,
or uvec4 via asprintf.

This also makes the INT and UNSIGNED_INT merge function code identical,
so I combined those two cases.

It's not a big savings, but a little bit tidier.

v2: Rebase on Vinson's MSVC build fixes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Don't try to dump shader source for fixed-function FS programs.
Kenneth Graunke [Wed, 26 Feb 2014 06:15:30 +0000 (22:15 -0800)]
i965: Don't try to dump shader source for fixed-function FS programs.

sh->Source is NULL and this will segfault.

Fixes MESA_GLSL=dump with "The Swapper".

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Don't forget to subtract mt->first_level in minify calls.
Kenneth Graunke [Sun, 23 Feb 2014 07:47:30 +0000 (23:47 -0800)]
i965: Don't forget to subtract mt->first_level in minify calls.

This fixes fbo-clear-formats GL_ARB_depth_texture on Ironlake, which
regressed since commit f128bcc7c293013f4b44e4b661638333de0077c2
("i965: Drop mt->levels[].width/height.")  intel_miptree_copy_slice was
calling minify(.., 7) on a 2x2 texture with mt->first_level == 7.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75292
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Delete LRP_TO_ARITH lowering pass flag.
Kenneth Graunke [Mon, 24 Feb 2014 00:34:04 +0000 (16:34 -0800)]
glsl: Delete LRP_TO_ARITH lowering pass flag.

Tt's kind of a trap---calling do_common_optimization() after
lower_instructions() may cause opt_algebraic() to reintroduce
ir_triop_lrp expressions that were lowered, effectively defeating the
point.  Because of this, nobody uses it.

v2: Delete more code (caught by Ian Romanick).

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Stop lowering ir_triop_lrp.
Kenneth Graunke [Mon, 24 Feb 2014 00:32:39 +0000 (16:32 -0800)]
i965: Stop lowering ir_triop_lrp.

Both the vector and scalar backends now support it natively, so there's
no point in lowering it.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4: Handle ir_triop_lrp on Gen4-5 as well.
Kenneth Graunke [Mon, 24 Feb 2014 00:29:46 +0000 (16:29 -0800)]
i965/vec4: Handle ir_triop_lrp on Gen4-5 as well.

When the vec4 backend encountered an ir_triop_lrp, it always emitted an
actual LRP instruction, which only exists on Gen6+.  Gen4-5 used
lower_instructions() to decompose ir_triop_lrp at the IR level.

Since commit 8d37e9915a3b21 ("glsl: Optimize open-coded lrp into lrp."),
we've had an bug where lower_instructions translates ir_triop_lrp into
arithmetic, but opt_algebraic reassembles it back into a lrp.

To avoid this ordering concern, just handle ir_triop_lrp in the backend.
The FS backend already does this, so we may as well do likewise.

v2: Add a comment reminding us that we could emit better assembly if we
    implemented the infrastructure necessary to support using MAC.
    (Assembly code provided by Eric Anholt).

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75253
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4: Add a brw->gen >= 6 assertion in three-source emitters.
Kenneth Graunke [Mon, 24 Feb 2014 00:08:56 +0000 (16:08 -0800)]
i965/vec4: Add a brw->gen >= 6 assertion in three-source emitters.

Three source instructions didn't exist until Gen6.  vec4_generator has
assertions to catch this, but catching it in the visitor provides a
nicer backtrace.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agoilo: create u_upload_mgr last
Chia-I Wu [Wed, 26 Feb 2014 03:29:18 +0000 (11:29 +0800)]
ilo: create u_upload_mgr last

Similar to u_blitter, u_upload_mgr is now a client of the pipe context.  Its
creation needs to be delayed until the context has been (almost) initialized.

10 years agoglx: Fix the GLXFBConfig attrib sort priorities
Fredrik Höglund [Sat, 15 Feb 2014 17:48:40 +0000 (18:48 +0100)]
glx: Fix the GLXFBConfig attrib sort priorities

The sort priorites for GLX_SAMPLES and GLX_SAMPLE_BUFFERS are
not defined in GL_ARB_multisample, but they are defined in
the GLX 1.4 specification.

Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx: Fix the default values for GLXFBConfig attributes
Fredrik Höglund [Thu, 13 Feb 2014 20:07:09 +0000 (21:07 +0100)]
glx: Fix the default values for GLXFBConfig attributes

The default values for GLX_DRAWABLE_TYPE and GLX_RENDER_TYPE are
GLX_WINDOW_BIT and GLX_RGBA_BIT respectively, as specified in
the GLX 1.4 specification.

This fixes the glx-choosefbconfig-defaults piglit test.

Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoRe-commit 'clover: Fix build with LLVM 3.5'
Tom Stellard [Tue, 25 Feb 2014 21:32:37 +0000 (13:32 -0800)]
Re-commit 'clover: Fix build with LLVM 3.5'

This was accidentally reverted in 9dfd7c5f75c806801b1b4b4d405899236c09ba75

10 years agomesa: Add GL_ARB_buffer_storage to dispatch_sanity.cpp.
Vinson Lee [Tue, 25 Feb 2014 20:18:41 +0000 (12:18 -0800)]
mesa: Add GL_ARB_buffer_storage to dispatch_sanity.cpp.

Fixes 'make check' failure introduced with commit
119ffa7307d62e7310ce3902fded662ee4021c92.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75503
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoRevert "Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa"
Timothy Arceri [Tue, 25 Feb 2014 21:46:08 +0000 (08:46 +1100)]
Revert "Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa"

This reverts commit 1b79582f322d4a89dd6d197c8d4962c788ae7f25, reversing
changes made to 376a98d345dfc3da8d5b0f1e489196f861c4e754.

10 years agoMerge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa
Timothy Arceri [Tue, 25 Feb 2014 21:39:32 +0000 (08:39 +1100)]
Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa

ry,

10 years agoclover: Fix build with LLVM 3.5
Tom Stellard [Tue, 25 Feb 2014 21:32:37 +0000 (13:32 -0800)]
clover: Fix build with LLVM 3.5

10 years agoglsl: removed unused dimension_count varible
Timothy Arceri [Tue, 25 Feb 2014 21:31:25 +0000 (08:31 +1100)]
glsl: removed unused dimension_count varible

This variable is no longer needed after the cleanup to the
code prior to the first arrays of array series

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agobuild: llvm libs may not be in system search path, add rpath
Ilia Mirkin [Mon, 24 Feb 2014 17:43:17 +0000 (12:43 -0500)]
build: llvm libs may not be in system search path, add rpath

On my gentoo system, llvm libs are in /usr/lib64/llvm, and llvm-config
--ldflags does not provide the rpath (it does, of course, provide a -L).
This adds the llvm dir to the rpath. It should be harmless if the path
is a system path, and should make things work when it's not.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965: Fix segfaults since the buffer_storage changes.
Eric Anholt [Tue, 25 Feb 2014 19:35:49 +0000 (11:35 -0800)]
i965: Fix segfaults since the buffer_storage changes.

10 years agodocs: update nv50 support
Ilia Mirkin [Tue, 25 Feb 2014 19:41:15 +0000 (14:41 -0500)]
docs: update nv50 support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: enable txg where supported
Ilia Mirkin [Thu, 20 Feb 2014 02:29:40 +0000 (21:29 -0500)]
nv50: enable txg where supported

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: enable cube map array texture support
Ilia Mirkin [Fri, 7 Feb 2014 22:42:58 +0000 (17:42 -0500)]
nv50: enable cube map array texture support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agolibgl-xlib: add -Isrc/gallium/winsys flag
Brian Paul [Tue, 25 Feb 2014 16:56:49 +0000 (09:56 -0700)]
libgl-xlib: add -Isrc/gallium/winsys flag

So that sw/xlib/xlib_sw_winsys.h can be found.  Fixes a build break.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agost/mesa: add comment to explain _min(), _maxf(), etc. functions
Brian Paul [Tue, 25 Feb 2014 16:53:49 +0000 (09:53 -0700)]
st/mesa: add comment to explain _min(), _maxf(), etc. functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g,radeonsi: consolidate create_surface and surface_destroy
Marek Olšák [Sun, 9 Feb 2014 22:25:06 +0000 (23:25 +0100)]
r600g,radeonsi: consolidate create_surface and surface_destroy

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: inline util_blitter_copy_texture
Marek Olšák [Tue, 11 Feb 2014 02:02:35 +0000 (03:02 +0100)]
radeonsi: inline util_blitter_copy_texture

This will be used for changing texture properties without modifying
pipe_resource like r600g, but not in this series. For now, this change
allows consolidation of pipe_surface functions.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: remove useless psbox variable from resource_copy_region
Marek Olšák [Tue, 11 Feb 2014 00:50:03 +0000 (01:50 +0100)]
radeonsi: remove useless psbox variable from resource_copy_region

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: compute depth surface registers only once
Marek Olšák [Sun, 9 Feb 2014 22:05:13 +0000 (23:05 +0100)]
radeonsi: compute depth surface registers only once

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: compute color surface registers only once
Marek Olšák [Sun, 9 Feb 2014 21:16:48 +0000 (22:16 +0100)]
radeonsi: compute color surface registers only once

Same as r600g.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: remove r600_resource.h
Marek Olšák [Sun, 9 Feb 2014 18:34:59 +0000 (19:34 +0100)]
r600g: remove r600_resource.h

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: remove r600_surface::htile_enabled
Marek Olšák [Sun, 9 Feb 2014 18:30:09 +0000 (19:30 +0100)]
r600g: remove r600_surface::htile_enabled

v2: use one of the htile registers instead

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: use r600_surface::db_z_info
Marek Olšák [Sun, 9 Feb 2014 18:25:45 +0000 (19:25 +0100)]
r600g: use r600_surface::db_z_info

db_z_info was unused. This just renames the variable to match the register
name.

Now, db_depth_info is unused on Evergreen.
Both variables will be needed on SI though.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g,radeonsi: share r600_surface
Marek Olšák [Sun, 9 Feb 2014 18:23:58 +0000 (19:23 +0100)]
r600g,radeonsi: share r600_surface

I'm gonna use this in radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to framebuffer state
Marek Olšák [Sun, 9 Feb 2014 16:42:00 +0000 (17:42 +0100)]
radeonsi: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to framebuffer state

It doesn't depend on anything else.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agomesa: allow buffers to be mapped multiple times
Marek Olšák [Thu, 6 Feb 2014 18:24:23 +0000 (19:24 +0100)]
mesa: allow buffers to be mapped multiple times

OpenGL allows a buffer to be mapped only once, but we also map buffers
internally, e.g. in the software primitive restart fallback, for PBOs,
vbo_get_minmax_index, etc. This has always been a problem, but it will
be a bigger problem with persistent buffer mappings, which will prevent
all Mesa functions from mapping buffers for internal purposes.

This adds a driver interface to core Mesa which supports multiple buffer
mappings and allows 2 mappings: one for the GL user and one for Mesa.

Note that Gallium supports an unlimited number of buffer and texture
mappings, so it's not really an issue for Gallium.

v2: fix unmapping in xm_dd.c, remove the GL errors there
v3: fix the intel driver (by Fredrik)

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agodocs: update ARB_buffer_storage status
Marek Olšák [Wed, 29 Jan 2014 02:20:32 +0000 (03:20 +0100)]
docs: update ARB_buffer_storage status

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agogallium/upload_mgr: remove useless variable "size"
Marek Olšák [Mon, 27 Jan 2014 23:53:28 +0000 (00:53 +0100)]
gallium/upload_mgr: remove useless variable "size"

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agogallium/upload_mgr: don't unmap buffers if persistent mappings are supported
Marek Olšák [Mon, 27 Jan 2014 21:28:56 +0000 (22:28 +0100)]
gallium/upload_mgr: don't unmap buffers if persistent mappings are supported

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agogallium: the other drivers don't support ARB_buffer_storage
Marek Olšák [Mon, 27 Jan 2014 20:57:42 +0000 (21:57 +0100)]
gallium: the other drivers don't support ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agor300g,r600g,radeonsi: add support for ARB_buffer_storage
Marek Olšák [Mon, 27 Jan 2014 20:46:21 +0000 (21:46 +0100)]
r300g,r600g,radeonsi: add support for ARB_buffer_storage

All GTT memory mappings are coherent and therefore can be persistent.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agost/mesa: implement ARB_buffer_storage
Marek Olšák [Mon, 27 Jan 2014 20:45:54 +0000 (21:45 +0100)]
st/mesa: implement ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agogallium: add interface for persistent and coherent buffer mappings
Marek Olšák [Mon, 27 Jan 2014 20:42:07 +0000 (21:42 +0100)]
gallium: add interface for persistent and coherent buffer mappings

Required for ARB_buffer_storage.

10 years agomesa: allow buffers mapped with the persistent flag to be used by the GPU
Marek Olšák [Mon, 27 Jan 2014 20:36:53 +0000 (21:36 +0100)]
mesa: allow buffers mapped with the persistent flag to be used by the GPU

v2: also fixed InvalidateBufferData, added citations from the 4.4 spec

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agomesa: add error checks to glMapBufferRange, glMapBuffer for ARB_buffer_storage
Marek Olšák [Mon, 27 Jan 2014 20:31:58 +0000 (21:31 +0100)]
mesa: add error checks to glMapBufferRange, glMapBuffer for ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agoglapi: add ARB_buffer_storage
Marek Olšák [Mon, 27 Jan 2014 11:56:11 +0000 (12:56 +0100)]
glapi: add ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agomesa: implement glBufferStorage, immutable buffers; add extension enable flag
Marek Olšák [Mon, 27 Jan 2014 20:22:43 +0000 (21:22 +0100)]
mesa: implement glBufferStorage, immutable buffers; add extension enable flag

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
v2: dropped the error that DYNAMIC_STORAGE is required for MAP_WRITE_BIT,
    the error is removed in the latest revision of GL 4.4

10 years agomesa: add storage flags parameter to Driver.BufferData
Marek Olšák [Mon, 27 Jan 2014 20:15:19 +0000 (21:15 +0100)]
mesa: add storage flags parameter to Driver.BufferData

It will be used by glBufferStorage. The parameters are chosen according
to ARB_buffer_storage.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agomesa: remove unused driver hook BindBuffer
Marek Olšák [Mon, 27 Jan 2014 11:57:28 +0000 (12:57 +0100)]
mesa: remove unused driver hook BindBuffer

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
10 years agonv50: correctly calculate the number of vertical blocks during transfer map
Emil Velikov [Mon, 24 Feb 2014 16:46:19 +0000 (16:46 +0000)]
nv50: correctly calculate the number of vertical blocks during transfer map

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agost/mesa: add texture gather support. (v2)
Dave Airlie [Fri, 7 Feb 2014 01:37:31 +0000 (11:37 +1000)]
st/mesa: add texture gather support. (v2)

This adds support for GL_ARB_texture_gather, and one step of
support for GL_ARB_gpu_shader5.

This adds support for passing the TG4 instruction, along
with non-constant texture offsets, and tracking them for the
optimisation passes.

This doesn't support native textureGatherOffsets hw, to do that
you'd need to add a CAP and if set disable the lowering pass,
and bump the MAX offsets to 4, then do the i0,j0 sampling using
those.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agogallium: add texture gather support to gallium (v3)
Dave Airlie [Sat, 21 Sep 2013 08:45:43 +0000 (18:45 +1000)]
gallium: add texture gather support to gallium (v3)

This adds support to gallium for a TG4 instruction,
and two CAPs. The first CAP is required for GL_ARB_texture_gather.

The second CAP is required to expose GL_ARB_gpu_shader5.

However so far we haven't found any hardware that natively
exposes the textureGatherOffsets feature from GL, so just
lower it for now. If hardware appears for this we can add
another CAP to allow TG4 to take 4 offsets.

v2: add component selection src and a cap to say
hw can do it. (st can use to help control
GL_ARB_gpu_shader5/GLSL 4.00). Add docs.

v3: rename to SM5, add docs.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoglsl/i965: move lower_offset_array up to GLSL compiler level.
Dave Airlie [Mon, 10 Feb 2014 23:41:44 +0000 (09:41 +1000)]
glsl/i965: move lower_offset_array up to GLSL compiler level.

This lowering pass will be useful for gallium drivers as well, in order to support
the GL TG4 oddity that is textureGatherOffsets.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoclover: Pass buffer offsets to the driver in set_global_binding() v3
Tom Stellard [Thu, 13 Feb 2014 22:46:25 +0000 (14:46 -0800)]
clover: Pass buffer offsets to the driver in set_global_binding() v3

The offsets will be stored in the handles parameter.  This makes
it possible to use sub-buffers.

v2:
  - Style fixes
  - Add support for constant sub-buffers
  - Store handles in device byte order

v3:
  - Use endian helpers

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoradeonsi: Use SI_BIG_ENDIAN now that it exists
Tom Stellard [Wed, 19 Feb 2014 22:19:53 +0000 (14:19 -0800)]
radeonsi: Use SI_BIG_ENDIAN now that it exists

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: Use util_cpu_to_le32() instead of bswap32() on big-endian systems
Tom Stellard [Thu, 20 Feb 2014 15:51:24 +0000 (07:51 -0800)]
r600g: Use util_cpu_to_le32() instead of bswap32() on big-endian systems

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: Use util_cpu_to_le32() instead of bswap32() on big-endian systems
Tom Stellard [Thu, 20 Feb 2014 17:03:53 +0000 (09:03 -0800)]
radeonsi: Use util_cpu_to_le32() instead of bswap32() on big-endian systems

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoutil: Add util_cpu_to_le* helpers
Tom Stellard [Thu, 20 Feb 2014 15:46:28 +0000 (07:46 -0800)]
util: Add util_cpu_to_le* helpers

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoutil: Add util_bswap64() v3
Tom Stellard [Wed, 19 Feb 2014 22:17:33 +0000 (14:17 -0800)]
util: Add util_bswap64() v3

v2:
  - Use __builtin_bswap64()
  - Remove unnecessary mask
  - Add util_le64_to_cpu() helper

v3:
  - Remove unnecessary AC_SUBST

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoconfigure.ac: Use AX_GCC_BUILTIN to check availability of __builtin_bswap32 v2
Tom Stellard [Thu, 20 Feb 2014 15:31:16 +0000 (07:31 -0800)]
configure.ac: Use AX_GCC_BUILTIN to check availability of __builtin_bswap32 v2

v2:
  - Remove unnecessary AC_SUBST

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/opencl: resolve undefined symbols at link time
Emil Velikov [Sun, 23 Feb 2014 20:29:57 +0000 (20:29 +0000)]
targets/opencl: resolve undefined symbols at link time

Current automake build does not try to resolve undefined
symbols thus we could end up with a broken library.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agogallium/targets: resolve undefined reference to pipe_loader_sw_probe_dri
Emil Velikov [Mon, 24 Feb 2014 14:20:36 +0000 (14:20 +0000)]
gallium/targets: resolve undefined reference to pipe_loader_sw_probe_dri

With the introduction of the pipe_loader_sw_probe_dri helper we
require the sw/dri winsys during linking stage despite it being
unused by any of the targets. This will cause a minor increase
in the resulting library which will be cleaned up via linker
options with upcoming patches.

v2: Link with libswdri.la only when available.

Reported-and-tested-by: Tom Stellard <thomas.stellard@amd.com> (v1)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: correctly report if we're building the sw/xlib winsys
Emil Velikov [Sat, 22 Feb 2014 16:47:21 +0000 (16:47 +0000)]
configure: correctly report if we're building the sw/xlib winsys

While looking at bug 75356, I've noticed that the presence of
x11 egl platform pulls in sw/xlib as "needed" but fails to
report so at the end of configure.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: wrap pipe_loader_sw_probe_xlib within HAVE_PIPE_LOADER_XLIB
Emil Velikov [Sat, 22 Feb 2014 16:44:14 +0000 (16:44 +0000)]
pipe-loader: wrap pipe_loader_sw_probe_xlib within HAVE_PIPE_LOADER_XLIB

The above function implies using the the xlib winsys, which
has additional library dependencies that should not be forced.

Make the software xlib pipe loader optional thus avoid all
the dependency hell. A user that wishes to use the particular
pipe-loader would need to set the following within configure.ac.

 enable_gallium_xlib_loader=yes

v2:
 - Wrap sw/xlib/xlib_sw_winsys.h to handle compilation on systems
lacking X11 headers. Spotted by Christian Prochaska.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75356
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/gbm: exit gracefully if pipe_loader_drm_probe_fd is not available
Emil Velikov [Sat, 22 Feb 2014 16:20:04 +0000 (16:20 +0000)]
targets/gbm: exit gracefully if pipe_loader_drm_probe_fd is not available

When one builds without gallium_drm_loader, the above function will
not be available, thus we'll segfault in gallium_screen_create due
to memory access violation.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75335
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965: Don't try to use the hardware blitter for multisampled miptrees.
Kenneth Graunke [Sat, 22 Feb 2014 03:15:51 +0000 (19:15 -0800)]
i965: Don't try to use the hardware blitter for multisampled miptrees.

The blitter is completely ignorant of MSAA buffer layouts, so any
attempt to use BLT paths with MSAA buffers is likely to break
spectacularly.

In most cases, BLORP handles MSAA blits, so we never hit this bug.
Until recently, it also wasn't worth fixing, since Meta couldn't handle
MSAA either, so there was nothing to fall back to.  But now there is.

+143 piglit tests on Broadwell (which doesn't have BLORP support).
Surprisingly, three also start failing.  Since non-IMS MSAA buffers
store samples in successive array slices, using the blitter ought to
access sample 0 and ignore the rest, which is apparently good enough for
a few not-very-picky Piglit tests.  Presumably the meta replacement code
is still broken.

No Piglit changes on Ivybridge.

v2: Move the early return to the top of the function (suggested by
    Paul).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agofreedreno/a3xx/compiler: half-precision output
Rob Clark [Sat, 22 Feb 2014 14:46:39 +0000 (09:46 -0500)]
freedreno/a3xx/compiler: half-precision output

Using generic shaders caused a measurable fps drop, which was isolated to
use of full precision (vs half precision) output.  This is an attempt to
regain that lost performance by using half precision solid/blit shaders
(when the output format is not float32).

Note: for the built-in shaders, I would not expect them to be register
starved.  And in fact it is the solid frag shader that seems to have the
biggest impact.  So I suspect you get double the pixel pipe units (or
half the cycles) when the output is half precision.  So there may be
some gain to using half precision output for application shaders as
well, even though the rest of register usage is still full precision.
But for half precision to work for more complex shaders, we need to deal
with some constraints, like cat2 needing same precision for it's two src
registers.  So for now it is not enabled by default except for the
built-in shaders.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: add shader variants
Rob Clark [Sat, 22 Feb 2014 00:17:43 +0000 (19:17 -0500)]
freedreno/a3xx: add shader variants

Start putting in place infrastructure to deal with multiple shader
variants.  Initially we'll use this for two sided color (frag) and
binning pass (vert) shaders.  Possibly need for others later (such
as YUV vs RGB eglImage?).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx/compiler: collapse nop's with repeat
Rob Clark [Fri, 21 Feb 2014 23:03:30 +0000 (18:03 -0500)]
freedreno/a3xx/compiler: collapse nop's with repeat

Easier than making more extensive use of rpt, and the more compact
shaders seem to bring some bit of performance boost.  (Perhaps repeat
flag benefits are more than just instruction cache, possibly it saves
on instruction decode as well?)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: drop hand-coded blit/solid shaders
Rob Clark [Fri, 21 Feb 2014 19:36:11 +0000 (14:36 -0500)]
freedreno/a3xx: drop hand-coded blit/solid shaders

Instead in the common code, construct these shaders from TGSI.  For now
we let a2xx keep it's hand coded shaders, as it's compiler isn't quite
up to the job yet.  All the same it is a net drop in code size and gets
rid of special cases.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/lowering: cleanup api
Rob Clark [Sun, 23 Feb 2014 19:39:04 +0000 (14:39 -0500)]
freedreno/lowering: cleanup api

Make things configurable, and tweak the API a bit to avoid an extra
tgsi_shader_scan().  Getting closer to something generic which can be
moved out of freedreno and shaderd by other drivers.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: add float 16 and 32bit formats
Rob Clark [Sun, 23 Feb 2014 19:29:59 +0000 (14:29 -0500)]
freedreno/a3xx: add float 16 and 32bit formats

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: resync generated headers
Rob Clark [Sun, 23 Feb 2014 19:29:22 +0000 (14:29 -0500)]
freedreno: resync generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoglx/drisw: use the implemented version of __DRIswrastLoaderExtension
Emil Velikov [Wed, 12 Feb 2014 20:08:07 +0000 (20:08 +0000)]
glx/drisw: use the implemented version of __DRIswrastLoaderExtension

... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri: use the implemented version of __DRIdamageExtension
Emil Velikov [Wed, 12 Feb 2014 19:53:52 +0000 (19:53 +0000)]
glx/dri: use the implemented version of __DRIdamageExtension

... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri_common: use the implemented version of __DRIsystemTimeExtension
Emil Velikov [Wed, 12 Feb 2014 19:50:53 +0000 (19:50 +0000)]
glx/dri_common: use the implemented version of __DRIsystemTimeExtension

... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri: use the implemented version of __DRIgetDrawableInfoExtension
Emil Velikov [Wed, 12 Feb 2014 19:45:41 +0000 (19:45 +0000)]
glx/dri: use the implemented version of __DRIgetDrawableInfoExtension

... over the one provided by the headers.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_util: use the implemented version of __DRIimageDriverExtension
Emil Velikov [Wed, 12 Feb 2014 18:51:49 +0000 (18:51 +0000)]
dri_util: use the implemented version of __DRIimageDriverExtension

... over the one provided by the headers.

Currently both versions are identical, but that is not
guaranteed to be the case in the future.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri3: set the implemented version of __DRIimageLoaderExtension
Emil Velikov [Wed, 12 Feb 2014 18:46:32 +0000 (18:46 +0000)]
glx/dri3: set the implemented version of __DRIimageLoaderExtension

... over the one provided by the spec.
Currently both versions are identical, but that is not
guaranteed to be the case in the future.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogbm: explicitly set __DRIimageLoaderExtension members
Emil Velikov [Wed, 12 Feb 2014 18:43:11 +0000 (18:43 +0000)]
gbm: explicitly set __DRIimageLoaderExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoegl/wayland: explicitly set __DRIimageLoaderExtension members
Emil Velikov [Wed, 12 Feb 2014 18:32:59 +0000 (18:32 +0000)]
egl/wayland: explicitly set __DRIimageLoaderExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>y
10 years agodrivers/dri: explicitly set __DRI2flushExtension members
Emil Velikov [Wed, 12 Feb 2014 18:21:46 +0000 (18:21 +0000)]
drivers/dri: explicitly set __DRI2flushExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>y
10 years agogbm: explicitly set __DRIdri2LoaderExtension members
Emil Velikov [Wed, 12 Feb 2014 19:25:39 +0000 (19:25 +0000)]
gbm: explicitly set __DRIdri2LoaderExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>y
10 years agoglx/dri2: set the implemented version of __DRIdri2LoaderExtension
Emil Velikov [Wed, 12 Feb 2014 18:07:15 +0000 (18:07 +0000)]
glx/dri2: set the implemented version of __DRIdri2LoaderExtension

... over the version number provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_interface: note introduction of __DRIdri2LoaderExtension members
Emil Velikov [Wed, 12 Feb 2014 19:05:08 +0000 (19:05 +0000)]
dri_interface: note introduction of __DRIdri2LoaderExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_interface: note introduction of various __DRItexBufferExtension members
Emil Velikov [Wed, 12 Feb 2014 19:00:21 +0000 (19:00 +0000)]
dri_interface: note introduction of various __DRItexBufferExtension members

Note the member function releaseTexBuffer was added without
bumping spec version, and currently no drivers implement it.

v2: releaseTexBuffer was introduced by version 3

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_interface: Note the version introducing __DRIswrastLoaderExtensionRec::putImage2
Emil Velikov [Tue, 18 Feb 2014 02:31:27 +0000 (02:31 +0000)]
dri_interface: Note the version introducing __DRIswrastLoaderExtensionRec::putImage2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_util: explicitly set __DRIcopySubBufferExtension members
Emil Velikov [Wed, 12 Feb 2014 17:17:28 +0000 (17:17 +0000)]
dri_util: explicitly set __DRIcopySubBufferExtension members

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_util: explicitly set __DRIswrastExtension members.
Emil Velikov [Wed, 12 Feb 2014 17:08:43 +0000 (17:08 +0000)]
dri_util: explicitly set __DRIswrastExtension members.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Pass stdout to _mesa_print_ir from st_glsl_to_tgsi.
Kenneth Graunke [Sun, 23 Feb 2014 06:08:55 +0000 (22:08 -0800)]
glsl: Pass stdout to _mesa_print_ir from st_glsl_to_tgsi.

Fixes the Gallium build since commit 1e3bd9f9a5af90295788c5d71ea27c.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75389
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Move the remaining driver debug over to stderr.
Eric Anholt [Mon, 23 Dec 2013 08:56:20 +0000 (00:56 -0800)]
i965: Move the remaining driver debug over to stderr.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Move compiler debugging output to stderr.
Eric Anholt [Mon, 23 Dec 2013 07:29:31 +0000 (23:29 -0800)]
i965: Move compiler debugging output to stderr.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoglsl: Add a file argument to the IR printer.
Eric Anholt [Fri, 21 Feb 2014 02:00:23 +0000 (18:00 -0800)]
glsl: Add a file argument to the IR printer.

While we want to be able to print to stdout for glsl_compiler, for
debugging drivers we want to be able to dump to stderr because that's
where other driver debug (like LIBGL_DEBUG) tends to go, and because some
apps actually close stdout to shut up their own messages (such as the X
Server, or NWN).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Refactor debug dumping of GLSL IR.
Eric Anholt [Fri, 21 Feb 2014 02:23:52 +0000 (18:23 -0800)]
i965: Refactor debug dumping of GLSL IR.

This was only going to get worse when tesselation shows up, and was
causing too much extra duplication in my stderr changes coming up.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agointel: Remove some dead code I noticed in intel_screen.c.
Eric Anholt [Thu, 20 Feb 2014 22:49:50 +0000 (14:49 -0800)]
intel: Remove some dead code I noticed in intel_screen.c.

It was present in the initial i915tex import.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Use the object label when available for INTEL_DEBUG=vs,gs,fs output.
Eric Anholt [Thu, 20 Feb 2014 21:31:40 +0000 (13:31 -0800)]
i965: Use the object label when available for INTEL_DEBUG=vs,gs,fs output.

Note that this requires updated run.py in shader_db.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Use the object label when available for shader_time output.
Eric Anholt [Thu, 20 Feb 2014 21:26:45 +0000 (13:26 -0800)]
i965: Use the object label when available for shader_time output.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agometa: Set some object labels on our meta shaders.
Eric Anholt [Thu, 20 Feb 2014 21:22:12 +0000 (13:22 -0800)]
meta: Set some object labels on our meta shaders.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agonv50: make sure to clear _all_ layers of all attachments
Ilia Mirkin [Thu, 13 Feb 2014 10:10:23 +0000 (05:10 -0500)]
nv50: make sure to clear _all_ layers of all attachments

Unfortunately there's only one RT_ARRAY_MODE setting for all
attachments, so clears were previously truncated to the minimum number
of layers any attachment had. Instead set the RT_ARRAY_MODE to 512 (the
max number of layers) before doing the clear. This fixes
gl-3.2-layered-rendering-clear-color-mismatched-layer-count.

Also fix clears of individual layered rt/zeta, in case it ever happens.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Cc: 10.1 <mesa-stable@lists.freedesktop.org>
10 years agoilo: fix and enable fast depth clear
Chia-I Wu [Thu, 16 Jan 2014 07:29:03 +0000 (15:29 +0800)]
ilo: fix and enable fast depth clear

Use tex->bo_format instead of zs->format in ilo_blitter_rectlist_clear_zs()
because the latter may be combined depth/stencil format.  hiz_can_clear_zs()
is no-op for GEN7+, but move the GEN check so that the assertions are tested.

Finally, call the fast depth clear function from ilo_clear().