mesa.git
10 years agodraw: fix incorrect vertex size computation in LLVM drawing code
Brian Paul [Mon, 20 Jan 2014 18:57:20 +0000 (10:57 -0800)]
draw: fix incorrect vertex size computation in LLVM drawing code

We were calling draw_total_vs_outputs() too early.  The call to
draw_pt_emit_prepare() could result in the vertex size changing.
So call draw_total_vs_outputs() after draw_pt_emit_prepare().

This fix would seem to be needed for the non-LLVM code as well,
but it's not obvious.  Instead, I added an assertion there to
try to catch this problem if it were to occur there.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72926
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodocs: note reduced display list memory usage in 10.1 relnotes
Brian Paul [Wed, 15 Jan 2014 01:34:22 +0000 (17:34 -0800)]
docs: note reduced display list memory usage in 10.1 relnotes

10 years agodraw: clean up d3d style point clipping
Roland Scheidegger [Fri, 17 Jan 2014 18:39:19 +0000 (19:39 +0100)]
draw: clean up d3d style point clipping

Instead of skipping x/y clipping completely if there's point_tri_clip points
use guard band clipping. This should be easier (previously we could not disable
generating the x/y bits in the clip mask for llvm path, hence requiring custom
clip path), and it also allows us to enable this for tris-as-points more easily
too (this would require custom tri clip filtering too otherwise). Moreover,
some unexpected things could have happen if there's a NaN or just a huge number
in some tri-turned-point, as the driver's rasterizer would need to deal with it
and that might well lead to undefined behavior in typical rasterizers (which
need to convert these numbers to fixed point). Using a guardband should hence
be more robust, while "usually" guaranteeing the same results. (Only "usually"
because unlike hw guardbands draw guardband is always just twice the vp size,
hence small vp but large points could still lead to different results.)
Unfortunately because the clipmask generated is completely unaffected by guard
band clipping, we still need a custom clip stage for points (but not for tris,
as the actual clipping there takes guard band into account).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoswrast: check for null/-1 when mapping renderbuffers
Brian Paul [Mon, 20 Jan 2014 16:06:35 +0000 (08:06 -0800)]
swrast: check for null/-1 when mapping renderbuffers

Fixes fbo-drawbuffers-none crash (but test still fails).
https://bugs.freedesktop.org/show_bug.cgi?id=73757

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosoftpipe: fix crash when accessing null colorbuffer
Brian Paul [Mon, 20 Jan 2014 15:59:25 +0000 (07:59 -0800)]
softpipe: fix crash when accessing null colorbuffer

Fixes piglit fbo-missing-attachment-blit test.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73755

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/vdpau: s/surface/resource/ to fix compiler warning
Brian Paul [Mon, 20 Jan 2014 15:51:25 +0000 (07:51 -0800)]
st/vdpau: s/surface/resource/ to fix compiler warning

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoi915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".
José Fonseca [Mon, 20 Jan 2014 14:15:04 +0000 (14:15 +0000)]
i915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".

These are components which were originally developed by Tungsten Graphics,
which was in turn acquired by VMware, but are de facto now being maintained
by third-party contributors of the Mesa open-source community.

This matches what's reported by swrast driver and a few other components.

Suggested by Ian Romanick.

10 years agologger: Remove unused variable.
José Fonseca [Mon, 20 Jan 2014 13:58:11 +0000 (13:58 +0000)]
logger: Remove unused variable.

Silences gcc "unused variable ‘buf’" warning.

Trivial.

10 years agologger: s/\<log\>/log_/
José Fonseca [Mon, 20 Jan 2014 13:57:12 +0000 (13:57 +0000)]
logger: s/\<log\>/log_/

Currently the MSVC build is broken because of conflicting definitions of
'log' function.  I didn't investigate thoroughly, but I suspect the
it is conflicting standard math.h's log.

log_ is admittedly not a great name, but it is better than a broken build.
A better one can be used in a follow-on build.

10 years agoi965/blorp: reduce the scope of the explicit compression control
Topi Pohjolainen [Fri, 20 Dec 2013 09:12:31 +0000 (11:12 +0200)]
i965/blorp: reduce the scope of the explicit compression control

By highlighting these special cases makes it clearer to switch
to the fs-generator as the wider scoped compression control
settings used in the current implementation can be simply
dropped.

No regressions on IVB (piglit quick + unit tests).

v2 (Ian): typo in a comment

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/blorp: remove dependency to compression control state
Topi Pohjolainen [Thu, 12 Dec 2013 16:32:10 +0000 (18:32 +0200)]
i965/blorp: remove dependency to compression control state

Effectively only the mask control bit gets altered for the single
addition in question and hence there is no real need to use a
fresh state control level for it -- that is more useful when
multiple intructions share the same mask and compression settings.

This is a preparation step for removing the explicit compression
control modifiers in the blit compiler. After this patch there
are no nested state control levels making the constant nature of
the compression settings more apparent.

No regressions on IVB (piglit quick + unit tests).

v2 (Matt, Ian): use temporary variable instead of assigning
                directly on the same line with a function call.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Only update renderbuffers on initial intelMakeCurrent
Kristian Høgsberg [Sat, 18 Jan 2014 00:55:31 +0000 (16:55 -0800)]
i965: Only update renderbuffers on initial intelMakeCurrent

