mesa.git
12 years agointel: Add block alignment for RGTC textures.
Eric Anholt [Thu, 9 Jun 2011 16:28:19 +0000 (09:28 -0700)]
intel: Add block alignment for RGTC textures.

We were using the default 4x2 alignment instead of the 4x4 required
for RGTC textures.

12 years agointel: Add the MESA_FORMAT as a field of the miptree.
Eric Anholt [Thu, 9 Jun 2011 16:16:47 +0000 (09:16 -0700)]
intel: Add the MESA_FORMAT as a field of the miptree.

We only had internal_format before, which is way more irritating to
work with.

12 years agointel: Fix 2x2 and 1x1 compressed teximages from _mesa_generate_mipmap()
Eric Anholt [Wed, 8 Jun 2011 23:38:01 +0000 (16:38 -0700)]
intel: Fix 2x2 and 1x1 compressed teximages from _mesa_generate_mipmap()

Generally image uploads to a the region occur at TexImage time, but
that's not the case for fallback _mesa_generate_mipmap(), and in this
path we were forgetting to align the width when dividing height.  We
were just leaving out parts of the compressed block at 2x2 and 1x1
levels.

Fixes gen-compressed-teximage.

12 years agor600g: disable shader_texture_lod until there is driver support
Marek Olšák [Tue, 14 Jun 2011 18:03:04 +0000 (20:03 +0200)]
r600g: disable shader_texture_lod until there is driver support

12 years agollvmpipe: SSE2 fastpaths for b8g8r8x8 {un,}swizzle
Adam Jackson [Fri, 10 Jun 2011 16:56:51 +0000 (12:56 -0400)]
llvmpipe: SSE2 fastpaths for b8g8r8x8 {un,}swizzle

Copy-and-paste from the bgra cases.  The C paths attempt to avoid
copying the 'x' channel, but it's harmless, you might as well.  Good for
about 5% in glxgears (740 to 780 fps).

Signed-off-by: Adam Jackson <ajax@redhat.com>
12 years agonv50: fix copy/paste error in nv50_gmtyprog_validate
Christoph Bumiller [Tue, 14 Jun 2011 15:15:08 +0000 (17:15 +0200)]
nv50: fix copy/paste error in nv50_gmtyprog_validate

Used the vertprog instead of gmtyprog.

12 years agoapple: Set the glapi dispatch table on context bind
Jeremy Huddleston [Tue, 14 Jun 2011 07:45:12 +0000 (00:45 -0700)]
apple: Set the glapi dispatch table on context bind

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoconfigure.ac: cleanup the gallium-r300 option
Marek Olšák [Tue, 14 Jun 2011 02:03:17 +0000 (04:03 +0200)]
configure.ac: cleanup the gallium-r300 option

12 years agost/xorg: remove unused variable
Marek Olšák [Tue, 14 Jun 2011 01:48:06 +0000 (03:48 +0200)]
st/xorg: remove unused variable

12 years agor600g: do not link with softpipe
Marek Olšák [Mon, 13 Jun 2011 23:41:39 +0000 (01:41 +0200)]
r600g: do not link with softpipe

12 years agor300g: do not link with softpipe
Marek Olšák [Mon, 13 Jun 2011 23:41:11 +0000 (01:41 +0200)]
r300g: do not link with softpipe

12 years agoxorg-radeon: rename to xorg-r300
Marek Olšák [Mon, 13 Jun 2011 23:00:36 +0000 (01:00 +0200)]
xorg-radeon: rename to xorg-r300

12 years agotarget-helpers: remove copy-pasted function inline_noop_helper
Marek Olšák [Mon, 13 Jun 2011 23:23:20 +0000 (01:23 +0200)]
target-helpers: remove copy-pasted function inline_noop_helper

12 years agor600g: skip SPI setup for position and face inputs
Vadim Girlin [Mon, 13 Jun 2011 01:43:47 +0000 (05:43 +0400)]
r600g: skip SPI setup for position and face inputs

fixes fdo bug 38145

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor600g: move depth texture flushing out of line.
Dave Airlie [Tue, 7 Jun 2011 05:41:30 +0000 (15:41 +1000)]
r600g: move depth texture flushing out of line.

