platform/upstream/mesa.git
10 years agoi965: Emit full-length PIPE_CONTROLs for (non-write) flushes.
Kenneth Graunke [Wed, 11 Dec 2013 23:22:26 +0000 (15:22 -0800)]
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>
10 years agoi965: Create a helper function for emitting PIPE_CONTROL flushes.
Kenneth Graunke [Wed, 11 Dec 2013 22:44:45 +0000 (14:44 -0800)]
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>
10 years agoi965: Fix MI_STORE_REGISTER_MEM for Broadwell.
Kenneth Graunke [Mon, 18 Nov 2013 18:10:07 +0000 (10:10 -0800)]
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>
10 years agoi965: Introduce an OUT_RELOC64 macro.
Kenneth Graunke [Tue, 5 Nov 2013 00:55:26 +0000 (16:55 -0800)]
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>
10 years agoi965: Use the new drm_intel_bo offset64 field.
Kenneth Graunke [Mon, 13 Jan 2014 22:32:56 +0000 (14:32 -0800)]
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>
10 years agobuild: Require libdrm 2.4.52 for Intel.
Kenneth Graunke [Mon, 20 Jan 2014 18:46:53 +0000 (10:46 -0800)]
build: Require libdrm 2.4.52 for Intel.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Delete intel_batchbuffer_emit_reloc_fenced.
Kenneth Graunke [Mon, 13 Jan 2014 23:01:35 +0000 (15:01 -0800)]
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>
10 years agoi915: Silence warning: unused parameter warning in intel_bufferobj_buffer
Ian Romanick [Mon, 23 Dec 2013 04:05:50 +0000 (20:05 -0800)]
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>
10 years agoi915: Ensure that intel_bufferobj_map_range meets alignment guarantees
Ian Romanick [Fri, 20 Dec 2013 20:58:41 +0000 (12:58 -0800)]
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>
10 years agoi965: Ensure that intel_bufferobj_map_range meets alignment guarantees
Ian Romanick [Fri, 20 Dec 2013 20:42:33 +0000 (12:42 -0800)]
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>
10 years agodocs: Note that GL_ARB_viewport_array is done on i965
Ian Romanick [Sat, 11 Jan 2014 00:07:55 +0000 (16:07 -0800)]
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>
10 years agoi965: Enable ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:15:19 +0000 (13:15 -0700)]
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>
10 years agoi965: Consider all viewports before enabling guardband clipping
Ian Romanick [Wed, 8 Jan 2014 20:14:49 +0000 (12:14 -0800)]
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>
10 years agoi965: Consider only the scissor rectangle for viewport 0 for clears
Ian Romanick [Fri, 17 Jan 2014 23:28:23 +0000 (15:28 -0800)]
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>
10 years agoi965: Set all the supported scissor rectangles for GEN7
Ian Romanick [Wed, 8 Jan 2014 20:14:11 +0000 (12:14 -0800)]
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>
10 years agomesa: Refactor bounding-box calculation out of _mesa_update_draw_buffer_bounds
Ian Romanick [Wed, 8 Jan 2014 20:10:41 +0000 (12:10 -0800)]
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>
10 years agoi965: Set all the supported viewports for GEN7
Ian Romanick [Wed, 6 Nov 2013 06:50:02 +0000 (22:50 -0800)]
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>
10 years agoi965: Emit writes to viewport index
Ian Romanick [Tue, 5 Nov 2013 20:19:23 +0000 (12:19 -0800)]
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>
10 years agoi965: Set the maximum VPIndex
Ian Romanick [Fri, 10 Jan 2014 21:43:24 +0000 (13:43 -0800)]
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>
10 years agomesa: Add ARB_viewport_array plumbing
Courtney Goeltzenleuchter [Thu, 14 Nov 2013 17:10:47 +0000 (10:10 -0700)]
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>
10 years agoglsl: Add gl_ViewportIndex built-in variable
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 18:11:39 +0000 (11:11 -0700)]
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>
10 years agoglsl: Add extension infrastructure for ARB_viewport_array
Ian Romanick [Wed, 8 Jan 2014 16:32:03 +0000 (08:32 -0800)]
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>
10 years agomesa: Add varying slot for viewport index
Ian Romanick [Tue, 5 Nov 2013 20:18:43 +0000 (12:18 -0800)]
mesa: Add varying slot for viewport index

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add new viewport and depth-range entry points for GL_ARB_viewport_array
Courtney Goeltzenleuchter [Thu, 14 Nov 2013 17:06:59 +0000 (10:06 -0700)]
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>
10 years agomesa: Add new scissor entry points for GL_ARB_viewport_array
Courtney Goeltzenleuchter [Tue, 12 Nov 2013 19:58:40 +0000 (12:58 -0700)]
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>
10 years agomesa: Add custom get function for SCISSOR_TEST to _mesa_IsEnabledi
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:22:39 +0000 (13:22 -0700)]
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>
10 years agomesa: Add new get entrypoints for ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 20:25:32 +0000 (13:25 -0700)]
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>
10 years agomesa: Change parameter to _mesa_set_viewport to float
Ian Romanick [Wed, 8 Jan 2014 16:52:00 +0000 (08:52 -0800)]
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>
10 years agometa: Restore all scissor state
Ian Romanick [Thu, 9 Jan 2014 23:44:58 +0000 (15:44 -0800)]
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>
10 years agomesa: Set all scissor rects
Ian Romanick [Wed, 6 Nov 2013 17:11:08 +0000 (09:11 -0800)]
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>
10 years agomesa: Set all viewports from _mesa_Viewport and _mesa_DepthRange
Ian Romanick [Wed, 6 Nov 2013 06:40:38 +0000 (22:40 -0800)]
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>
10 years agomesa: Restore all the viewports in _mesa_PopAttrib
Ian Romanick [Wed, 8 Jan 2014 03:12:16 +0000 (19:12 -0800)]
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>
10 years agomesa: Restore all the scissor rectangles in _mesa_PopAttrib
Ian Romanick [Wed, 8 Jan 2014 03:06:59 +0000 (19:06 -0800)]
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>
10 years agomesa: Initialize all the viewports
Ian Romanick [Wed, 6 Nov 2013 06:36:38 +0000 (22:36 -0800)]
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]
10 years agomesa: Add an index parameter to _mesa_set_scissor
Ian Romanick [Wed, 8 Jan 2014 03:06:17 +0000 (19:06 -0800)]
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>
10 years agomesa: Refactor scissor rectangle setting even more
Ian Romanick [Mon, 9 Dec 2013 19:54:41 +0000 (11:54 -0800)]
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>
10 years agomesa: Refactor viewport setting even more
Ian Romanick [Wed, 6 Nov 2013 05:36:12 +0000 (21:36 -0800)]
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>
10 years agomesa: Refactor depth range setting even more
Ian Romanick [Wed, 6 Nov 2013 05:34:26 +0000 (21:34 -0800)]
mesa: Refactor depth range setting even more