We call intel_prepare_render() in intelMakeCurrent() to make sure we have
renderbuffers before calling _mesa_make_current().  The only reason we
do this is so that we can have valid defaults for width and height.
If we already have buffers for the drawable we're making current, we
don't need this step.

In itself, this is a small optimization, but it also avoids a round trip
that could block on the display server in a unexpected place.

https://bugs.freedesktop.org/show_bug.cgi?id=72540
https://bugs.freedesktop.org/show_bug.cgi?id=72612

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agost/vdpau: check surface params before creating surfaces
Ilia Mirkin [Sat, 18 Jan 2014 03:33:47 +0000 (22:33 -0500)]
st/vdpau: check surface params before creating surfaces

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: fix bogus error handling in output/bitmap creation
Ilia Mirkin [Sat, 18 Jan 2014 03:25:34 +0000 (22:25 -0500)]
st/vdpau: fix bogus error handling in output/bitmap creation

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: don't return a device if the screen doesn't support NPOT
Ilia Mirkin [Sat, 18 Jan 2014 02:41:38 +0000 (21:41 -0500)]
st/vdpau: don't return a device if the screen doesn't support NPOT

NV3x cards don't support NPOT textures. Technically this restriction
could be worked around, but since it also doesn't expose any video
decoding hw, just turn it off entirely.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agopipe-loader: Fix build
Armin K [Sun, 19 Jan 2014 14:09:33 +0000 (15:09 +0100)]
pipe-loader: Fix build

pipe_loader_drm.c: In function 'pipe_loader_drm_probe_fd':
pipe_loader_drm.c:120:4: error: implicit declaration of function 'loader_get_pci_id_for_fd' [-Werror=implicit-function-declaration]

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoloader: ifdef libdrm specific code and include
Emil Velikov [Sun, 19 Jan 2014 03:09:03 +0000 (03:09 +0000)]
loader: ifdef libdrm specific code and include

Mesa provides the flexibility of building without the
need to have libdrm present on the system. The situation
has regressed with the recent commit

commit 8c2e7fd8460750543367053b1be9368cc38e1d6a
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Jan 10 23:36:16 2014 +0000

    loader: introduce the loader util lib

By isolating libdrm code by #ifndef __NOT_HAVE_DRM_H we
can have libdrm-less builds on across all build systems.

This patch converts Android's _EGL_NO_DRM to __NOT_HAVE_DRM_H
to provide consistency with the other cases within mesa, allows
compilation of libloader on libdrm-less scons and conditionally
links against libdrm if present under automake.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73776
BUgzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73777
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Double the push constant space multipliers on Broadwell too.
Kenneth Graunke [Tue, 4 Dec 2012 19:39:14 +0000 (11:39 -0800)]
i965: Double the push constant space multipliers on Broadwell too.

Broadwell has 2Kb push constant size increments like Haswell GT3.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Update invariant state for Broadwell.
Kenneth Graunke [Mon, 3 Dec 2012 23:28:39 +0000 (15:28 -0800)]
i965: Update invariant state for Broadwell.

The only difference is that STATE_SIP takes a 48-bit address, so we need
to output two zeroes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Use the Sandybridge VUE format on Broadwell as well.
Kenneth Graunke [Thu, 29 Nov 2012 09:30:01 +0000 (01:30 -0800)]
i965: Use the Sandybridge VUE format on Broadwell as well.

It hasn't changed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Create a new fragment shader backend for Broadwell.
Kenneth Graunke [Fri, 7 Dec 2012 06:38:26 +0000 (22:38 -0800)]
i965: Create a new fragment shader backend for Broadwell.

This replaces the old fs_generator backend.

v2: Port to the C-based representation of assembly instructions.
    Fix texturing after the texture-grf merge.

v3: Add high quality derivative support.  Fix SET_SIMD4X2_OFFSET.

v4: Pass brw_context to gen8_instruction functions as required.

v5: Fixes for MRT, as well as zero render targets (alpha test only).