this needs a piglit run.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agometa: Fix glCopyTexImage(GL_LUMINANCE) from non-GL_LUMINANCE source.
Eric Anholt [Wed, 8 Jun 2011 20:00:51 +0000 (13:00 -0700)]
meta: Fix glCopyTexImage(GL_LUMINANCE) from non-GL_LUMINANCE source.

glReadPixels() was performing RGB -> L conversion differently from the
glTexImage() style conversion appropriate for glCopyTexImage().

Fixes gles2conform copy_texture.

12 years agointel: Fix mipmap and format handling of blit glCopyPixels().
Eric Anholt [Wed, 8 Jun 2011 19:06:43 +0000 (12:06 -0700)]
intel: Fix mipmap and format handling of blit glCopyPixels().

Fixes fbo-mipmap-copypix.

12 years agointel: Do the drawable x/y offset in intel_renderbuffer_map() for spans.
Eric Anholt [Tue, 31 May 2011 22:38:17 +0000 (15:38 -0700)]
intel: Do the drawable x/y offset in intel_renderbuffer_map() for spans.

We were mapping the renderbuffer once, then walking over all the
buffers to map just the texture ones using the other texture mapping
function that handled the x/y offset to the image in the region.  But
then we would go and overwrite *those* mappings with the original
mappings for depth/stencil, which was wrong.

Instead, just walk over the attachments once and map the attachments.
Wasn't that easy?

12 years agointel: Use rb->Data and rb->RowStride to handle spans Y flipping.
Eric Anholt [Tue, 31 May 2011 22:33:36 +0000 (15:33 -0700)]
intel: Use rb->Data and rb->RowStride to handle spans Y flipping.

This is already pointing at 0 or Height - 1 and with an appropriate
pitch, so no need to recompute those values per customization of the
spans code.  Cuts 3 out of 21kb of the compiled size.

Reviewed-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Clean up intel_render_texture with a rename and a helper function.
Eric Anholt [Tue, 31 May 2011 22:07:56 +0000 (15:07 -0700)]
intel: Clean up intel_render_texture with a rename and a helper function.

The "newImage" isn't particularly new -- it might be the same texture
that was attached to the same attachment point before.  This function
also gets called when just rebinding back to an FBO with a texture
attachment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Move the draw_x/draw_y to the renderbuffer where it belongs.
Eric Anholt [Tue, 31 May 2011 21:27:18 +0000 (14:27 -0700)]
intel: Move the draw_x/draw_y to the renderbuffer where it belongs.

It was originally located in the region because the tracking of
depth/color buffers was on the regions, and getting back to the irb
would have been tricky.  Now, we're keying off of the renderbuffer in
more places, which means we can move these fields where they belong.

This could fix potential rendering failure with a single texture
having multiple images attached to different renderbuffers across
shareCtx (as far as I can tell, this was the only failure we could
cause, since anything else should trigger intel_render_texture in
between, for example a BindFramebuffer).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad@chad-versace.us>
12 years agodri: include swrast.h, not s_texrender.h
Brian Paul [Mon, 13 Jun 2011 22:07:32 +0000 (16:07 -0600)]
dri: include swrast.h, not s_texrender.h

12 years agoglx: Remove check for gc->vtable->destroy
Jeremy Huddleston [Mon, 13 Jun 2011 19:13:44 +0000 (12:13 -0700)]
glx: Remove check for gc->vtable->destroy

gc->vtable->destroy is always set and is used unconditionally
in other places, so don't bother checking for it first.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: applegl_destroy_context: Pass along the correct display
Jeremy Huddleston [Mon, 13 Jun 2011 19:00:55 +0000 (12:00 -0700)]
apple: applegl_destroy_context: Pass along the correct display

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: Dead code removal
Jeremy Huddleston [Mon, 13 Jun 2011 19:10:38 +0000 (12:10 -0700)]
apple: Dead code removal

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglapi: Add check for NULL symbol_prefix in gentable and fix warnings
Jeremy Huddleston [Mon, 13 Jun 2011 18:35:18 +0000 (11:35 -0700)]
glapi: Add check for NULL symbol_prefix in gentable and fix warnings

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoi915g: add a few more render target formats
Daniel Vetter [Mon, 13 Jun 2011 21:03:00 +0000 (23:03 +0200)]
i915g: add a few more render target formats

Snatched from xvmc.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agomesa: move texrender.c to swrast
Brian Paul [Mon, 13 Jun 2011 19:44:35 +0000 (13:44 -0600)]
mesa: move texrender.c to swrast

