mesa.git
11 years agoi965: Add #define for MI_REPORT_PERF_COUNT on Gen6+.
Kenneth Graunke [Tue, 26 Mar 2013 22:22:22 +0000 (15:22 -0700)]
i965: Add #define for MI_REPORT_PERF_COUNT on Gen6+.

This appears in Volume 1 Part 1 of the Sandybridge PRM on page 48.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add support for GL_AMD_performance_monitor on Ironlake.
Kenneth Graunke [Thu, 11 Apr 2013 20:22:29 +0000 (13:22 -0700)]
i965: Add support for GL_AMD_performance_monitor on Ironlake.

Ironlake's counters are always enabled; userspace can simply send a
MI_REPORT_PERF_COUNT packet to take a snapshot of them.  This makes it
easy to implement.

The counters are documented in the source code for the intel-gpu-tools
intel_perf_counters utility.

v2: Adjust for core data structure changes.  Add a table mapping buffer
    object offsets to exposed counters (which changes each generation).
    Finally, add report ID assertions to sanity check the BO layout
    (thanks to Carl Worth).

v3: Update for core BeginPerfMonitor hook changes (requested by Brian).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Add core support for the GL_AMD_performance_monitor extension.
Kenneth Graunke [Thu, 11 Apr 2013 20:22:00 +0000 (13:22 -0700)]
mesa: Add core support for the GL_AMD_performance_monitor extension.

This provides an interface for applications (and OpenGL-based tools) to
access GPU performance counters.  Since the exact performance counters
available vary between vendors and hardware generations, the extension
provides an API the application can use to get the names, types, and
minimum/maximum values of all available counters.  Counters are also
organized into groups.

Applications create "performance monitor" objects, select the counters
they want to track, and Begin/End monitoring, much like OpenGL's query
API.  Multiple monitors can be in flight simultaneously.

v2: Pass ctx to all driver hooks (suggested by Christoph), and attempt
    to fix overallocation of bitsets (caught by Christoph).  Incomplete.

v3: Significantly rework core data structures.  Store counters in groups
    rather than in a global list.  Use their array index in the group's
    counter list as the ID rather than trying to store a globally unique
    counter ID.  Use bitsets for active counters within a group, and
    also track which groups are active so that's easy to query.

v4: Remove _mesa_ prefix on static functions; detect out of memory
    conditions in new_performance_monitor(); make BeginPerfMonitor hook
    return a boolean rather than setting m->Active or raising an error.
    Switch to GLuint/unsigned for NumGroups, NumCounters, and
    MaxActiveCounters (which also means switching a bunch of temporary
    variable types).  All suggested by Brian Paul.  Also, remove
    commented out code at the bottom of the block.  Finally, fix the
    dispatch sanity test (noticed by Ian Romanick).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com> [v3]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Create and use a has_uniform_buffer_objects() helper.
Kenneth Graunke [Tue, 24 Sep 2013 01:18:14 +0000 (18:18 -0700)]
glsl: Create and use a has_uniform_buffer_objects() helper.

This is better than overriding the extension enable based on the
language version; it's robust against shaders that do:

   #version 140
   #extension GL_ARB_uniform_buffer_object : disable

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Create and use a has_explicit_attrib_location() helper.
Kenneth Graunke [Tue, 24 Sep 2013 01:13:52 +0000 (18:13 -0700)]
glsl: Create and use a has_explicit_attrib_location() helper.

Explicit attribute locations are supported with GLSL 3.30, GLSL ES 3.00,
or "#extension GL_ARB_explicit_attrib_location: enable".  Using a helper
function makes it easy to check for this.

This enables support in GLSL 3.30, which was previously missing.

Previously, we overrode the extension enable flag for ES 3.00.  This is
not robust against a shader such as:

   #version 330
   #extension GL_ARB_explicit_attrib_location : disable

Disabling extensions should not remove core language functionality.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Remove 'invalidate_state' parameter to _mesa_dirty_texobj().
Kenneth Graunke [Wed, 18 Sep 2013 04:50:26 +0000 (21:50 -0700)]
mesa: Remove 'invalidate_state' parameter to _mesa_dirty_texobj().

Every caller passed true.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Remove some remaining FEATURE_* detritus.
Eric Anholt [Wed, 25 Sep 2013 22:41:46 +0000 (15:41 -0700)]
mesa: Remove some remaining FEATURE_* detritus.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix cube array coordinate normalization
Chris Forbes [Sun, 15 Sep 2013 10:25:45 +0000 (22:25 +1200)]
i965: Fix cube array coordinate normalization

Hardware requires the magnitude of the largest component to not exceed
1; brw_cubemap_normalize ensures that this is the case.

Unfortunately, we would previously multiply the array index for cube
arrays by the normalization factor. The incorrect array index would then
cause the sampler to attempt to access either the wrong cube, or memory
outside the cube surface entirely, resulting in garbage rendering or in
the worst case, hangs.

Alter the normalization pass to only multiply the .xyz components.

Fixes broken rendering in the arb_texture_cube_map_array-cubemap piglit,
which was recently adjusted to provoke this behavior.

V2: Fix indent.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agodraw/clip: don't emit so many empty triangles
Zack Rusin [Thu, 19 Sep 2013 17:38:12 +0000 (13:38 -0400)]
draw/clip: don't emit so many empty triangles