v6: Replace n-wide with SIMDn in comments and messages; port over
    Topi's blorp-generator changes; add missing TXF_MCS opcode,
    fix missing high quality derivatives for DDX; fix typo (all caught
    by Eric).  Simplify ADDC/SUBB handling; drop "Used only on Gen6+"
    comment (caught by Matt).  Emit SIMD16 versions of three source
    instructions (caught by both Eric and Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Create a new vec4 backend for Broadwell.
Kenneth Graunke [Fri, 7 Dec 2012 06:37:34 +0000 (22:37 -0800)]
i965: Create a new vec4 backend for Broadwell.

This replaces the old vec4_generator backend.

v2: Port to use the C-based instruction representation.  Also, remove
    Geometry Shader offset hacks - the visitor will handle those instead
    of this code.

v3: Texturing fixes (including adding textureGather support).

v4: Pass brw_context to gen8_instruction functions as required.

v5: Add SHADER_OPCODE_TXF_MCS support; port DUAL_INSTANCED gs fixes
    (caught by Eric).  Simplify ADDC/SUBB handling; add comments to
    gen8_set_dp_message calls (suggested by Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add a new infrastructure for generating Broadwell shader assembly.
Kenneth Graunke [Fri, 7 Dec 2012 06:36:50 +0000 (22:36 -0800)]
i965: Add a new infrastructure for generating Broadwell shader assembly.

This replaces the brw_eu_emit.c layer for Broadwell.  It will be
used by both the vector and scalar shader backends.

v2: Port to use the C-based instruction representation.

v3: Fix destination register type for CMP.

v4: Pass brw to gen8_instruction functions (required by rebase).

v5: Remove bogus assertion on math instructions (caught by Piglit).

v6: Remove more restrictions on math instructions (caught by Eric).
    Make ADDC and SUBB helpers set accumulator writes, like MAC and
    MACH (caught by Matt).

v7: Don't implicitly force ALU3 operations to SIMD8 (we've been able
    to do SIMD16 versions since Haswell, but didn't when I originally
    wrote this code).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Implement a disassembler for Broadwell's new instruction encoding.
Kenneth Graunke [Tue, 11 Dec 2012 08:26:11 +0000 (00:26 -0800)]
i965: Implement a disassembler for Broadwell's new instruction encoding.

Heavily based on Keith Packard's existing brw_disasm.c code.  I've tried
to go through most of the pieces (like SFIDs) and update the lists to
include features added in recent generations.

v2: Port to use the C-based instruction emitters.  This allows us to use
    C99 array initializers, which tidies up some of the code.

v3: Improve decoding of render target write messages.

v4: Update for BRW_REGISTER_TYPE becoming an abstraction.

v5: Rebase on Chris Forbes' SFID message defines.

v6: Fix disassembly of UV immediates; remove silly casts.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add a new representation for Broadwell shader instructions.
Kenneth Graunke [Fri, 7 Dec 2012 06:36:26 +0000 (22:36 -0800)]
i965: Add a new representation for Broadwell shader instructions.

Broadwell significantly changes the EU instruction encoding.  Many of
the fields got moved to different bit positions; some even got split
in two.

With so many changes, it was infeasible to continue using struct
brw_instruction.  We needed a new representation.

This new approach is a bit different: rather than a struct, I created a
class that has four DWords, and helper functions that read/write various
bits.  This has several advantages:

1. We can create several different names for the same bits.  For
   example, conditional modifiers, SFID for SEND instructions, and the
   MATH instruction's function opcode are all stored in bits 27:24.

   In each situation, we can use the appropriate setter function:
   set_sfid(), set_math_function(), or set_cond_modifier().  This
   is much easier to follow.

2. Since the fields are expressed using the original 128-bit numbers,
   the code to create the getter/setter functions follows the table in
   the documentation very closely.

To aid in debugging, I've enabled -fkeep-inline-functions when building
gen8_instruction.c.  Otherwise, these functions cannot be called by
gdb, making it insanely difficult to print out anything.

Kenneth Graunke wrote most of this code.  Damien Lespiau ported it to
C99.  Xiang Haihao added media fields.  Zhao Yakui added indirect
addressing support.  Eric Anholt added an assertion to make sure that
values fit in the alloted number of bits.

v2: Update for brw_reg_type_to_hw_type(), which necessitates passing
    brw_context pointers around everywhere.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add SFID #defines for media stuff.
Kenneth Graunke [Mon, 9 Dec 2013 00:35:36 +0000 (16:35 -0800)]
i965: Add SFID #defines for media stuff.

While we probably won't ever use these, having them makes it easy to
share disassembler code between intel-gpu-tools and Mesa.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add #defines for new Broadwell math functions.
Kenneth Graunke [Mon, 9 Dec 2013 00:33:19 +0000 (16:33 -0800)]
i965: Add #defines for new Broadwell math functions.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: add struct and SFID for pixel interpolator messages
Chris Forbes [Sun, 17 Nov 2013 06:32:49 +0000 (19:32 +1300)]
i965: add struct and SFID for pixel interpolator messages

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/Gen7: Only emit cube face enables for cubes.
Chris Forbes [Wed, 8 Jan 2014 21:01:13 +0000 (10:01 +1300)]
i965/Gen7: Only emit cube face enables for cubes.

This is not observed to actually fix anything, but the PRM says this
field must be zero for other surface types.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Improve dumping of Gen7 SURFACE_STATE
Chris Forbes [Wed, 8 Jan 2014 20:58:12 +0000 (09:58 +1300)]
i965: Improve dumping of Gen7 SURFACE_STATE

Previously this was missing many interesting fields. Having them decoded
makes debugging views much easier.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Add masks for more SURFACE_STATE fields
Chris Forbes [Wed, 8 Jan 2014 20:56:16 +0000 (09:56 +1300)]
i965: Add masks for more SURFACE_STATE fields

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agonv50: drop obsolete check from error path
Emil Velikov [Thu, 16 Jan 2014 17:36:43 +0000 (17:36 +0000)]
nv50: drop obsolete check from error path

At 'out_err' the nv50_context has been calloc-ated.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access framebuffer.cbufs
Emil Velikov [Thu, 16 Jan 2014 17:34:31 +0000 (17:34 +0000)]
nv50: assert before trying to out-of-bounds access framebuffer.cbufs

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access samplers
Emil Velikov [Thu, 16 Jan 2014 17:29:42 +0000 (17:29 +0000)]
nv50: assert before trying to out-of-bounds access samplers

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access textures
Emil Velikov [Thu, 16 Jan 2014 17:08:19 +0000 (17:08 +0000)]
nv50: assert before trying to out-of-bounds access textures

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: pass vtxbuf index as unsigned
Emil Velikov [Thu, 16 Jan 2014 16:55:52 +0000 (16:55 +0000)]
nv50: pass vtxbuf index as unsigned

The index passed to the function is already unsigned, and internally
we threat it as unsigned.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access vtxbuf
Emil Velikov [Thu, 16 Jan 2014 16:53:45 +0000 (16:53 +0000)]
nv50: assert before trying to out-of-bounds access vtxbuf

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: typecast the result of ffs() to unsigned
Emil Velikov [Thu, 16 Jan 2014 16:42:45 +0000 (16:42 +0000)]
nv50: typecast the result of ffs() to unsigned

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access constbuf
Emil Velikov [Thu, 16 Jan 2014 16:35:27 +0000 (16:35 +0000)]
nv50: assert before trying to out-of-bounds access constbuf

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: access only the available amount of constbuf
Emil Velikov [Thu, 16 Jan 2014 15:37:53 +0000 (15:37 +0000)]
nv50: access only the available amount of constbuf

The textures array is defined as a number of NV50_MAX_PIPE_CONSTBUFS
per shader stage. Currently the nv50 driver handles only 3 shader
stages, thus we wreck chaos when accessing array-out-of-bounds.

Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: access only the available amount of textures
Emil Velikov [Thu, 16 Jan 2014 15:35:02 +0000 (15:35 +0000)]
nv50: access only the available amount of textures

The textures array is defined as a number of PIPE_MAX_SAMPLERS per shader stage.
Currently nv50 driver handles only 3 shader stages, thus we wreck chaos when
accessing array-out-of-bounds.

Fixes a segfault in piglit/bin/arb_texture_buffer_object-data-sync -fbo -auto

Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoloader: fallback to drmGetVersion() for non-pci devices
Rob Clark [Sat, 14 Dec 2013 19:28:33 +0000 (14:28 -0500)]
loader: fallback to drmGetVersion() for non-pci devices

Use the kernel driver name are returned by drmGetVersion() for
non-pci(platform) devices.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
v2 (Emil): Rebased and weaked commit message.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agopipe-loader: add support for non-pci (platform) devices
Emil Velikov [Sat, 11 Jan 2014 05:19:36 +0000 (05:19 +0000)]
pipe-loader: add support for non-pci (platform) devices

Culled out of the "loader: refactor duplicated code into loader util lib"
patch by Rob Clark.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agopci_ids: no not include loader.h
Emil Velikov [Sat, 11 Jan 2014 05:16:06 +0000 (05:16 +0000)]
pci_ids: no not include loader.h

As per original approach by Rob, each user of the loader lib should include
loader.h and the pci_id_driver_map.h header will be used exclusively by the
loader.

Add back the include guard __IS_LOADER and remove no longer needed include
folder in the scons build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoegl_dri2: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:52:48 +0000 (04:52 +0000)]
egl_dri2: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agopipe-loader: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:28:24 +0000 (04:28 +0000)]
pipe-loader: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agost/egl: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:06:45 +0000 (04:06 +0000)]
st/egl: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoegl-static: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 03:12:40 +0000 (03:12 +0000)]
egl-static: use loader util lib