Create an internal function that just writes data into the depth range.
In future patches this will see more use because we only want to call
dd_function_table::DepthRange once after setting all of the depth ranges
instead of once per depth range.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Add an index parameter to _mesa_set_viewport
Ian Romanick [Wed, 8 Jan 2014 00:57:11 +0000 (16:57 -0800)]
mesa: Add an index parameter to _mesa_set_viewport

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Convert gl_context::Viewport to gl_context::ViewportArray
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Convert gl_context::Viewport to gl_context::ViewportArray

Only element 0 of the array is used anywhere at this time, so there
should be no changes.

v4: Split out from a single megapatch.  Suggested by Ken.

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>
10 years agomesa: Converty gl_viewport_attrib::X, ::Y, ::Width, and ::Height to float
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Converty gl_viewport_attrib::X, ::Y, ::Width, and ::Height to float

v4: Split out from a single megapatch.  Suggested by Ken.  Also make
meta's save_state::ViewportX, ::ViewportY, ::ViewportW, and ::ViewportH
to match gl_viewport_attrib.

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>
10 years agomesa: Convert gl_viewport_attrib::Near and ::Far to double
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Convert gl_viewport_attrib::Near and ::Far to double

v4: Split out from a single megapatch.  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Allow glGet of values that are 2 doubles
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 23:24:56 +0000 (16:24 -0700)]
mesa: Allow glGet of values that are 2 doubles

