mesa.git
13 years agoi965: Fix compile warning about missing opcodes.
Eric Anholt [Sun, 5 Dec 2010 00:27:57 +0000 (16:27 -0800)]
i965: Fix compile warning about missing opcodes.

13 years agoi965: Update gen6 SF state on fragment program change too.
Eric Anholt [Sat, 4 Dec 2010 02:20:42 +0000 (18:20 -0800)]
i965: Update gen6 SF state on fragment program change too.

SF state depends on what inputs there are to the fragment program, not
just the outputs of the VS.

13 years agoi965: Update gen6 WM state on compiled program change, not just FP change.
Eric Anholt [Sat, 4 Dec 2010 02:25:52 +0000 (18:25 -0800)]
i965: Update gen6 WM state on compiled program change, not just FP change.

13 years agointel: Add an env var override to execute for a different GPU revision.
Eric Anholt [Fri, 3 Dec 2010 02:25:45 +0000 (18:25 -0800)]
intel: Add an env var override to execute for a different GPU revision.

Sometimes I'm on the train and want to just read what's generated
under INTEL_DEBUG=vs,wm for some code on another generation.  Or, for
the next gen enablement we'll want to dump aub files before we have
the actual hardware.  This will let us do that.

13 years agost/vega: Fix pipe blend state for various blend modes.
Chia-I Wu [Sat, 4 Dec 2010 13:42:51 +0000 (21:42 +0800)]
st/vega: Fix pipe blend state for various blend modes.

rgb_src_factor and rgb_dst_factor should be PIPE_BLENDFACTOR_ONE for
VG_BLEND_SRC_IN and VG_BLEND_DST_IN respectively.  VG_BLEND_SRC_OVER can
be supported only when the fb has no alpha channel.  VG_BLEND_DST_OVER
and VG_BLEND_ADDITIVE have to be supported with a shader.

Note that Porter-Duff blending rules assume premultiplied alpha.

13 years agost/vega: Add blend shaders for all blend modes.
Chia-I Wu [Sat, 4 Dec 2010 14:42:46 +0000 (22:42 +0800)]
st/vega: Add blend shaders for all blend modes.

13 years agost/vega: Fix VG_BLEND_MULTIPLY.
Chia-I Wu [Sat, 4 Dec 2010 13:02:50 +0000 (21:02 +0800)]
st/vega: Fix VG_BLEND_MULTIPLY.

TEMP[1].w will be needed for OUT.w just below.  Use TEMP[0] to store the
intermediate value.

13 years agomesa: Clean up header file inclusion in texobj.h.
Vinson Lee [Sat, 4 Dec 2010 09:29:50 +0000 (01:29 -0800)]
mesa: Clean up header file inclusion in texobj.h.

13 years agomesa: Clean up header file inclusion in texgetimage.h.
Vinson Lee [Sat, 4 Dec 2010 09:20:28 +0000 (01:20 -0800)]
mesa: Clean up header file inclusion in texgetimage.h.

13 years agomesa: Clean up header file inclusion in texformat.h.
Vinson Lee [Sat, 4 Dec 2010 09:11:33 +0000 (01:11 -0800)]
mesa: Clean up header file inclusion in texformat.h.

13 years agomesa: Clean up header file inclusion in texenvprogram.h.
Vinson Lee [Sat, 4 Dec 2010 09:03:52 +0000 (01:03 -0800)]
mesa: Clean up header file inclusion in texenvprogram.h.

13 years agomesa: Clean up header file inclusion in texcompress_s3tc.h.
Vinson Lee [Sat, 4 Dec 2010 09:00:21 +0000 (01:00 -0800)]
mesa: Clean up header file inclusion in texcompress_s3tc.h.

13 years agost/vega: Silence uninitialized variable warning.
Vinson Lee [Sat, 4 Dec 2010 08:53:44 +0000 (00:53 -0800)]
st/vega: Silence uninitialized variable warning.

Fixes this GCC warning.
api_filters.c: In function 'execute_filter':
api_filters.c:184: warning: 'tex_wrap' may be used uninitialized in this function

13 years agomesa: Clean up header file inclusion in texcompress.h.
Vinson Lee [Sat, 4 Dec 2010 08:52:14 +0000 (00:52 -0800)]
mesa: Clean up header file inclusion in texcompress.h.

13 years agost/vega: Blending should use premultiplied alpha.
Chia-I Wu [Sat, 4 Dec 2010 06:51:27 +0000 (14:51 +0800)]
st/vega: Blending should use premultiplied alpha.

Convert color values to and back from premultiplied form for blending.
Finally the rendering result of the blend demo looks much closer to that
of the reference implementation.

13 years agost/vega: Add support for per-channel alpha.
Chia-I Wu [Sat, 4 Dec 2010 04:03:07 +0000 (12:03 +0800)]
st/vega: Add support for per-channel alpha.

Drawing an image in VG_DRAW_IMAGE_STENCIL mode produces per-channel
alpha for use in blending.  Add a new shader stage to produce and save
it in TEMP[1].

For other modes that do not need per-channel alpha, the stage does

  MOV TEMP[1], TEMP[0].wwww

13 years agost/vega: Move masking after blending.
Chia-I Wu [Sat, 4 Dec 2010 03:23:41 +0000 (11:23 +0800)]
st/vega: Move masking after blending.

Masking should happen after blending.  The shader is not entirely
correct, but leave it as is for now.

13 years agost/vega: Refactor blend shaders.
Chia-I Wu [Fri, 3 Dec 2010 12:35:56 +0000 (20:35 +0800)]
st/vega: Refactor blend shaders.

Add a helper function, blend_generic, that supports all blend modes and
per-channel alpha.  Make other blend generators a wrapper to it.