v2
* Drop the no longer used _EGL_NO_DRM from Android.mk.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogbm: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:50:08 +0000 (02:50 +0000)]
gbm: use the loader util lib

Additionally this commit removes the following exported functions

   _gbm_udev_device_new_from_fd()
   _gbm_fd_get_device_name()
   _gbm_log()

All three were erroneously marked as exported since their inception.
Neither of them has ever been a part of the API thus there should be
no users of them.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:24:43 +0000 (02:24 +0000)]
glx: use the loader util lib

v2
* Set logger to ErrorMessageF. Spotted by Kristian

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoloader: introduce the loader util lib
Emil Velikov [Fri, 10 Jan 2014 23:36:16 +0000 (23:36 +0000)]
loader: introduce the loader util lib

All the various window system integration layers duplicate roughly the
same code for figuring out device and driver name, pci-id's, etc.  Which
is sad.  So extract it out into a loader util lib.

v2 (Emil)
* Separate the introduction of libloader from the code de-duplication.
* Strip out non-pci devices support.
* Add scons + Android build system support.
* Add VISIBILITY_CFLAGS to avoid exporting the loader funcs.

v3 (Emil)
* PIPE_OS_ANDROID is undefined at this scope, use ANDROID
* Make sure we define _EGL_NO_DRM when building only swrast

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Remove CACHED_BATCH support altogether.
Kenneth Graunke [Mon, 26 Aug 2013 20:11:21 +0000 (13:11 -0700)]
i965: Remove CACHED_BATCH support altogether.

Using an unoptimized variant of glamor spending 50% of its CPU time in
brw_draw_prims() (and hitting the cache *very* frequently):

    N           Min           Max        Median           Avg        Stddev
