Commit Graph

60607 Commits

Author SHA1 Message Date
Brian Paul b9f68d927e svga: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
Fixes several colorbuffer tests, including piglit "fbo-drawbuffers-none"
for "gl_FragColor" and "glDrawPixels" cases.

v2: rework patch to only avoid creating extra shader variants when
TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS is not specified.  Per Jose.
Use a write_color0_to_n_cbufs key field to replicate color0 to N
color buffers only when N > 0 and WRITES_ALL_CBUFS is set.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2014-01-21 10:53:51 -08:00
Brian Paul 384fd64ab1 svga: rename color output variables
Just to be bit more readable.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2014-01-21 10:53:51 -08:00
Brian Paul f6bc7d6586 svga: fix clearing for null color buffers
Fixes piglit "fbo-drawbuffers-none glClear" test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2014-01-21 10:53:51 -08:00
Brian Paul ff59b3d9ee mesa: add missing TYPE_DOUBLEN_2 cases in get.c
The new TYPE_DOUBLEN_2 type was added in 0e60d850 but the code to
return values of that type wasn't completed.

Fixes conform's default state test.  glGetFloatv(GL_DEPTH_RANGE)
wasn't returning anything.

v2: remove stray 'break' statements.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-01-21 10:53:12 -08:00
Paul Berry 51000c2ff8 i965: Modify some error messages to refer to "vec4" instead of "vs".
These messages are in code that is shared between the VS and GS
back-ends, so use the terminology "vec4" to avoid confusion.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-21 09:05:33 -08:00
Paul Berry a4d68e9ee9 i965: Add GS support to INTEL_DEBUG=shader_time.
Previously, time spent in geometry shaders would be counted as part of
the vertex shader time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-21 09:05:12 -08:00
Roland Scheidegger e23e4f67be draw: fix points with negative w coords for d3d style point clipping
Even with depth clipping disabled, vertices which have negative w coords
must be discarded. And since we don't have a proper guardband implementation
yet (relying on driver to handle all values except infs/nans in rasterization
for such points) we need to kill them off manually (as they can end up with
coordinates inside viewport otherwise).

v2: use 0.0f instead of 0 (spotted by Brian).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-21 17:49:02 +01:00
Kenneth Graunke ad04e396fa i965: Reserve space for "Vertex Count" in GS outputs.
v2: Also increment ir->offset in the GS visitor, rather than at the
    final assembly generation stage (requested by Paul).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2014-01-21 00:20:14 -08:00
Kenneth Graunke 94c0a11b19 i965: Update blitter code for 48-bit addresses.
v2: Rebase on Eric's SET_FIELD changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> [v1]
2014-01-20 16:21:52 -08:00
Kenneth Graunke 23827756f3 i965: Update PIPE_CONTROL packet lengths for Broadwell.
On Broadwell, PIPE_CONTROL needs an extra DWord to accomodate the
48-bit addressing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-20 15:38:24 -08:00
Kenneth Graunke f7e76e00b6 i965: Re-combine the Gen4-5 and Gen6+ write_depth_count functions.
Now that we have a helper function that handles the PIPE_CONTROL
variations between the various platforms, these are basically the same.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-20 15:38:23 -08:00
Kenneth Graunke f5dd608db2 i965: Create a helper function for emitting PIPE_CONTROL writes.
There are a lot of places that use PIPE_CONTROL to write a value to a
buffer (either an immediate write, TIMESTAMP, or PS_DEPTH_COUNT).
Creating a single function to do this seems convenient.

As part of this refactor, we now set the PPGTT/GTT selection bit
correctly on Gen7+.  Previously, we set bit 2 of DW2 on all platforms.
This is correct for Sandybridge, but actually part of the address on
Ivybridge and later!

Broadwell will also increase the length of these packets by 1; with the
refactoring, we should have to adjust that in substantially fewer
places, giving us confidence that we've hit them all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-20 15:38:23 -08:00
Kenneth Graunke 35458a99c0 i965: Use full-length PIPE_CONTROL packets for workaround writes.
I believe that PIPE_CONTROL uses the length field to decide whether to
do 32-bit or 64-bit writes.  A length of 4 would do a 32-bit write,
while a length of 5 would do a 64-bit write.  (I haven't verified this,
though.)

For workaround writes, we don't care what value gets written, or how
much data.  We're only writing something because hardware bugs mandate
that do so.  So using a 64-bit write should be fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-20 15:38:23 -08:00
Kenneth Graunke 4b9e5c985c i965: Emit full-length PIPE_CONTROLs for (non-write) flushes.
The PIPE_CONTROL packet actually has 5 DWords on Gen6+:
1. Header
2. Flags
3. Address
4. Immediate Data: Lower DWord
5. Immediate Data: Upper DWord

We just never emitted the last one.  While it appears to work, it's
probably safer to emit the entire thing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-20 15:38:23 -08:00
Kenneth Graunke 9420b577dd i965: Create a helper function for emitting PIPE_CONTROL flushes.
These days, we need to emit PIPE_CONTROL flushes all over the place.
Being able to do that via a single function call seems convenient.