Both the old and new code expects premultiplied colors, yet the input is
non-premultiplied.  Per-channel alpha is also not used for stencil
image.  They still need to be fixed.

13 years agost/vega: Add some comments to pipeline shaders.
Chia-I Wu [Fri, 3 Dec 2010 12:16:37 +0000 (20:16 +0800)]
st/vega: Add some comments to pipeline shaders.

13 years agost/mesa: new comment about updating state vars
Brian Paul [Sat, 4 Dec 2010 00:07:16 +0000 (17:07 -0700)]
st/mesa: new comment about updating state vars

13 years agomesa: update comments, remove dead code
Brian Paul [Fri, 3 Dec 2010 23:45:44 +0000 (16:45 -0700)]
mesa: update comments, remove dead code

13 years agomesa: remove unneeded cast
Brian Paul [Fri, 3 Dec 2010 23:40:36 +0000 (16:40 -0700)]
mesa: remove unneeded cast

13 years agomesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM
Brian Paul [Fri, 3 Dec 2010 22:59:29 +0000 (15:59 -0700)]
mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM

In find_value() check if we've hit the 0th/invalid entry before checking
if the pname matches.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=31987

NOTE: This is a candidate for the 7.9 branch.

13 years agoswrast: restructure some glReadPixels() code
Brian Paul [Fri, 3 Dec 2010 22:26:19 +0000 (15:26 -0700)]
swrast: restructure some glReadPixels() code

13 years agoswrast: accept GL_RG in glReadPixels()
Brian Paul [Fri, 3 Dec 2010 22:21:36 +0000 (15:21 -0700)]
swrast: accept GL_RG in glReadPixels()

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32088

13 years agoir_print_visitor: Print out constant structure values.
Kenneth Graunke [Thu, 2 Dec 2010 18:11:49 +0000 (10:11 -0800)]
ir_print_visitor: Print out constant structure values.

In the form (constant type ((field1 value) (field2 value) ...))

13 years agoswrast: fix indentation
Brian Paul [Fri, 3 Dec 2010 21:49:19 +0000 (14:49 -0700)]
swrast: fix indentation

13 years agoswrast: allow GL_RG format in glDrawPixels()
Brian Paul [Fri, 3 Dec 2010 21:48:01 +0000 (14:48 -0700)]
swrast: allow GL_RG format in glDrawPixels()

Restructure the switch statement to avoid having to add additional
color formats in the future.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32086

13 years agomesa: consolidate some compiler -D flags
Brian Paul [Fri, 3 Dec 2010 17:59:52 +0000 (10:59 -0700)]
mesa: consolidate some compiler -D flags

-D__STDC_CONSTANT_MACROS and -D__STDC_LIMIT_MACROS are only needed for
LLVM build.

13 years agor300g: one more r500_index_bias_supported leftover
Marek Olšák [Fri, 3 Dec 2010 19:59:55 +0000 (20:59 +0100)]
r300g: one more r500_index_bias_supported leftover

13 years agor300g: add capability bit index_bias_supported
Marek Olšák [Fri, 3 Dec 2010 07:01:19 +0000 (08:01 +0100)]
r300g: add capability bit index_bias_supported

.. instead of calling r500_index_bias_supported(..) every draw call.

13 years agor600g: more indentation fix + warning silencing + dead code removal
Jerome Glisse [Fri, 3 Dec 2010 18:06:53 +0000 (13:06 -0500)]
r600g: more indentation fix + warning silencing + dead code removal

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
13 years agor600g: indentation fix
Jerome Glisse [Fri, 3 Dec 2010 17:56:51 +0000 (12:56 -0500)]
r600g: indentation fix

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
13 years agor600g: update polygon offset only when rasterizer or zbuffer change
Jerome Glisse [Fri, 3 Dec 2010 17:20:40 +0000 (12:20 -0500)]
r600g: update polygon offset only when rasterizer or zbuffer change

Aim is to build as little state as possible in draw functions.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
13 years agollvmpipe: fix broken stencil writemask
Brian Paul [Fri, 3 Dec 2010 16:42:37 +0000 (09:42 -0700)]
llvmpipe: fix broken stencil writemask

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32070

13 years agor600g: set address of pop instructions to next instruction
Fabian Bieler [Fri, 3 Dec 2010 02:39:48 +0000 (03:39 +0100)]
r600g: set address of pop instructions to next instruction

13 years agor600g: dump raw shader output for debugging
Jerome Glisse [Fri, 3 Dec 2010 16:34:47 +0000 (11:34 -0500)]
r600g: dump raw shader output for debugging

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
13 years agomesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
Brian Paul [Fri, 3 Dec 2010 15:30:41 +0000 (08:30 -0700)]
mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type

If querying the default/window-system FBO's attachment type, return
GL_FRAMEBUFFER_DEFAULT (per the GL_ARB_framebuffer_object spec).

See http://bugs.freedesktop.org/show_bug.cgi?id=31947

NOTE: This is a candidate for the 7.9 branch.

13 years agomesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
Brian Paul [Fri, 3 Dec 2010 15:23:31 +0000 (08:23 -0700)]
mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query

Return 0 instead of generating an error.

See http://bugs.freedesktop.org/show_bug.cgi?id=30993

Note that piglit fbo-getframebufferattachmentparameter-01 still does
not pass.  But Mesa behaves the same as the NVIDIA driver in this case.
Perhaps the test is incorrect.

NOTE: This is a candidate for the 7.9 branch.

13 years agogallivm: fix null builder pointers
Brian Paul [Fri, 3 Dec 2010 14:38:02 +0000 (07:38 -0700)]
gallivm: fix null builder pointers

13 years agost/vega: Add a missing break.
Chia-I Wu [Fri, 3 Dec 2010 06:55:12 +0000 (14:55 +0800)]
st/vega: Add a missing break.