x 200         29200         40500         34900         34750     958.43256
+ 200         31000         40300         34700         34622     916.35941
No difference proven at 95.0% confidence

Similarly, no difference on GLB2.7:

    N           Min           Max        Median           Avg        Stddev
x  63          64.1         71.36         70.69     70.113175     1.6782026
+  63          63.6         71.18         70.75     70.223651     1.6044186
No difference proven at 95.0% confidence

v2: Rebase on master (by anholt)
v3: Add a missing BEGIN_BATCH(3) to aa_line_parameters -- CACHED_BATCH
    didn't have the asserts about batchbuffer usage that ADVANCE_BATCH
    does, so we started assertion failing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Replace 8-wide and 16-wide with SIMD8 and SIMD16.
Eric Anholt [Tue, 12 Nov 2013 23:33:27 +0000 (15:33 -0800)]
i965: Replace 8-wide and 16-wide with SIMD8 and SIMD16.

Those are the terms used in the docs, and think "n-wide" was something I
just happened to say.  Note that shader-db needs updating for the
INTEL_DEBUG=fs parsing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Stop doing our optimization on a copy of the GLSL IR.
Eric Anholt [Thu, 28 Nov 2013 08:48:57 +0000 (00:48 -0800)]
i965: Stop doing our optimization on a copy of the GLSL IR.

The original intent was that we'd keep a driver-private copy, and there
would be the normal copy for swrast to make use of without the tuning (or
anything more invasive we might do) specific to i965.  Only, we don't
generate swrast code any more, because swrast can't render current shaders
anyway.  Thus, our private copy is rather a waste, and we can just do our
backend-specific operations on the linked shader.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agos/Tungsten Graphics/VMware/
José Fonseca [Fri, 17 Jan 2014 16:27:50 +0000 (16:27 +0000)]
s/Tungsten Graphics/VMware/

Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agotrace: Re-license trace.xsl under MIT license.
José Fonseca [Fri, 17 Jan 2014 16:15:18 +0000 (16:15 +0000)]
trace: Re-license trace.xsl under MIT license.

I was the sole author, as Tungsten Graphics employee, which was since
then acquired by VMware Inc.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agosvga: fix crash when clearing null color buffer
Brian Paul [Thu, 16 Jan 2014 21:53:27 +0000 (13:53 -0800)]
svga: fix crash when clearing null color buffer

Fixes regression since 9baa45f78b8ca7d66280e36009b6a685055d7cd6
but some of the piglit fbo-drawbuffers-none tests still don't
pass.

v2: use the right pointer type for 'h'

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agollvmpipe: handle NULL color buffer pointers
Brian Paul [Thu, 16 Jan 2014 02:09:56 +0000 (18:09 -0800)]
llvmpipe: handle NULL color buffer pointers

Fixes regression from 9baa45f78b8ca7d66280e36009b6a685055d7cd6

v2: incorporate a few small changes suggested by Roland.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosoftpipe: handle NULL color buffer pointers
Brian Paul [Thu, 16 Jan 2014 01:24:02 +0000 (17:24 -0800)]
softpipe: handle NULL color buffer pointers

Fixes regression from 9baa45f78b8ca7d66280e36009b6a685055d7cd6

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agollvmpipe: fix large point rasterization with point_quad_rasterization
Roland Scheidegger [Fri, 17 Jan 2014 01:12:20 +0000 (02:12 +0100)]
llvmpipe: fix large point rasterization with point_quad_rasterization

The whole round-pointsize-to-int stuff must only be done with GL legacy
rules (no point_quad_rasterization) or all the wrong edges are lit up.
This was previously in a private branch (d3d pointsprite test complains
loudly otherwise) and got lost in a merge. However, it should certainly
apply to GL point sprite rasterization as well.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallium: add bits for clipping points as tris (d3d-style)
Roland Scheidegger [Thu, 9 Jan 2014 15:55:22 +0000 (16:55 +0100)]
gallium: add bits for clipping points as tris (d3d-style)

OpenGL does whole-point clipping, that is a large point is either fully
clipped or fully unclipped (the latter means it may extend beyond the
viewport as long as the center is inside the viewport). d3d9 (d3d10 has
no large points) however requires points to be clipped after they are
expanded to a rectangle. (Note some IHVs are known to ignore GL rules at
least with some hw/drivers.)
Hence add a rasterizer bit indicating which way points should be clipped
(some drivers probably will always ignore this), and add the draw interaction
this requires. Drivers wanting to support this and using draw must support
large points on their own as draw doesn't implement vp clipping on the
expanded points (it potentially could but the complexity doesn't seem
warranted), and the driver needs to do viewport scissoring on such points.

Conflicts:

src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_state_derived.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agomesa: fix GL_COLOR_SUM enum for drivers without ARB_vertex_program
Ilia Mirkin [Thu, 16 Jan 2014 18:13:28 +0000 (13:13 -0500)]
mesa: fix GL_COLOR_SUM enum for drivers without ARB_vertex_program

Commit c13970808 (mesa: GL_EXT_secondary_color is not optional) changed

CHECK_EXTENSION2(EXT_secondary_color, ARB_vetex_program, cap)

to

CHECK_EXTENSION(ARB_vertex_program, cap)

