mesa.git
13 years agomesa: remove unneeded soft renderbuffer format-setting code
Brian Paul [Sat, 5 Nov 2011 18:54:06 +0000 (12:54 -0600)]
mesa: remove unneeded soft renderbuffer format-setting code

These vars will just get overwritten when we call _mesa_add_renderbuffer()
anyway.  We only need to set the InternalFormat field when we create the
software renderbuffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: fix comment typo in intel_renderbuffer
Brian Paul [Sat, 5 Nov 2011 16:48:18 +0000 (10:48 -0600)]
mesa: fix comment typo in intel_renderbuffer

13 years agointel: update intel_texture_image comment
Brian Paul [Sat, 5 Nov 2011 16:48:18 +0000 (10:48 -0600)]
intel: update intel_texture_image comment

13 years agointel: wrap comment and fix typo
Brian Paul [Sat, 5 Nov 2011 16:48:18 +0000 (10:48 -0600)]
intel: wrap comment and fix typo

13 years agost/mesa: first implementation of Map/UnmapRenderbuffer()
Brian Paul [Sat, 5 Nov 2011 16:48:18 +0000 (10:48 -0600)]
st/mesa: first implementation of Map/UnmapRenderbuffer()

Untested, but also unused at this point.

13 years agoxlib: implement renderbuffer mapping/unmapping
Brian Paul [Sat, 5 Nov 2011 16:48:18 +0000 (10:48 -0600)]
xlib: implement renderbuffer mapping/unmapping

This fixes the glReadPixels() regression for reading from the front/back
color buffers.

Note, we only allow one mapping of an XImage/Pixmap renderbuffer
at any time.  That might need to be revisited in the future.

13 years agomesa: check for immutable texture in _mesa_test_texobj_completeness()
Brian Paul [Fri, 4 Nov 2011 01:56:51 +0000 (19:56 -0600)]
mesa: check for immutable texture in _mesa_test_texobj_completeness()

One of the points of GL_ARB_texture_storage is to make it impossible
to have malformed mipmap stacks.  If we know the texture object is
immutable, we can skip a bunch of size checking.

13 years agoswrast: update program type assertion
Brian Paul [Fri, 4 Nov 2011 01:56:51 +0000 (19:56 -0600)]
swrast: update program type assertion

Fixes bogus failed assertion when using NV_fragment_program, such
as with demos/fplight.c

Note: This is a candidate for the 7.11 branch.

13 years agost/mesa: clean-up st_translate_interp()
Brian Paul [Fri, 4 Nov 2011 01:56:51 +0000 (19:56 -0600)]
st/mesa: clean-up st_translate_interp()

13 years agost/mesa: add some null pointer checking to better handle out of memory
Brian Paul [Mon, 7 Nov 2011 19:28:26 +0000 (12:28 -0700)]
st/mesa: add some null pointer checking to better handle out of memory

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agost/mesa: fix memory leaks
Morgan Armand [Mon, 7 Nov 2011 18:38:32 +0000 (19:38 +0100)]
st/mesa: fix memory leaks

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agost/mesa: fix indentation
Morgan Armand [Mon, 7 Nov 2011 18:38:13 +0000 (19:38 +0100)]
st/mesa: fix indentation

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agosoftpipe: fix memory leaks
Morgan Armand [Mon, 7 Nov 2011 18:37:48 +0000 (19:37 +0100)]
softpipe: fix memory leaks

This series of patches is a splitted version of my previous one, as suggested by Brian.

Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoi965: Fix Sandybridge regression introduced by workaround-free math.
Kenneth Graunke [Mon, 7 Nov 2011 20:07:44 +0000 (12:07 -0800)]
i965: Fix Sandybridge regression introduced by workaround-free math.

Commit a73c65c5342bf41fa0dfefe7daa9197ce6a11db4 had a typo which
accidentally enabled the workaround-free Gen7 code on Gen6.

Fixes GPU hangs in anything using pow() or integer division/modulus.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Enable faster workaround-free math on Ivybridge.
Kenneth Graunke [Tue, 18 Oct 2011 19:24:47 +0000 (12:24 -0700)]
i965: Enable faster workaround-free math on Ivybridge.

According to the documentation, Ivybridge's math instruction works in
SIMD16 mode for the fragment shader, and no longer forbids align16 mode
for the vertex shader.

