Commit graph

49245 commits

Author SHA1 Message Date
Brian Paul
d9d0d4198f swrast: new fast_draw_depth_stencil() for glDrawPixels(GL_DEPTH_STENCIL)
Stop using deprecated renderbuffer PutRow() function.  Note that we
aren't using Map/UnmapRenderbuffer() yet because this call is inside
a swrast_render_start/finish() pair.

v2: use _mesa_pack_uint_24_8_depth_stencil_row(), per Eric.
2011-12-24 08:59:54 -07:00
Brian Paul
826f36b1d8 swrast: remove the copy_depth_stencil_pixels() function
Hopefully glCopyPixels(GL_DEPTH_STENCIL) will be handled by the
fast copy function.  Otherwise, just do the copy with separate
depth + stencil copies.  That's effectively what the removed code
did anyway.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:59:54 -07:00
Brian Paul
e6c6b1c147 swrast: stop using depth/stencil wrappers in CopyPixels code
The functions that read depth/stencil values understand all (packed)
depth/stencil buffer formats now so there's no reason to use the
wrappers.

Also, improve the format checks in fast_copy_pixels() to catch mismatched
depth/stencil cases.

v2: fix the test for combined depth+stencil buffers, per Eric.
2011-12-24 08:59:54 -07:00
Brian Paul
bd31fb3463 swrast: remove needless assignment in draw_depth_stencil_pixels()
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:59:53 -07:00
Brian Paul
7cf2d75d4f swast: replace renderbuffer->GetPointer() with _swrast_pixel_address()
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:59:53 -07:00
Brian Paul
242fd9df3b swrast: use _swrast_pixel_address() helper function
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:59:50 -07:00
Brian Paul
d00d39a016 swrast: rewrite stencil test code
Stop using the deprecated renderbuffer Get/Put Row/Values functions.
Consolidate code paths, etc.  The file is nearly half the size it used
to be!

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
8b913bda3a swrast: remove dead code in s_stencil.c
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
70df474941 swrast: rewrite _swrast_read_stencil_span()
Use format pack/unpack functions instead of deprecated renderbuffer
GetRow/PutRow functions.

v2: use get_stencil_address(), s/destVals/newVals/

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
4d6b0927ab swrast: rewrite _swrast_read_depth_span_float()
Stop using the deprecated renderbuffer GetRow() function.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
82f28c0a12 mesa: rewrite _swrast_depth_bounds_test()
Stop using the deprecated renderbuffer functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
29a9983969 swrast: rewrite depth-testing code
Consolidate code, stop using the deprecateted renderbuffer Put/Get
Row/Values() functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
8e7c388b31 swrast: stop using _swrast_get_values() in z/depth code
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
e23e8cbf39 swrast: stop using _swrast_get_values() in stencil code
That function will go a way in the future.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
89fb81d521 swrast: do fast_copy_pixels() with Map/UnmapRenderbuffer()
v2: use memmove() instead of memcpy() in case of overlap

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
95970677b9 swrast: replace GetRow() call with _mesa_unpack_ubyte_stencil_row()
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
fc41473b9f mesa: remove gl_renderbufer::PutMonoRow() and PutMonoValues()
The former was only used for clearing buffers.  The later wasn't used
anywhere!  Remove them and all implementations of those functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-24 08:54:26 -07:00
Brian Paul
c4b5f0cadb swrast: rewrite color buffer clearing to use Map/UnmapRenderbuffer()
v2: use _mesa_pack_colormask() helper and fix incorrect masking arithmetic

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 08:54:26 -07:00
Brian Paul
f1a2aa5cb3 mesa: add _mesa_pack_colormask()
For generating bit-wise colormasks for arbitrary pixel formats.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 08:54:26 -07:00
Brian Paul
488d7fc67d mesa: add _mesa_get_format_max_bits()
Returns max bits per channel for the given format.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 08:54:25 -07:00
Brian Paul
fd104a8459 swrast: do depth/stencil clearing with Map/UnmapRenderbuffer()
Another step toward getting rid of the renderbuffer PutRow/etc functions.

v2: fix assorted depth/stencil clear bugs found by Eric

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 08:54:25 -07:00
Brian Paul
fb758aab27 mesa: split get_tex_rgba() into compressed/uncompressed versions
This just splits one big function into two smaller ones for better
readability.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 08:54:25 -07:00
Brian Paul
5e6a6e49e9 mesa: fix comments in getteximage_error_check() 2011-12-24 08:00:29 -07:00
Jian Zhao
26195c8417 mesa: move the format and type check before select_tex_image()
Move the format and type check before select_tex_image, or it will fail to
report the mismatch error if the teximage is null.

