mesa.git
7 years agost/mesa: small optimization in swizzle_swizzle()
Brian Paul [Thu, 22 Sep 2016 22:10:02 +0000 (16:10 -0600)]
st/mesa: small optimization in swizzle_swizzle()

Usually, there's no user-specified texture swizzle so we can optimize
the swizzle_swizzle() function and skip the loop/switch.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agost/mesa: fix swizzle issue in st_create_sampler_view_from_stobj()
Brian Paul [Thu, 22 Sep 2016 22:03:40 +0000 (16:03 -0600)]
st/mesa: fix swizzle issue in st_create_sampler_view_from_stobj()

Some demos, like Heaven, were creating and destroying a large number
of sampler views because of a swizzle issue.

Basically, we compute the sampler view's swizzle by examining the
texture format, user swizzle, depth mode, etc.  Later, during validation
we recompute that swizzle (in case something like depth mode changes)
and see if it matches the view's swizzle.

In the case of PIPE_FORMAT_RGTC2_UNORM, get_texture_format_swizzle
returned SWIZZLE_XYZW but the u_sampler_view_default_template() function
was setting the sampler view's swizzle to SWIZZLE_XY01.  This mismatch
caused the validation step to always "fail" so we'd destroy the old
sampler view and create a new one.

By removing the conditional, the sampler view's swizzle and the computed
texture swizzle match and validation "passes".  When creating a new sampler
view, we always want to use the texture swizzle which we just computed.

Fixes VMware issue 1733389.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible
Brian Paul [Tue, 20 Sep 2016 23:22:42 +0000 (17:22 -0600)]
svga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible

When we create a depth/stencil texture, also check if we can render to
it and set the PIPE_BIND_DEPTH_STENCIL flag.  We were previously doing
this for color textures (PIPE_BIND_RENDER_TARGET).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: don't special case caps for SVGA3D_R32_FLOAT
Brian Paul [Thu, 22 Sep 2016 15:15:20 +0000 (09:15 -0600)]
svga: don't special case caps for SVGA3D_R32_FLOAT

This may have been needed years ago during development, but not now.
Prevents some regressions after introducing the next patch.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: use new adjust_z_layer() helper in svga_pipe_blit.c
Brian Paul [Fri, 23 Sep 2016 14:34:11 +0000 (08:34 -0600)]
svga: use new adjust_z_layer() helper in svga_pipe_blit.c

To handle z/layer fix-ups for blitting and copying.  Note that we weren't
doing this properly in svga_blit() before.

Also, remove redundant stex, dtex assignments.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: simplify/improve the format compatibility check for region copies
Brian Paul [Tue, 20 Sep 2016 23:36:32 +0000 (17:36 -0600)]
svga: simplify/improve the format compatibility check for region copies

The util_is_format_compatible() function didn't quite do what we wanted
for vgpu10.  This check is more flexible and allows copies between
formats such as R32G32B32A32_FLOAT and R32G32B32A32_INT.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: add const qualifier on svga_translate_format()
Brian Paul [Tue, 20 Sep 2016 23:01:20 +0000 (17:01 -0600)]
svga: add const qualifier on svga_translate_format()

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: eliminate unneeded gotos in svga_validate_surface_view()
Brian Paul [Thu, 22 Sep 2016 18:26:55 +0000 (12:26 -0600)]
svga: eliminate unneeded gotos in svga_validate_surface_view()

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: disable srgb format related code from svga_blit()
Neha Bhende [Fri, 16 Sep 2016 21:53:01 +0000 (14:53 -0700)]
svga: disable srgb format related code from svga_blit()

With latest mesa and latest piglit tests srgb<->linear conversion
is not required as per GL4.4 rules

See commit b662c70aeab6a92751514f30719c13a6de253b40.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agoRevert "glsl: move xfb BufferStride into gl_transform_feedback_info"
Timothy Arceri [Sat, 24 Sep 2016 00:17:26 +0000 (10:17 +1000)]
Revert "glsl: move xfb BufferStride into gl_transform_feedback_info"

This reverts commit f5a6aab4031bc4754756c1773411728ad9a73381.

This broke some tests. It seems gl_transform_feedback_info gets memset
to 0 so we were losing the values in BufferStride before we used them.

7 years agoglsl: Delete linker stuff relating to built-in functions.
Kenneth Graunke [Wed, 12 Nov 2014 06:32:27 +0000 (22:32 -0800)]
glsl: Delete linker stuff relating to built-in functions.

Now that we generate built-in functions inline, there's no need to link
against the built-in shader, and no built-in prototypes to consider.

This lets us delete a bunch of code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>

7 years agoglsl: Delete ftransform support from builtin_functions.cpp.
Kenneth Graunke [Mon, 19 Sep 2016 06:00:33 +0000 (23:00 -0700)]
glsl: Delete ftransform support from builtin_functions.cpp.

This is now handled directly by ast_function.cpp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>

7 years agoglsl: Immediately inline built-ins rather than generating calls.
Kenneth Graunke [Sat, 31 May 2014 06:52:22 +0000 (23:52 -0700)]
glsl: Immediately inline built-ins rather than generating calls.

In the past, we imported the prototypes of built-in functions, generated
calls to those, and waited until link time to resolve the calls and
import the actual code for the built-in functions.

This severely limited our compile-time optimization opportunities: even
trivial functions like dot() were represented as function calls.  We
also had no way of reasoning about those calls; they could have been
1,000 line functions with side-effects for all we knew.