This stuff is really for software rendering, it's not core Mesa.
A small step toward pushing the FetchTexel() stuff down into swrast.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agovbo: minor simplification in print_draw_arrays() debug function
Brian Paul [Mon, 13 Jun 2011 19:42:53 +0000 (13:42 -0600)]
vbo: minor simplification in print_draw_arrays() debug function

12 years agomesa: move invariant code out of loop in get_tex_rgba()
Brian Paul [Mon, 13 Jun 2011 14:18:11 +0000 (08:18 -0600)]
mesa: move invariant code out of loop in get_tex_rgba()

12 years agor600g: Put shaders into immutable buffers.
Mathias Fröhlich [Fri, 3 Jun 2011 22:21:29 +0000 (00:21 +0200)]
r600g: Put shaders into immutable buffers.

Put the shader programs into an immutable buffer object.
Also make sure that those object can be taken from the user
space buffer object pool.

12 years agor600g: Allow VRAM for the initial domain for every buffer binding.
Mathias Fröhlich [Sun, 12 Jun 2011 12:32:03 +0000 (14:32 +0200)]
r600g: Allow VRAM for the initial domain for every buffer binding.

12 years agor600g: Set the domains value also for recycled buffer objects.
Mathias Fröhlich [Sun, 12 Jun 2011 12:25:26 +0000 (14:25 +0200)]
r600g: Set the domains value also for recycled buffer objects.

12 years agor600g: Fix typo.
Mathias Fröhlich [Wed, 8 Jun 2011 15:33:57 +0000 (17:33 +0200)]
r600g: Fix typo.

Fix an obvious typo in the yet unused part of the shader setup.

12 years agor600g: remove useless call to u_upload_flush
Pierre-Eric Pelloux-Prayer [Fri, 10 Jun 2011 13:45:01 +0000 (15:45 +0200)]
r600g: remove useless call to u_upload_flush

No regressions found with :
- piglit (quick.tests)
- Unigine Heaven
- Lightsmark
- openarena
- Imprudence (Second Life fork)

agd5f Note: this patch was previously reverted due to piglit
regressions, but I'm not able to reproduce them here.
See this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=34008
and discussion:
http://lists.freedesktop.org/archives/dri-devel/2011-June/011996.html

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
12 years agost/mesa: rebind vertex arrays if _NEW_BUFFER_OBJECT is dirty
Marek Olšák [Sun, 12 Jun 2011 21:21:41 +0000 (23:21 +0200)]
st/mesa: rebind vertex arrays if _NEW_BUFFER_OBJECT is dirty

This fixes piglit/vbo-bufferdata. It's a regression in 7.11.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agor600g: fixed bo memory leak issue
Pierre-Eric Pelloux-Prayer [Fri, 10 Jun 2011 11:57:21 +0000 (13:57 +0200)]
r600g: fixed bo memory leak issue

pipe_resource_reference call was miossing, thus creating massive memory under certain conditions.
Fix : https://bugs.freedesktop.org/show_bug.cgi?id=37168

12 years agomapi: declare x86_entry_start/end static
Chia-I Wu [Mon, 13 Jun 2011 03:41:41 +0000 (11:41 +0800)]
mapi: declare x86_entry_start/end static

x86_entry_start and x86_entry_end are defined by the inline assembly.
Declaring them static saves one instruction in entry_get_public.

12 years agomapi: Fix tls with shared/es-glapi on x86-64
Benjamin Franzke [Wed, 8 Jun 2011 13:50:25 +0000 (15:50 +0200)]
mapi: Fix tls with shared/es-glapi on x86-64

x86_64_entry_start needs to be declared static in the C code,
in order to have the correct address in entry_get_public
(seems not to be needed on x86).

The compiler needs to lookup a local not a global object.

Otherwise addresses needed for _glapi_proc_address will be computed
from some random offset (0x6400229a61058b48 in my case).

12 years agowayland-drm: remove depend on "make clean"
Chia-I Wu [Mon, 13 Jun 2011 03:35:21 +0000 (11:35 +0800)]
wayland-drm: remove depend on "make clean"

12 years agoegl_dri2: try swrastg_dri if swrast_dri fails
Chia-I Wu [Wed, 8 Jun 2011 08:33:56 +0000 (16:33 +0800)]
egl_dri2: try swrastg_dri if swrast_dri fails

