mesa.git
10 years agogallium/util: add helpers for bitfield manipulation
Ilia Mirkin [Fri, 25 Apr 2014 22:07:41 +0000 (18:07 -0400)]
gallium/util: add helpers for bitfield manipulation

Add bitwise reversing and signed MSB helpers for software implementation
of the new TGSI opcodes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa/st: implement new bit manipulation opcodes
Ilia Mirkin [Fri, 25 Apr 2014 05:45:19 +0000 (01:45 -0400)]
mesa/st: implement new bit manipulation opcodes

Also pipe through [IU]MUL_HI, MAD, and lower ldexp. This provides
coverage of all new ARB_gpu_shader5 functions except uaddCarry,
usubBorrow and interpolateAt*.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium: add new opcodes for ARB_gs5 bit manipulation support
Ilia Mirkin [Fri, 25 Apr 2014 05:43:05 +0000 (01:43 -0400)]
gallium: add new opcodes for ARB_gs5 bit manipulation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoglx/drisw: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:52:26 +0000 (19:52 +0000)]
glx/drisw: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri3: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:26:27 +0000 (19:26 +0000)]
glx/dri3: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri2: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:22:29 +0000 (19:22 +0000)]
glx/dri2: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:05:57 +0000 (19:05 +0000)]
glx/dri: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/indirect: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 15:51:14 +0000 (15:51 +0000)]
glx/indirect: explicitly assign struct components for glx_*_vtable

... to improve readability of code. Set indirect_screen_vtable as a static const.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/apple: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 15:46:10 +0000 (15:46 +0000)]
glx/apple: explicitly assign struct components for glx_*_vtable

... to improve readability of code. Set applegl_screen_vtable as a static const.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoegl_dri: rework dri extension handling
Emil Velikov [Wed, 12 Feb 2014 20:13:15 +0000 (20:13 +0000)]
egl_dri: rework dri extension handling

Use designated initialisers, and store the extensions pointers as const.

The loader extensions __DRIdri2LoaderExtension and __DRIswrastLoaderExtension
are setup by the platform backends so they should not be constified.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agogbm: cleanup __DRI*extension handling
Emil Velikov [Sun, 16 Mar 2014 00:26:53 +0000 (00:26 +0000)]
gbm: cleanup __DRI*extension handling

Use designated initialisers, store all extension pointers as const and use
a const __DRIextensions array over assigning each element individually.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_util: cleanup dri extension handling
Emil Velikov [Wed, 12 Feb 2014 20:47:21 +0000 (20:47 +0000)]
dri_util: cleanup dri extension handling

Explicitly set the version that is implemented, as that may differ from
the one defined in dri_interface.h. The remaining __DRI*Extensions are
treated as constants, so got ahead and declare them as such.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/tests: explicitly set __DRI2rendererQueryExtension members
Emil Velikov [Wed, 12 Feb 2014 21:00:02 +0000 (21:00 +0000)]
glx/tests: explicitly set __DRI2rendererQueryExtension members

While we're here use the typcast'ed name and constify.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri3: rework __DRIextension handling
Emil Velikov [Sun, 16 Mar 2014 01:17:46 +0000 (01:17 +0000)]
glx/dri3: rework __DRIextension handling

Use a const array with the extensions, rather than assigning each
one to a fixed size array at runtime.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri2: rework __DRIextension handling
Emil Velikov [Wed, 12 Feb 2014 20:14:15 +0000 (20:14 +0000)]
glx/dri2: rework __DRIextension handling

Make sure that the DRI*Extensions report the version of the interface
implemented over the listed in the headers. While both are currently
the same, this may change in the future.

v2: Keep loader extensions handling as is.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agost/dri: cleanup dri extension handling
Emil Velikov [Wed, 12 Feb 2014 19:19:17 +0000 (19:19 +0000)]
st/dri: cleanup dri extension handling

Explicitly set the version that is implemented, as that may differ
from the one defined in dri_interface.h. Use designated initialisers
and constify whereever possible.

Note: __DRIimageExtension should not be made const as it's modified
at runtime. This patch should have no side effects on compilers that
do not support designated initialisers, as the existing code in
dri/common already uses them.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri/radeon: use a const __DRIextension array
Emil Velikov [Tue, 18 Feb 2014 03:43:14 +0000 (03:43 +0000)]
dri/radeon: use a const __DRIextension array