Practically all built-in functions are trivial translations to
ir_expression opcodes, so it makes sense to just generate those inline.
Since we eventually inline all functions anyway, we may as well just do
it for all built-in functions.

There's only one snag: built-in functions that refer to built-in global
variables need those remapped to the variables in the shader being
compiled, rather than the ones in the built-in shader.  Currently,
ftransform() is the only function matching those criteria, so it seemed
easier to just make it a special case.

On Skylake:

total instructions in shared programs: 12023491 -> 12024010 (0.00%)
instructions in affected programs: 77595 -> 78114 (0.67%)
helped: 97
HURT: 309

total cycles in shared programs: 137239044 -> 137295498 (0.04%)
cycles in affected programs: 16714026 -> 16770480 (0.34%)
helped: 4663
HURT: 4923

while these statistics are in the wrong direction, the number of
hurt programs is small (309 / 41282 = 0.75%), and I don't think
anything can be done about it.  A change like this significantly
alters the order in which optimizations are performed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>

7 years agoglsl: Check TCS barrier restrictions at ast_to_hir time, not link time.
Kenneth Graunke [Wed, 21 Sep 2016 09:03:10 +0000 (02:03 -0700)]
glsl: Check TCS barrier restrictions at ast_to_hir time, not link time.

We want to check prior to optimization - otherwise we might fail to
detect cases where barrier() is in control flow which is always taken
(and therefore gets optimized away).

We don't currently loop unroll if there are function calls inside;
otherwise we might have a problem detecting barrier() in loops that
get unrolled as well.

Tapani's switch handling code adds a loop around switch statements, so
even with the mess of if ladders, we'll properly reject it.

Enforcing these rules at compile time makes more sense more sense than
link time.  Doing it at ast-to-hir time (rather than as an IR pass)
allows us to emit an error message with proper line numbers.
(Otherwise, I would have preferred the IR pass...)

Fixes spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>

7 years agoglsl: move xfb BufferStride into gl_transform_feedback_info
Timothy Arceri [Fri, 23 Sep 2016 03:05:20 +0000 (13:05 +1000)]
glsl: move xfb BufferStride into gl_transform_feedback_info

It makes more sense to have this here where we store the other values
from xfb qualifiers. The struct it was previously part of is now only
used to store values that come from the api.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoRevert "mapi: export all GLES 3.2 functions in libGLESv2.so"
Dylan Baker [Fri, 23 Sep 2016 19:10:08 +0000 (12:10 -0700)]
Revert "mapi: export all GLES 3.2 functions in libGLESv2.so"

This reverts commit e66a2b879b73bf48800fec7353dafe8fc693ecdb.

Which breaks the scons build in an interesting way, particularly when
BlendBarrier and PrimitiveBoundingBox are added to static_data.py's
functions list. This seems to be related to the fact that the unsuffixed
names are only in GLES3.2, but Desktop GL only has suffixed versions.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
7 years agoi965: Enable EGL_KHR_gl_texture_3D_image
Adam Jackson [Wed, 21 Sep 2016 13:13:36 +0000 (09:13 -0400)]
i965: Enable EGL_KHR_gl_texture_3D_image

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoi915: Enable EGL_KHR_gl_texture_3D_image
Adam Jackson [Wed, 21 Sep 2016 13:11:26 +0000 (09:11 -0400)]
i915: Enable EGL_KHR_gl_texture_3D_image

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoanv: Check for VK_WHOLE_SIZE in anv_CmdFillBuffer
Nicolas Koch [Tue, 20 Sep 2016 15:37:36 +0000 (17:37 +0200)]
anv: Check for VK_WHOLE_SIZE in anv_CmdFillBuffer

From the Vulkan spec:

   Size is the number of bytes to fill, and must be either a multiple of 4,
   or VK_WHOLE_SIZE to fill the range from offset to the end of the buffer.
   If VK_WHOLE_SIZE is used and the remaining size of the buffer is not a
   multiple of 4, then the nearest smaller multiple is used.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: get rid of duplicated values from gen_device_info
Lionel Landwerlin [Thu, 22 Sep 2016 22:04:25 +0000 (01:04 +0300)]
anv: get rid of duplicated values from gen_device_info

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: get rid of duplicated values from gen_device_info
Lionel Landwerlin [Thu, 22 Sep 2016 21:41:23 +0000 (00:41 +0300)]
i965: get rid of duplicated values from gen_device_info

Now that we have gen_device_info mutable, we can update its values and drop
all copies we had in brw_context.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/i965: make gen_device_info mutable
Lionel Landwerlin [Thu, 22 Sep 2016 11:58:11 +0000 (14:58 +0300)]
intel/i965: make gen_device_info mutable

Make gen_device_info a mutable structure so we can update the fields that
can be refined by querying the kernel (like subslices and EU numbers).

This patch does not make any functional change, it just makes
gen_get_device_info() fill a structure rather than returning a const
pointer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogallium: remove unused PIPE_CC_GCC_VERSION
Timothy Arceri [Wed, 7 Sep 2016 04:28:19 +0000 (14:28 +1000)]
gallium: remove unused PIPE_CC_GCC_VERSION

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agoutil: remove Sun C Compiler support
Timothy Arceri [Wed, 7 Sep 2016 04:28:20 +0000 (14:28 +1000)]
util: remove Sun C Compiler support

