platform/upstream/mesa.git
13 years agointel: Add HiZ operations to intel_context::vtbl for all drivers
Chad Versace [Tue, 20 Sep 2011 20:43:17 +0000 (13:43 -0700)]
intel: Add HiZ operations to intel_context::vtbl for all drivers

Add the following to the vtbl:
    hiz_resolve_depthbuffer
    hiz_resolve_hizbuffer

For all drivers for which HiZ is not enabled, the methods are set to be
no-ops. If HiZ is enabled, the methods are currently to set to empty
stubs.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Initialize intel_context::vtbl after calling intelInitContext()
Chad Versace [Wed, 31 Aug 2011 19:16:13 +0000 (12:16 -0700)]
i965: Initialize intel_context::vtbl after calling intelInitContext()

intel_context::gen field is set by intelInitContext(). So, by calling
intelInitContext() before initializing the vtable, we can can construct
different vtables for different gens.

Specifically, this allows us to set the HiZ operations to be no-ops for
contexts for which HiZ is not enabled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Fix scatter/gather for depthstencil textures
Chad Versace [Fri, 7 Oct 2011 19:12:46 +0000 (12:12 -0700)]
intel: Fix scatter/gather for depthstencil textures

During anholt's MapTextureImage refactoring, the call to
intel_tex_image_s8z24_create_renderbuffers was missplaced. It needs to
occur *after* the miptree is allocated.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoi965/gen6: Fix segfault in prepare_blend_state()
Chad Versace [Sun, 9 Oct 2011 03:00:50 +0000 (20:00 -0700)]
i965/gen6: Fix segfault in prepare_blend_state()

Don't dereference the color buffer if one isn't attached.

This fixes the following Piglit tests in my experimental HiZ branch:
    glean/logicOp
    glean/paths

Note: This is a candidate for the stable branches.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agovbo: Redeclare bind_array() as non-static vbo_bind_array()
Chad Versace [Thu, 6 Oct 2011 18:38:29 +0000 (11:38 -0700)]
vbo: Redeclare bind_array() as non-static vbo_bind_array()

This is necessary because i965 will need to call vbo_bind_array() when
cleaning up after a buffer resolve meta-op.

Detailed Explanation
--------------------
The vbo module tracks vertex attributes separately from the gl_context.
Specifically, the vbo module maintins vertex attributes in
vbo_exec_context::array::inputs, which is synchronized with
gl_context::Array::ArrayObj::VertexAttrib by vbo_bind_array().
vbo_draw_arrays() calls vbo_bind_array() to perform the synchronization
before calling the real draw call, vbo_context::draw_arrays.

Intel hardware accomplishes buffer resolves with a meta-op. Frequently,
that meta-op must be performed within glDraw* in the moment immediately
before the draw occurs (The hardware designers hate us...). After
performing the meta-op, but before calling vbo_bind_array(), the
gl_context's vertex attributes will have been restored to their original
state (that is, their state before the meta-op began), but the vbo
module's vertex attribute are those used in the last meta-op. Therefore we
must manually synchronize the two with vbo_bind_array() before continuing
with the original draw command (that is, the one requested with glDraw*).

See brw_predraw_resolve_buffers(), which will be added in a future commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Add dd_function_table::PrepareExecBegin
Chad Versace [Thu, 29 Sep 2011 00:06:35 +0000 (17:06 -0700)]
mesa: Add dd_function_table::PrepareExecBegin

This hook allows the driver to prepare for a glBegin/glEnd.

i965 will use the hook to avoid avoid recursive calls to FLUSH_VERTICES
during a buffer resolve meta-op.

Detailed Justification
----------------------
When vertices are queued during a glBegin/glEnd block, those vertices must
of course be drawn before any rendering state changes. To enusure this,
Mesa calls FLUSH_VERTICES as a prehook to such state changes. Therefore,
FLUSH_VERTICES itself cannot change rendering state without falling into
a recursive trap.

This precludes meta-ops, namely i965 buffer resolves, from occuring while
any vertices are queued. To avoid that situation, i965 must satisfy the
following condition: that it queues no vertex if a buffer needs resolving.
To satisfy this, i965 will use the PrepareExecBegin hook to resolve all
buffers on entering a glBegin/glEnd block.

--------
v2: Don't add dd_function_table::CleanupExecEnd. Anholt and I discovered
    that hook to be unnecessary.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoswrast: Fix fastpaths for glRead/WritePixels(GL_DEPTH_STENCIL)
Chad Versace [Fri, 7 Oct 2011 23:22:56 +0000 (16:22 -0700)]
swrast: Fix fastpaths for glRead/WritePixels(GL_DEPTH_STENCIL)

In some cases, Intel hardware requires that depth and stencil buffers be
separate. To accommodate swrast, i965 resorts to hackery that causes
a segfault in the fastpaths of draw_depth_stencil_pixels() and
read_depth_stencil_pixels().

The hack is that i965 sets framebuffer->Attachment[BUFFER_DEPTH].Renderbuffer
and framebuffer->Attachment[BUFFER_STENCIL].Renderbuffer to a dummy
renderbuffer for which the GetRow accessors and friends are null. The real
buffers are located at framebuffer->_DepthBuffer and framebuffer->_Stencilbuffer.