13 years agost/vega: Move vertex transformation to shader.
Chia-I Wu [Thu, 2 Dec 2010 16:44:43 +0000 (00:44 +0800)]
st/vega: Move vertex transformation to shader.

It was done in path-to-polygon conversion.  That meant that the
results were invalidated when the transformation was modified, and CPU
had to recreate the vertex buffer with new vertices.  It could be a
performance hit for apps that animate.

13 years agost/vega: Set pipe_resource::array_size to 1.
Chia-I Wu [Fri, 3 Dec 2010 03:59:25 +0000 (11:59 +0800)]
st/vega: Set pipe_resource::array_size to 1.

13 years agost/egl: Set pipe_resource::array_size to 1.
Chia-I Wu [Fri, 3 Dec 2010 03:57:37 +0000 (11:57 +0800)]
st/egl: Set pipe_resource::array_size to 1.

13 years agor300g: do not remove unused constants if we are not near the limit
Marek Olšák [Fri, 3 Dec 2010 05:32:10 +0000 (06:32 +0100)]
r300g: do not remove unused constants if we are not near the limit

13 years agor300g: fix pointer arithmetic with void* in transfer_inline_write
Marek Olšák [Fri, 3 Dec 2010 05:08:50 +0000 (06:08 +0100)]
r300g: fix pointer arithmetic with void* in transfer_inline_write

13 years agomesa, st/mesa: fix gl_FragCoord with FBOs in Gallium
Marek Olšák [Thu, 2 Dec 2010 19:39:59 +0000 (20:39 +0100)]
mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium

gl_FragCoord.y needs to be flipped upside down if a FBO is bound.

This fixes:
- piglit/fbo-fragcoord
- https://bugs.freedesktop.org/show_bug.cgi?id=29420

Here I add a new program state STATE_FB_WPOS_Y_TRANSFORM, which is set based
on whether a FBO is bound. The state contains a pair of transformations.
It can be either (XY=identity, ZW=transformY) if a FBO is bound,
or (XY=transformY, ZW=identity) otherwise, where identity = (1, 0),
transformY = (-1, height-1).

A classic driver (or st/mesa) may, based on some other state, choose whether
to use XY or ZW, thus negate the conditional "if (is a FBO bound) ...".
The reason for this is that a Gallium driver is allowed to only support WPOS
relative to either the lower left or the upper left corner, so we must flip
the Y axis accordingly again. (the "invert" parameter in emit_wpos_inversion)

NOTE: This is a candidate for the 7.9 branch.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agor300g: implement simple transfer_inline_write for buffers
Marek Olšák [Fri, 3 Dec 2010 04:44:47 +0000 (05:44 +0100)]
r300g: implement simple transfer_inline_write for buffers

r600g might need something like that as well. This speeds up constant buffer
upload a bit.

13 years agor300g: use internal BO handle for add_buffer and write_reloc
Marek Olšák [Fri, 3 Dec 2010 01:48:11 +0000 (02:48 +0100)]
r300g: use internal BO handle for add_buffer and write_reloc

Small perf improvement in ipers.

radeon_drm_get_cs_handle is exactly what this commit tries to avoid
in every write_reloc.

13 years agogallivm/llvmpipe: remove lp_build_context::builder
Brian Paul [Fri, 3 Dec 2010 01:11:13 +0000 (18:11 -0700)]
gallivm/llvmpipe: remove lp_build_context::builder

The field was redundant.  Use the gallivm->builder value instead.

13 years agomesa: replace more MAX_WIDTH stack allocations with heap allocations
Brian Paul [Fri, 3 Dec 2010 01:06:40 +0000 (18:06 -0700)]
mesa: replace more MAX_WIDTH stack allocations with heap allocations

13 years agor300g: fix build
Marek Olšák [Thu, 2 Dec 2010 23:54:05 +0000 (00:54 +0100)]
r300g: fix build

13 years agor300g: Drop unnecessary cast
nobled [Thu, 2 Dec 2010 21:48:40 +0000 (21:48 +0000)]
r300g: Drop unnecessary cast

13 years agor300g: Abort if draw_create() fails
nobled [Thu, 2 Dec 2010 22:49:05 +0000 (22:49 +0000)]
r300g: Abort if draw_create() fails

The other drivers need to be updated to do this, too.

13 years agor300g: Abort if atom allocations fail
nobled [Thu, 2 Dec 2010 21:46:04 +0000 (21:46 +0000)]
r300g: Abort if atom allocations fail

13 years agonv50: silence some unknown get_param warnings
Ben Skeggs [Thu, 2 Dec 2010 22:23:44 +0000 (08:23 +1000)]
nv50: silence some unknown get_param warnings

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agost/mesa: avoid large stack allocations in readpixels code
Brian Paul [Thu, 2 Dec 2010 21:23:43 +0000 (14:23 -0700)]
st/mesa: avoid large stack allocations in readpixels code

13 years agoswrast: avoid large stack allocations in tex combine code
Brian Paul [Thu, 2 Dec 2010 21:18:31 +0000 (14:18 -0700)]
swrast: avoid large stack allocations in tex combine code

13 years agoswrast: avoid large stack allocations in blend code
Brian Paul [Thu, 2 Dec 2010 21:18:18 +0000 (14:18 -0700)]
swrast: avoid large stack allocations in blend code

13 years agomesa: replace large/MAX_WIDTH stack allocations with heap allocations
Brian Paul [Thu, 2 Dec 2010 21:00:30 +0000 (14:00 -0700)]
mesa: replace large/MAX_WIDTH stack allocations with heap allocations

