Jerome Glisse [Sun, 10 May 2009 14:57:22 +0000 (16:57 +0200)]
Merge commit 'origin/master' into radeon-rewrite
Conflicts:
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_fragprog.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_texmem.c
src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/r300/r500_fragprog.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_state.c
Jerome Glisse [Sat, 9 May 2009 10:56:27 +0000 (12:56 +0200)]
radeon: don't include cs uncondionaly
Corbin Simpson [Sat, 9 May 2009 07:43:05 +0000 (00:43 -0700)]
radeon-gallium: Clean up some of the BO counting logic.
Corbin Simpson [Sat, 9 May 2009 07:38:07 +0000 (00:38 -0700)]
r300-gallium: vs: Make imms work, cleanup some of the switches.
Corbin Simpson [Sat, 9 May 2009 07:28:49 +0000 (00:28 -0700)]
r300-gallium: Start VS dumper.
Corbin Simpson [Sat, 9 May 2009 05:54:52 +0000 (22:54 -0700)]
r300-gallium: vs: Add SLT, clean up MAX.
This should be all the opcodes for basic TCL.
Corbin Simpson [Sat, 9 May 2009 05:52:32 +0000 (22:52 -0700)]
r300-gallium: vs: Add MAX.
Corbin Simpson [Sat, 9 May 2009 05:46:12 +0000 (22:46 -0700)]
r300-gallium: vs: Add scalar setup, RSQ.
Icky icky icky icky. Icky icky, icky icky. Icky.
Corbin Simpson [Sat, 9 May 2009 05:45:56 +0000 (22:45 -0700)]
r300-gallium: vs: Add writemasks.
Corbin Simpson [Sat, 9 May 2009 05:05:18 +0000 (22:05 -0700)]
r300-gallium: Fix bad cast. Space accounting completely works now.
Boy, is my face red. :C
Corbin Simpson [Sat, 9 May 2009 02:40:38 +0000 (19:40 -0700)]
r300-gallium, radeon: BO handling fixes, some useful asserts.
Corbin Simpson [Sat, 9 May 2009 00:09:32 +0000 (17:09 -0700)]
radeon-gallium: Shut up Valgrind.
Corbin Simpson [Fri, 8 May 2009 23:50:42 +0000 (16:50 -0700)]
r300-gallium, radeon: A couple cleanups.
Trying to track down goddamn bugs. :C
Corbin Simpson [Fri, 8 May 2009 22:28:09 +0000 (15:28 -0700)]
r300-gallium: Finish space accounting.
Still broken...
Robert Ellison [Fri, 8 May 2009 20:51:11 +0000 (14:51 -0600)]
i965: improve debug logging
Looking for memory leaks that were causing crashes in my environment
in a situation where valgrind would not work, I ended up improving
the i965 debug traces so I could better see where the memory was
being allocated and where it was going, in the regions and miptrees
code, and in the state caches. These traces were specific enough
that external scripts could determine what elements were not being
released, and where the memory leaks were.
I also ended up creating my own backtrace code in intel_regions.c,
to determine exactly where regions were being allocated and for what,
since valgrind wasn't working. Because it was useful, I left it in,
but disabled and compiled out. It can be activated by changing a flag
at the top of the file.
Robert Ellison [Fri, 8 May 2009 20:42:47 +0000 (14:42 -0600)]
i965: fix memory leak in context/renderbuffer region management
A temporary change to the intelMakeCurrent() function to make
it work with frame buffer objects causes the static regions
associated with the context (the front_region, back_region,
and depth_region) to take on an additional reference, with
no corresponding release. This causes a memory leak if a
program repeatedly creates and destroys contexts.
The fix is the corresponding hack, to unreference these
regions when the context is deleted, but only if the
framebuffer objects are still present and the same
regions are still referenced within.
Both sets of code have comment blocks referring to each
other.
Robert Ellison [Fri, 8 May 2009 20:40:38 +0000 (14:40 -0600)]
i965: fix segfault on low memory conditions
When out of memory (in at least one case, triggered by a longrunning
memory leak), this code will segfault and crash. By checking for the
out-of-memory condition, the system can continue, and will report
the out-of-memory error later, a much preferable outcome.
Robert Ellison [Fri, 8 May 2009 17:13:57 +0000 (11:13 -0600)]
mesa: Fixed a texture memory leak
The current texture for any particular texture unit is given an additional
reference in update_texture_state(); but if the context is closed before
that texture can be released (which is quite frequent in normal use, unless
a program unbinds and deletes the texture and renders without it to force
a call to update_texture_state(), the memory is lost.
This affects general Mesa; but the i965 is particularly affected because
it allocates a considerable amount of additional memory for each allocated
texture.
Eric Anholt [Fri, 8 May 2009 05:50:19 +0000 (22:50 -0700)]
intel: Add a metaops version of glGenerateMipmapEXT/SGIS_generate_mipmaps.
In addition to being HW accelerated, it avoids the incorrect
(black) rendering of the mipmaps that SW was doing in fbo-generatemipmap.
Improves the performance of the mipmap generation and drawing in
fbo-generatemipmap by 30%.
Eric Anholt [Fri, 8 May 2009 19:46:18 +0000 (12:46 -0700)]
intel: Put the constant texcoords used in metaops into a vbo.
Make this be its own function for setup/teardown of the binding of these
texcoords. No performance difference in the engine demo (I just felt dirty
not using a VBO for this), and I think it should be more resilient to
interference from current GL state.
Brian Paul [Fri, 8 May 2009 19:48:41 +0000 (13:48 -0600)]
i965: const qualifiers
Brian Paul [Fri, 8 May 2009 20:34:43 +0000 (14:34 -0600)]
mesa: raise MAX_VARYING (number of shader varying vars) to 16
16 is the limit for now because of various 32-bit bitfields.
Brian Paul [Fri, 8 May 2009 20:34:15 +0000 (14:34 -0600)]
mesa: assertions to check for too many vertex outputs or fragment inputs
Brian Paul [Fri, 8 May 2009 20:32:19 +0000 (14:32 -0600)]
glsl: check number of varying variables against the limit
Link fails if too many varying vars.
Brian Paul [Fri, 8 May 2009 18:44:38 +0000 (12:44 -0600)]
mesa: issue warning for out of bounds array indexes
Brian Paul [Fri, 8 May 2009 18:43:58 +0000 (12:43 -0600)]
i965: don't use GRF regs 126,127 for WM programs
They seem to be used for something else and using them for shader temps
seems to lead to GPU lock-ups.
Call _mesa_warning() when we run out of temps.
Also, clean up some debug code.
Brian Paul [Fri, 8 May 2009 18:18:44 +0000 (12:18 -0600)]
glsl: set vertex/fragment program Ids to aid with debugging
Brian Paul [Fri, 8 May 2009 18:17:11 +0000 (12:17 -0600)]
mesa: more shader debug code (disabled)
Jerome Glisse [Fri, 8 May 2009 14:40:21 +0000 (16:40 +0200)]
radeon: IRQ always enabled in DRI2 path no need to query kernel for it
Keith Whitwell [Thu, 7 May 2009 18:48:06 +0000 (19:48 +0100)]
mesa/st: keep surface_copy arguments positive
The src/dest x,y, and w,h arguments of the pipe->surface_copy
function are unsigned and the drivers aren't expecting negative
(or extremly-large unsigned) values as inputs. Trim the requests
at the state-tracker level before passing down.
Keith Whitwell [Thu, 7 May 2009 18:27:30 +0000 (19:27 +0100)]
mesa/st: remove redundant call to st_finish in CopyTexSubImage
Rendering should already have been flushed, any synchronization will
be done by the driver or memory manager.
José Fonseca [Thu, 7 May 2009 17:21:56 +0000 (18:21 +0100)]
wgl: Export pixelformats with accumulation bits.
Keith Whitwell [Thu, 7 May 2009 10:46:08 +0000 (11:46 +0100)]
mesa/st: cope with non-ibo index data in st_draw_feedback.c
Previously only non-indexed or indicies-in-a-vbo cases were handled in
this code. This change adds the missing regular indices-in-memory
case.
Keith Whitwell [Thu, 7 May 2009 08:24:37 +0000 (09:24 +0100)]
util/upload: catch failures to map_range and return error
Caller may be able to do something about this - eg flush and retry.
Keith Whitwell [Thu, 7 May 2009 07:00:42 +0000 (08:00 +0100)]
scons: mingw is broken with -O1 and higher
Keith Whitwell [Wed, 6 May 2009 19:41:17 +0000 (20:41 +0100)]
stw: fix potential uninitialized use of curctx
José Fonseca [Wed, 6 May 2009 18:58:08 +0000 (19:58 +0100)]
wgl: Enforce a minimum 1x1 framebuffer size.
José Fonseca [Fri, 1 May 2009 17:53:51 +0000 (18:53 +0100)]
wgl: Add assertion for missing function.
José Fonseca [Fri, 1 May 2009 17:53:17 +0000 (18:53 +0100)]
wgl: Remove unused variable.
José Fonseca [Fri, 1 May 2009 17:52:54 +0000 (18:52 +0100)]
mesa: Make _mesa_share_state thread safe.
José Fonseca [Fri, 1 May 2009 17:49:22 +0000 (18:49 +0100)]
wgl: Implement ShareLists.
Maciej Cencora [Tue, 5 May 2009 12:45:51 +0000 (14:45 +0200)]
r300: add missing texture format
Fixes piglit/texdepth
Maciej Cencora [Sat, 2 May 2009 17:34:57 +0000 (19:34 +0200)]
r300: moar cleanup
- remove unused r300UpdateClipPlanes function
- move reg definition to r300_reg.h
- remove incorrect forward definition of tnl_UpdateFixedFunctionProgram and add proper #include
- remove unreachable code
Maciej Cencora [Sat, 2 May 2009 15:37:20 +0000 (17:37 +0200)]
r300: fix compiler warnings
Ben Skeggs [Thu, 7 May 2009 23:22:16 +0000 (09:22 +1000)]
nouveau: respect GALLIUM_STATE_TRACKERS_DIRS
Ben Skeggs [Thu, 7 May 2009 23:11:17 +0000 (09:11 +1000)]
nouveau: remove dri1 code now we're using the dri state tracker
Ben Skeggs [Thu, 7 May 2009 23:04:10 +0000 (09:04 +1000)]
nouveau: use dri state tracker for dri1
Brian Paul [Thu, 7 May 2009 20:33:18 +0000 (14:33 -0600)]
mesa: make the array object save/remove functions static
Brian Paul [Thu, 7 May 2009 20:26:17 +0000 (14:26 -0600)]
mesa: clean-up vertex array object VBO unbinding and delete/refcounting
Don't really delete vertex array objects until the refcount hits zero.
At that time, unbind any pointers to VBOs.
Brian Paul [Thu, 7 May 2009 20:15:24 +0000 (14:15 -0600)]
demos: delete vertex array objects upon exit
Brian Paul [Thu, 7 May 2009 19:52:26 +0000 (13:52 -0600)]
mesa: reference counting for gl_array_object
Every kind of object that can be shared by multiple contexts should be
refcounted.
Brian Paul [Thu, 7 May 2009 19:36:20 +0000 (13:36 -0600)]
mesa: array object comments
Brian Paul [Thu, 7 May 2009 19:30:39 +0000 (13:30 -0600)]
mesa: move the NullBufferObj from GLcontext to gl_shared_state
Since shared array objects may point to the null/default buffer object,
the null/default buffer object should be part of the shared state.
Brian Paul [Thu, 7 May 2009 19:10:48 +0000 (13:10 -0600)]
mesa: fix comments, s/texture/buffer/
Brian Paul [Thu, 7 May 2009 17:01:02 +0000 (11:01 -0600)]
vbo: in glDraw[Range]Element() code, check for out of bounds indexes
No-op the bad drawing command rather than go out of bounds and render
garbage. Print a warning to alert the developer to the bad drawing call.
Brian Paul [Wed, 6 May 2009 21:39:51 +0000 (15:39 -0600)]
mesa: remove unused gl_buffer_object::OnCard field
Brian Paul [Wed, 6 May 2009 21:23:09 +0000 (15:23 -0600)]
mesa: added gl_buffer_object::Written flag (for debug purposes)
The flag is set when we data has been written into the buffer object.
Brian Paul [Wed, 6 May 2009 21:17:25 +0000 (15:17 -0600)]
mesa: Compute gl_client_array->_MaxElement during array validation
Used to be done in the glVertex/Normal/Color/etc/Pointer() calls but
if the VBO was reallocated the size could change.
New _NEW_BUFFER_OBJECT state flag.
Brian Paul [Wed, 6 May 2009 21:12:01 +0000 (15:12 -0600)]
mesa: GLvector4f:: flags is a GLbitfield, update comments too.
Brian Paul [Wed, 6 May 2009 21:09:18 +0000 (15:09 -0600)]
mesa: add storage_count field to GLvector4f. Useful for debugging.
Brian Paul [Wed, 6 May 2009 19:02:38 +0000 (13:02 -0600)]
mesa: use array->BufferObj instead of ctx->Array.ArrayBufferObj
No difference, but a little more understandable.
Brian Paul [Wed, 6 May 2009 19:00:35 +0000 (13:00 -0600)]
mesa: added _ElementSize field to gl_client_array
Will be handy for bounds checking later...
Brian Paul [Wed, 6 May 2009 18:56:15 +0000 (12:56 -0600)]
mesa: use local var to make code a bit more concise
Brian Paul [Wed, 6 May 2009 18:48:21 +0000 (12:48 -0600)]
mesa: fix/add comments
Brian Paul [Wed, 6 May 2009 16:54:34 +0000 (10:54 -0600)]
mesa: use _mesa_sizeof_type() in vbo split code
Brian Paul [Wed, 6 May 2009 16:36:33 +0000 (10:36 -0600)]
mesa: vbo code reformatting, clean-up, comments
Brian Paul [Wed, 6 May 2009 15:56:26 +0000 (09:56 -0600)]
mesa: add GL_DOUBLE case in _mesa_sizeof_type()
Brian Paul [Wed, 6 May 2009 15:51:56 +0000 (09:51 -0600)]
mesa: in vbo split code, map buffers read-only, not write-only
And use GL_ELEMENT_ARRAY_BUFFER where appropriate.
Brian Paul [Wed, 6 May 2009 15:01:47 +0000 (09:01 -0600)]
mesa: limit number of error raised by invalid GL_TEXTURE_MAX_ANISOTROPY_EXT
Brian Paul [Wed, 6 May 2009 15:45:24 +0000 (09:45 -0600)]
tnl: added some clip debug/print code (disabled)
Brian Paul [Tue, 5 May 2009 17:11:25 +0000 (11:11 -0600)]
mesa: reformatting, updated comments, const-correctness
Brian Paul [Tue, 5 May 2009 00:22:19 +0000 (18:22 -0600)]
tnl: replace 0x3f with CILP_FRUSTUM_BITS
Brian Paul [Wed, 6 May 2009 14:16:42 +0000 (08:16 -0600)]
i965: relAddr local var (to make debug/test a little easier)
Brian Paul [Thu, 7 May 2009 15:46:53 +0000 (09:46 -0600)]
Merge branch 'mesa_7_5_branch'
Brian Paul [Thu, 7 May 2009 15:43:15 +0000 (09:43 -0600)]
swrast: fix span clipping bug
If a horizontal span of pixels was located at x < 0 we could sometimes
read/write outside of renderbuffer bounds.
Brian Paul [Thu, 7 May 2009 15:36:21 +0000 (09:36 -0600)]
mesa: unmap buffer objects during context tear-down
Eric Anholt [Thu, 7 May 2009 04:44:13 +0000 (21:44 -0700)]
i965: Remove bad constant buffer constant-reg-already-loaded optimization.
Thanks to branching, the state of c->current_const[i].index at the point
of emitting constant loads for this instruction may not match the actual
constant currently loaded in the reg at runtime. Fixes a regression in my
GLSL program for idr's class since
b58b3a786aa38dcc9d72144c2cc691151e46e3d5.
Eric Anholt [Wed, 6 May 2009 20:58:57 +0000 (13:58 -0700)]
intel: Unmap buffers if needed at DeleteBuffer time.
This fixes a crash in glean's pbo test, which tripped over the assert when a
context was destroyed while a buffer was still mapped (Mesa doesn't call
UnmapBuffer in that case). Regression in
c6bde8873fbda6d8467600b7491d8543c75b0509
Owen W. Taylor [Wed, 6 May 2009 18:44:16 +0000 (14:44 -0400)]
When clearing the stencil buffer, don't use a two-sided stencil
In radeon_clear_tris(), when clearing the stencil buffer,
pass GL_FRONT_AND_BACK to _mesa_StencilFuncSeparate(), to avoid
triggering a software fallback on r300 and below.
https://bugs.freedesktop.org/show_bug.cgi?id=21601
Brian Paul [Wed, 6 May 2009 18:38:11 +0000 (12:38 -0600)]
mesa: remove unnecessary buffer size check
Brian Paul [Wed, 6 May 2009 18:37:10 +0000 (12:37 -0600)]
mesa: code consolidation in glDraw[Range]Elements() validation
Brian Paul [Wed, 6 May 2009 18:27:38 +0000 (12:27 -0600)]
mesa: new comments, minor reformatting
Brian Paul [Wed, 6 May 2009 18:23:28 +0000 (12:23 -0600)]
mesa: use elementBuf local var instead of ctx->Array.ElementArrayBufferObj
Makes no real difference, but more consistant.
Eric Anholt [Wed, 6 May 2009 17:51:58 +0000 (10:51 -0700)]
i965: Remove the forced lack of caching for renderbuffer surface state.
This snuck in with the multi-draw-buffers commit, and is a major penalty
to performance. It doesn't appear to be required, as the only dependency
the surface BO has is on the state key (and if there's some other dependency,
it should just be in the key).
This brings openarena performance up to almost 2% faster than Mesa 7.4.
Eric Anholt [Wed, 6 May 2009 14:58:40 +0000 (07:58 -0700)]
i965: Remove _NEW_PROGRAM from brw_wm_surfaces setup dependencies.
This was a leftover from the brw_wm_constant_buffer change.
Brian Paul [Wed, 6 May 2009 14:45:55 +0000 (08:45 -0600)]
mesa: be smarter about allocating vert/frag program constants
Try to re-use constants/literals more often to make best use of the
constant buffer space.
See bug 21354.
Eric Anholt [Wed, 6 May 2009 00:16:15 +0000 (17:16 -0700)]
i965: Split WM constant buffer update from other WM surfaces.
This can avoid re-uploading constant data when it isn't necessary, and is
a step towards not updating other surfaces just because constants change.
It also brings the upload of the constant buffer next to the creation.
This brings openarena performance up another 4%, to 91% of the Mesa 7.4 branch.
Eric Anholt [Tue, 5 May 2009 21:05:54 +0000 (14:05 -0700)]
i965: Disentangle VS constant surface state from WM surface state.
Also, only create VS surface state if there's a VS constant buffer to be
uploaded, and set the contents of the buffer at the same time as creation.
Eric Anholt [Tue, 5 May 2009 20:07:33 +0000 (13:07 -0700)]
i965: Don't create constant buffers if they won't be used.
Really, the creation and upload of constants should be in the same place,
since they should only happen together, and a state flag should be
triggered by them so that we don't thrash state around so much for just
updating constants. But this still recovers openarena performance by
another 19%, leaving us 16% behind Mesa 7.4 branch.
Dave Airlie [Wed, 6 May 2009 04:43:07 +0000 (14:43 +1000)]
radeon: hopefully fixup radeon cube state emission for kms
Dave Airlie [Wed, 6 May 2009 04:06:13 +0000 (14:06 +1000)]
r100/r200: try and allocate miptree correct for hw.
This doesn't make things worse but according to sroland it
is how the GPU hw expects things on the r100/r200
Dave Airlie [Wed, 6 May 2009 03:34:34 +0000 (13:34 +1000)]
r200: fix cubic emission.
Still doesn't fix cubemaps, I really missed the whole drmsupports
thing when testing this all originally
Brian Paul [Tue, 5 May 2009 22:29:04 +0000 (16:29 -0600)]
mesa: only use fallback texture when using shaders, not fixed-function (take two)
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture. The fallback texture returning
(0,0,0,1) should only be used with shaders. For fixed function, the texture
unit is truly disabled/ignored.
Fixes glean fbo test regression.
Brian Paul [Tue, 5 May 2009 22:30:30 +0000 (16:30 -0600)]
Revert "mesa: only use fallback texture when using shaders, not fixed-function"
This reverts commit
a0edbfb28fb2e670c657d52190a7e8b1ccf4f46e.
This patch didn't completely fix the problem. The next patch will.
Brian Paul [Tue, 5 May 2009 22:29:04 +0000 (16:29 -0600)]
mesa: only use fallback texture when using shaders, not fixed-function
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture. The fallback texture returning
(0,0,0,1) should only be used with shaders.
Fixes glean fbo test regression.
Brian Paul [Tue, 5 May 2009 22:21:20 +0000 (16:21 -0600)]
mesa: only use fallback texture when using shaders, not fixed-function
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture. The fallback texture returning
(0,0,0,1) should only be used with shaders.
Fixes glean fbo test regression.
Brian Paul [Tue, 5 May 2009 22:17:55 +0000 (16:17 -0600)]
mesa: minor simplification in enable_texture(), updated comments
Roland Scheidegger [Tue, 5 May 2009 19:01:36 +0000 (21:01 +0200)]
r200: fix some cube map issues
remove the r100-ism of swapping cube faces which doesn't apply to r200,
and also use precalculated offsets.
Note that cube textures will still not work on r100 and r200 since mipmap
layout is level-first order (for r300) whereas r100/r200 require
face-first (and possibly also 2k alignment for face at least with tiling).
Roland Scheidegger [Tue, 5 May 2009 18:17:37 +0000 (20:17 +0200)]
r200: fix another section size mismatch
Brian Paul [Tue, 5 May 2009 16:13:13 +0000 (10:13 -0600)]
Merge branch 'mesa_7_5_branch'