Rather than keeping a separate and unused copy of the screen extensions
within the radeon screen, use a constant array that can be used directly
with __DRIscreen.

[Kristian Høgsberg]
The copy in the radeon screen isn't unused, that's where the array is
built and stored, the dri screen just points to that.  The pattern
here was used for cases where the extensions exported by a dri driver
could vary at runtime, for example depending on chipset.  In this
case, it's known at compile time, so it makes sense to use a static
const array instead.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodrivers/dri: cleanup dri extension instantiation
Emil Velikov [Wed, 12 Feb 2014 17:47:53 +0000 (17:47 +0000)]
drivers/dri: cleanup dri extension instantiation

Uniformly use the typecasted extension name, constify extension instances
and use designated initialisers. Set the implemented version of the
extension, over the one defined in dri_infertace.h. Patch covers the
following extensions:

__DRItexBufferExtension
__DRIimageExtension
__DRIrobustnessExtension
__DRI2rendererQueryExtension
__DRIdri2LoaderExtension

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri_interface: Update __DRItexBufferExtensionRec to version 3
Emil Velikov [Tue, 18 Feb 2014 03:04:03 +0000 (03:04 +0000)]
dri_interface: Update __DRItexBufferExtensionRec to version 3

With commit e59fa4c46c8("dri2: release texture image.") we updated the
extension without bumping the version number. The patch itself added an
interface required to enable texture_from_pixmap on certain platforms.

The new code was effectively never build, as it depended on
__DRI_TEX_BUFFER_VERSION >= 3, which never came to be in upstream mesa.

This commit bumps the version number, drops the __DRI_TEX_BUFFER_VERSION
checks and resolves all the build conflicts. Additionally it add a version
check as egl and dri3, as require version 2 of the extension which does
not have the releaseTexBuffer hook.

Cc: Juan Zhao <juan.j.zhao@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoCheck for dladdr(), rather than assuming we have it if we have RTLD_DEFAULT
Jon TURNEY [Sat, 5 Apr 2014 16:11:45 +0000 (17:11 +0100)]
Check for dladdr(), rather than assuming we have it if we have RTLD_DEFAULT

Unfortunately, Cygwin defines RTLD_DEFAULT (for glibc compatibility), but can't
provide dladdr(), so add a check for dladdr()

Since I don't think scons is ever used to build for Cygwin, just set HAVE_DLADDR
in SConscript, assuming that if we have RTLD_DEFAULT, we have dladdr().

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoutil: Fix cross-compiles between endiannesses
Richard Sandiford [Wed, 19 Mar 2014 17:11:02 +0000 (17:11 +0000)]
util: Fix cross-compiles between endiannesses

The old python code used sys.is_big_endian to select between little-endian
and big-endian formats, which meant that the build and host endiannesses
needed to be the same.  This patch instead generates both big- and little-
endian layouts, using PIPE_ARCH_BIG_ENDIAN to select between them.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Split out channel-parsing Python code
Richard Sandiford [Wed, 19 Mar 2014 17:10:12 +0000 (17:10 +0000)]
util: Split out channel-parsing Python code

Splits out the code that parses the channel list, so that we
can have different lists for little and big endian.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Split out channel-printing Python code
Richard Sandiford [Wed, 19 Mar 2014 17:09:45 +0000 (17:09 +0000)]
util: Split out channel-printing Python code

Rather than iterate over format.channels and format.swizzles directly,
use Python subfunctions that take the channel and swizzle lists as
arguments.  This allow the channel and swizzle lists to depend on
endianness.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Turn inv_swizzle into a global function
Richard Sandiford [Wed, 19 Mar 2014 17:09:14 +0000 (17:09 +0000)]
util: Turn inv_swizzle into a global function

With the big-endian changes, there can be two swizzle orders for each format.
This patch turns Format.inv_swizzle() into a global function that takes the
swizzle list as a parameter.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Add more query methods to u_format_parse.Format
Richard Sandiford [Wed, 19 Mar 2014 17:08:44 +0000 (17:08 +0000)]
util: Add more query methods to u_format_parse.Format

The main aim is to reduce the number of places that access channels[0],
swizzles[0] and swizzles[1] directly.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agost/mesa: Fix NULL pointer dereference for incomplete framebuffers
Michel Dänzer [Fri, 25 Apr 2014 02:40:39 +0000 (11:40 +0900)]
st/mesa: Fix NULL pointer dereference for incomplete framebuffers