Per libGL.

12 years agoegl_dri2: add dri2_load_driver_swrast
Chia-I Wu [Wed, 8 Jun 2011 08:33:55 +0000 (16:33 +0800)]
egl_dri2: add dri2_load_driver_swrast

Refactor dri2_load_driver and add dri2_load_driver_swrast for loading
swrast DRI driver.

12 years agoegl_dri2: Compare configs before matching them
Benjamin Franzke [Sat, 11 Jun 2011 21:00:40 +0000 (23:00 +0200)]
egl_dri2: Compare configs before matching them

This compares attribs like buffer size, and will prevent merging
unequal configs because of match criterion is e.g. ATLEAST.

12 years agost/eglwayland: Add support for EGL_DEFAULT_DISPLAY
Benjamin Franzke [Sat, 11 Jun 2011 20:24:14 +0000 (22:24 +0200)]
st/eglwayland: Add support for EGL_DEFAULT_DISPLAY

12 years agoegl_dri2/wayland: Add support for EGL_DEFAULT_DISPLAY
Benjamin Franzke [Sat, 11 Jun 2011 20:07:02 +0000 (22:07 +0200)]
egl_dri2/wayland: Add support for EGL_DEFAULT_DISPLAY

12 years agoapple: Request OpenGL 3.2 from OpenGL.framework if available
Jeremy Huddleston [Sun, 12 Jun 2011 06:43:38 +0000 (23:43 -0700)]
apple: Request OpenGL 3.2 from OpenGL.framework if available

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: Store the CGL API version number for future reference
Jeremy Huddleston [Sun, 12 Jun 2011 06:43:03 +0000 (23:43 -0700)]
apple: Store the CGL API version number for future reference

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: Use a struct glx_config * rather than a void * in apple_visual_create_pfobj
Jeremy Huddleston [Sun, 12 Jun 2011 05:54:59 +0000 (22:54 -0700)]
apple: Use a struct glx_config * rather than a void * in apple_visual_create_pfobj

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: Use _glapi_create_table_from_handle to initialize our dispatch table
Jeremy Huddleston [Fri, 10 Jun 2011 00:29:51 +0000 (17:29 -0700)]
apple: Use _glapi_create_table_from_handle to initialize our dispatch table

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglapi: Add API that can create a _glapi_table from a dlfcn handle
Jeremy Huddleston [Thu, 9 Jun 2011 23:59:49 +0000 (16:59 -0700)]
glapi: Add API that can create a _glapi_table from a dlfcn handle

Example usage:

void *handle = dlopen(opengl_library_path, RTLD_LOCAL);
struct _glapi_table *disp = _glapi_create_table_from_handle(handle, "gl");

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agor300g: max_anisotropy of 1 is not anisotropic filtering
Marek Olšák [Sat, 11 Jun 2011 21:01:36 +0000 (23:01 +0200)]
r300g: max_anisotropy of 1 is not anisotropic filtering

12 years agoi915g: implement fence signalling
Daniel Vetter [Tue, 7 Jun 2011 20:22:16 +0000 (22:22 +0200)]
i915g: implement fence signalling

v2: Incorporated feedback from Jakob Bornecrantz.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agoi965: Add support for GL_FIXED vertex attributes.
Eric Anholt [Wed, 8 Jun 2011 20:44:00 +0000 (13:44 -0700)]
i965: Add support for GL_FIXED vertex attributes.

This sadly requires work in the VS to rescale them, because the
hardware doesn't support this format natively.

Fixes arb_es2_compatibility-fixed-type and gtf/fixed_data_type.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Fix incorrect optimization of instructions before discard statements.
Eric Anholt [Wed, 8 Jun 2011 18:25:04 +0000 (11:25 -0700)]
glsl: Fix incorrect optimization of instructions before discard statements.

The function was named "find_unconditional_discard", but didn't
actually check that the discard statement found was unconditional.
Fixes piglit glsl-fs-discard-04.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoFix format not a string literal error with -Werror=format-security
Eugeni Dodonov [Fri, 10 Jun 2011 18:26:02 +0000 (15:26 -0300)]
Fix format not a string literal error with -Werror=format-security

A trivial fix for error: format not a string literal and no format
arguments with compiling with -Werror=format-security flags.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/brw: Fix emit_depthbuffer() when packed depth/stencil texture is attached
Chad Versace [Fri, 10 Jun 2011 17:27:54 +0000 (10:27 -0700)]
i965/brw: Fix emit_depthbuffer() when packed depth/stencil texture is attached

