Commit Graph

57907 Commits

Author SHA1 Message Date
Kenneth Graunke 0f7a15a247 i965: Add #defines for the MI_LOAD_REGISTER_MEM command.
This command reads a value from memory and writes it to a register (the
opposite of MI_STORE_REGISTER_MEM).  It's only available on Gen7+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-06 14:41:37 -07:00
Kenneth Graunke c047ad000b i965: Initialize the intel_context::bufmgr pointer earlier.
This prevents a crash in a future patch.

_mesa_initialize_context() creates a default transform feedback object
by calling the NewTransformFeedbackObject() driver hook.  Eventually,
we'll want to subclass that and allocate a buffer object.  This means
passing brw->bufmgr to drm_intel_alloc_bo(), and crashing if it isn't
initialized yet.

The buffer manager is actually already initialized; we just hadn't
copied the pointer from intel_screen to intel_context quite early
enough.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-06 14:41:37 -07:00
Kenneth Graunke 263ebe1a71 i965: Tidy preprocessor macros for SO_PRIM_STORAGE_NEEDED registers.
Gen7+ supports four transform feedback streams.  Using a function-like
macro makes it easy to access them by stream number or loop over them.
"GEN7_" prefixes are more common than "_IVB" suffixes, so use that.

Gen6 only supports a single stream, so the single #define should be
fine.  However, SO_NUM_PRIM_STORAGE_NEEDED was a poor name.  For one,
the word "NUM" doesn't appear in the actual name of the register.
It's also confusingly generic, as it doesn't exist on Gen7+.  Add a
"GEN6_" prefix for clarity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-06 14:41:37 -07:00
Kenneth Graunke 8c27f13cd9 i965: Tidy preprocessor macros for SO_NUM_PRIMS_WRITTEN registers.
Gen7+ supports four transform feedback streams.  Using a function-like
macro makes it easy to access them by stream number or loop over them.
"GEN7_" prefixes are more common than "_IVB" suffixes, so we use that.

Gen6 only supports a single stream, so the single #define should be
fine.  However, SO_NUM_PRIMS_WRITTEN was confusingly generic, as it
doesn't exist on Gen7+.  Add a "GEN6_" prefix for clarity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-06 14:41:37 -07:00
Christoph Bumiller 2daf974cfe nvc0: don't access array out of bounds on unexpected sample count 2013-08-06 22:29:33 +02:00
Emil Velikov 07c8f7a6f8 nv50: handle pure integer vertex attributes
And as a side effect fix a crash in the following piglit test:
general/attribs GL3

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "9.2 and 9.1" mesa-stable@lists.freedesktop.org
2013-08-06 22:25:26 +02:00
Samuel Pitoiset 31caddb8d9 nvc0: implement MP performance counters for nvc0:nvd9 2013-08-06 22:24:30 +02:00
Samuel Pitoiset 9dcd7888e6 nvc0: implement compute support for nvc0
Tested on nvc0, nvc1, nvcf and nvd9.
2013-08-06 22:22:49 +02:00
Samuel Pitoiset 981b589101 nvc0: add more MP counters for nve4 2013-08-06 22:22:34 +02:00
Ian Romanick 2f9fe2d80a mesa: Generate a renderbuffer wrapper even if the texture has no image
This prevents a segfault in check_begin_texture_render when an FBO is
rebound while in this state.  This fixes the piglit test
fbo-incomplete-invalid-texture.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
2013-08-06 12:18:50 -07:00
Ian Romanick 25281fef0f mesa: Validate the layer selection of an array texture too
Previously only the slice of a 3D texture was validated in the FBO
completeness check.  This fixes the failure in the 'invalid layer of an
array texture' subtest of piglit's fbo-incomplete test.

v2: 1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

v3: Handle CUBE_MAP_ARRAY textures too.  Noticed by Marek.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
2013-08-06 12:18:46 -07:00
Ian Romanick 41485fea7c mesa: Don't call driver RenderTexture for invalid zoffset
This fixes the segfault in the 'invalid slice of 3D texture' and
'invalid layer of an array texture' subtests of piglit's fbo-incomplete
test.