This can happen with glamor, which uses EGL_KHR_surfaceless_context and
only explicitly binds GL_READ_FRAMEBUFFER for glReadPixels.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoglsl: fix spelling of derived
Chris Forbes [Sun, 27 Apr 2014 04:49:18 +0000 (16:49 +1200)]
glsl: fix spelling of derived

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agodocs: mark off nv50/nvc0 for ARB_sample_shading, update relnotes
Ilia Mirkin [Sat, 26 Apr 2014 16:38:31 +0000 (12:38 -0400)]
docs: mark off nv50/nvc0 for ARB_sample_shading, update relnotes

relnotes weren't updated this whole time, so I went through all the
GL3.txt changes and picked out the nouveau ones since 10.1.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: overhaul debug namespace support
Chia-I Wu [Thu, 24 Apr 2014 03:17:32 +0000 (11:17 +0800)]
mesa: overhaul debug namespace support

_mesa_HashTable is not well-suited for us: it locks a mutex unnecessarily and
it does not accept 0 as the key (and have branches to handle 1 specially).
What we really need is a sparse array.  Whether it should be implemented as a
hash table, a list, or a bsearch()-able array requires investigations of the
use models.

We choose to implement it as a list for now, assuming it is common to have a
short list of IDs in each (source, type) namespace.  The code is simpler, and
the memory footprint is lower.  This also fixes several corner cases such as
making messages to have different states at different severities.

v2: use GLbitfield for State/DefaultState, and add a comment

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: delay copying of debug groups
Chia-I Wu [Wed, 23 Apr 2014 07:19:55 +0000 (15:19 +0800)]
mesa: delay copying of debug groups

Do not copy the debug group until it is about to be written.  One likely
scenario of using glPushDebugGroup/glPopDebugGroup is to enclose a sequence of
GL commands and give them a human-readable description.  There is no message
control change in this scenario, and thus no need to copy.

This also reduces the initial size of gl_debug_state from 306KB to 7KB.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug output namespace handling
Chia-I Wu [Wed, 23 Apr 2014 06:17:55 +0000 (14:17 +0800)]
mesa: clean up debug output namespace handling

Add functions to provide these operations on a struct gl_debug_namespace:

  init():    initialize the namespace
  copy():    copy all elements from one namespace to another
  clear():   clear all elements (to free the memories)
  set():     set the value of an element
  set_all(): set the value of all elements
  get():     get the value of an element

A debug namespace is like a sparse array.  The length of the array is huge,
2^sizeof(GLuint), but most of the elements assume the same value sepcified by
set_all().

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug groups
Chia-I Wu [Wed, 23 Apr 2014 05:42:24 +0000 (13:42 +0800)]
mesa: clean up debug groups

Add struct gl_debug_group to hold all namespaces of a debug group.  Replace
the 3-dimensional array, Namespaces, in struct gl_debug_state by a
1-dimensional array of type struct gl_debug_groups.

Turn the 4-dimensional array, Defaults, in struct gl_debug_state to a
1-dimensional array in struct gl_debug_namespace.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug message log
Chia-I Wu [Wed, 23 Apr 2014 05:32:10 +0000 (13:32 +0800)]
mesa: clean up debug message log

Remove NextMsgLength, and move members of struct gl_debug_state that belong to
the message log to a new struct, gl_debug_log.  Rename gl_debug_msg to
gl_debug_message.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: use accessors for struct gl_debug_state
Chia-I Wu [Tue, 22 Apr 2014 06:22:49 +0000 (14:22 +0800)]
mesa: use accessors for struct gl_debug_state

When GL_DEBUG_OUTPUT_SYNCHRONOUS is GL_TRUE, drivers are allowed to log debug
messages from other threads.  That requires gl_debug_state to be protected by
a mutex, even when it is a context state.  While we do not spawn threads in
Mesa yet, this commit makes it easier to do when we want to.

Since the definition of struct gl_debug_state is no longer needed by the rest
of the driver, move it to main/errors.c.  This should make it even harder to
use the struct incorrectly.

v2: add comments for the accessors

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output message_insert
Chia-I Wu [Tue, 22 Apr 2014 06:36:25 +0000 (14:36 +0800)]
mesa: eliminate debug output message_insert