If either depth or stencil buffer has packed depth/stencil format, then do
not use separate stencil.

Before this commit, emit_depthbuffer() incorrectly assumed that the
texture's stencil renderbuffer wrapper was a *separate* stencil buffer,
because the depth and stencil renderbuffer wrappers are distinct for
depth/stencil textures (that is, depth_irb != stencil_irb).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38134
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agor600g: VGT_PRIMITIVE_TYPE is special
Alex Deucher [Thu, 9 Jun 2011 20:54:23 +0000 (16:54 -0400)]
r600g: VGT_PRIMITIVE_TYPE is special

It's a special reg and does not require a flush like
the other CONFIG regs.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
12 years agor600g: Handle CONFIG regs properly
Alex Deucher [Thu, 9 Jun 2011 20:26:50 +0000 (16:26 -0400)]
r600g: Handle CONFIG regs properly

CONFIG regs (byte offsets 0x8000-0xac00) are single state and the pipeline
must be flushed and hw idle when they are changed.  Border color regs
are in the CONFIG range and this is why a flush is required when changing
them.  CONTEXT regs (byte offset 0x28000+) are multi-state and those do
not require flushes when changing them.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
12 years agoi965/gen6: Add support for gl_PointCoord.
Eric Anholt [Sun, 5 Jun 2011 18:52:20 +0000 (11:52 -0700)]
i965/gen6: Add support for gl_PointCoord.

This is just like PointSprite overrides, but it's always on for that
attribute.

Fixes glsl-fs-pointcoord, gtf/point_sprites.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/gen6: Fix point sprite texture coordinate overrides.
Eric Anholt [Sun, 5 Jun 2011 18:50:00 +0000 (11:50 -0700)]
i965/gen6: Fix point sprite texture coordinate overrides.

We were assuming that the input attribute n to the FS was
FRAG_ATTRIB_TEXn, which happened to be true often enough for our
testcases.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/gen6: Refactor SF setup a bit to handle overrides in one place.
Eric Anholt [Sun, 5 Jun 2011 18:45:04 +0000 (11:45 -0700)]
i965/gen6: Refactor SF setup a bit to handle overrides in one place.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agor300g: fix texturing with non-3D textures and wrap R mode set to sample border
Marek Olšák [Thu, 9 Jun 2011 02:09:40 +0000 (04:09 +0200)]
r300g: fix texturing with non-3D textures and wrap R mode set to sample border

If the wrap R (3rd) mode is set to CLAMP or CLAMP_TO_BORDER and the texture
isn't 3D, r300 always samples the border color regardless of texture
coordinates.

I HATE THIS HARDWARE.

NOTE: This is a candidate for the 7.10 branch.

12 years agor300g: don't enable aniso with nearest filtering
Marek Olšák [Thu, 9 Jun 2011 01:36:37 +0000 (03:36 +0200)]
r300g: don't enable aniso with nearest filtering

12 years agor600g: adjust vs/ps gprs on r600/r700 cards when needed.
Dave Airlie [Wed, 8 Jun 2011 04:35:00 +0000 (14:35 +1000)]
r600g: adjust vs/ps gprs on r600/r700 cards when needed.

Ideally we'd have a compiler and register spilling and all that
but this is good enough for now to avoid the gpu hang in piglit,

glsl-vs-vec4-indexing-temp-dst-in-nested-loop-combined

on r600/r700 cards.

based on r600c patch
Andre Maasikas <amaasikas@gmail.com>
r600c: bump sq gpr resources if a shader needs more than default

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor600g: remove unused variable
Marek Olšák [Wed, 8 Jun 2011 23:34:24 +0000 (01:34 +0200)]
r600g: remove unused variable

12 years agor300g: fix draw_vbo splitting on r3xx-r4xx
Marek Olšák [Wed, 8 Jun 2011 22:50:29 +0000 (00:50 +0200)]
r300g: fix draw_vbo splitting on r3xx-r4xx

NOTE: This is a candidate for the 7.10 branch.

12 years agor300g: make translate_primitive table-driven
Marek Olšák [Wed, 8 Jun 2011 22:33:45 +0000 (00:33 +0200)]
r300g: make translate_primitive table-driven