The 'invalid layer of an array texture' subtest still fails.

v2: Fix off-by-one comparison error noticed by Chris Forbes.  Also,
1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
2013-08-06 12:18:42 -07:00
Ian Romanick fb49713f8e mesa: Don't call driver RenderTexture for really broken textures
This fixes the segfault in the '0x0 texture' subtest of piglit's
fbo-incomplete test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
2013-08-06 12:18:39 -07:00
Ian Romanick 0c3dbd689b mesa: Remove stray debug printfs in attachment completeness code
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
2013-08-06 12:18:29 -07:00
Ian Romanick 4a9522a5a0 mesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctly
Allow user-generated names for glBindFramebufferEXT on desktop GL.
Disallow its use altogether for core profiles.

Names bound with glBindFramebuffer in desktop OpenGL are still
(incorrectly) shared across the share group instead of being
per-context.  This gets us a bit closer to being strictly conformant.

v2: Disallow glBindFramebufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
2013-08-06 10:46:05 -07:00
Ian Romanick 97965e87fc mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
Allow user-generated names for glBindRenderbufferEXT on desktop GL.
Disallow its use altogether for core profiles.

v2: Disallow glBindRenderbufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
2013-08-06 10:46:05 -07:00
Michel Dänzer 46b6f79fea radeonsi: Number of SGPRs retrieved from LLVM already includes VCC
Fixes spurious 'Assertion `num_sgprs <= 104' failed.' with shaders using
all 104 SGPRs.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
2013-08-06 12:50:01 +02:00
Kenneth Graunke 59f22148b3 i965: Don't allocate curbe buffers on Gen6+.
These are only used on Gen4-5.  Why waste the 8kB of space?

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-08-06 00:21:10 -07:00
Vinson Lee b57c1e4b86 llvmpipe: Do not need to free anything if there is no geometry shader.
If gs is null, then freeing state->shader.tokens would result in a null
dereference.

Fixes "Dereference after null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-05 21:54:20 -07:00
Vinson Lee 60b567ee59 nvc0: Initialize ptr for unexpected sample_count on release builds.
Fixes "Uninitialized pointer read" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-05 21:53:39 -07:00
Vinson Lee 8e850f2feb draw: Change slot from unsigned to int.
unfilled_stage::face_slot is of type int.

Fixes "Unsigned compared against 0" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-05 17:40:19 -07:00
Vinson Lee 8294d969e1 postprocess: Check ppq is null before calling pp_free_bos.
pp_free_bos dereferences ppq without a null check.

Fixes "Dereference before null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-05 17:27:38 -07:00
Zack Rusin a9cb914f49 draw: add back separate input assembler
the issue is that stream output is run before the pipeline, which
means that unless we decompose the primitives before the so
then things crash. we could convert the entire stream output
code into a pipeline stage but it will take a bit, so for now
fix the crashes by simply re-adding the old input assembler
which is run before the SO.

Signed-off-by: Zack Rusin <zackr@vmware.com>
2013-08-03 02:57:40 -04:00
Zack Rusin c9c211fae1 draw: implement proper primitive assembler as a pipeline stage
we used to have a face primitive assembler that we ran after if
the gs was missing but we had adjacency primitives in the pipeline,
lets convert it to a pipeline stage, which allows us to use it
to inject outputs (primitive id) into the vertices. it's also
a lot cleaner because the decomposition is already handled for us.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-03 00:38:58 -04:00
Zack Rusin 8a94d15fba draw: fix front face injection
Inject front face only if the fragment shader uses it and
propagate through all channels because otherwise we'll
need to figure out the exact swizzle that the fs expects and
it's just simpler to make sure all the components within
the front face register are correctly set.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-03 00:36:39 -04:00
Brian Paul 4c9f12d69c tgsi: remove unneeded File == TGSI_FILE_INPUT test
We're already in an "if (File == TGSI_FILE_INPUT)" block at that point.
2013-08-05 10:25:08 -06:00
Brian Paul 3e4b5c6c9c tgsi: clean up tgsi_scan_shader() function
Replace "fulldecl->Semantic.Name/Index" with semName/semIndex.
Simplify if/else logic for TGSI_FILE_OUTPUT code.
Remove old comment.
Fix indentation.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-08-05 10:11:33 -06:00
Zack Rusin 95829e2029 llvmpipe: fix frontface behavior again
Lets make sure the frontface is 1 for front and -1 for back.
Discussed with Roland and Jose.