Add validate_length, and call it together with log_msg directly instead of
message_insert.  No functional change.

v2: make sure length is non-negative (i.e., known) before calling
    validate_length, noted by Timothy Arceri

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output should_log
Chia-I Wu [Tue, 22 Apr 2014 05:54:17 +0000 (13:54 +0800)]
mesa: eliminate debug output should_log

In both call sites, it could be easily replaced by direct
debug_is_message_enabled calls.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output control_app_messages
Chia-I Wu [Tue, 22 Apr 2014 05:34:01 +0000 (13:34 +0800)]
mesa: eliminate debug output control_app_messages

Merge control_app_messages with the only caller.  Eliminate set_message_state
and control_messages too as they are unused.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output get_msg
Chia-I Wu [Tue, 22 Apr 2014 05:32:18 +0000 (13:32 +0800)]
mesa: eliminate debug output get_msg

Merge get_msg with the only caller.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_data
Chia-I Wu [Tue, 22 Apr 2014 05:01:56 +0000 (13:01 +0800)]
mesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_data

Replace free_errors_data by debug_clear_group.  Add debug_pop_group and
debug_destroy for use in _mesa_PopDebugGroup and _mesa_free_errors_data
respectively.  No funcitonal change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor _mesa_PushDebugGroup
Chia-I Wu [Tue, 22 Apr 2014 04:51:16 +0000 (12:51 +0800)]
mesa: refactor _mesa_PushDebugGroup

Move group copying to debug_push_group.  Save the group message before pushing
instead of after, since we will need it after popping.  No functional change
otherwise.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor debug output control_messages
Chia-I Wu [Tue, 22 Apr 2014 03:21:19 +0000 (11:21 +0800)]
mesa: refactor debug output control_messages

Move most of the code to debug_set_message_enable_all.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor debug output get_msg
Chia-I Wu [Tue, 22 Apr 2014 03:09:53 +0000 (11:09 +0800)]
mesa: refactor debug output get_msg

Move message fetching to debug_fetch_message and message deletion to
debug_delete_messages.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor debug out log_msg
Chia-I Wu [Tue, 22 Apr 2014 02:31:36 +0000 (10:31 +0800)]
mesa: refactor debug out log_msg

Move message logging to debug_log_message.  Replace store_message_details by
debug_message_store.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor debug output set_message_state
Chia-I Wu [Tue, 22 Apr 2014 02:23:47 +0000 (10:23 +0800)]
mesa: refactor debug output set_message_state

Move message state update to debug_set_message_enable.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor debug output should_log
Chia-I Wu [Tue, 22 Apr 2014 02:18:09 +0000 (10:18 +0800)]
mesa: refactor debug output should_log

Move the message filtering logic to debug_is_message_enabled.  No functional
change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: refactor _mesa_get_debug_state
Chia-I Wu [Tue, 22 Apr 2014 02:10:30 +0000 (10:10 +0800)]
mesa: refactor _mesa_get_debug_state