This will be used when the viewport near and far plane are stored as
doubles instead of as floats.

v4 (idr): Split out from a single megapatch.  Suggested by Ken.  Also
drop value_double_4.  It's never used anywhere in the patch series.

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>
10 years agomesa: Move parameter validation from _mesa_set_viewport to _mesa_Viewport
Ian Romanick [Tue, 5 Nov 2013 23:36:13 +0000 (15:36 -0800)]
mesa: Move parameter validation from _mesa_set_viewport to _mesa_Viewport

Internal callers should do the right thing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Update gl_scissor_attrib to support ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 13 Nov 2013 21:02:12 +0000 (14:02 -0700)]
mesa: Update gl_scissor_attrib to support ARB_viewport_array

Update Mesa and drivers to access updated gl_scissor_attrib.
Now have an enable bitfield and array of gl_scissor_rects.
Drivers have been updated to the new scissor enable state
attribute (gl_context.scissor.EnableFlags) but still treat it
as a single boolean which is okay as mesa will only use
bit 0 when communicating with a driver that does not support
ARB_viewport_array.

v2 (idr): Rebase fixes.

v3 (idr): Small code formatting fix suggsted by Ken.

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>
10 years agomesa: Add new constants related to GL_ARB_viewport_array
Ian Romanick [Tue, 7 Jan 2014 22:39:48 +0000 (14:39 -0800)]
mesa: Add new constants related to GL_ARB_viewport_array

These limits will be queryable by GL_MAX_VIEWPORTS,
GL_VIEWPORT_SUBPIXEL_BITS, and GL_VIEWPORT_BOUNDS_RANGE.  Drivers that
actually implement the extension must set values for these constants
that comply with the minimum-maximums from the spec.

Most of these changes were part of other patches.  They were separated out
because it make reordering of later patches easier.  Also, MaxViewports wasn't
set by that patch, and I completely overlooked it in review.  It's now obvious
that it's set. :)

v2 (idr): Split these changes out from the original patches.  Keep
MaxViewportWidth and MaxViewportHeight as GLuint.

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>
10 years agomesa: Add extension tracking bit for ARB_viewport_array
Courtney Goeltzenleuchter [Wed, 20 Nov 2013 01:31:24 +0000 (18:31 -0700)]
mesa: Add extension tracking bit for ARB_viewport_array

v2 (idr): Split these changes out from the original patch.  Only
advertise GL_ARB_viewport_array in a core profile because it requires
geometry shaders.

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>
10 years agodraw: use some cast wrappers in draw_pt_fetch_shade_pipeline*.c
Brian Paul [Mon, 20 Jan 2014 19:01:48 +0000 (11:01 -0800)]
draw: use some cast wrappers in draw_pt_fetch_shade_pipeline*.c

Trivial.

10 years agodraw: whitespace and formatting fixes in draw_pt_fetch_shade_pipeline*.c
Brian Paul [Mon, 20 Jan 2014 19:00:32 +0000 (11:00 -0800)]
draw: whitespace and formatting fixes in draw_pt_fetch_shade_pipeline*.c

Trivial.

10 years agodraw: fix incorrect vertex size computation in LLVM drawing code
Brian Paul [Mon, 20 Jan 2014 18:57:20 +0000 (10:57 -0800)]
draw: fix incorrect vertex size computation in LLVM drawing code

We were calling draw_total_vs_outputs() too early.  The call to
draw_pt_emit_prepare() could result in the vertex size changing.
So call draw_total_vs_outputs() after draw_pt_emit_prepare().