However CHECK_EXTENSION2 checks that either extension is available, not
both. Remove the extension check entirely since the intent was for it to
always be enabled.

v2: Fix glGet*(GL_COLOR_SUM) too.  Suggested by Ian.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org>
10 years agollvmpipe: do constant buffer bounds checking in shaders
Zack Rusin [Thu, 19 Dec 2013 00:16:07 +0000 (19:16 -0500)]
llvmpipe: do constant buffer bounds checking in shaders

It's possible to bind a smaller buffer as a constant buffer, than
what the shader actually uses/requires. This could cause nasty
crashes. This patch adds the architecture to pass the maximum
allowable constant buffer index to the jit to let it make
sure that the constant buffer indices are always within bounds.
The behavior follows the d3d10 spec, which says the overflow
should always return all zeros, and overflow is only defined
as access beyond the size of the currently bound buffer. Accesses
beyond the declared shader constant register size are not
considered an overflow and expected to return garbage but consistent
garbage (we follow the behavior which some wlk tests expect which
is to return the actual values from the bound buffer).

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agonv50, nvc0: initialize ctx->sample_mask to ~0
Ilia Mirkin [Sun, 12 Jan 2014 20:01:29 +0000 (15:01 -0500)]
nv50, nvc0: initialize ctx->sample_mask to ~0

Commit 95bf222603b (cso_context: Fix cso_context::sample_mask initial
value.) fixed the cso sample mask to be initialized to ~0. The cso code
is also careful not to needlessly call set_sample_mask, so we ended up
with the ctx->sample_mask never being set. This broke a number of
EXT_framebuffer_multisample piglit tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/main: Free ctx->DrawIndirectBuffer during teardown
Aaron Watry [Thu, 2 Jan 2014 17:18:09 +0000 (11:18 -0600)]
mesa/main: Free ctx->DrawIndirectBuffer during teardown

ctx->DrawIndirectBuffer wasn't being free'd in _mesa_free_buffer_objects

With this patch, "valgrind --leak-check=full glxgears" on evergreen (CEDAR)
now shows:

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 70,228 bytes in 651 blocks
        suppressed: 0 bytes in 0 blocks

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agost/dri: prevent leak of dri option default values
Aaron Watry [Wed, 18 Dec 2013 20:40:49 +0000 (14:40 -0600)]
st/dri: prevent leak of dri option default values

v2: Change comment style

CC: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeon: Move gfx/dma cs cleanup to r600_common_context_cleanup
Aaron Watry [Tue, 7 Jan 2014 20:45:41 +0000 (14:45 -0600)]
radeon: Move gfx/dma cs cleanup to r600_common_context_cleanup

The radeonsi code was not cleaning up either of these items leading to
leaked memory.

v2: Move cleanup to r600_common_context_cleanup instead of duplicating
    the logic for SI

CC: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa: Eliminate parameters to dd_function_table::Scissor
Ian Romanick [Tue, 5 Nov 2013 22:22:30 +0000 (14:22 -0800)]
mesa: Eliminate parameters to dd_function_table::Scissor

The i830 and i915 drivers used them, but they didn't really need to.
They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Eliminate parameters to dd_function_table::DepthRange
Ian Romanick [Tue, 5 Nov 2013 22:16:05 +0000 (14:16 -0800)]
mesa: Eliminate parameters to dd_function_table::DepthRange

No driver uses them.  They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Eliminate parameters to dd_function_table::Viewport
Ian Romanick [Tue, 5 Nov 2013 22:01:31 +0000 (14:01 -0800)]
mesa: Eliminate parameters to dd_function_table::Viewport

No driver uses them.  They will just be annoying in future patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon: Remove dead code
Ian Romanick [Tue, 5 Nov 2013 20:38:22 +0000 (12:38 -0800)]
radeon: Remove dead code

A future patch will rename some of the fields of gl_viewport_attrib, and
I don't want to update dead code that I can't test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Dave Airlie <airlied@redhat.com>
10 years agoi915: Remove spurious calls to DepthRange
Ian Romanick [Tue, 5 Nov 2013 22:34:03 +0000 (14:34 -0800)]
i915: Remove spurious calls to DepthRange

For both i830 and i915, the driver DepthRange function just calls
intelCalcViewport.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Eric Anholt <eric@anholt.net>
10 years agomesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLES
Ian Romanick [Tue, 14 Jan 2014 21:41:19 +0000 (13:41 -0800)]
mesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLES

The ES and desktop GL specs diverge here.  Yay!

In desktop OpenGL, the driver can perform online compression of
uncompressed texture data.  GL_NUM_COMPRESSED_TEXTURE_FORMATS and
GL_COMPRESSED_TEXTURE_FORMATS give the application a list of formats
that it could ask the driver to compress with some expectation of
quality.  The GL_ARB_texture_compression spec calls this "suitable for
general-purpose usage."  As noted above, this means
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT is not included in the list.

In OpenGL ES, the driver never performs compression.
GL_NUM_COMPRESSED_TEXTURE_FORMATS and GL_COMPRESSED_TEXTURE_FORMATS give
the application a list of formats that the driver can receive from the
application.  It is the *complete* list of formats.  The
GL_EXT_texture_compression_s3tc spec says:

    "New State for OpenGL ES 2.0.25 and 3.0.2 Specifications

        The queries for NUM_COMPRESSED_TEXTURE_FORMATS and
        COMPRESSED_TEXTURE_FORMATS include COMPRESSED_RGB_S3TC_DXT1_EXT,
        COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
        and COMPRESSED_RGBA_S3TC_DXT5_EXT."