The documentation claims that SIMD16 mode isn't supported for INT DIV,
but empirical evidence shows that it works fine.  Presumably the note
is trying to warn us that the variant that returns both quotient and
remainder in (dst, dst + 1) doesn't work in SIMD16 mode since dst + 1
would be sechalf(dst), trashing half your results.  Since we don't use
that variant, we don't care and can just enable SIMD16 everywhere.

The documentation also still claims that source modifiers and
conditional modifiers aren't supported, but empirical evidence and
study of the simulator both show that they work just fine.

Goodbye workarounds.  Math just works now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agomesa: add missing checks to compute_version
Marek Olšák [Fri, 4 Nov 2011 18:12:16 +0000 (19:12 +0100)]
mesa: add missing checks to compute_version

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoradeon: cleanup radeon shared code after r300 and r600 classic drivers removal
Fabio Pedretti [Mon, 7 Nov 2011 09:21:38 +0000 (09:21 +0000)]
radeon: cleanup radeon shared code after r300 and r600 classic drivers removal

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoi965: Fix struct vs class warnings in brw_fs_vector_splitting.cpp.
Kenneth Graunke [Tue, 1 Nov 2011 22:30:52 +0000 (15:30 -0700)]
i965: Fix struct vs class warnings in brw_fs_vector_splitting.cpp.

Makes clang happier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agollvmpipe: fix typo in the depth sampling aos code.
Dave Airlie [Sun, 6 Nov 2011 20:55:25 +0000 (20:55 +0000)]
llvmpipe: fix typo in the depth sampling aos code.

Just found by reading llvmpipe code for no great reason.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agollvmpipe: enable RGTC after u_format fix.
Dave Airlie [Sun, 6 Nov 2011 19:33:00 +0000 (19:33 +0000)]
llvmpipe: enable RGTC after u_format fix.

The two piglit tests pass + render correctly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agou_format: fix RGTC support in fits 8unorm.
Dave Airlie [Sun, 6 Nov 2011 19:32:22 +0000 (19:32 +0000)]
u_format: fix RGTC support in fits 8unorm.

Signed RGTC won't fit in a unorm, so don't allow them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoscons: add CPP_SOURCES for nv50/nvc0
Chia-I Wu [Sun, 6 Nov 2011 13:59:47 +0000 (06:59 -0700)]
scons: add CPP_SOURCES for nv50/nvc0

13 years agoandroid: add CPP_SOURCES for nv50/nvc0
Chia-I Wu [Sun, 6 Nov 2011 14:02:04 +0000 (07:02 -0700)]
android: add CPP_SOURCES for nv50/nvc0

13 years agoandroid: reorder nouveau pipe drivers
Chia-I Wu [Sun, 6 Nov 2011 14:43:32 +0000 (07:43 -0700)]
android: reorder nouveau pipe drivers

To match targerts/dri-nouveau, and to fix a potential

  "undefined reference to `nv50_ir::getTargetNVC0(unsigned int)'"

error.

13 years agogl3.txt: update for ARB_texture_storage.
Dave Airlie [Sun, 6 Nov 2011 19:38:50 +0000 (19:38 +0000)]
gl3.txt: update for ARB_texture_storage.

As per Brian's suggestion.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: add initial linestipple support.
Dave Airlie [Sun, 6 Nov 2011 12:49:21 +0000 (12:49 +0000)]
r600g: add initial linestipple support.

It seems line loop stipple in hardware needs something I don't know, it might
need a proper geometry shader who knows.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agogallivm: change sys::getHostTriple to sys::getDefaultTargetTriple for LLVM >= 0x0301
Christian Inci [Sun, 6 Nov 2011 07:32:54 +0000 (07:32 +0000)]
gallivm: change sys::getHostTriple to sys::getDefaultTargetTriple for LLVM >= 0x0301

LLVM change r143502

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
13 years agog3dvl: Fix memory leaks on error paths.
Vinson Lee [Fri, 4 Nov 2011 04:10:45 +0000 (21:10 -0700)]
g3dvl: Fix memory leaks on error paths.

Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agopp: Reorder calloc to avoid memory leak on error path.
Vinson Lee [Fri, 4 Nov 2011 03:55:10 +0000 (20:55 -0700)]
pp: Reorder calloc to avoid memory leak on error path.

Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agor600g: move SPI setup to PS setup
Vadim Girlin [Fri, 4 Nov 2011 17:24:03 +0000 (21:24 +0400)]
r600g: move SPI setup to PS setup