12 years agoutil: fix strict aliasing issues in u_format_r11g11b10f.h
Roland Scheidegger [Wed, 8 Jun 2011 23:11:52 +0000 (01:11 +0200)]
util: fix strict aliasing issues in u_format_r11g11b10f.h

12 years agomesa: get rid of homegrown logbase2 implementation in drivers
Roland Scheidegger [Wed, 8 Jun 2011 22:47:19 +0000 (00:47 +0200)]
mesa: get rid of homegrown logbase2 implementation in drivers

Some of the logbase2 functions did just the same as _mesa_logbase2,
though they were taking signed numbers (but it shouldn't matter for them).

12 years agomesa: fix gcc version check for _mesa_bitcount
Roland Scheidegger [Wed, 8 Jun 2011 22:45:03 +0000 (00:45 +0200)]
mesa: fix gcc version check for _mesa_bitcount

The version check was bogus, and only inside a non-gcc block anyway.

12 years agomesa: use __builtin_clz for logbase2 when available
Roland Scheidegger [Wed, 8 Jun 2011 22:44:32 +0000 (00:44 +0200)]
mesa: use __builtin_clz for logbase2 when available

Also rename to _mesa_logbase2 and move to imports.h to keep the ugly
ifdef GNUC stuff outside other files (also to allow reuse).

12 years agoutil: add gcc version check for builtins
Roland Scheidegger [Wed, 8 Jun 2011 21:23:24 +0000 (23:23 +0200)]
util: add gcc version check for builtins

Looks like only next_power_of_two, logbase2 and bitcount use builtins
requiring gcc 3.4, so maybe everything else compiles with older gcc.

12 years agoutil: better logbase2/next_power_of_two implementations
Benjamin Bellec [Wed, 8 Jun 2011 21:00:54 +0000 (23:00 +0200)]
util: better logbase2/next_power_of_two implementations

Use __builtin_clz when available for logbase/next_power_of_two,
and replace next_power_of_two with faster implementation otherwise.

12 years agoglx/xlib: Handle glXCreateContextAttribsARB in glXGetProcAddress.
José Fonseca [Wed, 8 Jun 2011 13:20:49 +0000 (14:20 +0100)]
glx/xlib: Handle glXCreateContextAttribsARB in glXGetProcAddress.

12 years agoi965/gen7: Call gen7_create_constant_surface instead of brw_[...].
Kenneth Graunke [Tue, 7 Jun 2011 00:19:12 +0000 (17:19 -0700)]
i965/gen7: Call gen7_create_constant_surface instead of brw_[...].

Fixes 17 piglit tests:
- glsl-vs-arrays-3
- glsl-vs-texturematrix-2
- glsl-vs-uniform-array-2
- arl
- nv-arl
- nv-init-zero-addr
- vp-address-01
- vp-arl-constant-array
- vp-arl-constant-array-huge
- vp-arl-constant-array-huge-offset
- vp-arl-constant-array-huge-offset-neg
- vp-arl-constant-array-huge-relative-offset
- vp-arl-constant-array-huge-varying
- vp-arl-env-array
- vp-arl-local-array
- vp-arl-neg-array
- vp-arl-neg-array-2

Fixes 4 glean tests:
- glsl1-constant array of vec4 with variable indexing, vertex shader
- glsl1-constant array with variable indexing, vertex shader
- glsl1-constant array with variable indexing, vertex shader (2)
- vp1-ARL test

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: Enable SIMD16 fragment shader dispatch.
Kenneth Graunke [Mon, 6 Jun 2011 18:14:15 +0000 (11:14 -0700)]
i965/gen7: Enable SIMD16 fragment shader dispatch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: Don't emit 3DSTATE_GS_SVB_INDEX on Ivybridge.
Kenneth Graunke [Mon, 6 Jun 2011 17:35:58 +0000 (10:35 -0700)]
i965/gen7: Don't emit 3DSTATE_GS_SVB_INDEX on Ivybridge.

According to vol2a.07, it only applies from Cantiga to Sandybridge.

I found this in my ringbuffers while investigating various GPU hangs.
While it may not have been the cause, it seemed wise to remove it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: Program stencil buffers on Ivybridge.
Kenneth Graunke [Mon, 23 May 2011 21:01:16 +0000 (14:01 -0700)]
i965/gen7: Program stencil buffers on Ivybridge.

Thanks to Chad's hard work implementing separate stencil and HiZ
support, this is entirely straightforward.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: Add a prepare_depthbuffer function.
Kenneth Graunke [Mon, 23 May 2011 21:40:51 +0000 (14:40 -0700)]
i965/gen7: Add a prepare_depthbuffer function.

We need to call add_validated_bo to do proper aperture space accounting.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: gen7_emit_depthbuffer needs the _NEW_DEPTH dirty bit.
Kenneth Graunke [Mon, 23 May 2011 18:55:39 +0000 (11:55 -0700)]
i965/gen7: gen7_emit_depthbuffer needs the _NEW_DEPTH dirty bit.

For ctx->Depth.Mask.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen7: Remove stencil renderbuffer from gen7_depth_format.
Kenneth Graunke [Mon, 23 May 2011 18:24:43 +0000 (11:24 -0700)]
i965/gen7: Remove stencil renderbuffer from gen7_depth_format.

Since Gen7 doesn't support packed depth/stencil, the stencil buffer
can't possibly be relevant for determining the depth format.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agost/mesa: more helpful debug message in destroy_program_variants_cb()
Brian Paul [Wed, 8 Jun 2011 21:15:07 +0000 (15:15 -0600)]
st/mesa: more helpful debug message in destroy_program_variants_cb()

12 years agosvga: fix typos, update comments
Brian Paul [Wed, 8 Jun 2011 21:07:15 +0000 (15:07 -0600)]
svga: fix typos, update comments

12 years agoglx: Remove some GLX_USE_APPLEGL guards around glapi
Jeremy Huddleston [Wed, 8 Jun 2011 19:03:10 +0000 (12:03 -0700)]
glx: Remove some GLX_USE_APPLEGL guards around glapi

Now that we're using glapi, we don't need some GLX_USE_APPLEGL ifdef-foo

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agodarwin: Use -fvisibility=hidden to set default symbol visibility
Jeremy Huddleston [Wed, 8 Jun 2011 18:47:00 +0000 (11:47 -0700)]
darwin: Use -fvisibility=hidden to set default symbol visibility

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agodarwin: mklib: Make the real file match the id
Jeremy Huddleston [Wed, 8 Jun 2011 18:20:38 +0000 (11:20 -0700)]
darwin: mklib: Make the real file match the id

This makes mesa more consistent with glibtool and XCode where the
generated file matches the dylib id rather using an extra symlink

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agointel: Request DRI2 buffers for separate stencil and hiz
Chad Versace [Fri, 3 Jun 2011 23:33:32 +0000 (16:33 -0700)]
intel: Request DRI2 buffers for separate stencil and hiz

When it is sensible to do so,
    1) intelCreateBuffer() now attaches separate depth and stencil
       buffers
       to the framebuffer it creates.
    2) intel_update_renderbuffers() requests for the framebuffer
       a separate stencil buffer (DRI2BufferStencil).