Move gl_debug_state allocation to a new function, debug_create.  No functional
change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonvc0/ir: fetch shadow value from proper place for TG4 cube array
Ilia Mirkin [Thu, 24 Apr 2014 04:45:19 +0000 (00:45 -0400)]
nvc0/ir: fetch shadow value from proper place for TG4 cube array

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: set gatherComp for non-shadow targets
Ilia Mirkin [Thu, 24 Apr 2014 04:28:41 +0000 (00:28 -0400)]
nvc0/ir: set gatherComp for non-shadow targets

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: set instance count based on the GS_INVOCATIONS property
Ilia Mirkin [Thu, 24 Apr 2014 03:15:03 +0000 (23:15 -0400)]
nvc0/ir: set instance count based on the GS_INVOCATIONS property

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for INVOCATIONID system value
Ilia Mirkin [Thu, 24 Apr 2014 02:34:29 +0000 (22:34 -0400)]
nvc0/ir: add support for INVOCATIONID system value

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for SAMPLEMASK sysval
Ilia Mirkin [Thu, 24 Apr 2014 02:20:51 +0000 (22:20 -0400)]
nvc0/ir: add support for SAMPLEMASK sysval

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/st: translate gl_InvocationID to INVOCATIONID semantic
Ilia Mirkin [Thu, 24 Apr 2014 02:30:46 +0000 (22:30 -0400)]
mesa/st: translate gl_InvocationID to INVOCATIONID semantic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa/st: translate gl_SampleMaskIn to SAMPLEMASK semantic
Ilia Mirkin [Thu, 24 Apr 2014 02:16:49 +0000 (22:16 -0400)]
mesa/st: translate gl_SampleMaskIn to SAMPLEMASK semantic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agogallium: add GS_INVOCATIONS property
Ilia Mirkin [Thu, 24 Apr 2014 03:14:55 +0000 (23:14 -0400)]
gallium: add GS_INVOCATIONS property

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agogallium: add INVOCATIONID semantic
Ilia Mirkin [Thu, 24 Apr 2014 02:30:04 +0000 (22:30 -0400)]
gallium: add INVOCATIONID semantic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agonvc0: add support for PIPE_CAP_SAMPLE_SHADING
Ilia Mirkin [Mon, 21 Apr 2014 04:28:13 +0000 (00:28 -0400)]
nvc0: add support for PIPE_CAP_SAMPLE_SHADING

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: add support for PIPE_CAP_SAMPLE_SHADING
Ilia Mirkin [Sun, 30 Mar 2014 22:25:40 +0000 (18:25 -0400)]
nv50: add support for PIPE_CAP_SAMPLE_SHADING

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/st: add support for ARB_sample_shading
Ilia Mirkin [Sun, 30 Mar 2014 22:21:50 +0000 (18:21 -0400)]
mesa/st: add support for ARB_sample_shading

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium: add basic support for ARB_sample_shading
Ilia Mirkin [Sun, 30 Mar 2014 22:21:04 +0000 (18:21 -0400)]
gallium: add basic support for ARB_sample_shading

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomapi: OpenVG symbol exports.
Enrico Horn [Fri, 25 Apr 2014 18:38:13 +0000 (20:38 +0200)]
mapi: OpenVG symbol exports.

Fixes another mistake in 144bbb7b78e.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77502

10 years agoglsl: Use properly typed arguments for bitfieldInsert.
Matt Turner [Fri, 25 Apr 2014 19:22:22 +0000 (12:22 -0700)]
glsl: Use properly typed arguments for bitfieldInsert.

bitfieldInsert takes scalar integers for its last two arguments. Since
bitfieldInsert is lowered on i965 to two instructions that have more
flexible arguments, I didn't notice when I wrote this.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoi965: Don't bother flushing the batch if it doesn't ref our mt to map.
Eric Anholt [Wed, 23 Apr 2014 20:45:22 +0000 (13:45 -0700)]
i965: Don't bother flushing the batch if it doesn't ref our mt to map.

-1.1372% +/- 0.858033% effect on cairo runtime on glamor (n=175).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoegl: Protect use of gbm_dri with ifdef HAVE_DRM_PLATFORM
Ander Conselvan de Oliveira [Tue, 8 Apr 2014 20:28:42 +0000 (23:28 +0300)]
egl: Protect use of gbm_dri with ifdef HAVE_DRM_PLATFORM

Otherwise it fails to compile if the drm egl platform is disabled.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agowayland: Fix the logic in disabling the prime capability
Neil Roberts [Tue, 8 Apr 2014 20:28:40 +0000 (23:28 +0300)]
wayland: Fix the logic in disabling the prime capability

It looks like this bit of code is trying to disable the prime capability if
the driver doesn't support createImageFromFds. However the logic looks a bit
broken and what it would actually do is disable all other capabilities apart
from prime. This patch fixes it to actually disable prime.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogbm: Set errno on errors
Ander Conselvan de Oliveira [Tue, 8 Apr 2014 20:28:39 +0000 (23:28 +0300)]
gbm: Set errno on errors

This should give the caller some information of what called the error.
For the gbm_bo_import() case, for instance, it is possible to know if
the import is not supported or the error was caused by an invalid
parameter.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogbm/dri: Fix out-of-memory error path in dri_device_create()
Ander Conselvan de Oliveira [Tue, 8 Apr 2014 20:28:38 +0000 (23:28 +0300)]
gbm/dri: Fix out-of-memory error path in dri_device_create()

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium/tests: conditionally include sw/dri winsys
Emil Velikov [Tue, 1 Apr 2014 16:42:42 +0000 (17:42 +0100)]
gallium/tests: conditionally include sw/dri winsys

