mesa.git
7 years agomesa/main: conversion from float in GetUniformi64v requires rounding to nearest
Iago Toral Quiroga [Thu, 18 May 2017 09:43:56 +0000 (11:43 +0200)]
mesa/main: conversion from float in GetUniformi64v requires rounding to nearest

As we do for all other cases of float/double conversions to integers.

v2: use round() instead of IROUND() macros (Iago)

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa/main: Add conversion from double to uint64/int64 in GetUniform*i64v()
Iago Toral Quiroga [Thu, 18 May 2017 09:43:55 +0000 (11:43 +0200)]
mesa/main: Add conversion from double to uint64/int64 in GetUniform*i64v()

v2:
  - need unsigned rounding for double->uint64 conversion (Nicolai)
  - use round() instead of IROUND() macros (Iago)

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa/main: Clamp GetUniformui64v values to be >= 0
Iago Toral Quiroga [Thu, 18 May 2017 09:43:54 +0000 (11:43 +0200)]
mesa/main: Clamp GetUniformui64v values to be >= 0

Like we do for the 32-bit case.

v2:
  - need unsigned rounding for float->uint64 conversion (Nicolai)
  - use roundf() instead of IROUND() macros (Iago)

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa/main: Clamp GetUniformuiv values to be >= 0
Kenneth Graunke [Thu, 18 May 2017 09:43:53 +0000 (11:43 +0200)]
mesa/main: Clamp GetUniformuiv values to be >= 0

Section 2.2.2 (Data Conversions For State Query Commands) of the
OpenGL 4.5 October 24th 2016 specification says:

"If a command returning unsigned integer data is called, such as
 GetSamplerParameterIuiv, negative values are clamped to zero."

v2: uint to int conversion should clamp to INT_MAX (Nicolai)

v3 (Iago)
  - Add conversions conversions from 64-bit integer paths
  - Rebase on master

v4:
  - need unsigned rounding for float/double->uint conversions (Nicolai)
  - use round{f}() instead of IROUND() macros (Iago)

Fixes:
KHR-GL45.gpu_shader_fp64.state_query

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v2)
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa/main: fix indentation in _mesa_get_uniform()
Iago Toral Quiroga [Thu, 18 May 2017 09:43:52 +0000 (11:43 +0200)]
mesa/main: fix indentation in _mesa_get_uniform()

v2: also change the style of the large conditional in that function
    to follow the style from most other parts of Mesa (Nicolai)

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agor100: Silence numerous unused this or that warnings
Ian Romanick [Mon, 22 May 2017 22:19:54 +0000 (15:19 -0700)]
r100: Silence numerous unused this or that warnings