13 years agomesa: replace large/MAX_WIDTH stack allocations with heap allocations
Brian Paul [Thu, 2 Dec 2010 20:56:58 +0000 (13:56 -0700)]
mesa: replace large/MAX_WIDTH stack allocations with heap allocations

13 years agor600g: bump texture/cb limits appropriately for evergreen
Alex Deucher [Thu, 2 Dec 2010 21:09:22 +0000 (16:09 -0500)]
r600g: bump texture/cb limits appropriately for evergreen

13 years agor600c: bump texture limits to hw limits
Alex Deucher [Thu, 2 Dec 2010 20:39:28 +0000 (15:39 -0500)]
r600c: bump texture limits to hw limits

13 years agogallium/util: add states relevant to geometry shaders
Zack Rusin [Thu, 2 Dec 2010 20:49:36 +0000 (15:49 -0500)]
gallium/util: add states relevant to geometry shaders

13 years agomesa: Temporary hack to prevent stack overflow on windows
José Fonseca [Thu, 2 Dec 2010 20:30:59 +0000 (20:30 +0000)]
mesa: Temporary hack to prevent stack overflow on windows

e.g. st_readpixels is trying to alloca() an huge ammount of memory from
the stack.

13 years agowgl: Fix visual's buffer_mask configuration.
José Fonseca [Thu, 2 Dec 2010 20:21:39 +0000 (20:21 +0000)]
wgl: Fix visual's buffer_mask configuration.

13 years agomapi: Hack to avoid vgCreateFont being generated as vgCreateFontA.
José Fonseca [Thu, 2 Dec 2010 19:33:41 +0000 (19:33 +0000)]
mapi: Hack to avoid vgCreateFont being generated as vgCreateFontA.

Right fix is probably stop C-preprocessor abuse and stick 100% with
scripted code generation.

13 years agomesa: Add getters for ARB_copy_buffer's attachment points.
Eric Anholt [Thu, 2 Dec 2010 17:24:19 +0000 (09:24 -0800)]
mesa: Add getters for ARB_copy_buffer's attachment points.

Fixes more complaints by oglconform.

13 years agomesa: Add getters for the rest of the supported draw buffers.
Eric Anholt [Thu, 2 Dec 2010 17:05:53 +0000 (09:05 -0800)]
mesa: Add getters for the rest of the supported draw buffers.

MAX_DRAW_BUFFERS is 8, so allow all 8 GL_DRAW_BUFFER# to be retrieved.
Fixes complaints by oglconform.

13 years agoglsl: Fix flipped return of has_value() for array constants.
Eric Anholt [Thu, 2 Dec 2010 16:52:58 +0000 (08:52 -0800)]
glsl: Fix flipped return of has_value() for array constants.

Fixes glsl-array-uniform.

13 years agoWIN32_THREADS -> WIN32
José Fonseca [Thu, 2 Dec 2010 17:27:05 +0000 (17:27 +0000)]
WIN32_THREADS -> WIN32

Fixes nasty bug where some parts of the code didn't define WIN32_THREADS
and were using the integer mutex implementation, causing even confusion
to the debuggers.

And there is little interest of other thread implemenation on Win32
besides Win32 threads.

13 years agosoftpipe: increase max texture size to 16K
Brian Paul [Thu, 2 Dec 2010 17:08:33 +0000 (10:08 -0700)]
softpipe: increase max texture size to 16K

13 years agomesa: raise max texture sizes to 16K
Brian Paul [Thu, 2 Dec 2010 15:20:08 +0000 (08:20 -0700)]
mesa: raise max texture sizes to 16K

This allows 16K x 16K 2D textures, for example, but we don't want to
allow that for 3D textures.  The new gl_constants::MaxTextureMBytes
field is used to prevent allocating too large of texture image.
This allows a 16K x 32 x 32 3D texture, for example, but prevents 16K^3.
Drivers can override this limit.  The default is currently 1GB.

Apps should use the proxy texture mechanism to determine the actual
max texture size.

13 years agor300/compiler: disable the swizzle lowering pass in vertex shaders
Marek Olšák [Thu, 2 Dec 2010 14:56:38 +0000 (15:56 +0100)]
r300/compiler: disable the swizzle lowering pass in vertex shaders

It was a no-op because all swizzles are native there.

13 years agowgl: Unreference the current framebuffer after the make_current call.
José Fonseca [Thu, 2 Dec 2010 16:28:36 +0000 (16:28 +0000)]
wgl: Unreference the current framebuffer after the make_current call.

To prevent a dangling pointer dereference.

13 years agoutil: Don't try to use imagehlp on mingw.
José Fonseca [Thu, 2 Dec 2010 15:14:20 +0000 (15:14 +0000)]
util: Don't try to use imagehlp on mingw.

13 years agoutil: __builtin_frame_address() doesn't work on mingw.
José Fonseca [Thu, 2 Dec 2010 15:14:07 +0000 (15:14 +0000)]
util: __builtin_frame_address() doesn't work on mingw.

13 years agoutil: Plug leaks in util_destroy_gen_mipmap.
José Fonseca [Thu, 2 Dec 2010 15:13:46 +0000 (15:13 +0000)]
util: Plug leaks in util_destroy_gen_mipmap.

13 years agowgl: Fix double free. Remove dead code.
José Fonseca [Thu, 2 Dec 2010 14:57:40 +0000 (14:57 +0000)]
wgl: Fix double free. Remove dead code.

13 years agor300g: fix up cubemap texture offset computation
Marek Olšák [Thu, 2 Dec 2010 13:30:56 +0000 (14:30 +0100)]
r300g: fix up cubemap texture offset computation

Broken since 4c7001462607e6e99e474d6271dd481d3f8f201c.

13 years agoutil: C++ safe.
José Fonseca [Thu, 2 Dec 2010 12:26:55 +0000 (12:26 +0000)]
util: C++ safe.