Reported-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Jian Zhao <jian.j.zhao@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-12-24 08:00:29 -07:00
Maarten Lankhorst
1fdecef886 vl: Fix inverted logic in vlc checks
Reported-by: Andy Furniss <andyqos@ukfsn.org>
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
2011-12-24 15:36:46 +01:00
Alexandre Demers
3258cd9e61 egl,glx,wgl: Fixes stapi->createContext usage
Fixed the build failure, fixed a warning where attributs and error arguments had
been
inverted and fixed another call that was missing an argument.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-12-24 11:11:33 +00:00
Eric Anholt
e71375d375 i965/gen7: Fix feedback for flat-shaded tristrips versus provoking vertex.
Fixes piglit tesselation triangle_strip flat_last.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-23 22:07:20 -08:00
Eric Anholt
c8223d8c8d i965/gen7: Add support for transform feedback.
Fixes almost all of the transform feedback piglit tests.  Remaining
are a few tests related to tesselation for
quads/trifans/tristrips/polygons with flat shading.

v2: Incorporate Paul's feedback (squash with previous, state flag note,
    static assert, update FINISHME)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-23 22:07:09 -08:00
Eric Anholt
8f0baace98 i965/gen7: Move SOL stage disable to gen7_sol_state.c
We'll be growing more code in here as we actually enable the unit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-23 22:02:25 -08:00
Eric Anholt
e1425a54b1 i965/gen7: Add register definitions for GL_EXT_transform_feedback.
v2: Make the buffer enable bitfield take an index argument.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-23 22:02:12 -08:00
Eric Anholt
43e0d77597 i965/gen7: Make primitives_written counting work.
The code was relying on gs.prog_data's copy of the
number-of-verts-per-prim, which segfaulted on gen7 since it doesn't
make a GS program.  We can easily calculate that value right here.

v2: Fix svbi_0_starting_index regression.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 22:02:09 -08:00
Eric Anholt
bf2a93db4d i965/gen7: Enable EXT_transform_feedback extension under 3.0 override.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-23 22:02:04 -08:00
Matt Turner
7a8f52e4b4 glsl: remove old autogen.sh
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 17:03:00 -08:00
Paul Berry
f2f14bc4a9 i965 Gen6+: Invalidate VF address-based cache on flush
Although there is not much documentation of this fact, there are in
fact two separate VF caches:

- an "index-based" cache (described in the Sandy Bridge PRM, vol 2
  part 1, section 2.1.2 "Vertex Cache").  This cache stores URB
  handles of vertex shader outputs; its purpose is to avoid redundant
  invocations of the vertex shader when drawing in random access mode
  (e.g. glDrawElements()), and the same vertex index is specified
  multiple times.  It is automatically invalidated between
  3D_PRIMITIVE commands and between instances within a single
  3D_PRIMITIVE command.

- an "address-based" cache (mentioned briefly in vol 2 part 1, section
  1.7.4 "PIPE_CONTROL Command").  This cache stores the data read from
  vertex buffers; its purpose is to avoid redundant memory accesses
  when doing instanced drawing or when multiple 3D_PRIMITIVE commands
  access the same vertex data.  It needs to be manually invalidated
  whenever new data is written to a buffer that is used for vertex
  data.

Previous to this patch, it was not necessary for Mesa to explicitly
invalidate the address-based cache, because there were no reasonable
use cases in which the GPU would write to a vertex data buffer during
a batch, and inter-batch flushing was taken care of by the kernel.

However, with transform feedback, there is now a reasonable use case:
vertex data is written to a buffer using transform feedback, and then
that data is immediately re-used as vertex input in the next drawing
operation.  To make this use case work, we need to flush the
address-based VF cache between transform feedback and the next draw
operation.  Since we are already calling
intel_batchbuffer_emit_mi_flush() when transform feedback completes,
and intel_batchbuffer_emit_mi_flush() is intended to invalidate all
caches, it seems reasonable to add VF cache invalidation to this
function.

As with commit 63cf7fad13 (i965: Flush
pipeline on EndTransformFeedback), this is not an ideal solution.  It
would be preferable to only invalidate the VF cache if the next draw
call was about to consume data generated by a previous draw call in
the same batch.  However, since we don't have the necessary dependency
tracking infrastructure to figure that out right now, we have to
overzealously invalidate the cache.