Support for this compiler was dropped in 51564f04b77e6

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agost/mesa: turn on OES_viewport_array when dependencies are met
Ilia Mirkin [Fri, 16 Sep 2016 19:43:31 +0000 (15:43 -0400)]
st/mesa: turn on OES_viewport_array when dependencies are met

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agomesa: add implementations for new float depth functions
Ilia Mirkin [Fri, 16 Sep 2016 17:52:18 +0000 (13:52 -0400)]
mesa: add implementations for new float depth functions

This just up-converts them to doubles. Not great, but this is what all
the other variants also do.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: move ARB_viewport_array params to a GLES 3.1-accessible section
Ilia Mirkin [Fri, 16 Sep 2016 17:43:30 +0000 (13:43 -0400)]
mesa: move ARB_viewport_array params to a GLES 3.1-accessible section

This is needed for GL_OES_viewport_array.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: add GL_OES_viewport_array to the extension string
Ilia Mirkin [Fri, 16 Sep 2016 17:53:03 +0000 (13:53 -0400)]
mesa: add GL_OES_viewport_array to the extension string

The expectation is that drivers will set this based on
OES_geometry_shader and ARB_viewport_array support. This is a separate
enable on the same reasoning as for OES_texture_cube_map_array.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoglsl: add OES_viewport_array enables and use them to expose gl_ViewportIndex
Ilia Mirkin [Fri, 16 Sep 2016 17:59:27 +0000 (13:59 -0400)]
glsl: add OES_viewport_array enables and use them to expose gl_ViewportIndex

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: add new entrypoints for GL_OES_viewport_array
Ilia Mirkin [Fri, 16 Sep 2016 17:38:36 +0000 (13:38 -0400)]
mesa: add new entrypoints for GL_OES_viewport_array

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomapi: export all GLES 3.2 functions in libGLESv2.so
Dylan Baker [Thu, 22 Sep 2016 18:30:42 +0000 (11:30 -0700)]
mapi: export all GLES 3.2 functions in libGLESv2.so

See commit 5921f372c89a68fac6ddefc009442721d9df4db2 for the rational of
this commit.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomapi: sort static_data.py functions
Dylan Baker [Thu, 22 Sep 2016 18:38:28 +0000 (11:38 -0700)]
mapi: sort static_data.py functions

Sorted by vim's builtin "sort i" (keeping the sorting case insensitive)

v2:
 - uses case insensitive sorting (Ken)

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomapi: retab static_data.py to be consistent
Dylan Baker [Thu, 22 Sep 2016 17:58:45 +0000 (10:58 -0700)]
mapi: retab static_data.py to be consistent

This file currently uses a mixture of 3 and 4 space indent. I have
changed it all to 4 space indent, matching the settings in
$ROOT/.editorconfig.

This was generated with sed:
sed -i -e 's@^   "@    "@g'

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agospirv: fix AtomicLoad/Store on images
Lionel Landwerlin [Mon, 19 Sep 2016 16:14:18 +0000 (17:14 +0100)]
spirv: fix AtomicLoad/Store on images

OpAtomicLoad/Store should have pointer to images just like the rest of the
atomic operators. These couple of lines were poorly copied from the
ssbo/shared_vars cases (the only ones currently tests by the CTS).

Fixes 2afb950161f8 ("spirv/nir: Add support for OpAtomicLoad/Store")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir: Allow opt_peephole_sel to be more aggressive in flattening IFs.
Eric Anholt [Wed, 7 Sep 2016 02:45:51 +0000 (19:45 -0700)]
nir: Allow opt_peephole_sel to be more aggressive in flattening IFs.

VC4 was running into a major performance regression from enabling control
flow in the glmark2 conditionals test, because of short if statements
containing an ffract.

This pass seems like it was was trying to ensure that we only flattened
IFs that should be entirely a win by guaranteeing that there would be
fewer bcsels than there were MOVs otherwise.  However, if the number of
ALU ops is small, we can avoid the overhead of branching (which itself
costs cycles) and still get a win, even if it means moving real
instructions out of the THEN/ELSE blocks.

For now, just turn on aggressive flattening on vc4.  i965 will need some
tuning to avoid regressions.  It does looks like this may be useful to
replace freedreno code.

Improves glmark2 -b conditionals:fragment-steps=5:vertex-steps=0 from 47
fps to 95 fps on vc4.

vc4 shader-db:
total instructions in shared programs: 101282 -> 99543 (-1.72%)
instructions in affected programs:     17365 -> 15626 (-10.01%)
total uniforms in shared programs: 31295 -> 31172 (-0.39%)
uniforms in affected programs:     3580 -> 3457 (-3.44%)
total estimated cycles in shared programs: 225182 -> 223746 (-0.64%)
estimated cycles in affected programs:     26085 -> 24649 (-5.51%)

v2: Update shader-db output.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
7 years agodocs: Mark ES 3.2 "all done" for i965/gen9+.
Kenneth Graunke [Wed, 21 Sep 2016 18:51:43 +0000 (11:51 -0700)]
docs: Mark ES 3.2 "all done" for i965/gen9+.

7 years agodocs: Add ES 3.2 to release notes.
Kenneth Graunke [Wed, 21 Sep 2016 18:49:24 +0000 (11:49 -0700)]
docs: Add ES 3.2 to release notes.

7 years agogallium/util: add comment on util_is_format_compatible()
Brian Paul [Tue, 20 Sep 2016 22:05:48 +0000 (16:05 -0600)]
gallium/util: add comment on util_is_format_compatible()