Signed-off-by: Zack Rusin <zackr@vmware.com>
2013-08-02 22:21:29 -04:00
Vinson Lee 0794f638ee r600g/sb: Dump correct value for CND.
Fixes "Copy-paste error" reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Vadim Girlin <vadimgirlin@gmail.com>
2013-08-04 13:49:17 -07:00
Jordan Justen 83486d3148 intel_fbo: remove unused intel_renderbuffer hiz functions
We are now using functions that operate on the renderbuffer
attachment to handle layered rendering.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-04 11:52:38 -07:00
Jordan Justen 7b36137642 i965 clear/draw: set renderbuffer attachment as needing depth resolve
Previously we would mark a renderbuffer as needing a depth resolve.
But, to support layered rendering, we need to look at the attachment
instead, since the attachment knows if layered rendering is being
used.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-04 11:52:38 -07:00
Jordan Justen d44be9ed2f i965: add intel_renderbuffer_att_set_needs_depth_resolve
This function is needed to support layered rendering. With
layered rendering, the attachment stores the state of whether
layered rendering is being used.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-04 11:52:38 -07:00
Jordan Justen 814a040504 i965: add intel_miptree_set_all_slices_need_depth_resolve
This function marks all slices of a renderbuffer at a particular
level as needing a depth resolve.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-04 11:52:38 -07:00
Jordan Justen b05b81743c i965 gen7: don't set FORCE_ZERO_RTAINDEX for layered rendering
When layered rendering is being used, we should not set
FORCE_ZERO_RTAINDEX in the clip state to allow render target
array values other than zero to be used.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:38 -07:00
Jordan Justen 20799c11eb hsw hiz: Remove x/y offset restriction for hiz
This restriction was related to programming the offset fields
of the depth buffer packet. We are now setting these offsets
to 0 now, so this restriction should no longer be required.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen bf25ee2840 gen7 depth surface: program 3DSTATE_DEPTH_BUFFER to top of surface
Previously we would always find the 2D sub-surface of interest,
and then program the surface to this location. Now we always
program the 3DSTATE_DEPTH_BUFFER at the start of the surface.
To select the lod/slice, we utilize the lod & minimum array
element fields.

As part of this change, we must revert 1f112ccf:
Revert "i965/gen7: Align all depth miplevels to 8 in the X direction."

We also must disable brw_workaround_depthstencil_alignment for
gen >= 7. Now the hardware will handle alignment when rendering
to additional slices/LODs.

v2:
 * Merge with recent MOCS changes

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen f3c886be1f gen7 fbo: make unmatched depth/stencil configs return unsupported
For gen >= 7, we will use the lod/minimum-array-element fields to
support layered rendering. This means that we must restrict
the depth & stencil attachments to match in various more retrictive
ways. (Now the width, height, depth, LOD and layer must match)

The reason width, height, and depth must match is that the hardware
has a single set of width, height, and depth settings (in
3DSTATE_DEPTH_BUFFER) that affect both the depth and stencil buffers.
Since these controls determine the miptree layout, they need to be
set correctly in order for lod and minimum-array-element to work
properly.  So the only way rendering can work is if the width,
height, and depth match.