In all fairness we allow the gallium tests to be build with --disable-dri
which will result in the approapriate winsys to not be build, thus the
build will fail.

  ./configure --disable-dri --with-gallium-drivers=svga --enable-gallium-tests

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoautomake: cleanup pipe-loader handling when using sw/xlib winsys
Emil Velikov [Tue, 1 Apr 2014 16:42:41 +0000 (17:42 +0100)]
automake: cleanup pipe-loader handling when using sw/xlib winsys

Rather than defining our own set of variables, use NEED_WINSYS_XLIB
and based on it include the sw/xlib winsys.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: conditionally build and use pipe_loader_sw_probe_dri
Emil Velikov [Tue, 1 Apr 2014 16:42:40 +0000 (17:42 +0100)]
pipe-loader: conditionally build and use pipe_loader_sw_probe_dri

The function relies on the sw/dri winsys which is build only when --enable-dri
is set. Fixes build issues with the following config

 ./configure --disable-dri --with-gallium-drivers=svga --enable-xa

Issue can be reproduced with any hw gallium driver + st that uses the pipe-loader.

Cc: Brian Paul <brianp@vmware.com>
Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agollvmpipe: fix clearing of individual color buffers in a fb
Roland Scheidegger [Wed, 23 Apr 2014 18:23:07 +0000 (20:23 +0200)]
llvmpipe: fix clearing of individual color buffers in a fb

GL (3.0) allows you to clear individual color buffers in a fb. In fact
for fbs containing both int and float/normalized color buffers this is
required (because the clearing values are otherwise undefined if applied
to all buffers). The gallium interface was changed a while ago, but llvmpipe
ignored it (hence doing such individual clears always resulted in clearing
all buffers, plus some assorted asserts due to the mixed fbs).
So change the clear command to indicate the buffer to be cleared. Also, because
indicating the buffer to be cleared would have made lp_rast_arg_cmd larger
which is unacceptable (we're trying to shrink it some day) allocate the clear
value in the scene and just pass a pointer.
There's several advantages and disadvantages here:
+ clearing individual buffers works (we could also actually bin such clears now
if they'd come through clear_render_target() if the surface is in the current
fb, though we didn't do this before for the single rb case and still don't try).
+ since there's one clear per rb, we do the format conversion in setup rather
than per bin. Aside from the (drop in the ocean...) performance advantage this
means that clearing to very small values (that is, denormal when converted to
the format) should work for small float (fp16 etc.) formats, as the util code
couldn't handle it correctly before (because cpu denorms are disabled when
executing the bin commands, screwing up the magic conversion and flushing
the values to 0, though this was not verified).
- there's some overhead for traditional old-style clear-all MRT cases, since
there's one rast clear command per rb instead of one for all rbs.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=76976.

v2: get rid of the ugly manual memcpy stuff and just use union util_color.
This is 32 bytes instead of 16 but as the allocation is per scene we can live
with those additional 16 bytes (and the additional 128 bytes in the setup
context), which makes the code much more obvious. Suggested by Brian.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallium/util: use ui[4] instead of ui in union util_color
Roland Scheidegger [Wed, 23 Apr 2014 18:00:03 +0000 (20:00 +0200)]
gallium/util: use ui[4] instead of ui in union util_color

util_color often merely represents a collection of bytes, however it is
inconvenient if those bytes can only be accessed as floats/doubles for int
formats exceeding 32bits.
(Note that since rgba8 formats use one uint, not 4 bytes, hence the byte and
short member were left as is.)

10 years agollvmpipe: (trivial) use correct LP_MIN_VECTOR_ALIGN define for alignment.
Roland Scheidegger [Fri, 4 Apr 2014 02:24:49 +0000 (04:24 +0200)]
llvmpipe: (trivial) use correct LP_MIN_VECTOR_ALIGN define for alignment.

Currently it's the same value.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agor600g: fix hang on RV740 by using DX_RASTERIZATION_KILL instead of SX_MISC
Marek Olšák [Sun, 20 Apr 2014 16:17:51 +0000 (18:17 +0200)]
r600g: fix hang on RV740 by using DX_RASTERIZATION_KILL instead of SX_MISC