13 years agoretrace: Some fixes.
José Fonseca [Thu, 2 Dec 2010 12:17:07 +0000 (12:17 +0000)]
retrace: Some fixes.

13 years agost/vega: polygon_array requires a deep free.
Chia-I Wu [Thu, 2 Dec 2010 09:53:42 +0000 (17:53 +0800)]
st/vega: polygon_array requires a deep free.

A polygon array is an array of pointers to polygons.  The polygons
should be freed with the array.

13 years agost/vega: Destroy the pipe context with vg_context.
Chia-I Wu [Thu, 2 Dec 2010 09:26:55 +0000 (17:26 +0800)]
st/vega: Destroy the pipe context with vg_context.

13 years agoglsl: Fix linker bug in cross_validate_globals()
Chad Versace [Wed, 17 Nov 2010 22:34:38 +0000 (14:34 -0800)]
glsl: Fix linker bug in cross_validate_globals()

Cause linking to fail if a global has mismatching invariant qualifiers.

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

13 years agogallium: support for array textures and related changes
Roland Scheidegger [Thu, 2 Dec 2010 03:33:43 +0000 (04:33 +0100)]
gallium: support for array textures and related changes

resources have a array_size parameter now.
get_tex_surface and tex_surface_destroy have been renamed to create_surface
and surface_destroy and moved to context, similar to sampler views (and
create_surface now uses a template just like create_sampler_view). Surfaces
now really should only be used for rendering. In particular they shouldn't be
used as some kind of 2d abstraction for sharing a texture. offset/layout fields
don't make sense any longer and have been removed, width/height should go too.
surfaces and sampler views now specify a layer range (for texture resources),
layer is either array slice, depth slice or cube face.
pipe_subresource is gone array slices (or cube faces) are now treated the same
as depth slices in transfers etc. (that is, they use the z coord of the
respective functions).

Squashed commit of the following:

commit a45bd509014743d21a532194d7b658a1aeb00cb7
Merge: 1aeca28 32e1e59
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Dec 2 04:32:06 2010 +0100

    Merge remote branch 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/drivers/i915/i915_resource_texture.c
     src/gallium/drivers/i915/i915_state_emit.c
     src/gallium/drivers/i915/i915_surface.c

commit 1aeca287a827f29206078fa1204715a477072c08
Merge: 912f042 6f7c8c3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Dec 2 00:37:11 2010 +0100

    Merge remote branch 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/state_trackers/vega/api_filters.c
     src/gallium/state_trackers/vega/api_images.c
     src/gallium/state_trackers/vega/mask.c
     src/gallium/state_trackers/vega/paint.c
     src/gallium/state_trackers/vega/renderer.c
     src/gallium/state_trackers/vega/st_inlines.h
     src/gallium/state_trackers/vega/vg_context.c
     src/gallium/state_trackers/vega/vg_manager.c

commit 912f042e1d439de17b36be9a740358c876fcd144
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Dec 1 03:01:55 2010 +0100

    gallium: even more compile fixes after merge

commit 6fc95a58866d2a291def333608ba9c10c3f07e82
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Dec 1 00:22:26 2010 +0100

    gallium: some fixes after merge

commit a8d5ffaeb5397ffaa12fb422e4e7efdf0494c3e2
Merge: f7a202f 2da02e7
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Tue Nov 30 23:41:26 2010 +0100

    Merge remote branch 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/drivers/i915/i915_state_emit.c
     src/gallium/state_trackers/vega/api_images.c
     src/gallium/state_trackers/vega/vg_context.c

commit f7a202fde2aea2ec78ef58830f945a5e214e56ab
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Nov 24 19:19:32 2010 +0100

    gallium: even more fixes/cleanups after merge

commit 6895a7f969ed7f9fa8ceb788810df8dbcf04c4c9
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Nov 24 03:07:36 2010 +0100

    gallium: more compile fixes after merge

commit af0501a5103b9756bc4d79167bd81051ad6e8670
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Tue Nov 23 19:24:45 2010 +0100

    gallium: lots of compile fixes after merge

commit 0332003c2feb60f2a20e9a40368180c4ecd33e6b
Merge: 26c6346 b6b91fa
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Tue Nov 23 17:02:26 2010 +0100

    Merge remote branch 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/auxiliary/gallivm/lp_bld_sample.c
     src/gallium/auxiliary/util/u_blit.c
     src/gallium/auxiliary/util/u_blitter.c
     src/gallium/auxiliary/util/u_inlines.h
     src/gallium/auxiliary/util/u_surface.c
     src/gallium/auxiliary/util/u_surfaces.c
     src/gallium/docs/source/context.rst
     src/gallium/drivers/llvmpipe/lp_rast.c
     src/gallium/drivers/nv50/nv50_state_validate.c
     src/gallium/drivers/nvfx/nv04_surface_2d.c
     src/gallium/drivers/nvfx/nv04_surface_2d.h
     src/gallium/drivers/nvfx/nvfx_buffer.c
     src/gallium/drivers/nvfx/nvfx_miptree.c
     src/gallium/drivers/nvfx/nvfx_resource.c
     src/gallium/drivers/nvfx/nvfx_resource.h
     src/gallium/drivers/nvfx/nvfx_state_fb.c
     src/gallium/drivers/nvfx/nvfx_surface.c
     src/gallium/drivers/nvfx/nvfx_transfer.c
     src/gallium/drivers/r300/r300_state_derived.c
     src/gallium/drivers/r300/r300_texture.c
     src/gallium/drivers/r600/r600_blit.c
     src/gallium/drivers/r600/r600_buffer.c
     src/gallium/drivers/r600/r600_context.h
     src/gallium/drivers/r600/r600_screen.c
     src/gallium/drivers/r600/r600_screen.h
     src/gallium/drivers/r600/r600_state.c
     src/gallium/drivers/r600/r600_texture.c
     src/gallium/include/pipe/p_defines.h
     src/gallium/state_trackers/egl/common/egl_g3d_api.c
     src/gallium/state_trackers/glx/xlib/xm_st.c
     src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
     src/gallium/targets/libgl-gdi/libgl_gdi.c
     src/gallium/tests/graw/tri.c
     src/mesa/state_tracker/st_cb_blit.c
     src/mesa/state_tracker/st_cb_readpixels.c