This fix would seem to be needed for the non-LLVM code as well,
but it's not obvious.  Instead, I added an assertion there to
try to catch this problem if it were to occur there.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72926
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodocs: note reduced display list memory usage in 10.1 relnotes
Brian Paul [Wed, 15 Jan 2014 01:34:22 +0000 (17:34 -0800)]
docs: note reduced display list memory usage in 10.1 relnotes

10 years agodraw: clean up d3d style point clipping
Roland Scheidegger [Fri, 17 Jan 2014 18:39:19 +0000 (19:39 +0100)]
draw: clean up d3d style point clipping

Instead of skipping x/y clipping completely if there's point_tri_clip points
use guard band clipping. This should be easier (previously we could not disable
generating the x/y bits in the clip mask for llvm path, hence requiring custom
clip path), and it also allows us to enable this for tris-as-points more easily
too (this would require custom tri clip filtering too otherwise). Moreover,
some unexpected things could have happen if there's a NaN or just a huge number
in some tri-turned-point, as the driver's rasterizer would need to deal with it
and that might well lead to undefined behavior in typical rasterizers (which
need to convert these numbers to fixed point). Using a guardband should hence
be more robust, while "usually" guaranteeing the same results. (Only "usually"
because unlike hw guardbands draw guardband is always just twice the vp size,
hence small vp but large points could still lead to different results.)
Unfortunately because the clipmask generated is completely unaffected by guard
band clipping, we still need a custom clip stage for points (but not for tris,
as the actual clipping there takes guard band into account).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoswrast: check for null/-1 when mapping renderbuffers
Brian Paul [Mon, 20 Jan 2014 16:06:35 +0000 (08:06 -0800)]
swrast: check for null/-1 when mapping renderbuffers

Fixes fbo-drawbuffers-none crash (but test still fails).
https://bugs.freedesktop.org/show_bug.cgi?id=73757

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosoftpipe: fix crash when accessing null colorbuffer
Brian Paul [Mon, 20 Jan 2014 15:59:25 +0000 (07:59 -0800)]
softpipe: fix crash when accessing null colorbuffer

Fixes piglit fbo-missing-attachment-blit test.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73755

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/vdpau: s/surface/resource/ to fix compiler warning
Brian Paul [Mon, 20 Jan 2014 15:51:25 +0000 (07:51 -0800)]
st/vdpau: s/surface/resource/ to fix compiler warning

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoi915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".
José Fonseca [Mon, 20 Jan 2014 14:15:04 +0000 (14:15 +0000)]
i915,r200,radeon,vega: Change vendor from "VMware, Inc." to "Mesa Project".

These are components which were originally developed by Tungsten Graphics,
which was in turn acquired by VMware, but are de facto now being maintained
by third-party contributors of the Mesa open-source community.

This matches what's reported by swrast driver and a few other components.

Suggested by Ian Romanick.

10 years agologger: Remove unused variable.
José Fonseca [Mon, 20 Jan 2014 13:58:11 +0000 (13:58 +0000)]
logger: Remove unused variable.

Silences gcc "unused variable ‘buf’" warning.

Trivial.

10 years agologger: s/\<log\>/log_/
José Fonseca [Mon, 20 Jan 2014 13:57:12 +0000 (13:57 +0000)]
logger: s/\<log\>/log_/

Currently the MSVC build is broken because of conflicting definitions of
'log' function.  I didn't investigate thoroughly, but I suspect the
it is conflicting standard math.h's log.

log_ is admittedly not a great name, but it is better than a broken build.
A better one can be used in a follow-on build.

10 years agoi965/blorp: reduce the scope of the explicit compression control
Topi Pohjolainen [Fri, 20 Dec 2013 09:12:31 +0000 (11:12 +0200)]
i965/blorp: reduce the scope of the explicit compression control

By highlighting these special cases makes it clearer to switch
to the fs-generator as the wider scoped compression control
settings used in the current implementation can be simply
dropped.

No regressions on IVB (piglit quick + unit tests).

v2 (Ian): typo in a comment

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/blorp: remove dependency to compression control state
Topi Pohjolainen [Thu, 12 Dec 2013 16:32:10 +0000 (18:32 +0200)]
i965/blorp: remove dependency to compression control state