SPI semantic indices for PS/VS are now static, so we don't
need to update spi config for every shaders combination. We can move
the functionality of r600_spi_update to r600(evergreen)_pipe_shader_ps.

Flatshade state is now controlled by the global FLAT_SHADE_ENA flag
instead of updating FLAT_SHADE for all inputs.

Sprite coord still requires the update of spi setup when
sprite_coord_enable is first changed from zero (enabled), and then
only when it's changed to other non-zero value (enabled for other input).
Change to zero (disabling) and back to the same value is handled via
global SPRITE_COORD_ENA.

New field "sprite_coord_enable" added to "struct r600_pipe_shader"
to track current state for the pixel shader. It's checked in the
r600_update_derived_state.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: precalculate semantic indices for SPI setup
Vadim Girlin [Sat, 5 Nov 2011 04:48:02 +0000 (08:48 +0400)]
r600g: precalculate semantic indices for SPI setup

There is no need to duplicate semantic mapping which is done in hw, so get
rid of r600_find_vs_semantic_index.

TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agodocs: fix grammar and punctuation in llvmpipe docs.
Matt Turner [Sat, 5 Nov 2011 21:11:59 +0000 (17:11 -0400)]
docs: fix grammar and punctuation in llvmpipe docs.

13 years agogl3.txt: add not of ARB_texture_storage work started.
Dave Airlie [Sat, 5 Nov 2011 17:18:34 +0000 (17:18 +0000)]
gl3.txt: add not of ARB_texture_storage work started.

13 years agodocs: Update llvmpipe docs.
José Fonseca [Sat, 5 Nov 2011 10:38:16 +0000 (10:38 +0000)]
docs: Update llvmpipe docs.

Recommend LLVM 2.9, it has been working quite well, and unlike earlier
versions, it works out-of-the-box without patches.

Update Windows instructions.

13 years agoconfigure.ac: gbm_gallium requires DRI_LIB_DEPS to link
Chia-I Wu [Sat, 5 Nov 2011 07:09:36 +0000 (15:09 +0800)]
configure.ac: gbm_gallium requires DRI_LIB_DEPS to link

gbm_gallium does not depend on DRI, but its build rules depend on DRI_LIB_DEPS
being set.  Output an error when the user enables gbm_gallium but disables
DRI.  This is just a workaround.

13 years agoshared-glapi: fix a linking error for SELinux
Chia-I Wu [Fri, 4 Nov 2011 08:32:17 +0000 (16:32 +0800)]
shared-glapi: fix a linking error for SELinux

Link with -lselinux when SELinux is enabled.

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

13 years agoRevert "r600g: precalculate semantic indices for SPI setup"
Alex Deucher [Fri, 4 Nov 2011 22:33:31 +0000 (18:33 -0400)]
Revert "r600g: precalculate semantic indices for SPI setup"

This reverts commit c15f8569fddac5f8aee77863922fd5bb992cfe8a.

This breaks r6xx.

13 years agoRevert "r600g: move SPI setup to PS setup"
Alex Deucher [Fri, 4 Nov 2011 22:32:42 +0000 (18:32 -0400)]
Revert "r600g: move SPI setup to PS setup"

This reverts commit 9804cf3118ae7249098af2a9c78b36f4fb576ee4.

This breaks r6xx.

13 years agosvga: fix varying var remapping for unused FS outputs
Brian Paul [Fri, 4 Nov 2011 20:36:59 +0000 (14:36 -0600)]
svga: fix varying var remapping for unused FS outputs

If the VS has outputs that aren't consumed by the FS we were mapping
them all to one unused VS output index, but that's illegal.  Instead,
map unused VS outputs to unique indexes.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agosvga: add comments and reformat code in svga_tgsi_decl_sm30.c
Brian Paul [Fri, 4 Nov 2011 19:39:19 +0000 (13:39 -0600)]
svga: add comments and reformat code in svga_tgsi_decl_sm30.c