Compress empty triangles (don't emit more than one in a row) and
never emit empty triangles if we already generated a triangle
covering a non-null area. We can't skip all null-triangles
because c_primitives expects ones that were generated from vertices
exactly at the clipping-plane, to be emitted.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: count c_primitives before discarding null prims
Zack Rusin [Thu, 19 Sep 2013 17:37:03 +0000 (13:37 -0400)]
llvmpipe: count c_primitives before discarding null prims

We need to count the clipper primitives before the rasterizer
discards one it considers to be null.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: we need to subdivide if fb is bigger in either direction
Zack Rusin [Tue, 24 Sep 2013 20:25:24 +0000 (16:25 -0400)]
llvmpipe: we need to subdivide if fb is bigger in either direction

We need to subdivide triangles if either of the dimensions is
larger than the max edge length, not when both of them are larger.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoradeon/llvm: fix shadow cube texturing for GL3.0
Marek Olšák [Tue, 24 Sep 2013 17:28:27 +0000 (19:28 +0200)]
radeon/llvm: fix shadow cube texturing for GL3.0

The fix is at the end (TGSI_TEXTURE_SHADOWCUBE handling), but I also
restructured the code for it to be more readable.

Fixes spec/!OpenGL 3.0/sampler-cube-shadow.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: fix blitting the last 2 mipmap levels of compressed textures
Marek Olšák [Tue, 24 Sep 2013 12:15:00 +0000 (14:15 +0200)]
radeonsi: fix blitting the last 2 mipmap levels of compressed textures

This fixes compressedteximage piglit tests.

+10 piglits

Evergreen and Cayman have the same issue. R600 and R700 don't.

Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: add missing colorbuffer formats (rework format translation)
Marek Olšák [Mon, 23 Sep 2013 13:40:50 +0000 (15:40 +0200)]
radeonsi: add missing colorbuffer formats (rework format translation)

This fixes some piglits, e.g:
  spec/!OpenGL 3.0/required-renderbuffer-attachment-formats.

This can be ported to r600g.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: bypass alpha-test for integer colorbuffers
Marek Olšák [Mon, 23 Sep 2013 19:41:34 +0000 (21:41 +0200)]
radeonsi: bypass alpha-test for integer colorbuffers

Fixes spec/EXT_texture_integer/fbo-blending.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agor600g: fix texture buffer object cache flushing
Marek Olšák [Thu, 19 Sep 2013 13:07:41 +0000 (15:07 +0200)]
r600g: fix texture buffer object cache flushing

Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agor600g: fix constant buffer cache flushing
Marek Olšák [Wed, 18 Sep 2013 20:46:25 +0000 (22:46 +0200)]
r600g: fix constant buffer cache flushing

Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoradeon/winsys: keep screen pointer in winsys v2
Christian König [Wed, 25 Sep 2013 11:59:56 +0000 (13:59 +0200)]
radeon/winsys: keep screen pointer in winsys v2

Only create one screen for each winsys instance.
This helps with buffer sharing and interop handling.

v2: rebased and some minor cleanup

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agobuild/radeonsi: group all targets in common subdir
Christian König [Wed, 25 Sep 2013 10:28:09 +0000 (12:28 +0200)]
build/radeonsi: group all targets in common subdir

Allows us to share more code between different targets.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
11 years agobuild/r600: group all targets in common subdir
Christian König [Wed, 25 Sep 2013 09:34:39 +0000 (11:34 +0200)]
build/r600: group all targets in common subdir

Allows us to share more code between different targets.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
11 years agobuild/r300: group build target in common subdir
Christian König [Wed, 25 Sep 2013 09:49:49 +0000 (11:49 +0200)]
build/r300: group build target in common subdir

Allows us to share more code between different targets.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
11 years agoradeon/uvd: try to place msg/fb buffer into GART
Christian König [Sun, 22 Sep 2013 13:59:17 +0000 (15:59 +0200)]
radeon/uvd: try to place msg/fb buffer into GART

This is only supported on NI+, but the kernel takes care of those limitations.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoradeon/uvd: move alignment to winsys
Christian König [Sun, 22 Sep 2013 08:41:27 +0000 (10:41 +0200)]
radeon/uvd: move alignment to winsys

Similar to GFX and DMA.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agost/vdpau: use a separate lock per decoder
Christian König [Sun, 22 Sep 2013 10:16:20 +0000 (12:16 +0200)]
st/vdpau: use a separate lock per decoder

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: use new vlc function to serach for VC-1 start codes
Christian König [Mon, 9 Sep 2013 09:58:53 +0000 (03:58 -0600)]
st/vdpau: use new vlc function to serach for VC-1 start codes

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agovl/mpeg12: use new vlc function to search for start codes
Christian König [Mon, 9 Sep 2013 09:57:58 +0000 (03:57 -0600)]
vl/mpeg12: use new vlc function to search for start codes

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agovl/vlc: add fast forward search for byte value
Christian König [Mon, 9 Sep 2013 09:47:10 +0000 (03:47 -0600)]
vl/vlc: add fast forward search for byte value

Commonly used to find start codes and has far less overhead
to searching manually.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agoglsl: Initialize ir_lower_jumps_visitor member variables.
Vinson Lee [Tue, 24 Sep 2013 05:13:37 +0000 (22:13 -0700)]
glsl: Initialize ir_lower_jumps_visitor member variables.

Fixes "Unintialized scalar field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Initialize lower_vector_visitor::dont_lower_swz.
Vinson Lee [Tue, 24 Sep 2013 04:47:48 +0000 (21:47 -0700)]
glsl: Initialize lower_vector_visitor::dont_lower_swz.

Fixes "Uninitialized scalar field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Initialize assignment_generator member variables.
Vinson Lee [Tue, 24 Sep 2013 05:02:27 +0000 (22:02 -0700)]
glsl: Initialize assignment_generator member variables.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Remove unused pointer value.
Vinson Lee [Tue, 24 Sep 2013 04:41:39 +0000 (21:41 -0700)]
glsl: Remove unused pointer value.

Silences "Unused pointer value" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoRevert "llvmpipe: increase number of subpixel bits to eight"
Zack Rusin [Tue, 24 Sep 2013 19:08:35 +0000 (15:08 -0400)]
Revert "llvmpipe: increase number of subpixel bits to eight"

This reverts commit 755c11dc5e94f17097c186edaaa39d818396f14c.
We agreed that this is band-aid that's not very useful and
the proper solution is to rewrite the rasterization algo
so that it operates on 64 bit values.

Signed-off-by: Zack Rusin <zackr@vmware.com>
11 years agomesa: remove handcounted magic number
Dylan Noblesmith [Fri, 20 Sep 2013 15:55:41 +0000 (11:55 -0400)]
mesa: remove handcounted magic number

Also make it a compile-time error with STATIC_ASSERT.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: remove outdated comment
Dylan Noblesmith [Fri, 20 Sep 2013 15:55:27 +0000 (11:55 -0400)]
mesa: remove outdated comment

No such argument exists since this commit:

commit 92f3fca0ea429dcf07123e63447449db53308266
Author:     Ian Romanick <ian.d.romanick@intel.com>
AuthorDate: Sun Aug 21 17:23:58 2011 -0700
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Tue Aug 23 14:52:09 2011 -0700

    mesa: Remove target parameter from dd_function_table::BufferSubData

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: remove stale comment
Dylan Noblesmith [Fri, 20 Sep 2013 15:55:19 +0000 (11:55 -0400)]
mesa: remove stale comment

This line stopped making sense in the great sed
replace of commit f9995b30756140724f41daf963fa06167912be7f

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agollvmpipe: align the array used for subdivived vertices
Zack Rusin [Mon, 23 Sep 2013 21:29:39 +0000 (17:29 -0400)]
llvmpipe: align the array used for subdivived vertices

When subdiving a triangle we're using a temporary array to store
the new coordinates for the subdivided triangles. Unfortunately
the array used for that was not aligned properly causing
random crashes in the llvm jit code which was trying to load
vectors from it.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoglapi: Move declaration before code.
Vinson Lee [Mon, 23 Sep 2013 21:07:15 +0000 (14:07 -0700)]
glapi: Move declaration before code.

This patch fixes the MSVC build error introduced by commit
673129e0b936b1c748e988d3f74f3efaab9e5693.

enums.c
mesa\main\enums.c(3776) : error C2143: syntax error : missing ';' before 'type'
mesa\main\enums.c(3781) : error C2065: 'elt' : undeclared identifier
mesa\main\enums.c(3781) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *'
mesa\main\enums.c(3782) : error C2065: 'elt' : undeclared identifier
mesa\main\enums.c(3782) : error C2223: left of '->offset' must point to struct/union
mesa\main\enums.c(3782) : warning C4033: '_mesa_lookup_enum_by_nr' must return a value

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: Use -Bsymbolic in the linker to locally resolve Mesa-internal symbols.
Eric Anholt [Fri, 20 Sep 2013 19:37:04 +0000 (12:37 -0700)]
mesa: Use -Bsymbolic in the linker to locally resolve Mesa-internal symbols.

Normally, LD_PRELOAD will take precedence over your own symbols, which you
want for things like malloc() in libc.  But we don't have any local
symbols we would want overridden (like hash_table_insert(), for example!),
so tell the linker to resolve them internally.  This also avoids calls
through the PLT.

Saves almost 100k on libdricore's size, and gets us a bunch of the
performance back that we had with non-dricore.

Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agoglsl: Hide many classes local to individual .cpp files in anon namespaces.
Eric Anholt [Fri, 20 Sep 2013 18:03:44 +0000 (11:03 -0700)]
glsl: Hide many classes local to individual .cpp files in anon namespaces.

This gives the compiler the chance to inline and not export class symbols
even in the absence of LTO.  Saves about 60kb on disk.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agomesa: Drop an extra copy-and-pasted copy in the program clone function.
Eric Anholt [Thu, 19 Sep 2013 23:16:16 +0000 (16:16 -0700)]
mesa: Drop an extra copy-and-pasted copy in the program clone function.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agomesa: Convert some runtime asserts to static asserts.
Eric Anholt [Fri, 20 Sep 2013 03:06:35 +0000 (20:06 -0700)]
mesa: Convert some runtime asserts to static asserts.

Noticed while grepping through the code for something else.

v2: Don't convert really-runtime asserts to static asserts.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agomesa: Shrink the size of the enum string lookup struct.
Eric Anholt [Thu, 19 Sep 2013 21:54:13 +0000 (14:54 -0700)]
mesa: Shrink the size of the enum string lookup struct.

Since it's only used for debug information, we can misalign the struct and
save the disk space.  Another 19k on a 64-bit build.

v2: Make a compiler.h macro to only use the attribute if we know we can.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agomesa: Remove the extra enum strings and extra lookup table.
Eric Anholt [Thu, 19 Sep 2013 19:06:54 +0000 (12:06 -0700)]
mesa: Remove the extra enum strings and extra lookup table.

Now that there's no name -> enum direction, we can drop the extra strings,
and merge the offsets table and the reduced_enums table.

Between the previous commit and this one, Mesa core drops by 30k.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agomesa: Remove _mesa_lookup_enum_by_name().
Eric Anholt [Thu, 19 Sep 2013 18:48:24 +0000 (11:48 -0700)]
mesa: Remove _mesa_lookup_enum_by_name().

It's been unused for a long time.  I stopped digging through git history
as of 2009.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
11 years agollvmpipe: increase number of subpixel bits to eight
Zack Rusin [Thu, 19 Sep 2013 18:10:08 +0000 (14:10 -0400)]
llvmpipe: increase number of subpixel bits to eight

Unfortunately d3d10 requires a lot higher precision (e.g.
wgf11clipping tests for it). The smallest number of precision
bits with which it passes is 8. That means that we need to
decrease the maximum length of an edge that we can handle without
subdivision by 4 bits. Abstracted the code a bit to make it easier
to change once to switch to 64bit rasterization.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoglsl: Define isnormal and copysign for MSVC to fix build.
Vinson Lee [Sun, 22 Sep 2013 23:08:26 +0000 (16:08 -0700)]
glsl: Define isnormal and copysign for MSVC to fix build.

This patch fixes these MSVC build errors.

ir_constant_expression.cpp
src\glsl\ir_constant_expression.cpp(564) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
src\glsl\ir_constant_expression.cpp(1384) : error C3861: 'isnormal': identifier not found
src\glsl\ir_constant_expression.cpp(1385) : error C3861: 'copysign': identifier not found

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69541
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Matt Turner <mattst88@gmail.com>
11 years agoSuppress clang's warnings about unused CFLAGS and CXXFLAGS.
Johannes Obermayr [Wed, 11 Sep 2013 22:32:40 +0000 (00:32 +0200)]
Suppress clang's warnings about unused CFLAGS and CXXFLAGS.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoradeon/uvd: async flush the UVD cs
Christian König [Sat, 21 Sep 2013 13:34:38 +0000 (15:34 +0200)]
radeon/uvd: async flush the UVD cs

No need to block for the CS thread here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agowinsys/radeon: share winsys between different fd's
Christian König [Sat, 21 Sep 2013 10:25:13 +0000 (12:25 +0200)]
winsys/radeon: share winsys between different fd's

Share the winsys between different fd's if they point to the same device.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agowinsys/radeon: remove cs_queue_empty
Christian König [Sat, 21 Sep 2013 13:24:55 +0000 (15:24 +0200)]
winsys/radeon: remove cs_queue_empty

Waiting for an empty queue is nonsense and can lead to deadlocks if we have
multiple waiters or another thread that continuously sends down new commands.

Just post the cs to the queue and immediately wait for it to finish.

This is a candidate for the stable branch.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agowinsys/radeon: fix killing the CS thread
Christian König [Sat, 21 Sep 2013 11:21:47 +0000 (13:21 +0200)]
winsys/radeon: fix killing the CS thread

Kill the thread only after we checked that it's not used any more, not before.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
11 years agoi965/gen4: Fix fragment program rectangle texture shadow compares.
Eric Anholt [Wed, 18 Sep 2013 19:32:31 +0000 (12:32 -0700)]
i965/gen4: Fix fragment program rectangle texture shadow compares.

The rescale_texcoord(), if it does something, will return just the
GLSL-sized coordinate, leaving out the 3rd and 4th components where we
were storing our projected shadow compare and the texture projector.
Deref the shadow compare before using the shared rescale-the-coordinate
code to fix the problem.

Fixes piglit tex-shadow2drect.shader_test and txp-shadow2drect.shader_test

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69525
NOTE: This is a candidate for stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/gen7.5: Fix missing Shader Channel Select entries on Haswell
Abdiel Janulgue [Fri, 20 Sep 2013 10:56:52 +0000 (13:56 +0300)]
i965/gen7.5: Fix missing Shader Channel Select entries on Haswell

Probably non-intentional, but the SURFACE_STATE setup refactoring
for buffer surfaces had missed the scs bits when creating constant
surface states.

Fixes broken GLB 2.5 on Haswell where the knight's textures are missing

Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965, mesa: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS macros.
Kenneth Graunke [Wed, 18 Sep 2013 21:11:32 +0000 (14:11 -0700)]
i965, mesa: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS macros.

These classes declared a placement new operator, but didn't declare a
delete operator.  Switching to the macro gives them a delete operator,
which probably is a good idea anyway.

This also eliminates a lot of boilerplate.

v2: Properly use RZALLOC in Mesa IR/TGSI translators.  Caught by Eric
    and Chad.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS in a bunch of places.
Kenneth Graunke [Wed, 18 Sep 2013 21:05:36 +0000 (14:05 -0700)]
glsl: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS in a bunch of places.

This eliminates a lot of boilerplate and should be 100% equivalent.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoralloc: Introduce new macros for defining C++ new/delete operators.
Kenneth Graunke [Wed, 18 Sep 2013 20:56:26 +0000 (13:56 -0700)]
ralloc: Introduce new macros for defining C++ new/delete operators.

Most of our C++ classes define placement new and delete operators so we
can do convenient allocation via:

   thing *foo = new(mem_ctx) thing(...)

Currently, this is done via a lot of boilerplate.  By adding simple
macros to ralloc, we can condense this to a single line, making it
trivial to add this feature to a new class.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agor600g: fast color clears for single-sample buffers
Grigori Goronzy [Tue, 10 Sep 2013 23:41:40 +0000 (01:41 +0200)]
r600g: fast color clears for single-sample buffers

Allocate a CMASK on demand and use it to fast clear single-sample
colorbuffers. Both FBOs and window system colorbuffers are fast
cleared. Expand as needed when colorbuffers are mapped or displayed
on screen.

v2: cosmetics, move transfer expansion into dma_blit

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
11 years agor600g: add support for separately allocated CMASKs
Grigori Goronzy [Tue, 10 Sep 2013 23:41:39 +0000 (01:41 +0200)]
r600g: add support for separately allocated CMASKs

v2: check for NULL cbufs

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
11 years agogallium: add flush_resource context function
Marek Olšák [Fri, 20 Sep 2013 13:08:29 +0000 (15:08 +0200)]
gallium: add flush_resource context function

r600g needs explicit flushing before DRI2 buffers are presented on the screen.

v2: add (stub) implementations for all drivers, fix frontbuffer flushing
v3: fix galahad

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
11 years agoradeonsi: simplify and fix MSAA texture sampling for array textures
Marek Olšák [Wed, 18 Sep 2013 13:40:21 +0000 (15:40 +0200)]
radeonsi: simplify and fix MSAA texture sampling for array textures

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: fix textureOffset and texelFetchOffset GLSL functions
Marek Olšák [Wed, 18 Sep 2013 13:36:38 +0000 (15:36 +0200)]
radeonsi: fix textureOffset and texelFetchOffset GLSL functions

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agollvmpipe: Fix rendering to PIPE_FORMAT_R10G10B10A2_UNORM.
José Fonseca [Fri, 20 Sep 2013 11:58:59 +0000 (12:58 +0100)]
llvmpipe: Fix rendering to PIPE_FORMAT_R10G10B10A2_UNORM.

We must take rounding in consideration when re-scaling to narrow
normalized channels, such as 2-bit normalized alpha.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: Ensure draw_pt_middle_end::bind_parameters is never NULL.
José Fonseca [Wed, 18 Sep 2013 19:01:54 +0000 (20:01 +0100)]
draw: Ensure draw_pt_middle_end::bind_parameters is never NULL.

Prevents calling NULL pointer with softpipe in certain cases.

Trivial.

11 years agotools/trace: Simple script to compare two traces.
José Fonseca [Wed, 18 Sep 2013 19:00:50 +0000 (20:00 +0100)]
tools/trace: Simple script to compare two traces.

Based on the earlier apitrace tracediff.sh script.

11 years agomesa: Silence GCC warning 'comparison between signed and unsigned integer expressions'
Ian Romanick [Tue, 10 Sep 2013 16:48:21 +0000 (11:48 -0500)]
mesa: Silence GCC warning 'comparison between signed and unsigned integer expressions'

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Fix broken call to print_table_stats
Ian Romanick [Tue, 10 Sep 2013 16:43:56 +0000 (11:43 -0500)]
mesa: Fix broken call to print_table_stats

The function takes a parameter, but none was given.  Also, in the
non-GET_DEBUG case, silence the unused parameter warning.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Set VertexProgram.MaxOutputComponents and FragmentProgram.MaxInputComponents...
Ian Romanick [Tue, 10 Sep 2013 16:34:11 +0000 (11:34 -0500)]
glsl: Set VertexProgram.MaxOutputComponents and FragmentProgram.MaxInputComponents in standalone scaffolding

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Allow several ARB_geometry_shader4 queries in OpenGL 3.2
Ian Romanick [Tue, 10 Sep 2013 15:22:47 +0000 (10:22 -0500)]
mesa: Allow several ARB_geometry_shader4 queries in OpenGL 3.2

GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, GL_MAX_GEOMETRY_OUTPUT_VERTICES,
GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, and
GL_MAX_GEOMETRY_UNIFORM_COMPONENTS all have the same enum value and
meaning as their _ARB counterparts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Expose MAX_GEOMETRY_{INPUT,OUTPUT}_COMPONENTS on OpenGL 3.2
Ian Romanick [Tue, 10 Sep 2013 15:18:17 +0000 (10:18 -0500)]
mesa: Expose MAX_GEOMETRY_{INPUT,OUTPUT}_COMPONENTS on OpenGL 3.2

The comment '# GL 3.0 / GLES3' was incorrect.  The
MAX_VERTEX_OUTPUT_COMPONENTS and MAX_FRAGMENT_INPUT_COMPONENTS queries
were added in OpenGL 3.2 (with geometry shaders) and OpenGL ES 3.0.
This just fixes that comment.

v2: Add the GEOMETRY queries in the existing '# GL 3.2' section since
they have nothing to do with GLES3.  Suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Get GL_MAX_FRAGMENT_INPUT_COMPONENTS from FragmentProgram.MaxInputComponents
Ian Romanick [Tue, 10 Sep 2013 15:12:16 +0000 (10:12 -0500)]
mesa: Get GL_MAX_FRAGMENT_INPUT_COMPONENTS from FragmentProgram.MaxInputComponents

In OpenGL ES 3.0 the minimum-maximum for GL_MAX_VERTEX_OUTPUT_VECTORS is 16,
but the minimum-maximum for GL_MAX_FRAGMENT_INTPUT_VECTORS is 15.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Get GL_MAX_VERTEX_OUTPUT_COMPONENTS from VertexProgram.MaxOutputComponents
Ian Romanick [Tue, 10 Sep 2013 15:10:07 +0000 (10:10 -0500)]
mesa: Get GL_MAX_VERTEX_OUTPUT_COMPONENTS from VertexProgram.MaxOutputComponents

In OpenGL ES 3.0 the minimum-maximum for GL_MAX_VERTEX_OUTPUT_VECTORS is 16,
but the minimum-maximum for GL_MAX_FRAGMENT_INTPUT_VECTORS is 15.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi915: Set VertexProgram.MaxOutputComponents and FragmentProgram.MaxInputComponents
Ian Romanick [Tue, 10 Sep 2013 15:07:10 +0000 (10:07 -0500)]
i915: Set VertexProgram.MaxOutputComponents and FragmentProgram.MaxInputComponents

This was the only remaining place in Mesa that sets MaxVaryings without
also setting these values.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Set *Program.Max{Input,Output}Components
Ian Romanick [Wed, 18 Sep 2013 20:29:00 +0000 (15:29 -0500)]
i965: Set *Program.Max{Input,Output}Components

Now that MaxVaryings is > 16, VertexProgram.MaxOutputComponents,
GeometryProgram.MaxInputComponents, GeometryProgram.MaxOutputComponents,
and FragmentProgram.MaxInputComponents also need to be set.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Set default values for Max{Input,Output}Components in init_program_limits
Ian Romanick [Tue, 10 Sep 2013 14:58:47 +0000 (09:58 -0500)]
mesa: Set default values for Max{Input,Output}Components in init_program_limits

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Remove gl_constants::MaxVaryingComponents
Ian Romanick [Tue, 10 Sep 2013 14:39:38 +0000 (09:39 -0500)]
mesa: Remove gl_constants::MaxVaryingComponents

There are no longer any users.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Zack Rusin <zackr@vmware.com>
11 years agomesa: Use correct data for MAX_{VERTEX,GEOMETRY}_VARYING_COMPONENTS_ARB queries
Ian Romanick [Tue, 10 Sep 2013 14:35:58 +0000 (09:35 -0500)]
mesa: Use correct data for MAX_{VERTEX,GEOMETRY}_VARYING_COMPONENTS_ARB queries

Previously gl_constants::MaxVaryingComponents was used.  Now
gl_constants::VertexProgram::MaxOutputs and
gl_constants::GeometryProgram::MaxOutputs are used.

This means that st_extensions.c had to be updated to set these fields
instead of MaxVaryingComponents.  It was previously the only place that
set MaxVaryingComponents.

I believe that the structure is allocated by calloc, so the value should
be initialized to zero in non-Gallium drivers before and after my
change.  Right now nobody enables GL_ARB_geometry_shader4, so it's
pretty much dead code anyway.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Zack Rusin <zackr@vmware.com>
11 years agomesa: Track per-stage shader input and output limits independently
Ian Romanick [Tue, 10 Sep 2013 14:21:56 +0000 (09:21 -0500)]
mesa: Track per-stage shader input and output limits independently

In OpenGL 3.2 these are independently queryable.  In addition, the spec
has different minimum-maximums for various values.
GL_MAX_VERTEX_OUTPUT_COMPONENTS is 64, but
GL_MAX_GEOMETRY_OUTPUT_COMPONENTS (and GL_MAX_FRAGMENT_INPUT_COMPONENTS)
is 128.

In OpenGL ES 3.0 these are also independently queryable.  The spec has
different minimum-maximums for various values.
GL_MAX_VERTEX_OUTPUT_VECTORS is 16, but GL_MAX_FRAGMENT_INTPUT_VECTORS
is 15.

None of these values are used yet.  I have just added space to the
structures.  Future patches will add users and eventually remove some
old fields.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Zack Rusin <zackr@vmware.com>
11 years agomesa: Support GL_MAX_VERTEX_OUTPUT_COMPONENTS query with ES3
Ian Romanick [Mon, 9 Sep 2013 21:54:11 +0000 (16:54 -0500)]
mesa: Support GL_MAX_VERTEX_OUTPUT_COMPONENTS query with ES3

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
11 years agoi965: Refactor Gen4-6 SURFACE_STATE setup for buffer surfaces.
Kenneth Graunke [Sat, 14 Sep 2013 03:12:56 +0000 (20:12 -0700)]
i965: Refactor Gen4-6 SURFACE_STATE setup for buffer surfaces.

This was an embarassingly large amount of copy and pasted code,
and it wasn't particularly simple code either.  By factoring it out
into a helper function, we consolidate the complexity.

v2: Properly NULL-check bo.  Caught by Eric Anholt.
v3: Do the subtraction by 1 in gen7_emit_buffer_surface_state, rather
    than making callers do it.  This makes the buffer_size parameter
    the actual size of the buffer.  Suggested by Paul Berry.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Refactor Gen7+ SURFACE_STATE setup for buffer surfaces.
Kenneth Graunke [Sat, 14 Sep 2013 00:46:47 +0000 (17:46 -0700)]
i965: Refactor Gen7+ SURFACE_STATE setup for buffer surfaces.

This was an embarassingly large amount of copy and pasted code,
and it wasn't particularly simple code either.  By factoring it out
into a helper function, we consolidate the complexity.

v2: Properly NULL-check bo.  Caught by Eric Anholt.
v3: Do the subtraction by 1 in gen7_emit_buffer_surface_state, rather
    than making callers do it.  This makes the buffer_size parameter
    the actual size of the buffer.  Suggested by Paul Berry.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Fix off by one errors in texture buffer size calculations.
Kenneth Graunke [Tue, 17 Sep 2013 18:23:59 +0000 (11:23 -0700)]
i965: Fix off by one errors in texture buffer size calculations.

The value that's split into width/height/depth needs to be the size of
the buffer minus one.  This makes it consistent with the constant buffer
and shader time SURFACE_STATE setup code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Fix writemask != 0 assertions on Sandybridge.
Kenneth Graunke [Tue, 17 Sep 2013 18:54:05 +0000 (11:54 -0700)]
i965: Fix writemask != 0 assertions on Sandybridge.

This fixes myriads of regressions since commit 169f9c030c16d1247a3a7629
("i965: Add an assertion that writemask != NULL for non-ARFs.").

On Sandybridge, our control flow handling (such as brw_IF) does:

   brw_set_dest(p, insn, brw_imm_w(0));
   insn->bits1.branch_gen6.jump_count = 0;

This results in a IMM destination with zero for the writemask.  IMM
destinations are rather bizarre, but the code has been working for ages,
so I'm loathe to change it.

Fixes glxgears on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Delete builtin_builder::shader when destroying built-ins.
Kenneth Graunke [Tue, 17 Sep 2013 06:35:41 +0000 (23:35 -0700)]
glsl: Delete builtin_builder::shader when destroying built-ins.

I would use _mesa_delete_shader, but it's declared static, and we don't
really need any of the stuff in it anyway.

This fixes a memory leak caught by Valgrind.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Fix brw_gs_prog_data_compare to actually check field members.
Kenneth Graunke [Tue, 17 Sep 2013 06:41:57 +0000 (23:41 -0700)]
i965: Fix brw_gs_prog_data_compare to actually check field members.

&a and &b are the address of the local stack variables, not the actual
structures.  Instead of comparing the fields of a and b, we compared
...some stack memory.

Not a candidate for stable since GS code doesn't exist in 9.2.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Fix brw_vs_prog_data_compare to actually check field members.
Kenneth Graunke [Tue, 17 Sep 2013 05:39:37 +0000 (22:39 -0700)]
i965: Fix brw_vs_prog_data_compare to actually check field members.

&a and &b are the address of the local stack variables, not the actual
structures.  Instead of comparing the fields of a and b, we compared
...some stack memory.

Caught by Valgrind on Piglit's glsl-lod-bias test (among many others).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68233
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agoi965: Move binding table code to a new file, brw_binding_tables.c.
Kenneth Graunke [Fri, 13 Sep 2013 22:55:03 +0000 (15:55 -0700)]
i965: Move binding table code to a new file, brw_binding_tables.c.

The code to upload the binding tables for each stage was scattered
across brw_{vs,gs,wm}_surface_state.c and brw_misc_state.c, which also
contain a lot of code to populate individual SURFACE_STATE structures.

This patch brings all the binding table upload code together, and splits
it out from the code which fills in SURFACE_STATE entries.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Use brw_upload_binding_table() for the pixel shader as well.
Kenneth Graunke [Fri, 13 Sep 2013 22:27:04 +0000 (15:27 -0700)]
i965: Use brw_upload_binding_table() for the pixel shader as well.

This is not quite the same: brw_upload_binding_table() also has code to
early-return if there are no entries, while the existing code did not.

The PS binding table is unlikely to be empty since it will have at least
one color buffer.  If it ever is empty, early returning seems wise.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Generalize brw_vec4_upload_binding_table() beyond vec4 stages.
Kenneth Graunke [Fri, 13 Sep 2013 22:13:49 +0000 (15:13 -0700)]
i965: Generalize brw_vec4_upload_binding_table() beyond vec4 stages.

Instead of passing in a brw_vec4_prog_data structure, we can simply
pass the one field it needs: the number of entries in the binding table.

We also need to pass in the shader time surface index rather than
hardcoding SURF_INDEX_VEC4_SHADER_TIME.

Since the resulting function is stage-agnostic, this patch removes
"vec4_" from the name.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Convert loop to memcpy in brw_vec4_upload_binding_table().
Kenneth Graunke [Fri, 13 Sep 2013 21:51:10 +0000 (14:51 -0700)]
i965: Convert loop to memcpy in brw_vec4_upload_binding_table().

This is probably more efficient.  At any rate, it's less code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Update comments in brw_vec4_upload_binding_table().
Kenneth Graunke [Fri, 13 Sep 2013 21:45:34 +0000 (14:45 -0700)]
i965: Update comments in brw_vec4_upload_binding_table().

The first comment was a bit stale; there are more kinds of surfaces than
textures and pull constants.

The second was a leftover "to do" comment for something I already did.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agowinsys/sw/xlib: fix compile error in xlib_sw_winsys.c.
Gaetan Nadon [Tue, 17 Sep 2013 19:46:10 +0000 (15:46 -0400)]
winsys/sw/xlib: fix compile error in xlib_sw_winsys.c.

xlib_sw_winsys.h:5:22: fatal error: X11/Xlib.h: No such file or directory

The compiler cannot find the Xlib.h in the installed system headers.
All supplied include directives point to inside the mesa module.
The X11_CFLAGS variable is undefined (not defined in config.status).

It appears the intent was to use X11_INCLUDES defined in configure.ac.

The Xlib.h file is not installed on my workstation. It is supplied in
the libx11-dev package. This allows an X developer control over which
version of this file is used for X development.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglx: fix compile error in egl_glx.c.
Gaetan Nadon [Tue, 17 Sep 2013 19:46:09 +0000 (15:46 -0400)]
glx: fix compile error in egl_glx.c.

egl_glx.c:40:22: fatal error: X11/Xlib.h: No such file or directory

The compiler cannot find the Xlib.h in the installed system headers.
All supplied include directives point to inside the mesa module.
The X11_CFLAGS variable is undefined (not defined in config.status).

It appears the intent was to use X11_INCLUDES defined in configure.ac.

The Xlib.h file is not installed on my workstation. It is supplied in
the libx11-dev package. This allows an X developer control over which
version of this file is used for X development.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agofreedreno/a3xx: fix typo mixup w/ mipfilter
Rob Clark [Thu, 19 Sep 2013 14:28:52 +0000 (10:28 -0400)]
freedreno/a3xx: fix typo mixup w/ mipfilter

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: fix glReadPixels
Rob Clark [Thu, 19 Sep 2013 14:08:38 +0000 (10:08 -0400)]
freedreno: fix glReadPixels

duh, we still need to flush if there are pending draws and it isn't an
unsynchronized case.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agogallivm: adjust wrap mode to CLAMP_TO_EDGE always for cube maps.
Roland Scheidegger [Thu, 19 Sep 2013 15:13:18 +0000 (17:13 +0200)]
gallivm: adjust wrap mode to CLAMP_TO_EDGE always for cube maps.

Technically without seamless filtering enabled GL allows any wrap mode, which
made sense when supporting true borders (can get seamless effect with border
and CLAMP_TO_BORDER), but gallium doesn't support borders and d3d9 requires
wrap modes to be ignored and it's a pain to fix up the sampler state (as it
makes it texture dependent). It is difficult to imagine a situation where an
app really wants another behavior so just cheat here. (It looks like some
graphics hw (intel) actually requires this too hence it should be safe.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoandroid: Remove builtin_compiler
Adrian Negreanu [Fri, 13 Sep 2013 08:58:33 +0000 (11:58 +0300)]
android: Remove builtin_compiler

The first part was done in:

   commit c845140a20efa6a30a5465301d1f9b4acea79155
   Author: Kenneth Graunke <kenneth@whitecape.org>
   Date:   Tue Sep 3 21:22:17 2013 -0700

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoutil/u_blit: Implement util_blit_pixels via pipe_context::blit.
José Fonseca [Thu, 12 Sep 2013 13:20:02 +0000 (14:20 +0100)]
util/u_blit: Implement util_blit_pixels via pipe_context::blit.

This removes a lot of code, but not everything, as util_blit_pixels_tex
is still useful when one needs to override pipe_sampler_view::swizzle_?.

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil/u_blit: Support blits from cubemaps.
José Fonseca [Tue, 17 Sep 2013 18:22:44 +0000 (19:22 +0100)]
util/u_blit: Support blits from cubemaps.

By calling util_map_texcoords2d_onto_cubemap.

A new parameter for util_blit_pixels_tex is necessary, as
pipe_sampler_view::first_layer is always supposed to point to the first
face when sampling from cubemaps.

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agovega: Use pipe_context::blit instead of util_blit_pixels_tex.
José Fonseca [Tue, 17 Sep 2013 18:01:11 +0000 (19:01 +0100)]
vega: Use pipe_context::blit instead of util_blit_pixels_tex.

Only compile-tested but it seems straightforward.

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoi965: Rename brw_{fs,vec4}_emit.cpp to brw_{fs,vec4}_generator.cpp.
Kenneth Graunke [Wed, 18 Sep 2013 06:32:10 +0000 (23:32 -0700)]
i965: Rename brw_{fs,vec4}_emit.cpp to brw_{fs,vec4}_generator.cpp.

The previous names were really confusing to talk about:
- brw_fs_visitor() contained methods named emit_whatever().
- brw_fs_generator() contained methods named generate_whatever(), but
  lived in brw_fs_emit.cpp.

So when someone said "the emit layer", or "emit code", we weren't sure
whether they meant the visitor's emit() functions or the generator in
brw_fs_emit.cpp.

By renaming these files, the method names, class names, and file names
all match, which is much less confusing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Eric Anholt <eric@anholt.net>