Effectively only the mask control bit gets altered for the single
addition in question and hence there is no real need to use a
fresh state control level for it -- that is more useful when
multiple intructions share the same mask and compression settings.

This is a preparation step for removing the explicit compression
control modifiers in the blit compiler. After this patch there
are no nested state control levels making the constant nature of
the compression settings more apparent.

No regressions on IVB (piglit quick + unit tests).

v2 (Matt, Ian): use temporary variable instead of assigning
                directly on the same line with a function call.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Only update renderbuffers on initial intelMakeCurrent
Kristian Høgsberg [Sat, 18 Jan 2014 00:55:31 +0000 (16:55 -0800)]
i965: Only update renderbuffers on initial intelMakeCurrent

We call intel_prepare_render() in intelMakeCurrent() to make sure we have
renderbuffers before calling _mesa_make_current().  The only reason we
do this is so that we can have valid defaults for width and height.
If we already have buffers for the drawable we're making current, we
don't need this step.

In itself, this is a small optimization, but it also avoids a round trip
that could block on the display server in a unexpected place.

https://bugs.freedesktop.org/show_bug.cgi?id=72540
https://bugs.freedesktop.org/show_bug.cgi?id=72612

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agost/vdpau: check surface params before creating surfaces
Ilia Mirkin [Sat, 18 Jan 2014 03:33:47 +0000 (22:33 -0500)]
st/vdpau: check surface params before creating surfaces

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: fix bogus error handling in output/bitmap creation
Ilia Mirkin [Sat, 18 Jan 2014 03:25:34 +0000 (22:25 -0500)]
st/vdpau: fix bogus error handling in output/bitmap creation

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: don't return a device if the screen doesn't support NPOT
Ilia Mirkin [Sat, 18 Jan 2014 02:41:38 +0000 (21:41 -0500)]
st/vdpau: don't return a device if the screen doesn't support NPOT

NV3x cards don't support NPOT textures. Technically this restriction
could be worked around, but since it also doesn't expose any video
decoding hw, just turn it off entirely.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agopipe-loader: Fix build
Armin K [Sun, 19 Jan 2014 14:09:33 +0000 (15:09 +0100)]
pipe-loader: Fix build

pipe_loader_drm.c: In function 'pipe_loader_drm_probe_fd':
pipe_loader_drm.c:120:4: error: implicit declaration of function 'loader_get_pci_id_for_fd' [-Werror=implicit-function-declaration]

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoloader: ifdef libdrm specific code and include
Emil Velikov [Sun, 19 Jan 2014 03:09:03 +0000 (03:09 +0000)]
loader: ifdef libdrm specific code and include

Mesa provides the flexibility of building without the
need to have libdrm present on the system. The situation
has regressed with the recent commit

commit 8c2e7fd8460750543367053b1be9368cc38e1d6a
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Jan 10 23:36:16 2014 +0000

    loader: introduce the loader util lib

By isolating libdrm code by #ifndef __NOT_HAVE_DRM_H we
can have libdrm-less builds on across all build systems.

This patch converts Android's _EGL_NO_DRM to __NOT_HAVE_DRM_H
to provide consistency with the other cases within mesa, allows
compilation of libloader on libdrm-less scons and conditionally
links against libdrm if present under automake.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73776
BUgzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73777
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Double the push constant space multipliers on Broadwell too.
Kenneth Graunke [Tue, 4 Dec 2012 19:39:14 +0000 (11:39 -0800)]
i965: Double the push constant space multipliers on Broadwell too.

Broadwell has 2Kb push constant size increments like Haswell GT3.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Update invariant state for Broadwell.
Kenneth Graunke [Mon, 3 Dec 2012 23:28:39 +0000 (15:28 -0800)]
i965: Update invariant state for Broadwell.

The only difference is that STATE_SIP takes a 48-bit address, so we need
to output two zeroes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Use the Sandybridge VUE format on Broadwell as well.
Kenneth Graunke [Thu, 29 Nov 2012 09:30:01 +0000 (01:30 -0800)]
i965: Use the Sandybridge VUE format on Broadwell as well.