In the future, if this restriction proves to be a problem (say
because some crucial client application relies on rendering to
different levels/layers of stencil and depth buffers), then we can
always work around the restriction by copying depth and/or stencil
data to a temporary buffer prior to rendering (much in the same way
that brw_workaround_depthstencil_alignment() does today for
gen < 7), but hopefully that won't be necessary.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen 65290a20f9 hsw hiz: Add new size restrictions for miplevels > 0
When performing hiz ops, we must ensure that the region sizes
have an 8 aligned width and 4 aligned height. We can tweak the
size for blorp hiz operations at LOD 0, but for the others we
can't. Therefore, we disable hiz for these miplevels if they
don't meet the size alignment requirements.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen e3a49e1ad3 gen7 blorp depth: calculate base surface width/height
This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen a23cfb8648 gen7 depth surface: calculate minimum array element being rendered
In layered rendering this will be 0. Otherwise it will be the
selected slice.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen 08ef1dde1b gen7 depth surface: calculate LOD being rendered to
This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen bc1acaa426 gen7 depth surface: calculate depth (array size) for depth surface
This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.

Note: Cube maps are treated as 2D arrays with 6 times as
many array elements as the cube map array would have.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen 171e633294 gen7 depth surface: calculate more specific surface type
This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.

Note: Cube maps are treated as 2D arrays with 6 times as
many array elements as the cube map array would have.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Jordan Justen 0e6be2e67b i965: init global state first in brw_workaround_depthstencil_alignment
In a future pass this will allow us to exit-early from this
routine to disable it for gen >= 7.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-04 11:52:37 -07:00
Ilia Mirkin 8edb79f1ef nv50: fix some h264 interlaced decoding on vp2
Some videos specify mb_adaptive_frame_field_flag instead of
field_pic_flag. This implies that the pic height needs to be halved, and
this field needs to be passed to the VP engine.

Cc: "9.2" mesa-stable@lists.freedesktop.org

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2013-08-03 12:52:04 +02:00
Zack Rusin bff0d87668 llvmpipe: don't interpolate front face or prim id
The loop was iterating over all the fs inputs and setting them
to perspective interpolation, then after the loop we were
creating extra output slots with the correct interpolation. Instead
of injecting bogus extra outputs, just set the interpolation
on front face and prim id correctly when doing the initial scan
of fs inputs.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-02 20:12:53 -04:00
Zack Rusin 8e77e5e543 draw: make sure clipping works with injected outputs
clipping would drop the extra outputs because it always
used the number of standard vertex shader outputs, without
geometry shader or extra outputs. The commit makes sure
that clipping with geometry shaders which have more outputs
than the current vertex shader and with extra outputs correctly
propagates the entire vertex.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-08-02 20:11:18 -04:00
Zack Rusin d6b3a193d4 draw: inject frontface info into wireframe outputs
Draw module can decompose primitives into wireframe models, which
is a fancy word for 'lines', unfortunately that decomposition means
that we weren't able to preserve the original front-face info which
could be derived from the original primitives (lines don't have a
'face'). To fix it allow draw module to inject a fake face semantic
into outputs from which the backends can figure out the original
frontfacing info of the primitives.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-08-02 20:11:18 -04:00
Zack Rusin 05487ef88d draw: stop crashing with extra shader outputs
Draw sometimes injects extra shader outputs (aa points, lines or
front face), unfortunately most of the pipeline and llvm code
didn't handle them at all. It only worked if number of inputs
happened to be bigger or equal to the number of shader outputs
plus the extra injected outputs. In particular when running
the pipeline which depends on the vertex_id in the vertex_header
things were completely broken. The patch adjust the code to
correctly use the total number of shader outputs (the standard
ones plus the injected ones) to make it all stop crashing and
work.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-02 20:11:18 -04:00
Zack Rusin 2e46a1dcb3 draw: use the vertex size
Instead of using the magical 4 use the above computed
vertex size. Doesn't change the behavior, just makes the code
a bit cleaner.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-08-02 20:11:18 -04:00