Broadwell will also increase the length of these packets by 1; with the
refactoring, we should have to do this in substantially fewer places.

v2: Add back forgotten intel_emit_post_sync_nonzero_flush (caught by
    Eric Anholt).  Drop unlikely() from BLT_RING check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-20 15:38:16 -08:00
Kenneth Graunke ded5674689 i965: Fix MI_STORE_REGISTER_MEM for Broadwell.
It now takes a 48-bit address.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-20 15:12:23 -08:00
Kenneth Graunke f11c1feaf7 i965: Introduce an OUT_RELOC64 macro.
Broadwell uses 48-bit addresses.  The first DWord is the low 32 bits,
and the second DWord is the high 16 bits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-20 15:12:23 -08:00
Kenneth Graunke 67ebcb4711 i965: Use the new drm_intel_bo offset64 field.
libdrm 2.4.52 introduces a new 'uint64_t offset64' field, intended to
replace the old 'unsigned long offset' field.  To preserve ABI, libdrm
continues to store the presumed offset in both locations.

On Broadwell, a 64-bit kernel may place BOs at "high" (> 4G) addresses.
However, with a 32-bit userspace, the 'unsigned long offset' field will
only be 32-bit, which is not large enough to hold this value.  We need
to use a proper uint64_t (like the kernel does).

Technically, a lot of this code doesn't affect Broadwell, so we could
leave it using the old field.  But it makes sense to just switch to the
new, properly typed field.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-20 15:12:23 -08:00
Kenneth Graunke 77425ef91a build: Require libdrm 2.4.52 for Intel.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 15:12:23 -08:00
Kenneth Graunke 5f4eed3575 i965: Delete intel_batchbuffer_emit_reloc_fenced.
Nothing in i965 uses it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-20 15:12:12 -08:00
Ian Romanick 4cd8011907 i915: Silence warning: unused parameter warning in intel_bufferobj_buffer
intel_buffer_objects.c: In function 'old_intel_bufferobj_buffer':
intel_buffer_objects.c:471:17: warning: unused parameter 'flag' [-Wunused-parameter]

The parameter hasn't been used since the i915 and i965 drivers had their
breakup.  i965 got the flags, and i915 got to cry itself to sleep.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:40:46 -08:00
Ian Romanick 8468f437e8 i915: Ensure that intel_bufferobj_map_range meets alignment guarantees
Not actually tested, but the changes are identical to the i965 changes
that are tested.