It hasn't changed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Create a new fragment shader backend for Broadwell.
Kenneth Graunke [Fri, 7 Dec 2012 06:38:26 +0000 (22:38 -0800)]
i965: Create a new fragment shader backend for Broadwell.

This replaces the old fs_generator backend.

v2: Port to the C-based representation of assembly instructions.
    Fix texturing after the texture-grf merge.

v3: Add high quality derivative support.  Fix SET_SIMD4X2_OFFSET.

v4: Pass brw_context to gen8_instruction functions as required.

v5: Fixes for MRT, as well as zero render targets (alpha test only).

v6: Replace n-wide with SIMDn in comments and messages; port over
    Topi's blorp-generator changes; add missing TXF_MCS opcode,
    fix missing high quality derivatives for DDX; fix typo (all caught
    by Eric).  Simplify ADDC/SUBB handling; drop "Used only on Gen6+"
    comment (caught by Matt).  Emit SIMD16 versions of three source
    instructions (caught by both Eric and Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Create a new vec4 backend for Broadwell.
Kenneth Graunke [Fri, 7 Dec 2012 06:37:34 +0000 (22:37 -0800)]
i965: Create a new vec4 backend for Broadwell.

This replaces the old vec4_generator backend.

v2: Port to use the C-based instruction representation.  Also, remove
    Geometry Shader offset hacks - the visitor will handle those instead
    of this code.

v3: Texturing fixes (including adding textureGather support).

v4: Pass brw_context to gen8_instruction functions as required.

v5: Add SHADER_OPCODE_TXF_MCS support; port DUAL_INSTANCED gs fixes
    (caught by Eric).  Simplify ADDC/SUBB handling; add comments to
    gen8_set_dp_message calls (suggested by Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add a new infrastructure for generating Broadwell shader assembly.
Kenneth Graunke [Fri, 7 Dec 2012 06:36:50 +0000 (22:36 -0800)]
i965: Add a new infrastructure for generating Broadwell shader assembly.

This replaces the brw_eu_emit.c layer for Broadwell.  It will be
used by both the vector and scalar shader backends.

v2: Port to use the C-based instruction representation.

v3: Fix destination register type for CMP.

v4: Pass brw to gen8_instruction functions (required by rebase).

v5: Remove bogus assertion on math instructions (caught by Piglit).

v6: Remove more restrictions on math instructions (caught by Eric).
    Make ADDC and SUBB helpers set accumulator writes, like MAC and
    MACH (caught by Matt).

v7: Don't implicitly force ALU3 operations to SIMD8 (we've been able
    to do SIMD16 versions since Haswell, but didn't when I originally
    wrote this code).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Implement a disassembler for Broadwell's new instruction encoding.
Kenneth Graunke [Tue, 11 Dec 2012 08:26:11 +0000 (00:26 -0800)]
i965: Implement a disassembler for Broadwell's new instruction encoding.

Heavily based on Keith Packard's existing brw_disasm.c code.  I've tried
to go through most of the pieces (like SFIDs) and update the lists to
include features added in recent generations.

v2: Port to use the C-based instruction emitters.  This allows us to use
    C99 array initializers, which tidies up some of the code.

v3: Improve decoding of render target write messages.

v4: Update for BRW_REGISTER_TYPE becoming an abstraction.

v5: Rebase on Chris Forbes' SFID message defines.

v6: Fix disassembly of UV immediates; remove silly casts.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add a new representation for Broadwell shader instructions.
Kenneth Graunke [Fri, 7 Dec 2012 06:36:26 +0000 (22:36 -0800)]
i965: Add a new representation for Broadwell shader instructions.

Broadwell significantly changes the EU instruction encoding.  Many of
the fields got moved to different bit positions; some even got split
in two.

With so many changes, it was infeasible to continue using struct
brw_instruction.  We needed a new representation.

This new approach is a bit different: rather than a struct, I created a
class that has four DWords, and helper functions that read/write various
bits.  This has several advantages:

1. We can create several different names for the same bits.  For
   example, conditional modifiers, SFID for SEND instructions, and the
   MATH instruction's function opcode are all stored in bits 27:24.

   In each situation, we can use the appropriate setter function:
   set_sfid(), set_math_function(), or set_cond_modifier().  This
   is much easier to follow.

2. Since the fields are expressed using the original 128-bit numbers,
   the code to create the getter/setter functions follows the table in
   the documentation very closely.

To aid in debugging, I've enabled -fkeep-inline-functions when building
gen8_instruction.c.  Otherwise, these functions cannot be called by
gdb, making it insanely difficult to print out anything.

Kenneth Graunke wrote most of this code.  Damien Lespiau ported it to
C99.  Xiang Haihao added media fields.  Zhao Yakui added indirect
addressing support.  Eric Anholt added an assertion to make sure that
values fit in the alloted number of bits.

v2: Update for brw_reg_type_to_hw_type(), which necessitates passing
    brw_context pointers around everywhere.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add SFID #defines for media stuff.
Kenneth Graunke [Mon, 9 Dec 2013 00:35:36 +0000 (16:35 -0800)]
i965: Add SFID #defines for media stuff.

While we probably won't ever use these, having them makes it easy to
share disassembler code between intel-gpu-tools and Mesa.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add #defines for new Broadwell math functions.
Kenneth Graunke [Mon, 9 Dec 2013 00:33:19 +0000 (16:33 -0800)]
i965: Add #defines for new Broadwell math functions.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: add struct and SFID for pixel interpolator messages
Chris Forbes [Sun, 17 Nov 2013 06:32:49 +0000 (19:32 +1300)]
i965: add struct and SFID for pixel interpolator messages

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/Gen7: Only emit cube face enables for cubes.
Chris Forbes [Wed, 8 Jan 2014 21:01:13 +0000 (10:01 +1300)]
i965/Gen7: Only emit cube face enables for cubes.

This is not observed to actually fix anything, but the PRM says this
field must be zero for other surface types.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Improve dumping of Gen7 SURFACE_STATE
Chris Forbes [Wed, 8 Jan 2014 20:58:12 +0000 (09:58 +1300)]
i965: Improve dumping of Gen7 SURFACE_STATE

Previously this was missing many interesting fields. Having them decoded
makes debugging views much easier.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Add masks for more SURFACE_STATE fields
Chris Forbes [Wed, 8 Jan 2014 20:56:16 +0000 (09:56 +1300)]
i965: Add masks for more SURFACE_STATE fields

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agonv50: drop obsolete check from error path
Emil Velikov [Thu, 16 Jan 2014 17:36:43 +0000 (17:36 +0000)]
nv50: drop obsolete check from error path

At 'out_err' the nv50_context has been calloc-ated.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access framebuffer.cbufs
Emil Velikov [Thu, 16 Jan 2014 17:34:31 +0000 (17:34 +0000)]
nv50: assert before trying to out-of-bounds access framebuffer.cbufs

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access samplers
Emil Velikov [Thu, 16 Jan 2014 17:29:42 +0000 (17:29 +0000)]
nv50: assert before trying to out-of-bounds access samplers

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access textures
Emil Velikov [Thu, 16 Jan 2014 17:08:19 +0000 (17:08 +0000)]
nv50: assert before trying to out-of-bounds access textures

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: pass vtxbuf index as unsigned
Emil Velikov [Thu, 16 Jan 2014 16:55:52 +0000 (16:55 +0000)]
nv50: pass vtxbuf index as unsigned

The index passed to the function is already unsigned, and internally
we threat it as unsigned.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access vtxbuf
Emil Velikov [Thu, 16 Jan 2014 16:53:45 +0000 (16:53 +0000)]
nv50: assert before trying to out-of-bounds access vtxbuf

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: typecast the result of ffs() to unsigned
Emil Velikov [Thu, 16 Jan 2014 16:42:45 +0000 (16:42 +0000)]
nv50: typecast the result of ffs() to unsigned

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: assert before trying to out-of-bounds access constbuf
Emil Velikov [Thu, 16 Jan 2014 16:35:27 +0000 (16:35 +0000)]
nv50: assert before trying to out-of-bounds access constbuf

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: access only the available amount of constbuf
Emil Velikov [Thu, 16 Jan 2014 15:37:53 +0000 (15:37 +0000)]
nv50: access only the available amount of constbuf

The textures array is defined as a number of NV50_MAX_PIPE_CONSTBUFS
per shader stage. Currently the nv50 driver handles only 3 shader
stages, thus we wreck chaos when accessing array-out-of-bounds.

Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: access only the available amount of textures
Emil Velikov [Thu, 16 Jan 2014 15:35:02 +0000 (15:35 +0000)]
nv50: access only the available amount of textures

The textures array is defined as a number of PIPE_MAX_SAMPLERS per shader stage.
Currently nv50 driver handles only 3 shader stages, thus we wreck chaos when
accessing array-out-of-bounds.

Fixes a segfault in piglit/bin/arb_texture_buffer_object-data-sync -fbo -auto

Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoloader: fallback to drmGetVersion() for non-pci devices
Rob Clark [Sat, 14 Dec 2013 19:28:33 +0000 (14:28 -0500)]
loader: fallback to drmGetVersion() for non-pci devices

Use the kernel driver name are returned by drmGetVersion() for
non-pci(platform) devices.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
v2 (Emil): Rebased and weaked commit message.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agopipe-loader: add support for non-pci (platform) devices
Emil Velikov [Sat, 11 Jan 2014 05:19:36 +0000 (05:19 +0000)]
pipe-loader: add support for non-pci (platform) devices

Culled out of the "loader: refactor duplicated code into loader util lib"
patch by Rob Clark.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agopci_ids: no not include loader.h
Emil Velikov [Sat, 11 Jan 2014 05:16:06 +0000 (05:16 +0000)]
pci_ids: no not include loader.h

As per original approach by Rob, each user of the loader lib should include
loader.h and the pci_id_driver_map.h header will be used exclusively by the
loader.

Add back the include guard __IS_LOADER and remove no longer needed include
folder in the scons build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoegl_dri2: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:52:48 +0000 (04:52 +0000)]
egl_dri2: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agopipe-loader: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:28:24 +0000 (04:28 +0000)]
pipe-loader: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agost/egl: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 04:06:45 +0000 (04:06 +0000)]
st/egl: use loader util lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoegl-static: use loader util lib
Emil Velikov [Sat, 11 Jan 2014 03:12:40 +0000 (03:12 +0000)]
egl-static: use loader util lib