From reading the code, it's not obvious what is src/dest compatible.
The list of a->b copy-compatible formats comes from Jose's original
check-in message, with some format name updates.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agosvga: minor simplification in svga_validate_surface_view()
Brian Paul [Fri, 16 Sep 2016 21:22:51 +0000 (15:22 -0600)]
svga: minor simplification in svga_validate_surface_view()

Get rid of unneeded local var.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: remove disable_shader debug variable
Brian Paul [Mon, 19 Sep 2016 22:34:17 +0000 (16:34 -0600)]
svga: remove disable_shader debug variable

Never used, AFAIK.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agoi965: Enable ES 3.2 on Skylake.
Kenneth Graunke [Wed, 21 Sep 2016 03:33:54 +0000 (20:33 -0700)]
i965: Enable ES 3.2 on Skylake.

It's already advertised because the version.c extension checks are
fulfilled, but we didn't actually claim support, so trying to create
a ES 3.2 context would fail.

It's all done, and the CTS results look good, so let's turn it on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agonir/spirv/glsl450: Add support for the InterpolateAt opcodes
Jason Ekstrand [Wed, 14 Sep 2016 04:10:13 +0000 (21:10 -0700)]
nir/spirv/glsl450: Add support for the InterpolateAt opcodes

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agonir/spirv: Claim support for SampleRateShading
Jason Ekstrand [Wed, 14 Sep 2016 04:09:28 +0000 (21:09 -0700)]
nir/spirv: Claim support for SampleRateShading

We already support all of the decorations that require this capability.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agonir/spirv: Bring back the spirv2nir helper binary
Jason Ekstrand [Fri, 16 Sep 2016 02:47:49 +0000 (19:47 -0700)]
nir/spirv: Bring back the spirv2nir helper binary

This was something that I wrote in the early days of the spirv_to_nir code
but deleted once we had a real driver.  However, in the absence of a
shader_runner equivalent, it's extremely useful for debugging the
spirv_to_nir code so let's bring it back.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: implement querying __DRI_IMAGE_ATTRIB_OFFSET.
Chuanbo Weng [Tue, 13 Sep 2016 17:07:18 +0000 (01:07 +0800)]
i965: implement querying __DRI_IMAGE_ATTRIB_OFFSET.

Implement querying this attribute in intelImageExtension and bump
version of intelImageExtension.

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoegl: return corresponding offset of EGLImage instead of 0.
Chuanbo Weng [Tue, 13 Sep 2016 17:07:10 +0000 (01:07 +0800)]
egl: return corresponding offset of EGLImage instead of 0.

The offset should not always be 0. For example, if EGLImage is
created from a 2D texture with EGL_GL_TEXTURE_LEVEL=1, then the
offset should be the actual start of miplevel 1 in bo.

v2: Add version check of __DRIimageExtension implementation
(Suggested by Axel Davy).

v3: Don't add version check of __DRIimageExtension implementation.
Set the offset only when queryImage() succeeds. (Suggested by Emil
Velikov)

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
[Emil Velikov: coding style fixes]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodri: add offset attribute and bump version of EGLImage extensions.
Chuanbo Weng [Tue, 13 Sep 2016 17:07:02 +0000 (01:07 +0800)]
dri: add offset attribute and bump version of EGLImage extensions.

Offset is useful for buffer sharing with other components, so add
it to queryImage attributes.

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/ir: Test thread dispatch packing assumptions.
Francisco Jerez [Fri, 16 Sep 2016 04:43:18 +0000 (21:43 -0700)]
i965/ir: Test thread dispatch packing assumptions.

Not [originally] intended for upstream.  Should cause a GPU hang if
some thread is executed with a non-contiguous dispatch mask breaking
assumptions of brw_stage_has_packed_dispatch().  Doesn't cause any
CTS, DEQP or Piglit regressions, while replacing
brw_stage_has_packed_dispatch() with a dummy implementation that
unconditionally returns true on top of this patch causes multiple GPU
hangs.