radeon_fbo.c: In function ‘radeon_map_renderbuffer_s8z24’:
radeon_fbo.c:147:50: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 radeon_map_renderbuffer_s8z24(struct gl_context *ctx,
                                                  ^~~
radeon_fbo.c: In function ‘radeon_map_renderbuffer_z16’:
radeon_fbo.c:186:48: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 radeon_map_renderbuffer_z16(struct gl_context *ctx,
                                                ^~~
radeon_fbo.c: In function ‘radeon_unmap_renderbuffer_s8z24’:
radeon_fbo.c:344:52: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 radeon_unmap_renderbuffer_s8z24(struct gl_context *ctx,
                                                    ^~~
radeon_fbo.c: In function ‘radeon_unmap_renderbuffer_z16’:
radeon_fbo.c:377:50: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 radeon_unmap_renderbuffer_z16(struct gl_context *ctx,
                                                  ^~~
radeon_fbo.c: In function ‘radeon_nop_alloc_storage’:
radeon_fbo.c:624:75: warning: unused parameter ‘rb’ [-Wunused-parameter]
 radeon_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
                                                                           ^~
radeon_fbo.c:625:12: warning: unused parameter ‘internalFormat’ [-Wunused-parameter]
     GLenum internalFormat, GLuint width, GLuint height)
            ^~~~~~~~~~~~~~
radeon_fbo.c:625:35: warning: unused parameter ‘width’ [-Wunused-parameter]
     GLenum internalFormat, GLuint width, GLuint height)
                                   ^~~~~
radeon_fbo.c:625:49: warning: unused parameter ‘height’ [-Wunused-parameter]
     GLenum internalFormat, GLuint width, GLuint height)
                                                 ^~~~~~
radeon_fbo.c: In function ‘radeon_bind_framebuffer’:
radeon_fbo.c:696:74: warning: unused parameter ‘fbread’ [-Wunused-parameter]
                        struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
                                                                          ^~~~~~
radeon_fbo.c: In function ‘radeon_validate_framebuffer’:
radeon_fbo.c:832:19: warning: unused variable ‘radeon’ [-Wunused-variable]
  radeonContextPtr radeon = RADEON_CONTEXT(ctx);
                   ^~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agor100: Use _mesa_get_format_base_format in radeon_update_wrapper
Ian Romanick [Fri, 26 May 2017 04:26:09 +0000 (21:26 -0700)]
r100: Use _mesa_get_format_base_format in radeon_update_wrapper

The wrapper is for a renderbuffer around a texture.  Textures can have
formats (e.g., 3) that aren't valide for API generated renderbuffers.
_mesa_base_fbo_format will return 0, but _mesa_get_format_base_format
will return the base format of RGB.

Fixes a crashes in piglit tests fbo-alphatest-formats (all subtests
pass) and fbo-colormask-formats (some subtests pass, some fail).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agor100,r200: Don't assume glVisual is non-NULL during context creation
Ian Romanick [Thu, 25 May 2017 05:14:44 +0000 (22:14 -0700)]
r100,r200: Don't assume glVisual is non-NULL during context creation

Thanks to EGL_MESA_configless_context, the visual pointer can be NULL.

Fixes a segfault (or assertion failure) in piglit's
egl-configless-context test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agor100: Don't assume that the base mipmap of a texture exists
Ian Romanick [Wed, 24 May 2017 23:36:28 +0000 (16:36 -0700)]
r100: Don't assume that the base mipmap of a texture exists

Fixes crashes in piglit's gl-1.2-texture-base-level.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agor600/eg: add support for tracing IBs after a hang.
Dave Airlie [Tue, 9 May 2017 05:47:12 +0000 (15:47 +1000)]
r600/eg: add support for tracing IBs after a hang.

This is a poor man's version of radeonsi ddebug stuff, this
should get hooked into that infrastructure, and grow more stuff,
but for now, just create R600_TRACE var that points to a file
that you want to dump the last IB to.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl/lower_int64: only set progress when something is lowered.
Dave Airlie [Wed, 31 May 2017 22:34:09 +0000 (08:34 +1000)]
glsl/lower_int64: only set progress when something is lowered.

Otherwise we'd get progress continually set if we had non 64-bit
versions of these ops.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Revert HTILE reset word to 0xFFFFFFFF.
Bas Nieuwenhuizen [Tue, 30 May 2017 21:02:07 +0000 (23:02 +0200)]
radv: Revert HTILE reset word to 0xFFFFFFFF.

0x30f regressed mad max.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Fixes: df91abfe5af "radv: Use correct clear words for HTILE."
7 years agoAndroid: major/minor/makedev live in <sys/sysmacros.h>
Rob Herring [Tue, 30 May 2017 12:22:18 +0000 (07:22 -0500)]
Android: major/minor/makedev live in <sys/sysmacros.h>

sysmacros.h was getting implicitly included in types.h until recently in
AOSP master. Define MAJOR_IN_SYSMACROS to explicitly include sysmacros.h.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoegl/android: Drop unused 'format' param in get_back_bo()
Chad Versace [Wed, 24 May 2017 00:26:52 +0000 (17:26 -0700)]
egl/android: Drop unused 'format' param in get_back_bo()

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/android: Align channel masks in HAL_PIXEL_FORMAT table
Chad Versace [Tue, 23 May 2017 22:50:13 +0000 (15:50 -0700)]
egl/android: Align channel masks in HAL_PIXEL_FORMAT table

Improves readability. No change in behavior.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/drm: remove temporary fd variable
Eric Engestrom [Wed, 31 May 2017 15:57:42 +0000 (16:57 +0100)]
egl/drm: remove temporary fd variable

In all codepaths, this var ends up assigned to the struct, except one:
a cleanup codepath, where the `close()` was removed, leading to fd leaks.
Remove the temp fd and assign to the struct field directly instead.

CovID: 1213930
Fixes: 7ec07beedf486d8ab901 ("egl/drm: make use of the
                              dri2_display_destroy() helper")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomesa: throw an INVALID_OPERATION error in get_texobj_by_name()
Samuel Pitoiset [Mon, 29 May 2017 12:07:31 +0000 (14:07 +0200)]
mesa: throw an INVALID_OPERATION error in get_texobj_by_name()

Because get_texobj_by_name() can already throw a INVALID_ENUM
error, it makes more sense to add a check directly there.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add new 'name' parameter to get_texobj_by_name()
Samuel Pitoiset [Mon, 29 May 2017 12:07:30 +0000 (14:07 +0200)]
mesa: add new 'name' parameter to get_texobj_by_name()

To display better function names when INVALID_OPERATION is
returned. Requested by Timothy.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradeonsi: remove unused si_pm4_state::compute_pkt
Samuel Pitoiset [Tue, 30 May 2017 16:53:16 +0000 (18:53 +0200)]
radeonsi: remove unused si_pm4_state::compute_pkt

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: remove chip_class define from si_pm4.h
Samuel Pitoiset [Tue, 30 May 2017 16:53:15 +0000 (18:53 +0200)]
radeonsi: remove chip_class define from si_pm4.h

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: merge si_pm4_free_state_simple() into si_pm4_free_state()
Samuel Pitoiset [Tue, 30 May 2017 16:53:14 +0000 (18:53 +0200)]
radeonsi: merge si_pm4_free_state_simple() into si_pm4_free_state()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa/util: fix arithmetic use of 'void *' in u_vector_foreach
Samuel Pitoiset [Tue, 30 May 2017 15:41:32 +0000 (17:41 +0200)]
mesa/util: fix arithmetic use of 'void *' in u_vector_foreach

u_vector_foreach is currently only used by the Intel Vulkan
driver but when this macro is used in mesa core, GCC reports
a compile-time error. Probably because some compiler options
are different.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: remove _mesa from static function names
Timothy Arceri [Tue, 30 May 2017 00:56:36 +0000 (10:56 +1000)]
mesa: remove _mesa from static function names

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa/st: indentation tidy-up
Timothy Arceri [Tue, 30 May 2017 00:26:09 +0000 (10:26 +1000)]
mesa/st: indentation tidy-up

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agofreedreno/a5xx: drop WFIs in emit_marker5()
Rob Clark [Tue, 30 May 2017 15:19:12 +0000 (11:19 -0400)]
freedreno/a5xx: drop WFIs in emit_marker5()

Results in always having at least one WFI between draws, which was
slowing stk down by ~5% and ~10% in xonotic.

(also drop bogus assert while we're at it.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/a5xx: timestamp / time-elapsed queries
Rob Clark [Tue, 30 May 2017 11:52:25 +0000 (07:52 -0400)]
freedreno/a5xx: timestamp / time-elapsed queries

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/a5xx: rename query result struct
Rob Clark [Tue, 30 May 2017 11:30:18 +0000 (07:30 -0400)]
freedreno/a5xx: rename query result struct

Going to want the same thing for timestamp queries.

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno: update generated headers
Rob Clark [Tue, 30 May 2017 10:36:28 +0000 (06:36 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agoi965: Delete dead old-school packing structs.
Kenneth Graunke [Tue, 30 May 2017 22:13:08 +0000 (15:13 -0700)]
i965: Delete dead old-school packing structs.

Trivial.

7 years agoswr/rast: code cleanup (no functional change)
Tim Rowley [Mon, 22 May 2017 23:56:59 +0000 (18:56 -0500)]
swr/rast: code cleanup (no functional change)

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: whitespace changes
Tim Rowley [Wed, 24 May 2017 18:43:48 +0000 (13:43 -0500)]
swr/rast: whitespace changes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: code cleanup (no functional change)
Tim Rowley [Wed, 24 May 2017 18:43:33 +0000 (13:43 -0500)]
swr/rast: code cleanup (no functional change)

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: allow early-z if shader uses depth value
Tim Rowley [Thu, 18 May 2017 20:44:22 +0000 (15:44 -0500)]
swr/rast: allow early-z if shader uses depth value

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: move wireframe/point triangle binning after culling
Tim Rowley [Thu, 18 May 2017 18:08:06 +0000 (13:08 -0500)]
swr/rast: move wireframe/point triangle binning after culling

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: remove unused functions
Tim Rowley [Thu, 18 May 2017 16:35:58 +0000 (11:35 -0500)]
swr/rast: remove unused functions

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: code cleanup (no functional change)
Tim Rowley [Thu, 18 May 2017 15:56:20 +0000 (10:56 -0500)]
swr/rast: code cleanup (no functional change)

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: move binner utility functions to binner.h
Tim Rowley [Thu, 18 May 2017 15:55:41 +0000 (10:55 -0500)]
swr/rast: move binner utility functions to binner.h

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - fix/use SIMD16 calcDeterminantIntVertical()
Tim Rowley [Wed, 17 May 2017 22:39:33 +0000 (17:39 -0500)]
swr/rast: SIMD16 FE - fix/use SIMD16 calcDeterminantIntVertical()

Stop double pumping the SIMD8 version.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: add renderTargetArrayIndex to SWR_PS_CONTEXT
Tim Rowley [Tue, 16 May 2017 21:51:58 +0000 (16:51 -0500)]
swr/rast: add renderTargetArrayIndex to SWR_PS_CONTEXT

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: make simd16 logicops avx512f safe
Tim Rowley [Tue, 16 May 2017 15:25:21 +0000 (10:25 -0500)]
swr/rast: make simd16 logicops avx512f safe

Express the simd16 logicops in terms of avx512f instructions.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - add SIMD16 types to jitter
Tim Rowley [Mon, 15 May 2017 17:33:21 +0000 (12:33 -0500)]
swr/rast: SIMD16 FE - add SIMD16 types to jitter

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - fix PA_STATE_OP::Reset()
Tim Rowley [Fri, 12 May 2017 17:57:46 +0000 (12:57 -0500)]
swr/rast: SIMD16 FE - fix PA_STATE_OP::Reset()

Fixes instanced GS.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - simplify/refactor StreamOut
Tim Rowley [Tue, 9 May 2017 20:40:55 +0000 (15:40 -0500)]
swr/rast: SIMD16 FE - simplify/refactor StreamOut

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - fix conservative rasterization
Tim Rowley [Mon, 8 May 2017 18:32:18 +0000 (13:32 -0500)]
swr/rast: SIMD16 FE - fix conservative rasterization

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - interleaved simdvertex output in GS
Tim Rowley [Mon, 8 May 2017 17:45:20 +0000 (12:45 -0500)]
swr/rast: SIMD16 FE - interleaved simdvertex output in GS

Eliminates conversion copies on GS output from simdvertex to simd16vertex.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: fix _simd16_movemask_(ps,pd) native AVX512 intrinsics
Tim Rowley [Thu, 4 May 2017 23:40:35 +0000 (18:40 -0500)]
swr/rast: fix _simd16_movemask_(ps,pd) native AVX512 intrinsics

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: SIMD16 FE - primitive assembly simplification
Tim Rowley [Tue, 2 May 2017 17:19:23 +0000 (12:19 -0500)]
swr/rast: SIMD16 FE - primitive assembly simplification

Reduce/simplify vertex storage usage in PA_STATE_OPT, fix PA
GetNextVSOutput wrap-around behaviour and eliminate unnecessary
SIMDVERTEX copies/storage for tri fan in PA_STATE_OPT

Fixes the OpenGL tri fan test failure under SIMD16 -
triangle-rasterization-overdraw.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: silence write of cfg graph
Tim Rowley [Mon, 1 May 2017 22:26:19 +0000 (17:26 -0500)]
swr/rast: silence write of cfg graph

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: add CreateDirectoryPath to recursively create directories
Tim Rowley [Wed, 26 Apr 2017 18:46:31 +0000 (13:46 -0500)]
swr/rast: add CreateDirectoryPath to recursively create directories

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: add support for DX1_RGB{_SRGB} formats
Tim Rowley [Tue, 25 Apr 2017 23:53:18 +0000 (18:53 -0500)]
swr/rast: add support for DX1_RGB{_SRGB} formats

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: clean up whitespace
Tim Rowley [Wed, 24 May 2017 18:37:12 +0000 (13:37 -0500)]
swr/rast: clean up whitespace

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: adjust BinPostSetupPoints* function signature
Tim Rowley [Wed, 24 May 2017 18:36:46 +0000 (13:36 -0500)]
swr/rast: adjust BinPostSetupPoints* function signature

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr/rast: remove extra pixel center adjustment in BinPostSetupPoints
Tim Rowley [Wed, 24 May 2017 18:36:00 +0000 (13:36 -0500)]
swr/rast: remove extra pixel center adjustment in BinPostSetupPoints

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoanv: Port over CACHE_MODE_1 optimization fix enables from brw.
Kenneth Graunke [Wed, 24 May 2017 04:33:12 +0000 (21:33 -0700)]
anv: Port over CACHE_MODE_1 optimization fix enables from brw.

Ben and I haven't observed these to help anything, but they enable
hardware optimizations for particular cases.  It's probably best to
enable them ahead of time, before we run into such a case.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agogenxml: Add Gen9 CACHE_MODE_1 definitons.
Kenneth Graunke [Wed, 24 May 2017 04:30:02 +0000 (21:30 -0700)]
genxml: Add Gen9 CACHE_MODE_1 definitons.

These were already in gen8.xml but not gen9.xml.  There are a few new
fields and a couple that have changed.  These are all documented in the
Skylake PRM, Volume 2c Command Reference: Registers, Part 1.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Set the "Float Blend Optimization Enable" bit on Gen9+.
Kenneth Graunke [Wed, 24 May 2017 04:03:14 +0000 (21:03 -0700)]
i965: Set the "Float Blend Optimization Enable" bit on Gen9+.

This is woefully undocumented.  It's some kind of optimization that
avoids unnecessary render target reads when blending with a floating
point render target, using independent alpha blending modes.

The internal documentation indicates that this bit exists on Cherryview
as well, but the other driver doesn't appear to set it on that platform.
There's also some confusing wording that indicates that it may exist on
Broadwell, but the documentation says it's reserved, so who knows.

I was not able to find any workload that benefited from setting this
bit, but it seems like a good idea to set it nonetheless.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Fix type of brw_context::render_target_format[]
Chad Versace [Fri, 26 May 2017 21:53:22 +0000 (14:53 -0700)]
i965: Fix type of brw_context::render_target_format[]

It's an array of isl_format, not uint32_t. This patch updates every
reference to render_target_format[] git-grep.

Trivial cleanup. No change in behavior.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Move func to right comment block in brw_context.h
Chad Versace [Wed, 24 May 2017 00:02:16 +0000 (17:02 -0700)]
i965: Move func to right comment block in brw_context.h

brw_init_surface_formats() is defined in brw_surface_formats.c, not
brw_wm_surface_state.c.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Document type of GLuint __DRIimage::format
Chad Versace [Tue, 23 May 2017 23:46:59 +0000 (16:46 -0700)]
i965: Document type of GLuint __DRIimage::format

It's either a mesa_format or mesa_array_format.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Add whitespace in intel_update_image_buffers()
Chad Versace [Tue, 23 May 2017 23:37:32 +0000 (16:37 -0700)]
i965: Add whitespace in intel_update_image_buffers()

Improve readability.  Add an empty line between two large 'if' blocks.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Move an 'i' declaration into its 'for' loop
Chad Versace [Tue, 23 May 2017 23:35:34 +0000 (16:35 -0700)]
i965: Move an 'i' declaration into its 'for' loop

In intel_update_dri2_buffers().
Trivial cleanup.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Fix type of intel_update_image_buffers::format
Chad Versace [Tue, 23 May 2017 23:33:50 +0000 (16:33 -0700)]
i965: Fix type of intel_update_image_buffers::format

It's a mesa_format, not an unsigned int.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965: Rename intel_create_renderbuffer
Chad Versace [Tue, 23 May 2017 23:29:25 +0000 (16:29 -0700)]
i965: Rename intel_create_renderbuffer

The name is misleading because the function is unrelated to GL
renderbuffers. Rename it to intel_create_winsys_renderbuffer.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965/dri: Combine declaration and assignment in intelCreateBuffer
Chad Versace [Tue, 23 May 2017 23:07:10 +0000 (16:07 -0700)]
i965/dri: Combine declaration and assignment in intelCreateBuffer

Trivial cleanup.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoi965/dri: Rewrite comment for intelCreateBuffer
Chad Versace [Tue, 23 May 2017 23:04:55 +0000 (16:04 -0700)]
i965/dri: Rewrite comment for intelCreateBuffer

The old comment pinned this function to X11 windows. In reality, this
function serves more than X11 and more than just windows.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agomesa: Avoid leaking surface in st_renderbuffer_delete
Bartosz Tomczyk [Sat, 29 Apr 2017 14:37:45 +0000 (16:37 +0200)]
mesa: Avoid leaking surface in st_renderbuffer_delete

v2: add comment in code

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100741
Fixes: a5e733c6b52 mesa: drop current draw/read buffer when ctx is released
Reviewed-by: Rob Clark <robdclark@gmail.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: advertise EGL_EXT_image_dma_buf_import_modifiers
Varad Gautam [Tue, 30 May 2017 11:53:40 +0000 (17:23 +0530)]
egl: advertise EGL_EXT_image_dma_buf_import_modifiers

v2: check for DRIimageExtension version 15 (Jason Ekstrand)

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl: implement eglQueryDmaBufModifiersEXT
Varad Gautam [Tue, 30 May 2017 11:53:39 +0000 (17:23 +0530)]
egl: implement eglQueryDmaBufModifiersEXT

query and return supported dmabuf format modifiers for
EGL_EXT_image_dma_buf_import_modifiers.

v2: move format check to the driver instead of making format queries
   here and then checking.
v3: Check DRIimageExtension version before query (Daniel Stone)
v4:
- move to DRIimageExtension version 15, check queryDmaBufModifiers before
  calling (Jason Ekstrand)
- pass external_only to the driver instead of setting as EGL_TRUE here
  (Emil Velikov, Daniel Stone)

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl: implement eglQueryDmaBufFormatsEXT
Varad Gautam [Tue, 30 May 2017 11:53:38 +0000 (17:23 +0530)]
egl: implement eglQueryDmaBufFormatsEXT

allow egl clients to query the dmabuf formats supported on this platform.

v2: return EGLBoolean.
v3: Check DRIimageExtension version before querying (Daniel Stone).
v4: move to DRIimageExtension version 15, error checking (Jason Ekstrand).

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: Create EGLImages with dmabuf modifiers
Varad Gautam [Tue, 30 May 2017 11:53:37 +0000 (17:23 +0530)]
egl/dri2: Create EGLImages with dmabuf modifiers

Allow creating EGLImages with dmabuf format modifiers when target is
EGL_LINUX_DMA_BUF_EXT for EGL_EXT_image_dma_buf_import_modifiers.

v2:
- clear modifier assembling and error label name (Eric Engestrom)
v3:
- remove goto jumps within switch-case (Emil Velikov)
- treat zero as valid modifier (Daniel Stone)
- ensure same modifier across all dmabuf planes (Emil Velikov)
v4:
- allow modifiers to add extra planes (Louis-Francis Ratté-Boulianne)
v5:
- fix error checking, some cleanups (Jason Ekstrand)
- pass single copy of the modifier to createImageFromDmaBufs2

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodri: introduce dmabuf format modifier related handles
Varad Gautam [Tue, 30 May 2017 11:53:36 +0000 (17:23 +0530)]
dri: introduce dmabuf format modifier related handles

these allow dmabuf import with modifiers, and supported format and
modifier queries, which are used to implement
EGL_EXT_image_dma_buf_import_modifiers.

v2:
- squash dmabuf queries into DRIimage version 15 (Jason Ekstrand).
- add external_only param to queryDmaBufModifiers (Emil, Daniel Stone)
- pass a single modifier form createImageFromDmaBufs2 since all planes have
the same modifier (Jason Ekstrand)

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/main: add support for fourth plane tokens
Pekka Paalanen [Tue, 30 May 2017 11:53:35 +0000 (17:23 +0530)]
egl/main: add support for fourth plane tokens

The EGL_EXT_dma_buf_import_modifiers extension adds support for a
fourth plane, just like DRM KMS API does.

Bump maximum dma_buf plane count to four.

v2: prevent attribute tokens from being parsed if
    EXT_image_dma_buf_import_modifiers is not suported. (Emil Velikov)

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoegl: introduce DMA_BUF_MAX_PLANES
Pekka Paalanen [Tue, 30 May 2017 11:53:34 +0000 (17:23 +0530)]
egl: introduce DMA_BUF_MAX_PLANES

Rather than hardcoding 3, use a #define. Makes it easier to bump this
later to 4.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agonvc0: support for GP10B
Alexandre Courbot [Thu, 30 Mar 2017 10:05:57 +0000 (19:05 +0900)]
nvc0: support for GP10B

GP10B uses the same 3D class as GP100.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoetnaviv: Don't try to use the index buffer if size is zero
Tomeu Vizoso [Fri, 19 May 2017 10:40:44 +0000 (12:40 +0200)]
etnaviv: Don't try to use the index buffer if size is zero

If info->index_size is zero, info->index will point to uninitialized
memory.

Fatal signal 11 (SIGSEGV), code 2, fault addr 0xab5d07a3 in tid 20456 (surfaceflinger)

lst: Remove useless indexbuf conditional in the index_size != 0 case.

Fixes: 330d0607ed60 ("gallium: remove pipe_index_buffer and set_index_buffer")
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoi965: Always scissor on Gen4-5 instead of disabling guardband.
Kenneth Graunke [Thu, 11 May 2017 07:03:05 +0000 (00:03 -0700)]
i965: Always scissor on Gen4-5 instead of disabling guardband.

See commit ece0e535a44c228dd994861592deb155c14740d8.  This makes
Gen4-5 follow the behavior we use on Gen6+.  It seems to have
worked out there.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Unify Gen4-5 and Gen6 SF_VIEWPORT/CLIP_VIEWPORT code.
Kenneth Graunke [Thu, 11 May 2017 06:27:43 +0000 (23:27 -0700)]
i965: Unify Gen4-5 and Gen6 SF_VIEWPORT/CLIP_VIEWPORT code.

This brings the improved guardbanding we implemented on Gen6+
back to the older Gen4-5 code.  It also deletes piles of code.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Make a set_scissor_bits helper function.
Kenneth Graunke [Thu, 11 May 2017 06:53:05 +0000 (23:53 -0700)]
i965: Make a set_scissor_bits helper function.

Gen4-5 include a single SCISSOR_RECT in SF_VIEWPORT.

Making a helper function will allow us to reuse this code for Gen4-5.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Use GENX(packet_length) rather than hardcoded dword counts.
Kenneth Graunke [Thu, 11 May 2017 06:55:47 +0000 (23:55 -0700)]
i965: Use GENX(packet_length) rather than hardcoded dword counts.

This is clearer and less likely to break in the future.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the scissoring code up near the viewport code.
Kenneth Graunke [Thu, 11 May 2017 06:49:27 +0000 (23:49 -0700)]
i965: Move the scissoring code up near the viewport code.

These are fairly related.  Gen4-5 combine the scissor rectangle and
SF_VIEWPORT.  Co-locating them will allow me to avoid forward
declarations of helper functions in a few patches.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agogenxml: Make a SCISSOR_RECT structure on Gen4-5.
Kenneth Graunke [Thu, 11 May 2017 06:37:23 +0000 (23:37 -0700)]
genxml: Make a SCISSOR_RECT structure on Gen4-5.

Gen6+ support multiple scissor rectangles, and define a SCISSOR_RECT
structure containing their dimensions.  On Gen4-5, those same fields
exist in SF_VIEWPORT.

This patch extracts the SF_VIEWPORT fields into a SCISSOR_RECT
structure.  Although not a named concept on Gen4-5, it works just
as well, and gives us a consistent SCISSOR_RECT structure across
all generations, making it easier to reuse code.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Replace brw->gen and devinfo->gen with GEN_GEN.
Kenneth Graunke [Thu, 11 May 2017 05:55:27 +0000 (22:55 -0700)]
i965: Replace brw->gen and devinfo->gen with GEN_GEN.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Rework Sandybridge 3DSTATE_VIEWPORT_STATE_POINTERS.
Kenneth Graunke [Thu, 11 May 2017 02:39:36 +0000 (19:39 -0700)]
i965: Rework Sandybridge 3DSTATE_VIEWPORT_STATE_POINTERS.

On Gen7+ we emit 3DSTATE_VIEWPORT_STATE_POINTERS_{SF_CL,CC} when
emitting a new viewport.

This patch makes us take the same approach on Sandybridge - but because
we have a combined command, we just set the appropriate "change" bits.
This eliminates an atom, some dirty flagging, and some brw->*.vp_offset
writes.  It does mean we'll emit two 3DSTATE_VIEWPORT_STATE_POINTERS
instead of one if both change, but that's probably fine.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Port CC_VIEWPORT to genxml.
Kenneth Graunke [Thu, 11 May 2017 03:39:26 +0000 (20:39 -0700)]
i965: Port CC_VIEWPORT to genxml.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Ignore INTEL_SCALAR_* debug variables on Gen10+.
Kenneth Graunke [Sat, 13 May 2017 19:11:40 +0000 (12:11 -0700)]
i965: Ignore INTEL_SCALAR_* debug variables on Gen10+.

Scalar mode has been default since Broadwell, and vector mode is getting
increasingly unmaintained.  There are a few things that don't even fully
work in vector mode on Skylake, but we've never cared because nobody
uses it.  There's no point in porting it forward to new platforms.

So, just ignore the debug options to force it on.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomesa: add KHR_no_error support for glBindBufferRange()
Timothy Arceri [Mon, 22 May 2017 05:47:02 +0000 (15:47 +1000)]
mesa: add KHR_no_error support for glBindBufferRange()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: create bind_buffer_range() helper
Timothy Arceri [Mon, 22 May 2017 05:47:01 +0000 (15:47 +1000)]
mesa: create bind_buffer_range() helper

This will help us add KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: convert mesa_bind_buffer_range_transform_feedback() to a validate function
Timothy Arceri [Mon, 22 May 2017 05:47:00 +0000 (15:47 +1000)]
mesa: convert mesa_bind_buffer_range_transform_feedback() to a validate function

This allows some tidy up and also makes it so we can add KHR_no_error
support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: create _mesa_bind_buffer_range_xfb() helper
Timothy Arceri [Mon, 22 May 2017 05:46:59 +0000 (15:46 +1000)]
mesa: create _mesa_bind_buffer_range_xfb() helper

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: split bind_atomic_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:58 +0000 (15:46 +1000)]
mesa: split bind_atomic_buffer() in two

This will help us add KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: split bind_buffer_range_shader_storage_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:57 +0000 (15:46 +1000)]
mesa: split bind_buffer_range_shader_storage_buffer() in two

This will help us implement KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: split bind_buffer_range_uniform_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:56 +0000 (15:46 +1000)]
mesa: split bind_buffer_range_uniform_buffer() in two

This will help us implement KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: add KHR_no_error support for glVertexArrayVertexBuffer()
Timothy Arceri [Mon, 22 May 2017 05:46:55 +0000 (15:46 +1000)]
mesa: add KHR_no_error support for glVertexArrayVertexBuffer()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: add KHR_no_error support for glBindVertexBuffer()
Timothy Arceri [Mon, 22 May 2017 05:46:54 +0000 (15:46 +1000)]
mesa: add KHR_no_error support for glBindVertexBuffer()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: split vertex_array_vertex_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:53 +0000 (15:46 +1000)]
mesa: split vertex_array_vertex_buffer() in two

This will allow us to skip the error checkes when adding
KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agoradv: Reserve space for descriptor and push constant user SGPR setting.
Bas Nieuwenhuizen [Sun, 28 May 2017 22:18:56 +0000 (00:18 +0200)]
radv: Reserve space for descriptor and push constant user SGPR setting.

flush_compute_state doesn't reserve a large chunk, so these need their own reservation.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
7 years agoamd/common: set vcn dec as hw decode as well
Leo Liu [Fri, 5 May 2017 14:54:01 +0000 (10:54 -0400)]
amd/common: set vcn dec as hw decode as well

Recommit after issue resolved by the previous patch.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoamd/common: add vcn dec ip info query for amdgpu version 3.17
Leo Liu [Wed, 3 May 2017 18:06:35 +0000 (14:06 -0400)]
amd/common: add vcn dec ip info query for amdgpu version 3.17

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglthread/gallium: require safe_glthread to start glthread
Gregory Hainaut [Mon, 29 May 2017 11:18:28 +0000 (13:18 +0200)]
glthread/gallium: require safe_glthread to start glthread

Print an error message for the user if the requirement isn't met, or
we're not thread safe.

v2: based on Nicolai feedbacks
Check the DRI extension version

v3: based on Emil feedbacks
improve commit and error messages.
use backgroundCallable variable to improve readability

v5: based on Emil feedbacks
Properly check the function pointer

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: implement __DRIbackgroundCallableExtension.isThreadSafe
Gregory Hainaut [Mon, 29 May 2017 11:18:27 +0000 (13:18 +0200)]
egl: implement __DRIbackgroundCallableExtension.isThreadSafe

v2:
bump version

v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)
Include X11/Xlibint.h protected by ifdef

v5: based on Daniel feedback
Move non X11 code outside of X11 define
Always return true for Wayland

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>