To fix the segault, this patch skips the fastpath if
framebuffer->Attachment[BUFFER_DEPTH].Renderbuffer->GetRow is null.

Note: This is a candidate for the 7.11 branch.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agometa: Bump MAX_META_OPS_DEPTH from 2 to 8
Chad Versace [Tue, 27 Sep 2011 23:23:29 +0000 (16:23 -0700)]
meta: Bump MAX_META_OPS_DEPTH from 2 to 8

When i965 uses (in the near future) meta-ops to perform buffer resolves,
the meta-op stack exceeds depth 2. I bumped it to 8 because... 8 is bigger
than 2, but not too big.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agometa: Add flag MESA_META_SELECT_FEEDBACK
Chad Versace [Fri, 7 Oct 2011 22:07:00 +0000 (15:07 -0700)]
meta: Add flag MESA_META_SELECT_FEEDBACK

If this flag is set, then _mesa_meta_begin/end will save/restore the state of
GL_SELECT and GL_FEEDBACK render modes.

Intel's future buffer resolve meta-ops will require this, since buffer resolves
may occur when the GL_RENDER_MODE is GL_SELECT.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Declare _mesa_RenderMode as non-static
Chad Versace [Fri, 7 Oct 2011 22:45:51 +0000 (15:45 -0700)]
mesa: Declare _mesa_RenderMode as non-static

This is required in order for meta-ops to save/restore the GL_RENDER_MODE
state.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Convert from GLboolean to 'bool' from stdbool.h.
Kenneth Graunke [Fri, 7 Oct 2011 19:26:50 +0000 (12:26 -0700)]
intel: Convert from GLboolean to 'bool' from stdbool.h.