Changing SX_MISC hangs RV740. When we're at it, let's use DX_RASTERIZATION_KILL
on all R700 and later chipsets.

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix for an MSAA hang on RV770
Marek Olšák [Sun, 20 Apr 2014 16:11:56 +0000 (18:11 +0200)]
r600g: fix for an MSAA hang on RV770

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix for broken CULL_FRONT behavior on R6xx
Marek Olšák [Sun, 20 Apr 2014 13:19:43 +0000 (15:19 +0200)]
r600g: fix for broken CULL_FRONT behavior on R6xx

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix for HTILE on R6xx
Marek Olšák [Sun, 20 Apr 2014 13:17:23 +0000 (15:17 +0200)]
r600g: fix for HTILE on R6xx

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix buffer copying on R600-R700
Marek Olšák [Sat, 19 Apr 2014 22:53:32 +0000 (00:53 +0200)]
r600g: fix buffer copying on R600-R700

This fixes broken rendering in DOTA 2.

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix flushing on RV670, RS780, RS880 again
Marek Olšák [Sat, 19 Apr 2014 21:39:13 +0000 (23:39 +0200)]
r600g: fix flushing on RV670, RS780, RS880 again

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix MSAA resolve on R6xx when the destination is 1D-tiled
Marek Olšák [Sat, 19 Apr 2014 21:11:41 +0000 (23:11 +0200)]
r600g: fix MSAA resolve on R6xx when the destination is 1D-tiled

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: disable async DMA on R700
Marek Olšák [Sat, 19 Apr 2014 13:47:54 +0000 (15:47 +0200)]
r600g: disable async DMA on R700

Cc: 10.0 10.1 mesa-stable@lists.freedesktop.org
10 years agor600g: fix edge flags and layered rendering on R600-R700
Marek Olšák [Sat, 19 Apr 2014 15:21:57 +0000 (17:21 +0200)]
r600g: fix edge flags and layered rendering on R600-R700

We forgot to set these bits.

Cc: 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agost/mesa: remove trailing NULL colorbuffers
Marek Olšák [Sun, 20 Apr 2014 01:41:47 +0000 (03:41 +0200)]
st/mesa: remove trailing NULL colorbuffers

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agor300g: don't crash when getting NULL colorbuffers
Marek Olšák [Sun, 20 Apr 2014 02:32:24 +0000 (04:32 +0200)]
r300g: don't crash when getting NULL colorbuffers

Cc: mesa-stable@lists.freedesktop.org
10 years agor300g: fix runtime warning after winsys cleanup
Marek Olšák [Sun, 20 Apr 2014 01:39:23 +0000 (03:39 +0200)]
r300g: fix runtime warning after winsys cleanup

Broken by:
  b2238b3452b0bcf3c1216c20c9918f9f0664b464
  winsys/radeon: remove cs_write_reloc, add simpler cs_get_reloc

10 years agoradeonsi: implement GL_ARB_vertex_type_10f_11f_11f_rev
Marek Olšák [Fri, 18 Apr 2014 14:16:44 +0000 (16:16 +0200)]
radeonsi: implement GL_ARB_vertex_type_10f_11f_11f_rev

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agost/xlib: Do minimal version checking in glXCreateContextAttribsARB.
José Fonseca [Thu, 24 Apr 2014 14:49:01 +0000 (15:49 +0100)]
st/xlib: Do minimal version checking in glXCreateContextAttribsARB.

The current version checking is wrongly refusing to create 3.3 contexts;
unsupported version are checked elsewhere; and the DRI path doesn't do
this sort of checking neither.

This enables piglit glsl 3.30 tests to run without skipping.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agollvmpipe: Advertise GLSL 3.30.
José Fonseca [Thu, 24 Apr 2014 14:00:12 +0000 (15:00 +0100)]
llvmpipe: Advertise GLSL 3.30.

According to Roland all TGSI support is there in theory.

In practice there are a few piglit failures and crashes, as this hadn't
been tested before.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/xlib: Honour request of 3.1 contexts through core profile where available.
José Fonseca [Thu, 24 Apr 2014 14:05:47 +0000 (15:05 +0100)]
st/xlib: Honour request of 3.1 contexts through core profile where available.

The GLX_ARB_create_context_profile spec says:

    "If version 3.1 is requested, the context returned may implement
    any of the following versions:

      * Version 3.1. The GL_ARB_compatibility extension may or may not
        be implemented, as determined by the implementation.

      * The core profile of version 3.2 or greater."

Mesa does not support GL_ARB_compatibility, and there are no plans to
ever support it, therefore the only chance to honour a 3.1 context is
through core profile, i.e, the 2nd alternative from the spec.