v2: Refactor into a separate function instead of emitting the test
    code directly from emit_nir_code(), drop VEC4 test and clean up
    slightly for upstream. (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/ir: Pass identity mask to brw_find_live_channel() in the packed dispatch case.
Francisco Jerez [Fri, 16 Sep 2016 00:24:10 +0000 (17:24 -0700)]
i965/ir: Pass identity mask to brw_find_live_channel() in the packed dispatch case.

This avoids emitting a few extra instructions required to take the
dispatch mask into account when it's known to be tightly packed.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/ir: Skip eliminate_find_live_channel() for stages with sparse thread dispatch.
Francisco Jerez [Fri, 16 Sep 2016 00:20:23 +0000 (17:20 -0700)]
i965/ir: Skip eliminate_find_live_channel() for stages with sparse thread dispatch.

The eliminate_find_live_channel optimization eliminates
FIND_LIVE_CHANNEL instructions in cases where control flow is known to
be uniform, and replaces them with 'MOV 0', which in turn unblocks
subsequent elimination of the BROADCAST instruction frequently used on
the result of FIND_LIVE_CHANNEL.  This is however not correct in
per-sample fragment shader dispatch because the PSD can dispatch a
fully unlit sample under certain conditions.  Disable the optimization
in that case.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
v2: Add devinfo argument to brw_stage_has_packed_dispatch() to
    implement hardware generation check.

7 years agoi965/fs: Take Dispatch/Vector mask into account in FIND_LIVE_CHANNEL
Jason Ekstrand [Wed, 14 Sep 2016 22:09:33 +0000 (15:09 -0700)]
i965/fs: Take Dispatch/Vector mask into account in FIND_LIVE_CHANNEL

On at least Sky Lake, ce0 does not contain the full story as far as enabled
channels goes.  It is possible to have completely disabled channels where
the corresponding bits in ce0 are 1.  In order to get the correct execution
mask, you have to mask off those channels which were disabled from the
beginning by taking the AND of ce0 with either sr0.2 or sr0.3 depending on
the shader stage.  Failure to do so can result in FIND_LIVE_CHANNEL
returning a completely dead channel.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: Francisco Jerez <currojerez@riseup.net>
[ Francisco Jerez: Fix a couple of typos, add mask register type
  assertion, clarify reason why ce0 can have bits set for disabled
  channels, clarify that this may only be a problem when thread
  dispatch doesn't pack channels tightly in the SIMD thread.  Apply
  same treatment to Align16 path. ]
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/reg: Make brw_sr0_reg take a subnr and return a vec1 reg
Jason Ekstrand [Wed, 14 Sep 2016 22:09:32 +0000 (15:09 -0700)]
i965/reg: Make brw_sr0_reg take a subnr and return a vec1 reg

The state register sr0 is really a collection of dwords not a SIMD8
anything.  It's much more convenient for brw_sr0_reg to return the
particular dword you're looking for rather than a giant blob you have to
massage into what you want.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
[ Francisco Jerez: Trivial simplification of brw_ud1_reg(). ]
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoanv: pipeline: use correct number of thread for compute
Lionel Landwerlin [Wed, 7 Sep 2016 16:28:44 +0000 (17:28 +0100)]
anv: pipeline: use correct number of thread for compute

Reproduces this commit :

commit 0fb85ac08d61d365e67c8f79d6955e9f89543560
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Jun 6 21:37:34 2016 -0700

    i965: Use the correct number of threads for compute shaders.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: allocator: correct scratch space for haswell
Lionel Landwerlin [Wed, 7 Sep 2016 16:32:49 +0000 (17:32 +0100)]
anv: allocator: correct scratch space for haswell

This reproduces this commit :

commit 2213ffdb4bb79856f0556bdf2bfd4bdf57720232
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Jun 6 21:37:34 2016 -0700

    i965: Allocate scratch space for the maximum number of compute threads.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: device: calculate compute thread numbers using subslices numbers
Lionel Landwerlin [Wed, 7 Sep 2016 16:19:35 +0000 (17:19 +0100)]
anv: device: calculate compute thread numbers using subslices numbers

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogallivm: support negation on 64-bit integers
Nicolai Hähnle [Thu, 15 Sep 2016 10:17:56 +0000 (12:17 +0200)]
gallivm: support negation on 64-bit integers

This should be analogous to 32-bit integers.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: prepare 64-bit integer support. (v2)
Dave Airlie [Fri, 10 Jun 2016 02:11:01 +0000 (12:11 +1000)]
radeonsi: prepare 64-bit integer support. (v2)

v2:
- no PIPE_CAP_INT64 yet
- emit DIV/MOD without the divide-by-zero workaround

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallivm/llvmpipe: prepare support for ARB_gpu_shader_int64.
Dave Airlie [Thu, 9 Jun 2016 00:19:49 +0000 (10:19 +1000)]
gallivm/llvmpipe: prepare support for ARB_gpu_shader_int64.

This enables 64-bit integer support in gallivm and
llvmpipe.

v2: add conversion opcodes.
v3:
- PIPE_CAP_INT64 is not there yet
- restrict DIV/MOD defaults to the CPU, as for 32 bits
- TGSI_OPCODE_I2U64 becomes TGSI_OPCODE_U2I64

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agotgsi/softpipe: prepare ARB_gpu_shader_int64 support. (v3)
Dave Airlie [Thu, 9 Jun 2016 00:18:42 +0000 (10:18 +1000)]
tgsi/softpipe: prepare ARB_gpu_shader_int64 support. (v3)

This adds all the opcodes to tgsi_exec for softpipe to use.

v2: add conversion opcodes.
v3:
- no PIPE_CAP_INT64 yet
- change TGSI_OPCODE_I2U64 to TGSI_OPCODE_U2I64

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/tgsi: add support for 64-bit integer immediates.
Dave Airlie [Thu, 9 Jun 2016 00:16:22 +0000 (10:16 +1000)]
gallium/tgsi: add support for 64-bit integer immediates.

This adds support to TGSI for 64-bit integer immediates.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agogallium: add opcode and types for 64-bit integers. (v3)
Dave Airlie [Thu, 9 Jun 2016 00:14:51 +0000 (10:14 +1000)]
gallium: add opcode and types for 64-bit integers. (v3)

This just adds the basic support for 64-bit opcodes,
and the new types.

v2: add conversion opcodes.
add documentation.
v3:
- make docs more consistent
- change TGSI_OPCODE_I2U64 to TGSI_OPCODE_U2I64

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoi965: Rename intelScreen to screen.
Kenneth Graunke [Mon, 30 Nov 2015 23:47:13 +0000 (15:47 -0800)]
i965: Rename intelScreen to screen.

"intelScreen" is wordy and also doesn't fit our style guidelines.
"screen" is shorter, which is nice, because we use it fairly often.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Rename __DRIScreen pointers to "dri_screen".
Kenneth Graunke [Tue, 1 Dec 2015 00:04:08 +0000 (16:04 -0800)]
i965: Rename __DRIScreen pointers to "dri_screen".

I want to use "screen" as the variable name for a struct intel_screen
pointer.  This means that we can't use it for __DRIscreen pointers.

Sometimes we called it "screen", sometimes "sPriv", sometimes
"driScrnPriv", and sometimes "psp" (Pointer to Screen Private?).
The last one is particularly confusing because we use "psp" to refer to
the Gen4 PIPELINED_STATE_POINTERS packet as well.

Let's be consistent.  "dri_screen" is clear, and it's not used often
enough that I'm worried about the verbosity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: Implement ARB_shader_viewport_layer_array for i965
Dylan Baker [Mon, 19 Sep 2016 22:36:09 +0000 (15:36 -0700)]
mesa: Implement ARB_shader_viewport_layer_array for i965

This extension is a combination of AMD_vertex_shader_viewport_index and
AMD_vertex_shader_layer, making it rather trivial to implement.

For gallium I *think* this needs a new cap because of the addition of
support in tessellation evaluation shaders, and since I don't have any
hardware to test it on, I've left that for someone else to wire up.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradeon/vce: add firmware support for version 52.8.3
Leo Liu [Tue, 20 Sep 2016 14:09:23 +0000 (10:09 -0400)]
radeon/vce: add firmware support for version 52.8.3

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/omx/dec/h265: Correct the timestamping
Indrajit Das [Thu, 15 Sep 2016 05:01:15 +0000 (10:31 +0530)]
st/omx/dec/h265: Correct the timestamping

(derived from commit 3b6bda665a5a890f2c98e19d2939d7de92b8cb4c)

v2: fix the tabs(Leo)

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nishanth Peethambaran <nishanth.peethambaran@amd.com>
Signed-off-by: Indrajit Das <indrajit-kumar.das@amd.com>
Signed-off-by: Leo Liu <leo.liu@amd.com>
7 years agoaubinator: add a custom handler for immediate register load
Lionel Landwerlin [Fri, 9 Sep 2016 10:22:59 +0000 (11:22 +0100)]
aubinator: add a custom handler for immediate register load

Transforming this :

0x00c77084:  0x11000001:  MI_LOAD_REGISTER_IMM
0x00c77088:  0x0000b020 : Dword 1
    Register Offset: 0x0000b020
    0x00c7708c:  0x00880038 : Dword 2
    Data DWord: 8912952

Into this:

0x007880f0:  0x11000001:  MI_LOAD_REGISTER_IMM
0x007880f4:  0x0000b020 : Dword 1
    Register Offset: 0x0000b020
    0x007880f8:  0x00080040 : Dword 2
    Data DWord: 524352
register L3CNTLREG2 (0xb020) : 0x80040
    SLM Enable: 0
    URB Allocation: 32
    URB Low Bandwidth: 0
    RO Allocation: 32
    RO Low Bandwidth: 0
    DC Allocation: 0
    DC Low Bandwidth: 0

v2: Drop unused arguments (Sirisha)
    Print out register name

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agost/va: flush the context before calling flush_frontbuffer(v2)
Nayan Deshmukh [Tue, 20 Sep 2016 04:52:12 +0000 (10:22 +0530)]
st/va: flush the context before calling flush_frontbuffer(v2)

so that the texture is rendered to back buffer before calling
flush_frontbuffer and can be copied to a different buffer in
the function

v2: change comment style

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
7 years agost/vdpau: flush the context before calling flush_frontbuffer
Nayan Deshmukh [Tue, 20 Sep 2016 04:52:11 +0000 (10:22 +0530)]
st/vdpau: flush the context before calling flush_frontbuffer

so that the texture is rendered to back buffer before calling
flush_frontbuffer and can be copied to a different buffer in
the function

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
7 years agovl/dri3: handle the case of different GPU(v4.2)
Nayan Deshmukh [Tue, 20 Sep 2016 04:52:10 +0000 (10:22 +0530)]
vl/dri3: handle the case of different GPU(v4.2)

In case of prime when rendering is done on GPU other then the
server GPU, use a seprate linear buffer for each back buffer
which will be displayed using present extension.

v2: Use a seprate linear buffer for each back buffer (Michel)
v3: Change variable names and fix coding style (Leo and Emil)
v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer in case when
    a seprate linear buffer is used (Michel)
v4.1: remove empty line
v4.2: destroy the context and handle the case when
      create_context fails (Emil)

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
7 years agost/vdpau: fix argument type to vlVdpOutputSurfaceDMABuf
Ilia Mirkin [Wed, 14 Sep 2016 23:16:43 +0000 (19:16 -0400)]
st/vdpau: fix argument type to vlVdpOutputSurfaceDMABuf

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoswr: [rasterizer core] Better thread destruction
Tim Rowley [Mon, 12 Sep 2016 18:08:12 +0000 (13:08 -0500)]
swr: [rasterizer core] Better thread destruction

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer jitter] Fix missing end-of-file newline
Tim Rowley [Fri, 9 Sep 2016 21:44:21 +0000 (16:44 -0500)]
swr: [rasterizer jitter] Fix missing end-of-file newline

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] Add macros for mapping ArchRast to buckets
Tim Rowley [Tue, 6 Sep 2016 17:36:02 +0000 (12:36 -0500)]
swr: [rasterizer core] Add macros for mapping ArchRast to buckets