I initially produced the patch using this bash command:
for file in {intel,i915,i965}/*.{c,cpp,h}; do [ ! -h $file ] && sed -i
's/GLboolean/bool/g' $file && sed -i 's/GL_TRUE/true/g' $file && sed -i
's/GL_FALSE/false/g' $file; done

Then I manually added #include <stdbool.h> to fix compilation errors,
and converted a few functions back to GLboolean that were used in core
Mesa's function pointer table to avoid "incompatible pointer" warnings.

Finally, I cleaned up some whitespace issues introduced by the change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chad Versace <chad@chad-versace.us>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agomesa: Make the program texel offsets limits available with GLSL 1.30.
Eric Anholt [Sat, 15 Oct 2011 20:25:51 +0000 (13:25 -0700)]
mesa: Make the program texel offsets limits available with GLSL 1.30.

It was previously under gpu_shader4, but I'm pretty sure everyone's
going to be doing GLSL 1.30 first (since gpu_shader4 is basically 1.30
plus a bunch of extra stuff).

Fixes piglit glsl-1.30/texel-offset-limits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agometa: Fix saving the active program
Neil Roberts [Tue, 18 Oct 2011 17:42:51 +0000 (18:42 +0100)]
meta: Fix saving the active program

When saving the active program in _mesa_meta_begin, it was actually
saving the fragment program instead. This means that if the
application binds a program that only has a vertex shader then when
the meta saved state is restored it will forget the bound program.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41969
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Convert fixed function fragment program generator to GLSL IR.
Eric Anholt [Mon, 1 Nov 2010 20:16:21 +0000 (13:16 -0700)]
mesa: Convert fixed function fragment program generator to GLSL IR.

This is a step towards providing a direct route for drivers accepting
GLSL IR for codegen.  Perhaps more importantly, it runs the fixed
function fragment program through the GLSL IR optimization.  Having
seen how easy it is to make ugly fixed function texenv code that can
do unnecessary work, this may improve real applicatinos.

13 years agomesa: Add a flag for shader programs to allow SSO linkage in GLES2.
Eric Anholt [Fri, 22 Jul 2011 19:57:47 +0000 (12:57 -0700)]
mesa: Add a flag for shader programs to allow SSO linkage in GLES2.

On converting fixed function programs to generate GLSL, the linker
became cranky that we were trying to make something that wasn't a
linked vertex+fragment program.  Given that the Mesa GLES2 drivers
also support desktop GL with EXT_sso, just telling the linker to shut
up seems like the easiest solution.

13 years agoglsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.
Eric Anholt [Sun, 17 Jul 2011 00:41:26 +0000 (17:41 -0700)]
glsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.

These will be used by the FF VS/FS to represent the current attributes
when they don't have an active vertex array.

13 years agoff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.
Eric Anholt [Wed, 13 Jul 2011 22:52:04 +0000 (15:52 -0700)]
ff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.

This is a slight simplification on the way to actually generating GLSL
fragment shaders.

13 years agosvga: Plug a fence leak
Thomas Hellstrom [Mon, 17 Oct 2011 12:24:14 +0000 (14:24 +0200)]
svga: Plug a fence leak

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agoi915g: Use the right shader limits.
Stéphane Marchesin [Tue, 18 Oct 2011 04:43:19 +0000 (21:43 -0700)]
i915g: Use the right shader limits.

13 years agoi915g: Add TODO.
Stéphane Marchesin [Sun, 16 Oct 2011 06:12:05 +0000 (23:12 -0700)]
i915g: Add TODO.

13 years agor600g: Use the bitfield define matching the register it is used for.
Mathias Fröhlich [Fri, 23 Sep 2011 17:43:31 +0000 (19:43 +0200)]
r600g: Use the bitfield define matching the register it is used for.

Fix a typo that should result in the same code.

13 years agost/xorg: fix build when /lib/gallium directory does not exist yet
Marcin Slusarz [Sun, 16 Oct 2011 18:13:49 +0000 (20:13 +0200)]
st/xorg: fix build when /lib/gallium directory does not exist yet

TARGET was not defined, so make checked directory instead of file

13 years agotargets/va/vdpau/xvmc: don't rebuild target lib every time
Marcin Slusarz [Sun, 16 Oct 2011 16:51:11 +0000 (18:51 +0200)]
targets/va/vdpau/xvmc: don't rebuild target lib every time

Dependency on target directory caused unnecessary relink. Remove them.

13 years agost/xorg: remove target library on make clean
Marcin Slusarz [Sun, 16 Oct 2011 12:37:36 +0000 (14:37 +0200)]
st/xorg: remove target library on make clean

13 years agogallium/targets: use c++ compiler for linking
Marcin Slusarz [Thu, 13 Oct 2011 19:45:45 +0000 (21:45 +0200)]
gallium/targets: use c++ compiler for linking

As pointed out by Michel Dänzer, gcc -lstdc++ doesn't work on all systems,
because it may require other libraries which are only pulled in implicitly
by g++. And libstdc++ is available only with GNU compiler.

Use c++ compiler for linking and remove redundant LDFLAGS += -lstdc++
all over the tree.

13 years agoAdd an autoconf option for mangling Mesa.
Tom Fogal [Mon, 10 Oct 2011 16:33:18 +0000 (10:33 -0600)]
Add an autoconf option for mangling Mesa.

In addition to setting up the flags correctly, this renames the
generated libraries to ensure they get 'Mangled' in the name.
This is very useful for distros and the like, where mangled Mesa
and non-mangled GL libraries typically need to be installed
side-by-side.

Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
13 years agor300/compiler: Try to eliminate REPL_ALPHA instructions
Tom Stellard [Sat, 15 Oct 2011 21:56:15 +0000 (17:56 -0400)]
r300/compiler: Try to eliminate REPL_ALPHA instructions

Scalar instruction that need to write to the xyz components of a
register must reserve the RGB instruction slot for a REPL_ALPHA
instruction.  With this commit, the scheduler will attempt to free
the RGB slot by moving the write to the w component of a register.

13 years agor300/compiler: More agressive RGB to Alpha conversions
Tom Stellard [Sat, 15 Oct 2011 21:55:40 +0000 (17:55 -0400)]
r300/compiler: More agressive RGB to Alpha conversions

13 years agor300/compiler: Only convert RGB->Alpha when optimizations are enabled
Tom Stellard [Sun, 16 Oct 2011 15:12:54 +0000 (08:12 -0700)]
r300/compiler: Only convert RGB->Alpha when optimizations are enabled

13 years agomesa: add a function to do the image data copy stuff for save_CompressedTex(Sub)Image
Yuanhan Liu [Fri, 14 Oct 2011 06:28:22 +0000 (14:28 +0800)]
mesa: add a function to do the image data copy stuff for save_CompressedTex(Sub)Image

Introuduce a simple function called copy_data to do the image data copy
stuff for all the save_CompressedTex*Image function. The function check
the NULL data case to avoid some potential segfault. This also would
make the code a bit simpler and less redundance.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoconfigure: Use -fno-builtin-memcmp.
José Fonseca [Fri, 14 Oct 2011 17:28:55 +0000 (18:28 +0100)]
configure: Use -fno-builtin-memcmp.

Issue spotted by Adam Jackson <ajax at redhat.com>.

http://lists.freedesktop.org/archives/mesa-dev/2011-June/009077.html

13 years agogallivm: Eliminate tgsi_util_get_full_src_register_sign_mode call.
José Fonseca [Sun, 16 Oct 2011 12:48:33 +0000 (13:48 +0100)]
gallivm: Eliminate tgsi_util_get_full_src_register_sign_mode call.

It complicates more than it simplifies, now that there's only one negate
bit on TGSI registers.

13 years agollvmpipe: Use lp_build_ifloor_fract for exp2 calculation.
José Fonseca [Sun, 16 Oct 2011 00:42:57 +0000 (01:42 +0100)]
llvmpipe: Use lp_build_ifloor_fract for exp2 calculation.

Instead of separate ifloor / fract calls.

No change for SSE4.1 code, but less FP<->SI conversions on non SSE4.1
systems.

13 years agoRevert "r300g: fix rendering with a non-zero index bias in draw_elements_immediate"
Marek Olšák [Sun, 16 Oct 2011 01:19:11 +0000 (03:19 +0200)]
Revert "r300g: fix rendering with a non-zero index bias in draw_elements_immediate"

This reverts commit 5506f6ef966b8883e575a3f60ce96ad42ee6ffd2.

It breaks more things than it fixes.

13 years agoswrast: Remove redundant term in logic expression
Chad Versace [Mon, 10 Oct 2011 22:02:22 +0000 (15:02 -0700)]
swrast: Remove redundant term in logic expression

Fix is in {read,draw}_depth_stencil_pixels().  If depthRb == stencilRb,
then it is redundant to check depthRb->x *and* stencilRb->x.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoswrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)
Chad Versace [Mon, 10 Oct 2011 22:07:14 +0000 (15:07 -0700)]
swrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)

For glReadPixels, the user supplied pixels have format
GL_UNSIGNED_INT_24_8.  But, when the depthstencil buffer's format was
MESA_FORMAT_S8_Z24, the fastpath read from the buffer without reordering
the depth and stencil bits. To fix this, this patch just skips the
fastpath when the format is not MESA_FORMAT_Z24_S8.

The problem and fix for glWritePixels is analagous.

Fixes the Piglit tests below on i965/gen6 and causes no regressions.
   general/depthstencil-default_fb-drawpixels-24_8
   general/depthstencil-default_fb-readpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-drawpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8

Note: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agonv50,nvc0: extend formats table for integer formats
Christoph Bumiller [Thu, 13 Oct 2011 16:05:33 +0000 (18:05 +0200)]
nv50,nvc0: extend formats table for integer formats

13 years agogallium: add PIPE_BIND_BLENDABLE flag
Christoph Bumiller [Thu, 13 Oct 2011 12:48:03 +0000 (14:48 +0200)]
gallium: add PIPE_BIND_BLENDABLE flag

This is required for an accurate implementation of d3d1x's
CheckFormatSupport query.

It also seems generally useful for state trackers, which could
choose alternative rendering paths or formats if blending would
come at a significant performance loss.

13 years agor300/compiler: Enable reg rename pass on r500 and run it before optimizations
Tom Stellard [Sat, 14 May 2011 06:29:50 +0000 (23:29 -0700)]
r300/compiler: Enable reg rename pass on r500 and run it before optimizations

The scheduler and the register allocator are now smart enough to handle
it.

13 years agor300/compiler: Implement the texture semaphore
Tom Stellard [Fri, 13 May 2011 06:13:21 +0000 (23:13 -0700)]
r300/compiler: Implement the texture semaphore

The texture semaphore allows for prefetching of texture data.  On my
RV515, this increases the FPS of Lightsmark by 33% (This is with the
reg_rename pass enabled, which is enabled in the next commit).

There is a new env variable now called RADEON_TEX_GROUP, which allows
you to specify the maximum number of texture lookups to do at once.
The default is 8, but different values could produce better results
for various application / card combinations.

13 years agor300/compiler: Don't pair output writes with GPR writes in the scheduler
Tom Stellard [Thu, 13 Oct 2011 23:32:35 +0000 (16:32 -0700)]
r300/compiler: Don't pair output writes with GPR writes in the scheduler

13 years agor300/compiler: Prevent regalloc from creating non-native swizzles
Tom Stellard [Sat, 14 May 2011 07:48:57 +0000 (00:48 -0700)]
r300/compiler: Prevent regalloc from creating non-native swizzles

13 years agor300/compiler: Allow merged instructions to be scheduled on demand
Tom Stellard [Thu, 12 May 2011 06:51:39 +0000 (23:51 -0700)]
r300/compiler: Allow merged instructions to be scheduled on demand

We no longer emit full instructions immediately after they have been
merged.  Instead merged instructions are added to the ready list and
the scheduler can commit them whenever it wants.

13 years agomesa/vbo: Treat attribute 0 and vertex as the same
Ian Romanick [Thu, 13 Oct 2011 23:13:51 +0000 (16:13 -0700)]
mesa/vbo: Treat attribute 0 and vertex as the same

This is supported by the pseudo-code on pages 27 and 28 (pages 41 and
42 of the PDF) of the OpenGL 2.1 spec.  The last part of the
implementation of ArrayElement is:

    if (generic attribute array 0 enabled) {
      if (generic vertex attribute 0 array normalization flag is set, and
  type is not FLOAT or DOUBLE)
VertexAttrib[size]N[type]v(0, generic vertex attribute 0 array element i);
      else
VertexAttrib[size][type]v(0, generic vertex attribute 0 array element i);
    } else if (vertex array enabled) {
      Vertex[size][type]v(vertex array element i);
    }

Page 23 (page 37 of the PDF) of the same spec says:

    "Setting generic vertex attribute zero specifies a vertex; the
    four vertex coordinates are taken from the values of attribute
    zero. A Vertex2, Vertex3, or Vertex4 command is completely
    equivalent to the corresponding VertexAttrib* command with an
    index of zero."

Fixes piglit test attribute0.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agor300g: set max vertex samplers to 0 on swtcl chipsets
Marek Olšák [Fri, 14 Oct 2011 12:59:15 +0000 (14:59 +0200)]
r300g: set max vertex samplers to 0 on swtcl chipsets

This should fix a bug added by f5bfe54a.

Might also fix:
https://bugs.freedesktop.org/show_bug.cgi?id=41715

13 years agowinsys/svga: Rework buffer allocation to make it more robust v2.
Thomas Hellstrom [Wed, 12 Oct 2011 13:27:10 +0000 (15:27 +0200)]
winsys/svga: Rework buffer allocation to make it more robust v2.

Don't allow any "CPU" buffers to be allocated by the pb_fenced
buffer manager, since we can't protect against failures during
buffer validation.
Also, add an extra slab buffer manager to allocate buffers from
the kernel if there is a failure to allocate from our big buffer pool.
The reason we use a slab manager for this, is to avoid allocating
many very small buffers from the kernel.

v2: Increased VMW_MAX_BUFFER_SIZE and fixed some comments.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agodri-vmwgfx: Hook up a drm_descriptor configuration function
Thomas Hellstrom [Wed, 12 Oct 2011 08:44:37 +0000 (10:44 +0200)]
dri-vmwgfx: Hook up a drm_descriptor configuration function

Returns a configuration that makes the dri state-tracker-manager
throttle.
Also disable kernel-based throttling.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agost/dri: Hook up throttling based on the drm driver_descriptor configuration
Thomas Hellstrom [Wed, 12 Oct 2011 09:00:12 +0000 (11:00 +0200)]
st/dri: Hook up throttling based on the drm driver_descriptor configuration

Hooks up throttling if there is a configuration function present and
it indicates that throttling is desired.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agodrm_driver: Add a configuration function to the driver descriptor.
Thomas Hellstrom [Wed, 12 Oct 2011 08:29:24 +0000 (10:29 +0200)]
drm_driver: Add a configuration function to the driver descriptor.

Adds a possibility for the state tracker manager to query the
target for a specific configuration.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agosvga/winsys: Make sure a flush always inserts and returns a fence if requested
Thomas Hellstrom [Tue, 11 Oct 2011 13:34:37 +0000 (15:34 +0200)]
svga/winsys: Make sure a flush always inserts and returns a fence if requested

Needed for throttling.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrant <jakob@vmware.com>
13 years agost/dri: Implement the new dri2 throttling extension
Thomas Hellstrom [Tue, 11 Oct 2011 13:15:21 +0000 (15:15 +0200)]
st/dri: Implement the new dri2 throttling extension

But don't hook it up just yet until we figure out a good way to do that.
Also, we should, in the future, add driconf options to control what
throttling reasons should be honored, and the number of outstanding
swaps allowed.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
13 years agodri2: Implement a throttle dri extension.
Thomas Hellstrom [Mon, 10 Oct 2011 14:38:19 +0000 (16:38 +0200)]
dri2: Implement a throttle dri extension.

The X server has limited throttle support on the server side,
but doing this in the client has some benefits:

1) X server throttling is per client. Client side throttling can be done
per drawable.

2) It's easier to control the throttling based on what client is run,
for example using "driconf".

3) X server throttling requires drm swap complete events.

So implement a dri2 throttling extension intended to be used by direct
rendering clients.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
13 years agoswrast: be a bit smarter in clip_span()
Brian Paul [Thu, 13 Oct 2011 23:16:17 +0000 (17:16 -0600)]
swrast: be a bit smarter in clip_span()

If no pixels pass the clip test, return false.

13 years agomesa: remove unused gl_sampler_object::_CompleteTexture field
Brian Paul [Thu, 13 Oct 2011 23:14:24 +0000 (17:14 -0600)]
mesa: remove unused gl_sampler_object::_CompleteTexture field

13 years agometa: fix redBits size test in get_temp_image_type()
Brian Paul [Thu, 13 Oct 2011 23:11:57 +0000 (17:11 -0600)]
meta: fix redBits size test in get_temp_image_type()

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41768

13 years agost/wgl: Release stw_framebuffer::mutex after pbuffer creation.
Mathias Froehlich [Thu, 13 Oct 2011 09:32:35 +0000 (11:32 +0200)]
st/wgl: Release stw_framebuffer::mutex after pbuffer creation.

This change releases the stw_framebuffer::mutex past creation of
the pbuffer stw_framebuffer. Without this change the pbuffers
lock is never released. Since on win32 mutexes are recursive, this
does not hurt as long as all actions on a context are done from
the same thread. But if, for example, context creation happens in
a different thread than usage, every access to the context will
block for ever.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
13 years agost/xorg: fix build without LLVM
Marcin Slusarz [Thu, 13 Oct 2011 16:44:40 +0000 (18:44 +0200)]
st/xorg: fix build without LLVM

13 years agoi965 Gen6+: De-compact clip plane constants for old VS backend.
Paul Berry [Mon, 10 Oct 2011 20:24:38 +0000 (13:24 -0700)]
i965 Gen6+: De-compact clip plane constants for old VS backend.

In commit 018ea68d8780ab5baeef0b8122b8410e5e55ae6d, when I
de-compacted clip planes on Gen6+, I updated both the old and new VS
back-ends to reflect the change in how clip planes are stored, but I
failed to change the code in gen6_vs_state.c that uploads clip plane
constants when using the old VS back-end.

As a result, if the set of enabled clip planes wasn't contiguous
starting with 0, then clipping would not occur properly.  This patch
corrects gen6_vs_state.c to upload clip plane constants in the new
de-compacted form.

This only affects the old VS back-end (which is used for
fixed-function and ARB vertex programs, not for GLSL vertex shaders).

Fixes Piglit test fixed-clip-enables.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41603

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agost/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()
Brian Paul [Thu, 13 Oct 2011 14:35:19 +0000 (08:35 -0600)]
st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

This fixes a bug where we'd wind up emitting an invalid instruction like
MOVE R[0]., R[1];  - note the empty/zero writemask.  If we don't write to
any dest register channels, cull the instruction.

v2: simply change/fix the existing test for instruction culling.

13 years agos/format/baseFormat/ to be more explicit
Brian Paul [Thu, 13 Oct 2011 13:37:43 +0000 (07:37 -0600)]
s/format/baseFormat/ to be more explicit

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: remove redundant buffer checks in copytexsubimage_error_check2()
Brian Paul [Thu, 13 Oct 2011 13:37:43 +0000 (07:37 -0600)]
mesa: remove redundant buffer checks in copytexsubimage_error_check2()

Again, there was already a call to _mesa_source_buffer_exists() earlier in
the function.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: remove redundant buffer checks in copytexture_error_check()
Brian Paul [Thu, 13 Oct 2011 13:37:43 +0000 (07:37 -0600)]
mesa: remove redundant buffer checks in copytexture_error_check()

There was already a call to _mesa_source_buffer_exists() earlier in
the function.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: check attachment Type field in renderbuffer_exists()
Brian Paul [Thu, 13 Oct 2011 13:37:43 +0000 (07:37 -0600)]
mesa: check attachment Type field in renderbuffer_exists()

Instead of the renderbuffer pointer.  In the future, attaching a texture
may not mean the renderbuffer pointer gets set too.
Plus, remove some commented-out assertions.

13 years agomesa: consolidate _mesa_source/dest_buffer_exists()
Brian Paul [Thu, 13 Oct 2011 13:37:43 +0000 (07:37 -0600)]
mesa: consolidate _mesa_source/dest_buffer_exists()

v2: add a 'reading' parameter to distinguish between reading and writing
to the renderbuffer (we don't want to check if _ColorReadBuffer is null
when we're about to draw).  Eric found this mistake.

13 years agod3d1x: fix check for PIPE_CAP_CONDITIONAL_RENDER
Christoph Bumiller [Tue, 11 Oct 2011 13:04:36 +0000 (15:04 +0200)]
d3d1x: fix check for PIPE_CAP_CONDITIONAL_RENDER

13 years agoscons: Use -fno-builtin-memcmp.
José Fonseca [Wed, 12 Oct 2011 19:42:05 +0000 (20:42 +0100)]
scons: Use -fno-builtin-memcmp.

ipers framerate on llmvpipe improves 60%.

Issue spotted by Adam Jackson <ajax at redhat.com>.

http://lists.freedesktop.org/archives/mesa-dev/2011-June/009077.html

13 years agosoftpipe: fix regression with tex tile cache since integer support.
Dave Airlie [Wed, 12 Oct 2011 07:24:32 +0000 (08:24 +0100)]
softpipe: fix regression with tex tile cache since integer support.

Don't use the uint/int paths for ZS formats for tex tile cache.

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

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa: make _mesa_update_depth/stencil_buffer() static
Brian Paul [Tue, 11 Oct 2011 03:00:01 +0000 (21:00 -0600)]
mesa: make _mesa_update_depth/stencil_buffer() static

These functions were only called in framebuffer.c where they were defined.
Remove the unneeded attIndex parameter too.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Assert that no batch is emitted if a region is mapped
Chad Versace [Thu, 6 Oct 2011 21:18:35 +0000 (14:18 -0700)]
intel: Assert that no batch is emitted if a region is mapped

What I would prefer to assert is that, for each region that is currently
mapped, no batch is emitted that uses that region's bo. However, it's much
easier to implement this big hammer.

Observe that this requires that the batch flush in intel_region_map() be
moved to within the map_refcount guard.

v2: Add comments (borrowed from anholt's reply) explaining why the
assertion is a good idea.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Fix computation of abs(-x) in FS
Paul Berry [Fri, 7 Oct 2011 03:58:18 +0000 (20:58 -0700)]
i965: Fix computation of abs(-x) in FS

When updating a register reference to reflect the fact that we were
taking its absolute value, the fragment shader back-end failed to
clear the negate flag, resulting in abs(-x) getting computed as
-abs(x).

I also found (and fixed) a similar problem in brw_eu.h, but I'm not
aware of an actual manifestation of that problem.

Fixes piglit test glsl-fs-abs-neg-with-intermediate.

13 years agonv50: don't crash on TXD opcode
Marcin Slusarz [Mon, 10 Oct 2011 21:31:04 +0000 (23:31 +0200)]
nv50: don't crash on TXD opcode

It doesn't implement full TXD, but at least it does not crash.
Fixes arb_shader_texture_lod-texgrad and glsl-fs-shadow2DGradARB-*
piglit tests.

13 years agoi965: Replace incorrect use of GLboolean with enum brw_compression.
Kenneth Graunke [Fri, 7 Oct 2011 19:32:52 +0000 (12:32 -0700)]
i965: Replace incorrect use of GLboolean with enum brw_compression.

brw_set_compression_control took a GLboolean as an argument, then
promptly used a switch statement to compare it with various enumeration
values.  Clearly it's not actually a boolean.

Introduce a new enumeration type, enum brw_compression, and use that.

Found by converting GLboolean to bool; clang then gave warnings about
switching on a boolean and ultimately duplicated case errors.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Only allow queries of window system FBO on desktop GL w/ARB_fbo
Ian Romanick [Mon, 3 Oct 2011 19:04:09 +0000 (12:04 -0700)]
mesa: Only allow queries of window system FBO on desktop GL w/ARB_fbo

Neither OES_framebuffer_object nor EXT_framebuffer_object allow
querying the window system FBO.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
13 years agomesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only
Ian Romanick [Mon, 3 Oct 2011 19:02:18 +0000 (12:02 -0700)]
mesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only

Previously GL_DEPTH_BUFFER and GL_STENCIL_BUFFER were (incorrectly)
allowed for both.  Those enums don't even really exist!  Now GL_DEPTH
and GL_STENCIL are only allowed for the window system FBO.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
13 years agosvga: remove old, unused sincos code for SM2.0
Brian Paul [Tue, 11 Oct 2011 15:39:28 +0000 (09:39 -0600)]
svga: remove old, unused sincos code for SM2.0

13 years agosvga: remove support for shader model 2.0
Brian Paul [Tue, 11 Oct 2011 15:30:09 +0000 (09:30 -0600)]
svga: remove support for shader model 2.0

We've been requiring SM 3.0 all along so this just removes unused code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
13 years agosoftpipe: add integer support
Dave Airlie [Mon, 19 Sep 2011 14:05:51 +0000 (15:05 +0100)]
softpipe: add integer support

This adds support to the clear and tile caches for integer storage
and clearing, avoiding any floating paths.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agogallium: rename ZS stencil type to UINT (v2)
Dave Airlie [Sun, 11 Sep 2011 08:45:10 +0000 (09:45 +0100)]
gallium: rename ZS stencil type to UINT (v2)

these are never USCALED, always UINT in reality.

taken from some work by Christoph Bumiller

v2: fixup formatting of table + tabs

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agollvmpipe: don't support rendering to sRGB surfaces
Brian Paul [Thu, 6 Oct 2011 23:01:48 +0000 (17:01 -0600)]
llvmpipe: don't support rendering to sRGB surfaces

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=34199

13 years agodraw/llvm: set draw->pt.user.planes field in draw_set_clip_state()
Brian Paul [Mon, 10 Oct 2011 23:49:27 +0000 (17:49 -0600)]
draw/llvm: set draw->pt.user.planes field in draw_set_clip_state()

Previously it was getting set in draw_set_mapped_constant_buffer() but
if there were no shader constants, that function wasn't called.  So the
pt.user.planes field was null and we died when we tried to access the
clip planes in the LLVM-generated code.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41663

Note: This is a candidate for the 7.11 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agodraw/llvm: fix hard-coded number of total clip planes
Brian Paul [Mon, 10 Oct 2011 23:43:59 +0000 (17:43 -0600)]
draw/llvm: fix hard-coded number of total clip planes

Instead of 12 use DRAW_TOTAL_CLIP_PLANES.  The max number of user-defined
clip planes was increased to 8 so the total number of planes is 14.
This doesn't fix any specific bug, but clearly the old code was wrong.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agoi915g: fix warning about void pointer arithmetic
Brian Paul [Mon, 10 Oct 2011 22:35:22 +0000 (16:35 -0600)]
i915g: fix warning about void pointer arithmetic

13 years agoi915g: Remove duplicated comment.
Stéphane Marchesin [Tue, 11 Oct 2011 01:18:37 +0000 (18:18 -0700)]
i915g: Remove duplicated comment.

13 years agoi915g: Update TODO once more.
Stéphane Marchesin [Mon, 10 Oct 2011 23:56:49 +0000 (16:56 -0700)]
i915g: Update TODO once more.

13 years agoi965: Change type of brw_context.primitive from GLenum to hardware primitive
Chad Versace [Mon, 26 Sep 2011 23:23:26 +0000 (16:23 -0700)]
i965: Change type of brw_context.primitive from GLenum to hardware primitive

For example, GL_TRIANLGES is converted to _3DPRIM_TRILIST.

The conversion is necessary because HiZ and MSAA resolve operations emit
a 3DPRIM_RECTLIST, which cannot be conveyed by GLenum.

As a consequence, brw_gs_prog_key.primitive is also converted.

v2
----
- [anholt] Split brw_set_prim into brw/gen6 variants in previous commit,
  since not much code is really shared between the two.
- [anholt] Replace switch statements with table lookups, since this is
  a hot path.

Reviewed-by: Eric Anholt <eric@anho.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Split brw_set_prim into brw/gen6 variants
Chad Versace [Mon, 26 Sep 2011 22:48:54 +0000 (15:48 -0700)]
i965: Split brw_set_prim into brw/gen6 variants

The "slight optimization to avoid the GS program" in brw_set_prim() is not
used by Gen 6, since Gen 6 doesn't use a GS program. Also, Gen 6 doesn't use
reduced primitives.

Also, document that intel_context.reduced_primitive is only used for Gen < 6

Reviewed-by: Eric Anholt <eric@anho.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agor600g: drop force int type workaround
Dave Airlie [Mon, 10 Oct 2011 19:35:34 +0000 (20:35 +0100)]
r600g: drop force int type workaround

now that we have integer texture types I can drop this workaround so that
copies of values is done properly (as floats would fail on some corner cases).

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: add integer texture/render integer formats for r600/700.
Dave Airlie [Mon, 10 Oct 2011 19:27:51 +0000 (20:27 +0100)]
r600g: add integer texture/render integer formats for r600/700.

with these I can drop the force int type hack.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa: Prevent repeated glDeleteProgram() from blowing away our refcounts.
Eric Anholt [Tue, 4 Oct 2011 22:36:15 +0000 (15:36 -0700)]
mesa: Prevent repeated glDeleteProgram() from blowing away our refcounts.

glDeleteProgram should only be able to remove the one refcount for the
user's reference to the program from the hash table (even though that
ref does live on in the hash table until the last other ref is
removed).

Fixes piglit ARB_shader_objects/delete-repeat.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi965: Fix timer query on gen6+
Zou Nan hai [Wed, 20 Jul 2011 16:12:59 +0000 (00:12 +0800)]
i965: Fix timer query on gen6+

PIPE_CONTROL reported time stamp are 64 bits value incrementing every
80 ns, and only the low 32 bits are active (high 32 are always 0).

v2: Cleaned up whitespace, function arguments (anholt).

Fixes piglit EXT_timer_query/time-elapsed

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
13 years agolinker: Fix a slightly incorrect comment
Ian Romanick [Thu, 6 Oct 2011 17:25:34 +0000 (10:25 -0700)]
linker: Fix a slightly incorrect comment

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agohash_table: Make string_to_uint_map make a copy of the name
Ian Romanick [Fri, 7 Oct 2011 21:29:51 +0000 (14:29 -0700)]
hash_table: Make string_to_uint_map make a copy of the name

The hash table needs a copy of the key that it can keep for
comparisons during searches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41499
Cc: Stéphane Marchesin <stephane.marchesin@gmail.com>
Tested-by: Luzipher <luziphermcleod@yahoo.ie>
Tested-by: Michał Lipski <tallica@o2.pl>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agou_blitter: clean up velem setup
Dave Airlie [Mon, 10 Oct 2011 16:20:30 +0000 (17:20 +0100)]
u_blitter: clean up velem setup

as per Brian's suggestion, drop the pointless loops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoi915g: Update the TODO with another idea.
Stéphane Marchesin [Mon, 10 Oct 2011 07:12:40 +0000 (00:12 -0700)]
i915g: Update the TODO with another idea.

13 years agoi915g: Enable instanced drawing.
Stéphane Marchesin [Mon, 10 Oct 2011 00:14:16 +0000 (17:14 -0700)]
i915g: Enable instanced drawing.

13 years agomesa/st: Check for a NULL _LinkedShader[i] before using it.
Stéphane Marchesin [Sun, 9 Oct 2011 23:49:19 +0000 (16:49 -0700)]
mesa/st: Check for a NULL _LinkedShader[i] before using it.

The rest of the linker/glsl translation code checks for NULL, so I suppose we should check here too. Fixes crash on exit with i915g instanced drawing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agou_blitter: query vertex shader caps instead of geometry for int vertices
Marek Olšák [Sun, 9 Oct 2011 16:19:58 +0000 (18:19 +0200)]
u_blitter: query vertex shader caps instead of geometry for int vertices

13 years agor600g: uarl fixes.
Dave Airlie [Sun, 25 Sep 2011 14:41:59 +0000 (15:41 +0100)]
r600g: uarl fixes.

Not 100% sure these are correct yet

13 years agor600g: enable integer shader cap for evergreen.
Dave Airlie [Sun, 9 Oct 2011 15:47:03 +0000 (16:47 +0100)]
r600g: enable integer shader cap for evergreen.

Will get to adding r600/r700/cayman support, have it mostly written on
another PC.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agou_blitter: don't create integer vertex elements unless shader supports them
Dave Airlie [Sun, 9 Oct 2011 15:35:28 +0000 (16:35 +0100)]
u_blitter: don't create integer vertex elements unless shader supports them

Should fix https://bugs.freedesktop.org/show_bug.cgi?id=41613

We don't want to create these vertex elements unless the pipe driver
vertex stage can handle integers.

Signed-off-by: Dave Airlie <airlied@redhat.com>