The criteria for "sensible" is:
    - The GLX config has nonzero depth and stencil bits.
    - The hardware supports separate stencil.
    - The X driver supports separate stencil, or its support has not yet
      been determined.

If the hardware supports hiz too, then intel_update_renderbuffers()
also requests DRI2BufferHiz.

If after requesting DRI2BufferStencil we determine that X driver did not
actually support separate stencil, we clean up the mistake and never ask
for DRI2BufferStencil again.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Add assertions to intelCreateBuffer()
Chad Versace [Thu, 26 May 2011 21:55:54 +0000 (14:55 -0700)]
intel: Add assertions to intelCreateBuffer()

Assert that the GLX config has an expected depth/stencil bit combination:
one of d24/s8, d16/s0, d0/s0. These are the only depth/stencil
configurations that we advertise.

Remove the check for software stencil, because given the assertions'
constraints the check always fails.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Refactor intel_update_renderbuffers()
Chad Versace [Fri, 3 Jun 2011 23:14:25 +0000 (16:14 -0700)]
intel: Refactor intel_update_renderbuffers()

Extract the code that queries DRI2 to obtain the DRIdrawable's buffers
into intel_query_dri2_buffers_no_separate_stencil().

Extract the code that assigns the DRI buffer's DRM region to the
corresponding renderbuffer into
intel_process_dri2_buffer_no_separate_stencil().