This change does that.  And with it piglit tests that require 3.1
contexts no longer skip.

Assuming there is no objection with this change, src/glx/dri_common.c
and src/gallium/state_trackers/wgl/stw_context.c should also be updated
accordingly, given they have the same logic.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agodraw/llvm: reduce memory usage
Zack Rusin [Wed, 23 Apr 2014 21:06:13 +0000 (17:06 -0400)]
draw/llvm: reduce memory usage

Lets make draw_get_option_use_llvm function available unconditionally
and use it to avoid useless allocations when LLVM paths are active.
TGSI machine is never used when we're using LLVM.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodocs: fix typo in 10.1.1 release notes URL
Brian Paul [Thu, 24 Apr 2014 14:37:23 +0000 (08:37 -0600)]
docs: fix typo in 10.1.1 release notes URL

10 years agoswrast: move texture_slices() calls out of loops
Brian Paul [Wed, 23 Apr 2014 15:59:55 +0000 (09:59 -0600)]
swrast: move texture_slices() calls out of loops

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoswrast: move null pointer check earlier in _swrast_map_teximage()
Brian Paul [Wed, 23 Apr 2014 15:57:11 +0000 (09:57 -0600)]
swrast: move null pointer check earlier in _swrast_map_teximage()

There's no reason to compute texel size, stride, etc. if there's no
image data to map.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoswrast: remove _mesa_ prefix from static function
Brian Paul [Wed, 23 Apr 2014 15:55:25 +0000 (09:55 -0600)]
swrast: remove _mesa_ prefix from static function

And add a const qualifier.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoswrast: allocate swrast_texture_image::ImageSlices array if needed
Brian Paul [Wed, 23 Apr 2014 15:49:58 +0000 (09:49 -0600)]
swrast: allocate swrast_texture_image::ImageSlices array if needed

Fixes a segmentation fault in conform divzero.c test.
This happens when glTexImage(level, width=0, height=0) is called.  We
don't allocate texture memory in that case so the ImageSlices array
was never allocated.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoswrast: Fix vertex color in _swsetup_Translate()
nick [Wed, 23 Apr 2014 14:18:00 +0000 (08:18 -0600)]
swrast: Fix vertex color in _swsetup_Translate()

Straightforward fix to properly load dest->color with color data, as
opposed to position data as previously implemented.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27499
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallivm: Fix wrong operator in lp_exec_default.
José Fonseca [Thu, 24 Apr 2014 13:49:53 +0000 (14:49 +0100)]
gallivm: Fix wrong operator in lp_exec_default.

Courtesy of MSVC static code analyser.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa/st: Handle empty frame-buffers without asserting.
José Fonseca [Thu, 24 Apr 2014 13:48:37 +0000 (14:48 +0100)]
mesa/st: Handle empty frame-buffers without asserting.

Fixes assertion failures with radeonsi.

Tested-by: Marek Olšák <maraeo@gmail.com>
10 years agomesa/st: Fix pipe_framebuffer_state::height for PIPE_TEXTURE_1D_ARRAY.
José Fonseca [Thu, 3 Apr 2014 14:56:46 +0000 (15:56 +0100)]
mesa/st: Fix pipe_framebuffer_state::height for PIPE_TEXTURE_1D_ARRAY.

This prevents buffer overflow w/ llvmpipe when running piglit

  bin/gl-3.2-layered-rendering-clear-color-all-types 1d_array single_level -fbo -auto

v2: Compute the framebuffer size as the minimum size, as pointed out by
Brian;  compacted code;  ran piglit quick test list (with no
regressions.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoutil/u_debug: Pass correct size to strncat.
José Fonseca [Tue, 22 Apr 2014 11:32:17 +0000 (12:32 +0100)]
util/u_debug: Pass correct size to strncat.

Courtesy of Clang static analyzer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agofreedreno/a3xx: fix TOTALATTRTOVS
Rob Clark [Tue, 22 Apr 2014 19:43:51 +0000 (15:43 -0400)]
freedreno/a3xx: fix TOTALATTRTOVS

In cases where varying fetches are optimized away (just pass-through in
vertex shader, but unused in fragment shader) we need to calculate the
correct TOTALATTROVS based on the actual number of varyings fetched,
otherwise lockup.

Signed-off-by: Rob Clark <robclark@freedesktop.org>