v2
* Drop the no longer used _EGL_NO_DRM from Android.mk.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogbm: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:50:08 +0000 (02:50 +0000)]
gbm: use the loader util lib

Additionally this commit removes the following exported functions

   _gbm_udev_device_new_from_fd()
   _gbm_fd_get_device_name()
   _gbm_log()

All three were erroneously marked as exported since their inception.
Neither of them has ever been a part of the API thus there should be
no users of them.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx: use the loader util lib
Emil Velikov [Sat, 11 Jan 2014 02:24:43 +0000 (02:24 +0000)]
glx: use the loader util lib

v2
* Set logger to ErrorMessageF. Spotted by Kristian

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoloader: introduce the loader util lib
Emil Velikov [Fri, 10 Jan 2014 23:36:16 +0000 (23:36 +0000)]
loader: introduce the loader util lib

All the various window system integration layers duplicate roughly the
same code for figuring out device and driver name, pci-id's, etc.  Which
is sad.  So extract it out into a loader util lib.

v2 (Emil)
* Separate the introduction of libloader from the code de-duplication.
* Strip out non-pci devices support.
* Add scons + Android build system support.
* Add VISIBILITY_CFLAGS to avoid exporting the loader funcs.

v3 (Emil)
* PIPE_OS_ANDROID is undefined at this scope, use ANDROID
* Make sure we define _EGL_NO_DRM when building only swrast

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>