Note that the addition is only to the OpenGL ES specification!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
See-also: http://lists.freedesktop.org/archives/mesa-dev/2013-October/047439.html
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoscons: add new shaderimage.c file to the build
Brian Paul [Wed, 15 Jan 2014 16:17:04 +0000 (09:17 -0700)]
scons: add new shaderimage.c file to the build

10 years agoclover: Fix clover::keys and ::values to deal with r-value references properly.
Francisco Jerez [Tue, 14 Jan 2014 21:03:57 +0000 (22:03 +0100)]
clover: Fix clover::keys and ::values to deal with r-value references properly.

Returning a reference is incorrect if the specified pair was a
temporary -- Instead of that, use decltype() to deduce the correct
return type qualifiers.  Fixes a crash in clCreateProgramWithBinary().

Reported-and-tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
10 years agoclover: Don't try to build programs created from a binary again.
Francisco Jerez [Tue, 14 Jan 2014 20:55:29 +0000 (21:55 +0100)]
clover: Don't try to build programs created from a binary again.

According to the spec it's allowed to call clBuildProgram() on a
program created from a user-specified binary.  We don't need to do
anything to build the program in that case.

Reported-and-tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
10 years agoclover: Add missing fields to the clover::module serialization code.
Francisco Jerez [Tue, 14 Jan 2014 20:53:57 +0000 (21:53 +0100)]
clover: Add missing fields to the clover::module serialization code.

Tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
10 years agoclover: Store map result into a temporary vector in clCreateProgramWithBinary.
Francisco Jerez [Tue, 14 Jan 2014 20:47:46 +0000 (21:47 +0100)]
clover: Store map result into a temporary vector in clCreateProgramWithBinary.

This avoids the inefficient multiple evaluation of the map result in
the code below.  It should cause no functional changes.

Tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
10 years agodocs: Mark ARB_shader_image_load_store as work in progress.
Francisco Jerez [Mon, 25 Nov 2013 00:24:32 +0000 (16:24 -0800)]
docs: Mark ARB_shader_image_load_store as work in progress.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Validate image units when the texture state changes.
Francisco Jerez [Sat, 23 Nov 2013 03:58:10 +0000 (19:58 -0800)]
mesa: Validate image units when the texture state changes.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Unbind deleted textures from the shader image units.
Francisco Jerez [Sat, 23 Nov 2013 03:54:47 +0000 (19:54 -0800)]
mesa: Unbind deleted textures from the shader image units.

From ARB_shader_image_load_store:

   If a texture object bound to one or more image units is deleted by
   DeleteTextures, it is detached from each such image unit, as though
   BindImageTexture were called with <unit> identifying the image unit
   and <texture> set to zero.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add image parameter queries for ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 18:11:59 +0000 (10:11 -0800)]
mesa: Add image parameter queries for ARB_shader_image_load_store.

v2: Fix off-by-one error in index parameter bound checking.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add ARB_shader_image_load_store to the extension table.
Francisco Jerez [Sat, 23 Nov 2013 03:47:22 +0000 (19:47 -0800)]
mesa: Add ARB_shader_image_load_store to the extension table.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglapi: Update dispatch XML files for ARB_shader_image_load_store.
Francisco Jerez [Fri, 22 Nov 2013 23:55:09 +0000 (15:55 -0800)]
glapi: Update dispatch XML files for ARB_shader_image_load_store.

And uncomment the relevant lines of the dispatch sanity test.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Implement the GL entry points defined by ARB_shader_image_load_store.
Francisco Jerez [Fri, 22 Nov 2013 23:56:34 +0000 (15:56 -0800)]
mesa: Implement the GL entry points defined by ARB_shader_image_load_store.

v2: Name image format classes consistently, fix array and 3D teximage
    selection with layered = GL_FALSE, make sure that the
    user-specified layer is less than the number of texture layers,
    add some asserts.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add MESA_FORMAT_SIGNED_RG88 and _RG1616.
Francisco Jerez [Sat, 23 Nov 2013 03:49:58 +0000 (19:49 -0800)]
mesa: Add MESA_FORMAT_SIGNED_RG88 and _RG1616.

Including pack/unpack and texstore code.  ARB_shader_image_load_store
requires support for the GL_RG8_SNORM and GL_RG16_SNORM formats, which
map to MESA_FORMAT_SIGNED_GR88 and MESA_FORMAT_SIGNED_GR1616 on
little-endian hosts, and MESA_FORMAT_SIGNED_RG88 and
MESA_FORMAT_SIGNED_RG1616 respectively on big-endian hosts -- only the
former were already present, add support for the latter.

Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add MESA_FORMAT_ABGR2101010.
Francisco Jerez [Sat, 23 Nov 2013 03:49:29 +0000 (19:49 -0800)]
mesa: Add MESA_FORMAT_ABGR2101010.