v2: Remove MAX2(64, ...).  Suggested by Ken (in the i965 version of this
patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Siavash Eliasi <siavashserver@gmail.com>
2014-01-20 11:40:41 -08:00
Ian Romanick 1ec663ab19 i965: Ensure that intel_bufferobj_map_range meets alignment guarantees
No piglit regressions on IVB.

With minor tweaks to the arb_map_buffer_alignment-map-invalidate-range
test (disable the extension check, set alignment to 64 instead of
querying), the i965 driver would fail the test without this patch (as
predicted by Eric).  With this patch, it passes.

v2: Remove MAX2(64, ...).  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Siavash Eliasi <siavashserver@gmail.com>
2014-01-20 11:40:34 -08:00
Ian Romanick c2352a88ed docs: Note that GL_ARB_viewport_array is done on i965
At least for GEN7+, anyway.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:05 -08:00
Courtney Goeltzenleuchter 7837f425e7 i965: Enable ARB_viewport_array
v2 (idr): Only enable the extension on GEN7+ w/core profile because it
requires geometry shaders.

v3 (idr): Add some casting to fix setting of ViewportBounds.Min.
Negating an unsigned value, then casting to float doesn't do what you
might think it does.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:05 -08:00
Ian Romanick d3ee8ba346 i965: Consider all viewports before enabling guardband clipping
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:05 -08:00
Ian Romanick bdff9a6e47 i965: Consider only the scissor rectangle for viewport 0 for clears
noop_scissor (correctly) only examines the scissor rectangle for
viewport 0.  Therefore, it should only be called when that scissor
rectangle is enabled.

v2: Remove spurious change to radeon code.  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Ian Romanick 2c27f1d47a i965: Set all the supported scissor rectangles for GEN7
Currently MaxViewports is still 1, so this won't affect any change.

v2: Minor code reformatting suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Ian Romanick a2b946cb35 mesa: Refactor bounding-box calculation out of _mesa_update_draw_buffer_bounds
Drivers that currently use _Xmin and friends to set their scissor
rectangle will need to use this code directly once they are updated for
GL_ARB_viewport_array.

v2: Use different bit-test idiom and fix mixed tabs and spaces.  Both
were suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Ian Romanick d989c4b134 i965: Set all the supported viewports for GEN7
Currently MaxViewports is still 1, so this won't affect any change.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Ian Romanick fceb8b55c0 i965: Emit writes to viewport index
This variable is handled in a fashion identical to gl_Layer.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Ian Romanick 37f65b0751 i965: Set the maximum VPIndex
At various stages the hardware clamps the gl_ViewportIndex to these
values.  Setting them to zero effectively makes gl_ViewportIndex be
ignored.  This is acutally useful in blorp (so that we don't have to
modify all of the viewport / scissor state).

v2: Use INTEL_MASK to create GEN6_CLIP_MAX_VP_INDEX_MASK.  Suggested by
Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:01 -08:00
Courtney Goeltzenleuchter 9ef16befd0 mesa: Add ARB_viewport_array plumbing
Define API connections to extension entry points added in previous
commits. Update entry points to use floating point arguments as
required by the extension.
Add get tokens for ARB_viewport_array state.

v2: Include review feedback.

v3 (idr): Fix 'make check'.  Add missing Get infrastructure (some was
culled from other pathces).

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Courtney Goeltzenleuchter c2eefb06aa glsl: Add gl_ViewportIndex built-in variable
v2 (idr): Fix copy-and-paste bug... s/LAYER/VIEWPORT/

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Ian Romanick 5439964270 glsl: Add extension infrastructure for ARB_viewport_array
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Ian Romanick 3815264d7d mesa: Add varying slot for viewport index
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Courtney Goeltzenleuchter 86231c4ab3 mesa: Add new viewport and depth-range entry points for GL_ARB_viewport_array
v2 (idr): Use set_viewport_no_notify / set_depth_range_no_notify (and
manually notify the driver) instead of calling _mesa_set_viewporti /
_mesa_set_depthrangei.  Refactor bodies of _mesa_ViewportIndexed and
_mesa_ViewportIndexedv into a shared function.  Remove spurious CLAMP
calls in _mesa_DepthRangeArrayv and _mesa_DepthRangeIndexed.

v3 (idr): Add some missing return-statements after calls to _mesa_error.

v4 (idr): Only perform the ViewportBounds.Min / ViewportBounds.Max
clamping in set_viewport_no_notify if GL_ARB_viewport_array is enabled.
Otherwise the driver may not have set ViewportBounds, and the clamping
will do bad things.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Courtney Goeltzenleuchter 0a7baa68a8 mesa: Add new scissor entry points for GL_ARB_viewport_array
v2 (idr): Use set_scissor_no_notify (and manually notify the driver)
instead of calling _mesa_set_scissori.  Refactory bodies of
_mesa_ScissorIndexed and _mesa_ScissorIndexedv into a shared function.
Perform parameter validation in the same order in all three functions.
Pull MaxViewports comparison fix (in _mesa_ScissorArrayv) from the next
patch to this patch.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Courtney Goeltzenleuchter 917db0bc3d mesa: Add custom get function for SCISSOR_TEST to _mesa_IsEnabledi
Now that the scissor enable state is a bitfield need a custom function
to extract the correct value from gl_context.  Modeled
Scissor.EnableFlags after Color.BlendEnabled.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Courtney Goeltzenleuchter 6d9c0011a0 mesa: Add new get entrypoints for ARB_viewport_array
v2 (idr): Fix several "comparison between signed and unsigned integer
expressions" warnings.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Ian Romanick a4bc73f7ba mesa: Change parameter to _mesa_set_viewport to float
This matches the expectations of GL_ARB_viewport_array and the storage
type where the values will land.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:32:00 -08:00
Ian Romanick 91ad851876 meta: Restore all scissor state
Previously the restore code would enable all scissor rectangles if any
scissor rectangles were enabled on entry to meta.  When there is only
one scissor rectangle, this is fine.  As soon as a driver supports
multiple viewports, this will be a problem.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 6d3b1dc150 mesa: Set all scissor rects
In _mesa_Scissor, make sure that ctx->Driver.Scissor is only called once
instead of once per scissor rectangle.

v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the
driver may not set ctx->Const.MaxViewports yet.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 454cec4299 mesa: Set all viewports from _mesa_Viewport and _mesa_DepthRange
In _mesa_Viewport and _mesa_DepthRange, make sure that
ctx->Driver.Viewport is only called once instead of once per viewport or
depth range.

v2: Make _mesa_DepthRange actually set all of the depth ranges (instead
of just index 0).  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 562f353434 mesa: Restore all the viewports in _mesa_PopAttrib
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick c65db3ebed mesa: Restore all the scissor rectangles in _mesa_PopAttrib
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 9de863603d mesa: Initialize all the viewports
v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the
driver may not set ctx->Const.MaxViewports yet.

v3: Handle all viewport entries in update_viewport_matrix and
_mesa_copy_context too.  This was previously in an earlier patch.
Having the code in the earlier patch could cause _mesa_copy_context to
access a matrix that hadn't been constructed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v2]
2014-01-20 11:31:59 -08:00
Ian Romanick f6d7cd4a11 mesa: Add an index parameter to _mesa_set_scissor
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 5232a7ded0 mesa: Refactor scissor rectangle setting even more
Create an internal function that just writes data into the scissor
rectangle.  In future patches this will see more use because we only
want to call dd_function_table::Scissor once after setting all of the
scissor rectangles instead of once per scissor rectangle.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00
Ian Romanick 799265aadc mesa: Refactor viewport setting even more
Create an internal function that just writes data into the viewport.  In
future patches this will see more use because we only want to call
dd_function_table::Viewport once after setting all of the viewport
instead of once per viewport.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-20 11:31:59 -08:00