13 years agost/mesa: set geometry shader to NULL when doing internal drawing
Marek Olšák [Fri, 4 Nov 2011 17:10:16 +0000 (18:10 +0100)]
st/mesa: set geometry shader to NULL when doing internal drawing

The code expects the geometry shader to be NULL.
We don't have geometry shaders now, but it's good to be prepared.

v2: check for support in the cso context

13 years agomesa/st: Be nice with the stack -- use malloc for large structures/arrays.
José Fonseca [Fri, 4 Nov 2011 16:57:09 +0000 (16:57 +0000)]
mesa/st: Be nice with the stack -- use malloc for large structures/arrays.

st_translate_program's data was taking 51K off the stack, causing stack
overflow on Windows.

13 years agodri: cosmetic
George Sapountzis [Fri, 4 Nov 2011 14:35:49 +0000 (16:35 +0200)]
dri: cosmetic

To smooth minor diff between dri_util & drisw_util

13 years agodri_util: move drawable functions
George Sapountzis [Fri, 4 Nov 2011 14:25:51 +0000 (16:25 +0200)]
dri_util: move drawable functions

13 years agodri_util: move context functions
George Sapountzis [Fri, 4 Nov 2011 14:24:19 +0000 (16:24 +0200)]
dri_util: move context functions

13 years agodri_util: move context functions
George Sapountzis [Fri, 4 Nov 2011 14:19:22 +0000 (16:19 +0200)]
dri_util: move context functions

13 years agodri_util: move screen functions
George Sapountzis [Fri, 4 Nov 2011 14:14:58 +0000 (16:14 +0200)]
dri_util: move screen functions

This is to reorder as screen/context/drawable similar to drisw_util

13 years agodri: drop stray includes and typedef
George Sapountzis [Thu, 3 Nov 2011 12:38:31 +0000 (14:38 +0200)]
dri: drop stray includes and typedef

13 years agodri: move __driUtilMessage to xmlconfig.c
George Sapountzis [Thu, 3 Nov 2011 12:19:41 +0000 (14:19 +0200)]
dri: move __driUtilMessage to xmlconfig.c

__driUtilMessage seems to have fallen out of favor and is only used by xmlconfig.c now

13 years agodri: drop drisw_util.h
George Sapountzis [Thu, 3 Nov 2011 11:57:41 +0000 (13:57 +0200)]
dri: drop drisw_util.h

13 years agodri: reorder as driver,screen,context,drawable
George Sapountzis [Thu, 3 Nov 2011 11:14:31 +0000 (13:14 +0200)]
dri: reorder as driver,screen,context,drawable

13 years agodri: unify __DRIcontextRec, __DRIdrawableRec
George Sapountzis [Thu, 3 Nov 2011 11:11:55 +0000 (13:11 +0200)]
dri: unify __DRIcontextRec, __DRIdrawableRec

13 years agodri: unify __DRIscreenRec
George Sapountzis [Thu, 3 Nov 2011 11:04:57 +0000 (13:04 +0200)]
dri: unify __DRIscreenRec

Also drop DriverAPI field, this is a static symbol and I don't see why it
should be accessed through __DRIscreenRec

13 years agodri: unify __DriverAPIRec
George Sapountzis [Thu, 3 Nov 2011 10:46:08 +0000 (12:46 +0200)]
dri: unify __DriverAPIRec

I dropped the comments because they don't add much.

13 years agodri: drop drmLock remnants
George Sapountzis [Thu, 3 Nov 2011 09:59:57 +0000 (11:59 +0200)]
dri: drop drmLock remnants

13 years agodri: drop DRI_VALIDATE macros
George Sapountzis [Wed, 2 Nov 2011 16:01:01 +0000 (18:01 +0200)]
dri: drop DRI_VALIDATE macros

13 years agogallium/cso_cache: remove one call to pipe_sampler_view_reference
Marek Olšák [Fri, 4 Nov 2011 17:05:19 +0000 (18:05 +0100)]
gallium/cso_cache: remove one call to pipe_sampler_view_reference

13 years agor600g: move SPI setup to PS setup
Vadim Girlin [Fri, 4 Nov 2011 17:24:03 +0000 (21:24 +0400)]
r600g: move SPI setup to PS setup