commit 26c6346b385929fba94775f33838d0cceaaf1127
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Mon Aug 2 19:37:21 2010 +0200

    fix more merge breakage

commit b30d87c6025eefe7f6979ffa8e369bbe755d5c1d
Merge: 9461bf3 1f1928d
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Mon Aug 2 19:15:38 2010 +0200

    Merge remote branch 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/drivers/llvmpipe/lp_rast.c
     src/gallium/drivers/llvmpipe/lp_rast_priv.h
     src/gallium/drivers/r300/r300_blit.c
     src/gallium/drivers/r300/r300_screen_buffer.c
     src/gallium/drivers/r300/r300_state_derived.c
     src/gallium/drivers/r300/r300_texture.c
     src/gallium/drivers/r300/r300_texture.h
     src/gallium/drivers/r300/r300_transfer.c
     src/gallium/drivers/r600/r600_screen.c
     src/gallium/drivers/r600/r600_state.c
     src/gallium/drivers/r600/r600_texture.c
     src/gallium/drivers/r600/r600_texture.h
     src/gallium/state_trackers/dri/common/dri1_helper.c
     src/gallium/state_trackers/dri/sw/drisw.c
     src/gallium/state_trackers/xorg/xorg_exa.c

commit 9461bf3cfb647d2301364ae29fc3084fff52862a
Merge: 17492d7 0eaccb3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jul 15 20:13:45 2010 +0200

    Merge commit 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/auxiliary/util/u_blitter.c
     src/gallium/drivers/llvmpipe/lp_rast.c
     src/gallium/drivers/llvmpipe/lp_surface.c
     src/gallium/drivers/r300/r300_render.c
     src/gallium/drivers/r300/r300_state.c
     src/gallium/drivers/r300/r300_texture.c
     src/gallium/drivers/r300/r300_transfer.c
     src/gallium/tests/trivial/quad-tex.c

commit 17492d705e7b7f607b71db045c3bf344cb6842b3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Fri Jun 18 10:58:08 2010 +0100

    gallium: rename element_offset/width fields in views to first/last_element

    This is much more consistent with the other fields used there
    (first/last level, first/last layer).
    Actually thinking about removing the ugly union/structs again and
    rename first/last_layer to something even more generic which could also
    be used for buffers (like first/last_member) without inducing headaches.

commit 1b717a289299f942de834dcccafbab91361e20ab
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jun 17 14:46:09 2010 +0100

    gallium: remove PIPE_SURFACE_LAYOUT_LINEAR definition

    This was only used by the layout field of pipe_surface, but this
    driver internal stuff is gone so there's no need for this driver independent
    layout definition neither.

commit 10cb644b31b3ef47e6c7b55e514ad24bb891fac4
Merge: 5691db9 c85971d
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jun 17 12:20:41 2010 +0100

    Merge commit 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/docs/source/glossary.rst
     src/gallium/tests/graw/fs-test.c
     src/gallium/tests/graw/gs-test.c

commit 5691db960ca3d525ce7d6c32d9c7a28f5e907f3b
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jun 17 11:29:03 2010 +0100

    st/wgl: fix interface changes bugs

commit 2303ec32143d363b46e59e4b7c91b0ebd34a16b2
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Jun 16 19:42:32 2010 +0100

    gallium: adapt code to interface changes...

commit dcae4f586f0d0885b72674a355e5d56d47afe77d
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Jun 16 19:42:05 2010 +0100

    gallium: separate depth0 and array_size in the resource itself.

    These fields are still mutually exclusive (since no 3d array textures exist)
    but it ultimately seemed to error-prone to adapt all code accept the new
    meaning of depth0 (drivers stick that into hardware regs, calculate mipmap
    sizes etc.). And it isn't really cleaner anyway.
    So, array textures will have depth0 of 1, but instead use array_size,
    3D textures will continue to use depth0 (and have array_size of 1). Cube
    maps also will use array_size to indicate their 6 faces, but since all drivers
    should just be fine by inferring this themselves from the fact it's a cube map
    as they always used to nothing should break.

commit 621737a638d187d208712250fc19a91978fdea6b
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Jun 16 17:47:38 2010 +0100

    gallium: adapt code to interface changes

    There are still usages of pipe_surface where pipe_resource should be used,
    which should eventually be fixed.

commit 2d17f5efe166b2c3d51957c76294165ab30b8ae2
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Wed Jun 16 17:46:14 2010 +0100

    gallium: more interface changes

    In particular to enable usage of buffers in views, and ability to use a
    different pipe_format in pipe_surface.
    Get rid of layout and offset parameter in pipe_surface - the former was
    not used in any (public) code anyway, and the latter should either be computed
    on-demand or driver can use subclass of pipe_surface.
    Also make create_surface() use a template to be more consistent with
    other functions.