Switch all RDTSC_START/STOP macros to use AR_BEGIN/END macros.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoglsl: Skip "unsized arrays aren't allowed" check for TCS/TES/GS vars.
Kenneth Graunke [Thu, 15 Sep 2016 09:10:23 +0000 (02:10 -0700)]
glsl: Skip "unsized arrays aren't allowed" check for TCS/TES/GS vars.

Fixes ESEXT-CTS.draw_elements_base_vertex_tests.AEP_shader_stages and
ESEXT-CTS.texture_cube_map_array.texture_size_tesselation_con_sh.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: get rid of nvc0_stage_sampler_states_bind_range()
Samuel Pitoiset [Sun, 18 Sep 2016 21:48:05 +0000 (23:48 +0200)]
nvc0: get rid of nvc0_stage_sampler_states_bind_range()

Same thing as nvc0_stage_set_sampler_views_range().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: get rid of nvc0_stage_set_sampler_views_range()
Samuel Pitoiset [Sun, 18 Sep 2016 21:48:04 +0000 (23:48 +0200)]
nvc0: get rid of nvc0_stage_set_sampler_views_range()

This function was quite similar to nvc0_stage_set_sampler_views()
and I don't see any reasons to not remove it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50/ir: optimize SUB(a, b) to MOV(a - b)
Samuel Pitoiset [Sun, 18 Sep 2016 10:33:12 +0000 (12:33 +0200)]
nv50/ir: optimize SUB(a, b) to MOV(a - b)