SPI semantic indices for PS/VS are now static, so we don't
need to update spi config for every shaders combination. We can move
the functionality of r600_spi_update to r600(evergreen)_pipe_shader_ps.

Flatshade state is now controlled by the global FLAT_SHADE_ENA flag
instead of updating FLAT_SHADE for all inputs.

Sprite coord still requires the update of spi setup when
sprite_coord_enable is first changed from zero (enabled), and then
only when it's changed to other non-zero value (enabled for other input).
Change to zero (disabling) and back to the same value is handled via
global SPRITE_COORD_ENA.

New field "sprite_coord_enable" added to "struct r600_pipe_shader"
to track current state for the pixel shader. It's checked in the
r600_update_derived_state.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agor600g: precalculate semantic indices for SPI setup
Vadim Girlin [Fri, 4 Nov 2011 17:24:02 +0000 (21:24 +0400)]
r600g: precalculate semantic indices for SPI setup

There is no need to duplicate semantic mapping which is done in hw, so get
rid of r600_find_vs_semantic_index.

TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agosvga: Tighten the register file assertions.
José Fonseca [Fri, 4 Nov 2011 20:07:26 +0000 (20:07 +0000)]
svga: Tighten the register file assertions.

Untested. But should fix fdo 42576.

13 years agoradeon/r200: strip texture borders.
Dave Airlie [Fri, 4 Nov 2011 17:13:53 +0000 (17:13 +0000)]
radeon/r200: strip texture borders.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoradeon/r200: fix r100/r200 blit to use the offsets.
Dave Airlie [Fri, 4 Nov 2011 17:12:02 +0000 (17:12 +0000)]
radeon/r200: fix r100/r200 blit to use the offsets.

This is needed to do proper renderbuffer operation on mipmaps.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoradeon: drop mtface/mtlevel, use ones in base class.
Dave Airlie [Fri, 4 Nov 2011 10:47:40 +0000 (10:47 +0000)]
radeon: drop mtface/mtlevel, use ones in base class.

This just uses the base class copies.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agou_vbuf_mgr: avoid one call to pipe_resource_reference in most cases
Marek Olšák [Fri, 4 Nov 2011 17:06:04 +0000 (18:06 +0100)]
u_vbuf_mgr: avoid one call to pipe_resource_reference in most cases

13 years agoswrast: Avoid void * arithmetic.
José Fonseca [Fri, 4 Nov 2011 08:54:55 +0000 (08:54 +0000)]
swrast: Avoid void * arithmetic.

An error with MSVC.

13 years agoi965/gen6: Improve glReadPixels() performance by blitting to a linear temp.
Eric Anholt [Wed, 19 Oct 2011 17:31:40 +0000 (10:31 -0700)]
i965/gen6: Improve glReadPixels() performance by blitting to a linear temp.

The readpixels microbenchmark in mesa-demos goes from 47Mpix/sec at
1000x1000 to 450Mpix/sec.  The 10x10 sizes stay about the same.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agointel: Add safety asserts for the blit engine's pitch alignment requirements.
Eric Anholt [Mon, 31 Oct 2011 23:59:05 +0000 (16:59 -0700)]
intel: Add safety asserts for the blit engine's pitch alignment requirements.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agointel: Don't force a batchbuffer flush in readpixels.
Eric Anholt [Wed, 19 Oct 2011 17:39:15 +0000 (10:39 -0700)]
intel: Don't force a batchbuffer flush in readpixels.

Renderbuffer mapping handles flushing the batchbuffer if required, so
all we need to do is make sure any pending rendering has reached the
batchbuffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoradeon: Remove early dereference of src/dst width in glCopyTexSubImage.
Eric Anholt [Mon, 17 Oct 2011 16:39:48 +0000 (09:39 -0700)]
radeon: Remove early dereference of src/dst width in glCopyTexSubImage.

There doesn't appear to be any particular reason for this -- it's not
like the width is changing between the deref and the use.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Drop the global mapping of buffers across glReadPixels().
Eric Anholt [Thu, 13 Oct 2011 17:34:56 +0000 (10:34 -0700)]
swrast: Drop the global mapping of buffers across glReadPixels().

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Drop the remaining GetRow-based glReadPixels() fast-path.
Eric Anholt [Thu, 13 Oct 2011 17:25:15 +0000 (10:25 -0700)]
swrast: Drop the remaining GetRow-based glReadPixels() fast-path.