commit 71f885ee16aa5cf2742c44bfaf0dc5b8734b9901
Merge: 3232d11 8ad410d
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Mon Jun 14 14:19:51 2010 +0100

    Merge commit 'origin/master' into gallium-array-textures

    Conflicts:
     src/gallium/auxiliary/util/u_box.h
     src/gallium/drivers/nv50/nv50_surface.c
     src/gallium/drivers/nvfx/nvfx_surface.c
     src/gallium/drivers/r300/r300_blit.c
     src/gallium/drivers/r300/r300_texture.c
     src/gallium/drivers/r300/r300_transfer.c
     src/gallium/drivers/r600/r600_blit.c
     src/gallium/drivers/r600/r600_screen.h
     src/gallium/include/pipe/p_state.h

commit 3232d11fe3ebf7686286013c357b404714853984
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Mon Jun 14 11:40:04 2010 +0100

    mesa/st: adapt to interface changes

    still need to fix pipe_surface sharing
    (as that is now per-context).
    Also broken is depth0 handling - half the code assumes
    this is also used for array textures (and hence by extension
    of that cube maps would have depth 6), half the code does not...

commit f433b7f7f552720e5eade0b4078db94590ee85e1
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Mon Jun 14 11:35:52 2010 +0100

    gallium: fix a couple of bugs in interface chnage fixes

commit 818366b28ea18f514dc791646248ce6f08d9bbcf
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:42:11 2010 +0200

    targets: adapt to interface changes

    Yes even that needs adjustments...

commit 66c511ab1682c9918e0200902039247793acb41e
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:41:13 2010 +0200

    tests: adapt to interface changes

    Everything needs to be fixed :-(.

commit 6b494635d9dbdaa7605bc87b1ebf682b138c5808
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:39:50 2010 +0200

    st: adapt non-rendering state trackers to interface changes

    might not be quite right in all places, but they really don't want
    to use pipe_surface.

commit 00c4289a35d86e4fe85919ec32aa9f5ffe69d16d
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:38:48 2010 +0200

    winsys: adapt to interface changes

commit 39d858554dc9ed5dbc795626fec3ef9deae552a0
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:26:54 2010 +0200

    st/python: adapt to interface changes

    don't think that will work, sorry.

commit 6e9336bc49b32139cec4e683857d0958000e15e3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:26:07 2010 +0200

    st/vega: adapt to interface changes

commit e07f2ae9aaf8842757d5d50865f76f8276245e11
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:25:56 2010 +0200

    st/xorg: adapt to interface changes

commit 05531c10a74a4358103e30d3b38a5eceb25c947f
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:24:53 2010 +0200

    nv50: adapt to interface changes

commit 97704f388d7042121c6d496ba8c003afa3ea2bf3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:24:45 2010 +0200

    nvfx: adapt to interface changes

commit a8a9c93d703af6e8f5c12e1cea9ec665add1abe0
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:24:01 2010 +0200

    i965g: adapt to interface changes

commit 0dde209589872d20cc34ed0b237e3ed7ae0e2de3
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:22:38 2010 +0200

    i915g: adapt to interface changes

commit 5cac9beede69d12f5807ee1a247a4c864652799e
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:20:58 2010 +0200

    svga: adapt to interface changes

    resource_copy_region still looking fishy.
    Was not very suited to unified zslice/face approach...

commit 08b5a6af4b963a3e4c75fc336bf6c0772dce5150
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:20:01 2010 +0200

    rbug: adapt to interface changes

    Not sure if that won't need changes elsewhere?

commit c9fd24b1f586bcef2e0a6e76b68e40fca3408964
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:19:31 2010 +0200

    trace: adapt to interface changes

commit ed84e010afc5635a1a47390b32247a266f65b8d1
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:19:21 2010 +0200

    failover: adapt to interface changes

commit a1d4b4a293da933276908e3393435ec4b43cf201
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:19:12 2010 +0200

    identity: adapt to interface changes

commit a8dd73e2c56c7d95ffcf174408f38f4f35fd2f4c
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:18:55 2010 +0200

    softpipe: adapt to interface changes

commit a886085893e461e8473978e8206ec2312b7077ff
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:18:44 2010 +0200

    llvmpipe: adapt to interface changes

commit 70523f6d567d8b7cfda682157556370fd3c43460
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:18:14 2010 +0200

    r600g: adapt to interface changes

commit 3f4bc72bd80994865eb9f6b8dfd11e2b97060d19
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:18:05 2010 +0200

    r300g: adapt to interface changes

commit 5d353b55ee14db0ac0515b5a3cf9389430832c19
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:17:37 2010 +0200

    cell: adapt to interface changes

    not even compile tested

commit cf5d03601322c2dcb12d7a9c2f1745e2b2a35eb4
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:14:59 2010 +0200

    util: adapt to interface changes

    amazing how much code changes just due to some subtle interface changes?

commit dc98d713c6937c0e177fc2caf23020402cc7ea7b
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Sat Jun 12 02:12:40 2010 +0200

    gallium: more interface fail, docs

    this also changes flush_frontbuffer to use a pipe_resource instead of
    a pipe_surface - pipe_surface is not meant to be (or at least no longer)
    an abstraction for standalone 2d images which get passed around.
    (This has also implications for the non-rendering state-trackers.)

commit 08436d27ddd59857c22827c609b692aa0c407b7b
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jun 10 17:42:52 2010 +0200

    gallium: fix array texture interface changes bugs, docs

commit 4a4d927609b62b4d7fb9dffa35158afe282f277b
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Thu Jun 3 22:02:44 2010 +0200

    gallium: interface changes for array textures and related cleanups

    This patch introduces array textures to gallium (note they are not immediately
    usable without the associated changes to the shader side).
    Also, this abandons pipe_subresource in favor of using level and layer
    parameters since the distinction between several faces (which was part of
    pipe_subresource for cube textures) and several z slices (which were not part
    of pipe_subresource but instead part of pipe_box where appropriate for 3d
    textures) is gone at the resource level.
    Textures, be it array, cube, or 3d, now use a "unified" set of parameters,
    there is no distinction between array members, cube faces, or 3d zslices.
    This is unlike d3d10, whose subresource index includes layer information for
    array textures, but which considers all z slices of a 3d texture to be part
    of the same subresource.
    In contrast to d3d10, OpenGL though reuses old 2d and 3d function entry points
    for 1d and 2d array textures, respectively, which also implies that for instance
    it is possible to specify all layers of a 2d array texture at once (note that
    this is not possible for cube maps, which use the 2d entry points, although
    it is possible for cube map arrays, which aren't supported yet in gallium).
    This should possibly make drivers a bit simpler, and also get rid of mutually
    exclusive parameters in some functions (as z and face were exclusive), one
    potential downside would be that 3d array textures could not easily be supported
    without reverting this, but those are nowhere to be seen.

    Also along with adjusting to new parameters, rename get_tex_surface /
    tex_surface_destroy to create_surface / surface_destroy and move them from
    screen to context, which reflects much better what those do (they are analogous
    to create_sampler_view / sampler_view_destroy).

    PIPE_CAP_ARRAY_TEXTURES is used to indicate if a driver supports all of this
    functionality (that is, both sampling from array texture as well as use a range
    of layers as a render target, with selecting the layer from the geometry shader).

13 years agoi965: add support for polygon mode on Sandybridge.
Xiang, Haihao [Wed, 1 Dec 2010 08:59:36 +0000 (16:59 +0800)]
i965: add support for polygon mode on Sandybridge.

This fixes some mesa demos such as fslight/engine in wireframe mode.

13 years agoi915g: Make sure that new vbo gets updated
Jakob Bornecrantz [Mon, 29 Nov 2010 19:53:26 +0000 (20:53 +0100)]
i915g: Make sure that new vbo gets updated

Malloc likes to reuse old address as soon as possible this would cause the
new vbo buffer to get the same address as the old. So make sure we set it to
NULL when we allocate a new one. This fixes ipers which will fill up a couple
of VBO buffers per frame.

Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: Improve debug printing for textures
Jakob Bornecrantz [Sun, 28 Nov 2010 23:14:59 +0000 (00:14 +0100)]
i915g: Improve debug printing for textures

Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: Fix closure of full batch buffers
Chris Wilson [Wed, 1 Dec 2010 20:57:41 +0000 (21:57 +0100)]
i915g: Fix closure of full batch buffers

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: incorporate comments by Dr_Jakob]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: track TODO items
Daniel Vetter [Sun, 21 Nov 2010 16:56:09 +0000 (17:56 +0100)]
i915g: track TODO items

Just as a reminder for all things currently broken with i915g.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: assert(depth_surface->offset == 0)
Daniel Vetter [Sun, 28 Nov 2010 20:56:24 +0000 (21:56 +0100)]
i915g: assert(depth_surface->offset == 0)

Shouldn't happen and not supported, anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: enable x-tiling for render targets
Daniel Vetter [Sun, 28 Nov 2010 20:37:03 +0000 (21:37 +0100)]
i915g: enable x-tiling for render targets

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: switch rendering to mipmapped textures to (x,y) offsets
Daniel Vetter [Wed, 1 Dec 2010 20:04:56 +0000 (21:04 +0100)]
i915g: switch rendering to mipmapped textures to (x,y) offsets

Byte offsets simply don't work with tiled render targets when using
tiling bits. Luckily we can cox the hw into doing the right thing
with the DRAWING_RECT command by disabling the drawing rect offset
for the depth buffer.

Minor fixes by Jakob Bornecrantz.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: enable X-tiling for textures
Daniel Vetter [Sat, 20 Nov 2010 10:17:55 +0000 (11:17 +0100)]
i915g: enable X-tiling for textures

Tiling is rather fragile in general and results in pure blackness when
unlucky.  Hence add a new option to disable tiling.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: don't pot-align stride for tiled buffers
Daniel Vetter [Sat, 20 Nov 2010 09:23:03 +0000 (10:23 +0100)]
i915g: don't pot-align stride for tiled buffers

libdrm will do this for us, if it's required (i.e. if tiling is
possible).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: postpone mipmap/face offset calculation
Daniel Vetter [Sat, 20 Nov 2010 09:00:38 +0000 (10:00 +0100)]
i915g: postpone mipmap/face offset calculation