This helps shaders in UE4 demos, especially with Elemental
(+1% perf). This optimization reduces spilling usage in one
shader which explains the little gain.

GF100/GK104:

total instructions in shared programs :2838551 -> 2838045 (-0.02%)
total gprs used in shared programs    :396706 -> 396684 (-0.01%)
total local used in shared programs   :34432 -> 34416 (-0.05%)

                local        gpr       inst      bytes
    helped           1          19         112         112
      hurt           0           0           0           0

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agogk110/ir: fix wrong emission of OP_NOT
Samuel Pitoiset [Sun, 18 Sep 2016 12:42:20 +0000 (14:42 +0200)]
gk110/ir: fix wrong emission of OP_NOT

This should emit src0 instead of src1.
Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
7 years agor600g/sb: fix struct/class declaration conflicts
Martina Kollarova [Fri, 16 Sep 2016 15:54:53 +0000 (18:54 +0300)]
r600g/sb: fix struct/class declaration conflicts

A couple of forward-declarations were causing warnings in clang:
    'value' defined as a class here but previously declared as a struct
    [-Wmismatched-tags]

Signed-off-by: Martina Kollarova <martina.kollarova@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoi965: Drop assertion about buffer offset at draw time.
Eric Anholt [Mon, 15 Aug 2016 15:58:27 +0000 (08:58 -0700)]
i965: Drop assertion about buffer offset at draw time.

Given robust access, we should just be returning zeroes if the user gives
us a base pointer that's too big, which is what was happens on a release
build.  This was caught by a webgl conformance test for out-of-bounds
draws on servo.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agotgsi: Enable returns from within loops
Lars Hamre [Tue, 13 Sep 2016 19:08:00 +0000 (13:08 -0600)]
tgsi: Enable returns from within loops

Fixes the following piglit test (for softpipe):
/spec/glsl-1.10/execution/fs-loop-return

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: relax restriction of compressed formats for texture upload
Charmaine Lee [Fri, 16 Sep 2016 16:50:20 +0000 (09:50 -0700)]
svga: relax restriction of compressed formats for texture upload

This patch relaxes the restriction of compressed formats for texture
upload buffer. For now, 3D texture with compressed format
is still not supported in the texture upload buffer path.

As Brian noted, ETQW does many texture updates with glCompressedTexSubImage.
This patch greatly improves the performance of the ETQW trace.

Tested with ETQW, MTT piglit, glretrace, conform, viewperf

v2: Per Brian's suggestion, removed the subregion boundary check.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: skip query flush if we already have the query result
Brian Paul [Thu, 15 Sep 2016 18:07:18 +0000 (12:07 -0600)]
svga: skip query flush if we already have the query result

This reduces the number of times we flush in some situations (the
arbocclude demo is one trivial example).

Tested with Piglit, ETQW, Sauerbraten, arbocclude.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: remove unneeded svga_context_flush() in svga_end_query()
Brian Paul [Wed, 14 Sep 2016 18:33:15 +0000 (12:33 -0600)]
svga: remove unneeded svga_context_flush() in svga_end_query()

Since commit 99d8fe20abe1f we don't have to flush the command buffer when
we end a query.

Tested with Piglit, Sauerbraten, arbocclude, ETQW (noticably faster now).

Reviewed-by: José Fonseca <jfonseca@vmware.com>
7 years agosvga: use upload buffer for upload texture.
Charmaine Lee [Tue, 6 Sep 2016 18:29:41 +0000 (11:29 -0700)]
svga: use upload buffer for upload texture.

With this patch, when running with vgpu10, instead of mapping directly to the
guest backed memory for texture update, we'll use the texture upload buffer
and use the transfer from buffer command to update the host side texture memory.

This optimization yields about 20% performance improvement with
Lightsmark2008 and about 40% with Tropics.

Tested with Lightsmark2008, Tropics, Heaven, MTT piglit, glretrace, conform.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: refactor svga_texture_transfer_map/unmap functions
Charmaine Lee [Fri, 2 Sep 2016 00:45:28 +0000 (17:45 -0700)]
svga: refactor svga_texture_transfer_map/unmap functions

Split the functions into separate functions for dma and direct map to make
the code more readable.