Fixes Piglit test "EXT_transform_feedback/immediate-reuse".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 15:16:51 -08:00
Paul Berry
e25c4d0926 i965 gen6: Resend binding table pointer after updating SOL bindings.
After creating new binding table entries for transform feedback, we
need to set the dirty flag BRW_NEW_SURFACES, so that a new binding
table pointer will be sent to the hardware.  Otherwise the new binding
table entries will not take effect.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 15:16:51 -08:00
Paul Berry
9cfa8a74ce i965: Rename BRW_NEW_WM_SURFACES to BRW_NEW_SURFACES.
The surface states tracked by BRW_NEW_WM_SURFACES are no longer used
for just WM.  They are also used for vertex texturing and transform
feedback.  To avoid confusion, this patch renames BRW_NEW_WM_SURFACES
to BRW_NEW_SURFACES.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 15:16:51 -08:00
Kenneth Graunke
9df8662e28 i965: Don't use BRW_DEPTHFORMAT_D24_UNORM_X8_UINT on Gen4.
X8 depth formats weren't supported until Ironlake (Gen 5).

Fixes GPU hangs introduced in d84a180417.
One example test case was "fbo-missing-attachment-blit from".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-23 12:15:20 -08:00
Paul Berry
cb045880b1 mesa: Pause transform feedback during meta ops.
Fixes piglit tests "EXT_transform_feedback/generatemipmap buffer" and
"EXT_transform_feedback/generatemipmap prims_written" on i965 Gen6.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 09:43:18 -08:00
Paul Berry
772d4fef42 i965 gen6: Implement transform feedback pause/resume functionality.
Although i965 gen6 does not yet support ARB_transform_feedback2 or
NV_transform_feedback2, it needs to support pause/resume functionality
so that meta-ops will work correctly.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 09:43:18 -08:00
Paul Berry
87c7e5fb87 mesa: Disable certain error checks when transform feedback is paused
When transform feedback is paused, it is legal to change programs or
to perform drawing operations using a drawing mode that doesn't match
the transform feedback mode.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 09:43:18 -08:00
Paul Berry
08ce48733d mesa: Ensure that Paused is reset to false on EndTransformFeedback.
If a client calls BeginTransformFeedback(), then
PauseTransformFeedback(), then EndTransformFeedback(), we need to make
sure that the transform feedback object is not left in a "paused"
state, otherwise the next call to BeginTransformFeedback() will leave
transform feedback paused.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 09:43:18 -08:00
Paul Berry
a3a4d01e41 mesa: Save and restore GL_RASTERIZER_DISCARD state during meta ops.
During meta-operations (such as _mesa_meta_GenerateMipmap()), we need
to be able to draw even if GL_RASTERIZER_DISCARD is enabled.  This
patch causes _mesa_meta_begin() to save the state of
GL_RASTERIZER_DISCARD and disable it (so that drawing can be done
during the meta-op), and causes _mesa_meta_end() to restore it.

Fixes piglit test "EXT_transform_feedback/generatemipmap discard" on
i965 Gen6.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-23 09:43:18 -08:00
Ian Romanick
b5b2081d75 dri2: Add createContextAttribs entry point for DRISW version 3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:49:53 -08:00
Ian Romanick
1ab545494a dri2: Add createContextAttribs entry point for DRI2 version 3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:49:53 -08:00
Ian Romanick
d18152028e st-api: Have context_create explain why creation failed
This won't be used in the client-side libGL, but the xserver has to
generate a different protocol error depending on the reason context
creation failed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
2011-12-23 08:49:50 -08:00
Ian Romanick
358ecff1ea st-api: Clean-up OpenGL profile handling
There seems to have been two different ways to communicate the
profile.  There were flags and there were profiles.  I've opted to
remove the profile flags and use ST_PROFILE_DEFAULT (compatibility
profile) and ST_PROFILE_OPENGL_CORE (core profile) consistently
instead.

Also change the values of the ST_CONTEXT_FLAG_DEBUG and
ST_CONTEXT_FLAG_FORWARD_COMPATIBLE flags to match the WGL and GLX
values.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
2011-12-23 08:49:47 -08:00
Ian Romanick
ed4a65c3cf glx: Propagate the glXIsDirect protocol error back to the application
If the server returned BadContext, the error would just get droped on
the floor.

Fixes the piglit test glx-import-context-single-process

NOTE: This is a candidate for the 7.11 branch, but it also requires
the previous patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:40:30 -08:00
Ian Romanick
fba400072f glx: Deliver an xlib style error to the application from an XCB error
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:40:30 -08:00
Maarten Lankhorst
efa93ae449 vl: improve vlc functions and handling
Only initialize vlc in MPEG2 decoding once for all slices,
add more sanity checks to vlc decoding functions, support
multiple vlc input buffer, improve documentation of the
vlc functions.

v2: also implement multiple inputs for the vlc functions
v3: some bug fixes for buffer size and alignment corner cases
v4: rework of the patch, some more improvements

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
2011-12-23 16:31:26 +01:00
Maarten Lankhorst
ebe7c687ce nouveau: Fix bugs in nouveau_video_buffer
Double free and array overflow, even if only 2 members are
used the last one needs to be set to NULL explicitly.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com
2011-12-23 16:21:25 +01:00