In all of piglit, only two tests hit it (reading to RGBA float, where
GetRow would drop floats into place from R, RG, or RGB).  Mostly this
is because _ColorReadClamp has been causing transferOps to always be
set, skipping any fast-paths anyway.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Remove dead _swrast_read_depth_span_uint().
Eric Anholt [Thu, 13 Oct 2011 16:56:34 +0000 (09:56 -0700)]
swrast: Remove dead _swrast_read_depth_span_uint().

All the code using it is converted to MapRenderbuffer and the core
unpack functions.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Convert color glReadPixels slow path to using MapRenderbuffer.
Eric Anholt [Thu, 13 Oct 2011 00:05:20 +0000 (17:05 -0700)]
swrast: Convert color glReadPixels slow path to using MapRenderbuffer.

This may be a bit slower than before because we're switching from
per-format compiled loops in GetRow to
_mesa_unpack_rgba_block_unpack's loop around a callback to unpack a
pixel.  The solution there would be to make _mesa_unpack_rgba_block
fold the span loop into the format handlers.

(On the other hand, function call overhead will hardly matter if
MapRenderbuffer means the driver gets the data into cacheable memory
instead of uncached).

The adjust_colors code should no longer be required, since the unpack
function does the 565 to float conversion in a single pass instead of
converting it (poorly) through 8888 as apparently happened in the
past.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Skip _swrast_validate_derived in _swrast_ReadPixels().
Eric Anholt [Wed, 12 Oct 2011 23:55:23 +0000 (16:55 -0700)]
swrast: Skip _swrast_validate_derived in _swrast_ReadPixels().

None of the callgraph below this uses derived state (almost nothing
even dereferences the swrast context).

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Add a readpixels fast-path based on memcpy and MapRenderbuffer.
Eric Anholt [Wed, 12 Oct 2011 23:28:29 +0000 (16:28 -0700)]
swrast: Add a readpixels fast-path based on memcpy and MapRenderbuffer.

v2: Move _mesa_get_format_bytes out of the loop.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Add a function for comparing gl_format to format/type.
Eric Anholt [Wed, 12 Oct 2011 23:18:14 +0000 (16:18 -0700)]
mesa: Add a function for comparing gl_format to format/type.

This should be useful in making more generic fast paths in the pixel
paths.

v2: Add note about PACK_SWAP_BYTES, and fix up for endianness by
    synchronizing with memcpy_texture paths in texstore.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Switch the remaining depth readpixels to MapRenderbuffer.
Eric Anholt [Wed, 12 Oct 2011 20:39:14 +0000 (13:39 -0700)]
swrast: Switch the remaining depth readpixels to MapRenderbuffer.

This avoids the wrapper, which should improve performance on packed
depth/stencil drivers.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Switch the remaining depth/stencil readpixels path to MapRenderbuffer.
Eric Anholt [Wed, 12 Oct 2011 20:25:24 +0000 (13:25 -0700)]
swrast: Switch the remaining depth/stencil readpixels path to MapRenderbuffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: MapRenderbuffer in separate depth/stencil readpixels fastpath
Eric Anholt [Wed, 12 Oct 2011 19:40:18 +0000 (12:40 -0700)]
swrast: MapRenderbuffer in separate depth/stencil readpixels fastpath

This introduces two new span helper functions we'll want to use in
several places as we move to MapRenderbuffer, which pull out integer
depth and stencil values from a renderbuffer mapping based on the
renderbuffer format.

v2: Use format_unpack helper for stencil read.
v3: Clean up comment after conversion to format_unpack.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Calculate image address/stride once for depth/stencil readpixels.
Eric Anholt [Wed, 12 Oct 2011 19:03:47 +0000 (12:03 -0700)]
swrast: Calculate image address/stride once for depth/stencil readpixels.

The fast and slow paths were doing these separately before.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Make the packed depth/stencil read fastpath use MapRenderbuffer.
Eric Anholt [Wed, 12 Oct 2011 03:41:01 +0000 (20:41 -0700)]
swrast: Make the packed depth/stencil read fastpath use MapRenderbuffer.