Tested with MTT piglit, glretrace, viewperf, conform, various OpenGL apps

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: add SVGA3d_vgpu10_TransferFromBuffer()
Charmaine Lee [Thu, 1 Sep 2016 20:40:34 +0000 (13:40 -0700)]
svga: add SVGA3d_vgpu10_TransferFromBuffer()

Also add the corresponding dump function to dump the TransferFromBuffer command.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: single sample surface can be created as non-multisamples surface
Charmaine Lee [Mon, 12 Sep 2016 21:21:40 +0000 (14:21 -0700)]
svga: single sample surface can be created as non-multisamples surface

With this patch, single sample surface will be created as non-multisamples
surface.

Tested with piglit, glretrace.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: fix memory leak with sampler state
Charmaine Lee [Wed, 7 Sep 2016 18:46:26 +0000 (11:46 -0700)]
svga: fix memory leak with sampler state

This patch fixes a memory leak with sampler state when piglit
is run with HW version 11. Sampler state clean up was incorrectly skipped
in svga_cleanup_sampler_state() for vgpu9.

Tested with piglit.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: fix prim type check/assignment in translate_indices()
Brian Paul [Fri, 2 Sep 2016 20:06:00 +0000 (14:06 -0600)]
svga: fix prim type check/assignment in translate_indices()

Left over test code spotted by Sinclair.

Tested with piglit, Google Earth, Lightsmark, Heaven4, glretraces, etc.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
7 years agosvga: use SVGA3D_QUERYTYPE_MAX for svga query type check
Charmaine Lee [Thu, 1 Sep 2016 18:07:59 +0000 (11:07 -0700)]
svga: use SVGA3D_QUERYTYPE_MAX for svga query type check

Use SVGA3D_QUERYTYPE_MAX instead of SVGA_QUERY_MAX for
svga query type check.

Tested with various OpenGL apps with GALLIUM_HUD set.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: split the num-resources-mapped hud to textures & buffers
Charmaine Lee [Wed, 31 Aug 2016 21:49:52 +0000 (14:49 -0700)]
svga: split the num-resources-mapped hud to textures & buffers

Replace the num-resources-mapped hud with
num-textures-mapped and num-buffers-mapped, so we can
differentiate the map counts for these two different resources.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: change svga hud defines to enums
Charmaine Lee [Tue, 30 Aug 2016 23:40:12 +0000 (16:40 -0700)]
svga: change svga hud defines to enums

This will make it easier to add new hud types.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: implement an index buffer translation cache
Brian Paul [Wed, 31 Aug 2016 20:49:41 +0000 (14:49 -0600)]
svga: implement an index buffer translation cache

Some OpenGL apps, like Cinebench R15, have many glDrawElements(GL_QUADS)
calls.  Since we don't directly support quads we have to convert these
calls into GL_TRIANGLES which involves generating a new index buffer.

This patch saves the new/translated index buffer in the hope that it
can be reused for a later draw call.

Cinebench R15 increases by about 20% with this change.
The NobelClinician Viewer app also hits this code.
Tested with full piglit run.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: try to emit fewer buffer rebind commands
Brian Paul [Thu, 1 Sep 2016 00:28:00 +0000 (18:28 -0600)]
svga: try to emit fewer buffer rebind commands

If a consecutive sequence of drawing commands references the same
vertex/index buffers, there should be no need to rebind the surfaces
for the second and subsequent drawing commands.

Apps that use multiple display lists benefit from this since the vertex
data for several display lists is often stored in one buffer.

In the case of the legacy E&S Glaze demo, this reduces the size of our
command buffers from 91KB to 44KB.  One WSI Fusion trace shows a 33%
reduction in command buffer sizes.

Tested with full piglit run.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: reduce unmapping/remapping of the default constant buffer
Brian Paul [Mon, 15 Aug 2016 15:16:05 +0000 (09:16 -0600)]
svga: reduce unmapping/remapping of the default constant buffer

Previously, every time we put shader constants into the default constant
buffer we called u_upload_alloc(), which mapped the buffer, and
u_upload_unmap().  We had to unmap the buffer before calling
svga_buffer_handle() to get the winsys handle for the buffer.  But we
really only need to do that the first time we reference the const buffer.
Now we try to keep the upload manager's buffer mapped until we fill it or
flush the command buffer.

v2: add additional comment on the buffer unmapping code in
svga_context_flush(), per Charmaine.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: optimize memcpy() in svga_buffer_update_hw()
Brian Paul [Fri, 12 Aug 2016 16:44:22 +0000 (10:44 -0600)]
svga: optimize memcpy() in svga_buffer_update_hw()

When we migrate a buffer from sw/malloc storage to a hardware buffer,
don't memcpy the whole buffer, just copy the part we've written to.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Use comparison between svga texture types to use PredCopyRegion command
Neha Bhende [Thu, 1 Sep 2016 16:43:54 +0000 (09:43 -0700)]
svga: Use comparison between svga texture types to use PredCopyRegion command

PredCopyRegion support copy between same type of textures.
Instead of comparing src and dst pipe texture type, compare svga texture
type which can avoid some software fallback.
for example, it avoids a software blit with the Redway3D Aston demo.

Tested piglit tests on VGPU9 and  VGPU10 on GL/DX11Renderer, Redway3D Aston demo

v2: some nit pick suggested by Charmaine.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: Add function svga_resource_type()
Neha Bhende [Thu, 1 Sep 2016 16:40:43 +0000 (09:40 -0700)]
svga: Add function svga_resource_type()

This function returns svga texture type for corresponding pipe texture.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>