Rationale
---------
The next commit enables intel_update_renderbuffers() to query for separate
stencil and hiz buffers. Without separating the separate-stencil and
no-separate-stencil paths, intel_update_renderbuffers() degenerates into
an impenetrable labyrinth of if-trees.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Add function intel_renderbuffer_set_hiz_region()
Chad Versace [Tue, 31 May 2011 21:18:22 +0000 (14:18 -0700)]
intel: Add function intel_renderbuffer_set_hiz_region()

It's the analog of intel_renderbuffer_set_region(), but for the hiz region
of course.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel/intel_context.c: Remove unused functions
Chad Versace [Wed, 1 Jun 2011 22:14:18 +0000 (15:14 -0700)]
intel/intel_context.c: Remove unused functions

Remove functions intel_override_hiz() and
intel_override_separate_stencil(). They are now located in intel_screen.c.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Add flags to intel_screen for hiz and separate stencil
Chad Versace [Thu, 26 May 2011 22:24:48 +0000 (15:24 -0700)]
intel: Add flags to intel_screen for hiz and separate stencil

Add the fields below to intel_screen. The expression in parens is the
value to which intelInitScreen2() currently sets the field.
    GLboolean hw_has_separate_stencil      (true iff gen >= 7)
    GLboolean hw_must_use_separate_stencil (true iff gen >= 7)
    GLboolean hw_has_hiz                   (always false)
    enum intel_dri2_has_hiz dri2_has_hiz   (INTEL_DRI2_HAS_HIZ_UNKNOWN)

The analogous fields in intel_context now inherit their values from
intel_screen.

When hiz and separate stencil become completely implemented for a given
chipset, then the respective fields need to be enabled.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Define enum intel_dri2_has_hiz
Chad Versace [Wed, 1 Jun 2011 21:19:29 +0000 (14:19 -0700)]
intel: Define enum intel_dri2_has_hiz

... which indicates if the X driver supports DRI2BufferHiz and
DRI2BufferStencil.

I'm placing this in its own commit due to the large comment block.

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agodri2: Add token for DRI2BufferHiz
Chad Versace [Thu, 26 May 2011 23:50:30 +0000 (16:50 -0700)]
dri2: Add token for DRI2BufferHiz

CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Define span functions for S8 renderbuffers
Chad Versace [Wed, 1 Jun 2011 18:31:56 +0000 (11:31 -0700)]
intel: Define span functions for S8 renderbuffers

Since the stencil buffer is interleaved, the generic Mesa renderbuffer
accessors do not suffice. Custom span functions are necessary.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoi965/brw: Emit state for hiz and separate stencil buffers
Chad Versace [Mon, 23 May 2011 20:48:28 +0000 (13:48 -0700)]
i965/brw: Emit state for hiz and separate stencil buffers

When emitting 3DSTATE_DEPTH_BUFFER, also emit 3DSTATE_HIER_DEPTH_BUFFER if
there is a hiz buffer. Ditto for 3DSTATE_STENCIL_BUFFER and a separate
stencil buffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agost/egl: set EGL_ALPHA_MASK_SIZE
Chia-I Wu [Wed, 8 Jun 2011 16:23:16 +0000 (00:23 +0800)]
st/egl: set EGL_ALPHA_MASK_SIZE

12 years agomesa: merge glapidispatch.h into dispatch.h
Chia-I Wu [Wed, 8 Jun 2011 14:24:32 +0000 (22:24 +0800)]
mesa: merge glapidispatch.h into dispatch.h

glapidispatch.h was located in glapi and shared with mesa core.  Because
the way it was shared, mesa core must include it indirectly via
main/dispatch.h.

Now that it is no longer needed by glapi and is located in core mesa,
merging it with main/dispatch.h to avoid wrong uses.

12 years agomesa: fix function remapping for dlist
Chia-I Wu [Wed, 8 Jun 2011 13:51:41 +0000 (21:51 +0800)]
mesa: fix function remapping for dlist

glapidispatch.h should not be included directly.

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

12 years agomesa: fix GLES remap table setup again
Chia-I Wu [Wed, 8 Jun 2011 14:04:16 +0000 (22:04 +0800)]
mesa: fix GLES remap table setup again

Generate different glapidispatch.h's for GL and GLES.  For GLES, we want
a local remap table.

This reverts commit 5af46e836073d2112b147b524e441bdb808cc128.  The
commit will break GL remap table setup when main/glapidispatch.h is
regenerated.