This also makes it handle 24/8 vs 8/24, fixing piglit
depthstencil-default_fb-readpixels-24_8 on i965.  While here, avoid
incorrectly fast-pathing if packing->SwapBytes is set.

v2: Move the unpack code to format_unpack.c, fix BUFFER_DEPTH typo
v3: Fix signed/unsigned comparison.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoswrast: Directly map the stencil buffer in read_stencil_pixels.
Eric Anholt [Wed, 12 Oct 2011 00:07:37 +0000 (17:07 -0700)]
swrast: Directly map the stencil buffer in read_stencil_pixels.

This avoids going through the wrapper that has to rewrite the data for
packed depth/stencil.  This isn't done in _swrast_read_stencil_span
because we don't want to map/unmap for each span.

v2: Move the unpack code to format_unpack.c.
v3: Fix signed/unsigned comparison.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoradeon: Fix variable initialization typo.
Vinson Lee [Thu, 3 Nov 2011 07:48:53 +0000 (00:48 -0700)]
radeon: Fix variable initialization typo.

Fixes Coverity uninitialized scalar variable defect.

13 years agoi965: Fix constant propagation into 32-bit integer MUL.
Paul Berry [Wed, 2 Nov 2011 03:35:23 +0000 (20:35 -0700)]
i965: Fix constant propagation into 32-bit integer MUL.

i965's MUL instruction can't take an immediate value as its first
argument.  So normally, if constant propagation wants to propagate a
constant into the first argument of a MUL instruction, it swaps the
order of the two arguments.

This doesn't work for 32-bit integer (and unsigned integer)
multiplies, because the MUL operation is asymmetric in that case (it
multiplies 16 bits of one operand by 32 bits of the other).

Fixes piglit tests {vs,fs}-multiply-const-{ivec4,uvec4}.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agosvga: use the draw-module's sprite stage depending on FS inputs
Brian Paul [Thu, 3 Nov 2011 23:40:56 +0000 (17:40 -0600)]
svga: use the draw-module's sprite stage depending on FS inputs

If we're drawing sprites and the fragment shader needs both auto-
generated texcoords and user-defined varying vars we need to use
this fallback path.
The reason is when we enable auto texcoord generation, it gets
enabled for all texcoord sets.  And that clobbers the user-defined
varying vars.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agosvga: pass fragment shader to draw module
Brian Paul [Thu, 3 Nov 2011 23:40:56 +0000 (17:40 -0600)]
svga: pass fragment shader to draw module

If we use the draw-module for wide point/line/etc drawing we'll need
a fragment shader too (like we pass in the vertex shader).

This fixes sprite point rendering when forcing the swtnl path.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agosvga: implement generic variable index remapping
Brian Paul [Thu, 3 Nov 2011 23:40:56 +0000 (17:40 -0600)]
svga: implement generic variable index remapping

The state tracker may generate shaders that use generic vs outputs /
fs inputs like:

DCL IN[0], GENERIC[0]
DCL IN[1], GENERIC[10]
DCL IN[2], GENERIC[11]

This patch remaps 0, 10, 11 to small integers like 1, 2, 3 so that we
stay inside the SVGA3D limit (8).

The remapping is done to both the vertex shader outputs and the
fragment shader inputs.  The same mapping must be used for a vs/fs
pair.

Note that 'union svga_compile_key' is now 'struct svga_compile_key'
because we needed to add the register remapping table.  The change in
size isn't really significant though (it's not a search key).

Also, add assertions when building up SVGA3D src/dst registers to we
don't try to store too large of value for the bitfield size.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agodraw: assert that we have non-null fragment shader
Brian Paul [Thu, 3 Nov 2011 22:55:18 +0000 (16:55 -0600)]
draw: assert that we have non-null fragment shader

Instead of just segfaulting.  Recently ran into this.

13 years agotexgetimage: add missing return on error
nobled [Wed, 19 Oct 2011 11:54:06 +0000 (07:54 -0400)]
texgetimage: add missing return on error

Missed this back in the arb_robustness branch
<6b329b9274b18c50f4177eef7ee087d50ebc1525>.

NOTE: This is a candidate for the 7.11 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: fix texture target mix-up in NV_fragment_program parser
Brian Paul [Thu, 3 Nov 2011 16:39:26 +0000 (10:39 -0600)]
mesa: fix texture target mix-up in NV_fragment_program parser