Including pack/unpack and texstore code.  This texture format is a
requirement for ARB_shader_image_load_store.

Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add driver interface for ARB_shader_image_load_store.
Francisco Jerez [Sat, 23 Nov 2013 05:16:06 +0000 (21:16 -0800)]
mesa: Add driver interface for ARB_shader_image_load_store.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Add state data structures required for ARB_shader_image_load_store.
Francisco Jerez [Sat, 23 Nov 2013 05:15:26 +0000 (21:15 -0800)]
mesa: Add state data structures required for ARB_shader_image_load_store.

v2: Increase MAX_IMAGE_UNITS to what i965 wants and add a separate
    MAX_IMAGE_UNIFORMS define, clarify a couple of comments.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Define helper function to get the number of texture layers.
Francisco Jerez [Sat, 7 Dec 2013 22:35:04 +0000 (23:35 +0100)]
mesa: Define helper function to get the number of texture layers.

And to check if it can have layers at all.  This will be used by the
implementation of ARB_shader_image_load_store.

v2: Fix constness of texobj argument, use assert and return reasonable
    default rather than calling unreachable() in default switch case.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/mesa: use signed temporary variable to store _ColorDrawBufferIndexes
Emil Velikov [Wed, 15 Jan 2014 11:39:24 +0000 (11:39 +0000)]
st/mesa: use signed temporary variable to store _ColorDrawBufferIndexes

The temporary variable used to store _ColorDrawBufferIndexes must be
signed (GLint), otherwise the following conditional will be incorrectly
evaluated. Leading to crashes in the driver/mesa or accessing/writing
to arbitrary memory location. The bug dates back to 2009.

Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoautomake: include the git sha in the opengl version string for oot builds
Emil Velikov [Mon, 13 Jan 2014 01:56:39 +0000 (01:56 +0000)]
automake: include the git sha in the opengl version string for oot builds

Acked-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agomesa: use signed temporary variable to store _ColorDrawBufferIndexes
Emil Velikov [Sun, 12 Jan 2014 22:42:05 +0000 (22:42 +0000)]
mesa: use signed temporary variable to store _ColorDrawBufferIndexes

_ColorDrawBufferIndexes is defined as GLint* and using a GLuint*
will result in the first part of the conditional to be evaluated to
true always.

Unintentionally introduced by the following commit, this will result
in a driver segfault if one is using an old version of the piglit test

    bin/clearbuffer-mixed-format -auto -fbo

commit 03d848ea1003abefd8fe51a5b4a780527cd852af
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Wed Dec 4 00:27:20 2013 +0100

    mesa: fix interpretation of glClearBuffer(drawbuffer)

    This corresponding piglit tests supported this incorrect behavior instead of
    pointing at it.

Cc: Marek Olšák <marek.olsak@amd.com>
Cc: 10.0 9.2 9.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agonouveau: add framebuffer validation callback
Ilia Mirkin [Wed, 15 Jan 2014 00:50:33 +0000 (19:50 -0500)]
nouveau: add framebuffer validation callback

Fixes assertions when trying to attach textures to fbs with formats not
supported by the render engines.

See https://bugs.freedesktop.org/show_bug.cgi?id=73459

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.
Francisco Jerez [Tue, 14 Jan 2014 20:38:11 +0000 (21:38 +0100)]
clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.

10 years agoi965: Emit 3DSTATE_VF on Broadwell too.
Kenneth Graunke [Tue, 12 Nov 2013 02:30:32 +0000 (18:30 -0800)]
i965: Emit 3DSTATE_VF on Broadwell too.

It's not just for Haswell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Disable workaround flush for push constants on Broadwell.
Kenneth Graunke [Sat, 9 Nov 2013 06:21:29 +0000 (22:21 -0800)]
i965: Disable workaround flush for push constants on Broadwell.

If it wasn't necessary for Haswell, it's likely not to be necessary for
Broadwell either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Enable native ETC texture support on Broadwell.
Kenneth Graunke [Thu, 19 Dec 2013 23:15:01 +0000 (15:15 -0800)]
i965: Enable native ETC texture support on Broadwell.

Broadwell, like Baytrail, has native ETC texture support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoilo: handle NULL renderbuffers correctly
Chia-I Wu [Tue, 14 Jan 2014 08:02:34 +0000 (16:02 +0800)]
ilo: handle NULL renderbuffers correctly

Renderbuffers may be NULL since 9baa45f78b8ca7d66280e36009b6a685055d7cd6.

10 years agoilo: disable HiZ for misaligned levels
Chia-I Wu [Tue, 14 Jan 2014 06:51:51 +0000 (14:51 +0800)]
ilo: disable HiZ for misaligned levels

We need to disable HiZ for non-8x4 aligned levels, except for level 0, layer
0.  For the very first layer we can adjust Width and Height fields of
3DSTATE_DEPTH_BUFFER to make it aligned.

Specifically, add ILO_TEXTURE_HIZ and set the flag only for properly aligned
levels.  ilo_texture_can_enable_hiz() is updated to check for the flag.

In tex_layout_validate(), align the depth bo to 8x4 so that we can adjust
Width/Height of 3DSTATE_DEPTH_BUFFER without introducing out-of-bound access.

Finally in rectlist blitter, add the ability to adjust 3DSTATE_DEPTH_BUFFER.