libdrm-intel can refuse to tile buffers for various reasons. For
potentially tiled buffers the stride is therefore only known after
the iws->buffer_create_tiled call. Unconditionally rounding up to whatever
tiling requires wastes space, so rework the code to not use tex->stride
in the layout code.

Luckily only the mimap/face offset calculation uses it which can easily
be solved by storing an (x, y) coordinate pair. Furthermore this will
be usefull later for properly supporting rendering into the different
levels of tiled mipmap textures.

v2: switch to nblocks(x|y): More in line with gallium and better
suited for rendering into mipmap textures.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: implement unfenced relocs for textures using tiling bits
Daniel Vetter [Wed, 1 Dec 2010 20:03:13 +0000 (21:03 +0100)]
i915g: implement unfenced relocs for textures using tiling bits

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: implement unfenced color&depth buffer using tiling bits
Daniel Vetter [Wed, 1 Dec 2010 19:59:45 +0000 (20:59 +0100)]
i915g: implement unfenced color&depth buffer using tiling bits

v2: Clarify tiling bit calculation as suggested by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
13 years agoi915g: return tiling in iws->buffer_from_handle
Daniel Vetter [Sun, 21 Nov 2010 19:25:33 +0000 (20:25 +0100)]
i915g: return tiling in iws->buffer_from_handle

This is needed to properly implement tiling flags. And the gem
implemention fo buffer_from_handle already calls get_tiling, so
it's for free.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>