The returned value should be a texture target index, not a bit.
I spotted this from seeing a new compiler warning caused by the increase
in the number of texture targets.  This has been broken for a long time.

Note: This is a candidate for the 7.11 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agolinker: Check that initializers for global variables match
Ian Romanick [Mon, 31 Oct 2011 21:31:07 +0000 (14:31 -0700)]
linker: Check that initializers for global variables match

This requires tracking a couple extra fields in ir_variable:

 * A flag to indicate that a variable had an initializer.

 * For non-const variables, a field to track the constant value of the
   variable's initializer.

For variables non-constant initalizers, ir_variable::has_initializer
will be true, but ir_variable::constant_initializer will be NULL.  The
linker can use the values of these fields to check adherence to the
GLSL 4.20 rules for shared global variables:

    "If a shared global has multiple initializers, the initializers
    must all be constant expressions, and they must all have the same
    value. Otherwise, a link error will result. (A shared global
    having only one initializer does not require that initializer to
    be a constant expression.)"

Previous to 4.20 the GLSL spec simply said that initializers must have
the same value.  In this case of non-constant initializers, this was
impossible to determine.  As a result, no vendor actually implemented
that behavior.  The 4.20 behavior matches the behavior of NVIDIA's
shipping implementations.

NOTE: This is candidate for the 7.11 branch.  This patch also needs
the preceding patch "glsl: Refactor generate_ARB_draw_buffers_variables
to use add_builtin_constant"

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34687
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agoglsl: Refactor generate_ARB_draw_buffers_variables to use add_builtin_constant
Ian Romanick [Mon, 31 Oct 2011 21:43:27 +0000 (14:43 -0700)]
glsl: Refactor generate_ARB_draw_buffers_variables to use add_builtin_constant

v2: Remove int cast based on feedback from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agoglsl: Put all bitfields in ir_variable together for better packing
Ian Romanick [Mon, 31 Oct 2011 21:04:10 +0000 (14:04 -0700)]
glsl: Put all bitfields in ir_variable together for better packing

The diff looks weird because ir_variable::depth_layout was between the
last two bitfields in the structure.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agolinker: Fix the indentation of a block in cross_validate_globals
Ian Romanick [Mon, 31 Oct 2011 20:07:06 +0000 (13:07 -0700)]
linker: Fix the indentation of a block in cross_validate_globals

I suspect the indentation got messed up during a code merge.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agoradeon: Check an error return instead of assigning it to a dead variable.
Eric Anholt [Wed, 2 Nov 2011 21:38:05 +0000 (14:38 -0700)]
radeon: Check an error return instead of assigning it to a dead variable.

Fixes gcc set-but-unused-variable warning.

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
13 years agor300g: force buffer placements to GTT on big endian machines
Marek Olšák [Thu, 3 Nov 2011 14:20:55 +0000 (15:20 +0100)]
r300g: force buffer placements to GTT on big endian machines

13 years agostate_trackers/vdpau: Add support for VC-1 decoding
Maarten Lankhorst [Mon, 31 Oct 2011 17:37:37 +0000 (18:37 +0100)]
state_trackers/vdpau: Add support for VC-1 decoding

Add a struct with all the fields.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
13 years agostate_trackers/vdpau: Add mpeg4 part2 to PipeToProfile and ProfileToPipe
Maarten Lankhorst [Mon, 31 Oct 2011 17:32:05 +0000 (18:32 +0100)]
state_trackers/vdpau: Add mpeg4 part2 to PipeToProfile and ProfileToPipe

So it can actually be used when someone implements it. :)

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
13 years agostate_trackers/vdpau: Add support for MPEG4 Part 2
Maarten Lankhorst [Mon, 31 Oct 2011 10:45:37 +0000 (11:45 +0100)]
state_trackers/vdpau: Add support for MPEG4 Part 2

Just the support patch, no decoder implements it currently.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
13 years agostate_trackers/vdpau: Test if profile is supported first before trying to create...
Maarten Lankhorst [Mon, 31 Oct 2011 09:26:02 +0000 (10:26 +0100)]
state_trackers/vdpau: Test if profile is supported first before trying to create decoder

So a nicer error message is returned.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>