mesa.git
7 years agomesa: add KHR_no_error support for glViewport()
Samuel Pitoiset [Thu, 22 Jun 2017 13:51:46 +0000 (15:51 +0200)]
mesa: add KHR_no_error support for glViewport()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add viewport() helper
Samuel Pitoiset [Thu, 22 Jun 2017 13:26:32 +0000 (15:26 +0200)]
mesa: add viewport() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glViewportArrayv()
Samuel Pitoiset [Thu, 22 Jun 2017 13:24:04 +0000 (15:24 +0200)]
mesa: add KHR_no_error support for glViewportArrayv()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add viewport_array() helper
Samuel Pitoiset [Thu, 22 Jun 2017 13:22:25 +0000 (15:22 +0200)]
mesa: add viewport_array() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glViewportIndexed*()
Samuel Pitoiset [Thu, 22 Jun 2017 13:19:34 +0000 (15:19 +0200)]
mesa: add KHR_no_error support for glViewportIndexed*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename ViewportIndexedf() to viewport_indexed_err()
Samuel Pitoiset [Thu, 22 Jun 2017 13:14:02 +0000 (15:14 +0200)]
mesa: rename ViewportIndexedf() to viewport_indexed_err()

While are at it, add a 'context' parameter for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glClipControl()
Samuel Pitoiset [Thu, 22 Jun 2017 10:01:21 +0000 (12:01 +0200)]
mesa: add KHR_no_error support for glClipControl()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add clip_control() helper
Samuel Pitoiset [Thu, 22 Jun 2017 09:58:44 +0000 (11:58 +0200)]
mesa: add clip_control() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoi965: Convert upload_default_color to genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:18 +0000 (15:08 -0700)]
i965: Convert upload_default_color to genxml.

This function was moved to genX_state_upload.c but was still not using genxml.
By converting it to genxml, we make some things simpler, like setting
haswell's border color state, but others are more complex, since the structs
used by each gen are different.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965: Remove unused code and delete file.
Rafael Antognolli [Tue, 30 May 2017 22:08:17 +0000 (15:08 -0700)]
i965: Remove unused code and delete file.

The sampler state code was all moved to genxml, so we can get rid of these
functions and delete the file.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965: Convert vs, gs, tcs, tes and cs samplers to genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:16 +0000 (15:08 -0700)]
i965: Convert vs, gs, tcs, tes and cs samplers to genxml.

Since they just use the code that is already available in genX_state_upload.c,
convert them in one batch.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965: Convert fs sampler state to use genxml.
Rafael Antognolli [Tue, 30 May 2017 22:08:15 +0000 (15:08 -0700)]
i965: Convert fs sampler state to use genxml.

Also convert some auxiliary functions used by it, and copy
upload_default_color to genX_state_upload.c.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogenxml: fix gen5 sampler border color state.
Rafael Antognolli [Tue, 30 May 2017 22:08:14 +0000 (15:08 -0700)]
genxml: fix gen5 sampler border color state.

Based on the current code, gen5 and gen6 have the same sampler border color
state struct. So fix the gen5 one to match gen6.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoaubinator: Dump sampler state pointers on gen6 too.
Rafael Antognolli [Tue, 30 May 2017 22:08:13 +0000 (15:08 -0700)]
aubinator: Dump sampler state pointers on gen6 too.

We already have a function to dump sampler states, so do that for gen6
too.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Fix -Wswitch in anv_layout_to_aux_usage()
Chad Versace [Thu, 22 Jun 2017 21:39:12 +0000 (14:39 -0700)]
anv: Fix -Wswitch in anv_layout_to_aux_usage()

anv_layout_to_aux_usage() lacked a case for
VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR. Add an unreachable case, because we
don't support the extension.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Fix -Wunused-variable in gen8_write_pma_stall_bits()
Chad Versace [Thu, 22 Jun 2017 21:42:47 +0000 (14:42 -0700)]
i965: Fix -Wunused-variable in gen8_write_pma_stall_bits()

Trivial fix.  'ctx' was unused.

7 years agoi965/CFL: Add PCI Ids for Coffee Lake.
Anusha Srivatsa [Thu, 22 Jun 2017 17:42:32 +0000 (10:42 -0700)]
i965/CFL: Add PCI Ids for Coffee Lake.

Coffee Lake has a gen9 graphics following KBL.
From 3D perspective, CFL is a clone of KBL/SKL features.

v2: Change commit message, correct alignment <Anuj Phogat>
v3: Update IDs.
v4: Initialize l3_banks, correct nomenclature <Anuj>

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Benjamin Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agointel: Enable vulkan build for gen10
Anuj Phogat [Fri, 26 May 2017 15:28:29 +0000 (08:28 -0700)]
intel: Enable vulkan build for gen10

This patch just enables building Vulkan libs for gen10. We
still don't have gen 10 support enabled on Vulkan.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cnl: Generate and use gen10 functions
Anuj Phogat [Fri, 26 May 2017 16:11:20 +0000 (09:11 -0700)]
anv/cnl: Generate and use gen10 functions

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cnl: Don't set FloatBlendOptimizationEnable{Mask}
Anuj Phogat [Tue, 13 Jun 2017 18:08:48 +0000 (11:08 -0700)]
anv/cnl: Don't set FloatBlendOptimizationEnable{Mask}

This field is remove from CACHE_MODE_1 register in gen10.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cnl: Use GENX(xx) in place of GEN9_xx
Anuj Phogat [Fri, 26 May 2017 16:10:35 +0000 (09:10 -0700)]
anv/cnl: Use GENX(xx) in place of GEN9_xx

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cnl: Add #defines for MOCS and genX(x)
Anuj Phogat [Fri, 26 May 2017 16:05:51 +0000 (09:05 -0700)]
anv/cnl: Add #defines for MOCS and genX(x)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/genxml: Add Gen10 CACHE_MODE_1 definitions
Anuj Phogat [Mon, 5 Jun 2017 15:31:01 +0000 (08:31 -0700)]
intel/genxml: Add Gen10 CACHE_MODE_1 definitions

Few of the fields in this register are changed as compared
to gen9.xml.

V2: Remove some fields which are not valid anymore.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Rename StartInstanceLocation to StartingInstanceLocation
Anuj Phogat [Thu, 25 May 2017 22:21:17 +0000 (15:21 -0700)]
intel/genxml: Rename StartInstanceLocation to StartingInstanceLocation

This is required because we already have a macro defined with
the name StartInstanceLocation.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Rename IndirectStatePointer to BorderColorPointer
Anuj Phogat [Thu, 25 May 2017 22:19:44 +0000 (15:19 -0700)]
intel/genxml: Rename IndirectStatePointer to BorderColorPointer

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Combine DataDWord{0, 1} fields in to ImmediateData field
Anuj Phogat [Thu, 25 May 2017 21:51:58 +0000 (14:51 -0700)]
intel/genxml: Combine DataDWord{0, 1} fields in to ImmediateData field

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Add INSTDONE registers in gen10
Anuj Phogat [Thu, 25 May 2017 21:47:54 +0000 (14:47 -0700)]
intel/genxml: Add INSTDONE registers in gen10

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Add better support for MI_MATH in gen10
Anuj Phogat [Thu, 25 May 2017 21:45:23 +0000 (14:45 -0700)]
intel/genxml: Add better support for MI_MATH in gen10

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965/dri: Add intel_screen param to intel_create_winsys_renderbuffer
Chad Versace [Sat, 27 May 2017 00:10:37 +0000 (17:10 -0700)]
i965/dri: Add intel_screen param to intel_create_winsys_renderbuffer

The param is currently unused. It will later be used it to support
R8G8B8X8 EGLConfigs on Skylake.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move brw_context format arrays to intel_screen
Chad Versace [Tue, 30 May 2017 22:57:15 +0000 (15:57 -0700)]
i965: Move brw_context format arrays to intel_screen

This allows us to query the driver's supported formats in i965's DRI code,
where often there is available a DRIscreen but no GL context.

To reduce diff noise, this patch does not completely remove
brw_context's format arrays. It just redeclares them as pointers which
point to the arrays in intel_screen.

Specifically, move these two arrays from brw_context to intel_screen:
    mesa_to_isl_render_format[]
    mesa_format_supports_render[]

And add a new array to intel_screen,
    mesa_format_supportex_texture[]
which brw_init_surface_formats() copies to ctx->TextureFormatSupported.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Rename some vague format members of brw_context
Chad Versace [Tue, 30 May 2017 22:39:26 +0000 (15:39 -0700)]
i965: Rename some vague format members of brw_context

I'm swimming in a vortex of formats. Mesa formats, isl formats, DRI
formats, GL formats, etc.

It's easy to misinterpret the following brw_context members unless
you've recently read their definition.  In upcoming patches, I change
them from embedded arrays to simple pointers; after that, even their
definition doesn't help, because the MESA_FORMAT_COUNT hint will no
longer be present.

Rename them to prevent further confusion. While we're renaming, choose
shorter names too.

    -format_supported_as_render_target
    +mesa_format_supports_render

    -render_target_format
    +mesa_to_isl_render_format

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoegl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)

Rename 'count' to 'config_count'. I didn't understand what the variable
did until I untangled the for-loops. Now the next person won't have that
problem.

v2: Rebase. Fix typo. Apply to all platforms (for emil).

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agoegl/x11: Declare EGLConfig attrib array inside loop
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/x11: Declare EGLConfig attrib array inside loop

No behavioral change. Just a readability cleanup.

Instead of modifying this small array on each loop iteration, we now
initialize it in-place with the values it needs.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/drm: Declare EGLConfig attrib array inside loop
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/drm: Declare EGLConfig attrib array inside loop

No behavioral change. Just a readability cleanup.

Instead of modifying this small array on each loop iteration, we now
initialize it in-place with the values it needs.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: Declare EGLConfig attrib array inside loop (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)]
egl/android: Declare EGLConfig attrib array inside loop (v2)

No behavioral change. Just a readability cleanup.

Instead of modifying this small array on each loop iteration, we now
initialize it in-place with the values it needs.

v2: Rebase.

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agoegl/dri2: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/dri2: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.
This patch touches only egl_dri2.c.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/wayland: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/wayland: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: Move loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/surfaceless: Move loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: Declare loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/x11: Declare loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/drm: Move loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/drm: Move loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: Declare loop vars inside their loops (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/android: Declare loop vars inside their loops (v2)

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

v2: Rebase.

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agosvga: minor whitespace fixes in svga_pipe_vertex.c
Brian Paul [Thu, 22 Jun 2017 19:32:50 +0000 (13:32 -0600)]
svga: minor whitespace fixes in svga_pipe_vertex.c

7 years agosvga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)
Brian Paul [Thu, 22 Jun 2017 18:58:39 +0000 (12:58 -0600)]
svga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)

If the call fails we need to flush the command buffer and retry.  In this
case, we were failing to unbind the GS which led to subsequent errors.

This fixes a bug replaying a Cinebench R15 apitrace in a Linux guest.
VMware bug 1894451

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fix pre-mature flushing of the command buffer
Charmaine Lee [Wed, 21 Jun 2017 22:35:38 +0000 (15:35 -0700)]
svga: fix pre-mature flushing of the command buffer

When surface_invalidate is called to invalidate a newly created surface
in svga_validate_surface_view(), it is possible that the command
buffer is already full, and in this case, currently, the associated wddm
winsys function will flush the command buffer and resend the invalidate
surface command. However, this can pre-maturely flush the command buffer
if there is still pending image updates to be patched.

To fix the problem, this patch will add a return status to the
surface_invalidate interface and if it returns FALSE, the caller will
call svga_context_flush() to do the proper context flush.
Note, we don't call svga_context_flush() if surface_invalidate()
fails when flushing the screen surface cache though, because it is
already in the process of context flush, all the image updates are already
patched, calling svga_context_flush() can trigger a deadlock.
So in this case, we call the winsys context flush interface directly
to flush the command buffer.

Fixes driver errors and graphics corruption running Tropics. VMware bug 1891975.

Also tested with MTT glretrace, piglit and various OpenGL apps such as
Heaven, CinebenchR15, NobelClinicianViewer, Lightsmark, GoogleEarth.

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agoswr: invalidate attachment on transition change
George Kyriazis [Thu, 15 Jun 2017 19:39:36 +0000 (14:39 -0500)]
swr: invalidate attachment on transition change

Consider the following RT attachment order:
1. Attach surfaces attachments 0 & 1, and render with them
2. Detach 0 & 1
3. Re-attach 0 & 1 to different surfaces
4. Render with the new attachment

The definition of a tile being resolved is that local changes have been
flushed out to the surface, hence there is no need to reload the tile before
it's written to.  For an invalid tile, the tile has to be reloaded from
the surface before rendering.

Stage (2) was marking hot tiles for attachements 0 & 1 as RESOLVED,
which means that the hot tiles can be written out to memory with no
need to read them back in (they are "clean").  They need to be marked as
resolved here, because a surface may be destroyed after a detach, and we
don't want to have un-resolved tiles that may force a readback from a
NULL (destroyed) surface.  (Part of a destroy is detach all attachments first)

Stage (3), during the no att -> att transition, we  need to realize that the
"new" surface tiles need to be fetched fresh from the new surface, instead
of using the resolved tiles, that belong to a stale attachment.

This is done by marking the hot tiles as invalid in stage (3), when we realize
that a new attachment is being made, so that they are re-fetched during
rendering in stage (4).

Also note that hot tiles are indexed by attachment.

- Fixes VTK dual depth-peeling tests.
- No piglit changes

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoRevert "getteximage: Return correct error value when texure object is not found"
Juan A. Suarez Romero [Thu, 22 Jun 2017 16:16:16 +0000 (18:16 +0200)]
Revert "getteximage: Return correct error value when texure object is not found"

From OpenGL 4.5 spec PDF, section '8.11. Texture Queries', page 236:
  "An INVALID_VALUE error is generated if texture is not the name of
   an existing texture object."

Same wording applies to the compressed version.

But turns out this is a spec bug, and Khronos is fixing it for the next
revisions.

The proposal is to return INVALID_OPERATION in these cases.

This reverts commit 633c959faeae5099fd095f27da7b954e4a36254b.

v2:
- Use _mesa_lookup_texture_err (Samuel Pitoiset)

v3:
- _mesa_lookup_texture_err() already handles texture > 0 (Samuel
Pitoiset)
- Just revert 633c959fae (Juan A. Suarez)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoegl: properly count configs
Eric Engestrom [Wed, 21 Jun 2017 20:55:56 +0000 (21:55 +0100)]
egl: properly count configs

dri2_conf represents another config (which shouldn't be counted)
if it doesn't have the requested ID.

Reported-by: Liu Zhiquan <zhiquan.liu@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/android: Change order of EGLConfig generation (v2)
Chad Versace [Sat, 17 Jun 2017 02:11:21 +0000 (19:11 -0700)]
egl/android: Change order of EGLConfig generation (v2)

Many Android apps (such as Google's official NDK GLES2 example app), and
even portions the core framework code (such as SystemServiceManager in
Nougat), incorrectly choose their EGLConfig.  They neglect to match the
EGLConfig's EGL_NATIVE_VISUAL_ID against the window's native format, and
instead choose the first EGLConfig whose channel sizes match those of
the native window format while ignoring the channel *ordering*.

We can detect such buggy clients in logcat when they call
eglCreateSurface, by detecting the mismatch between the EGLConfig's
format and the window's format.

As a workaround, this patch changes the order of EGLConfig generation
such that all EGLConfigs for HAL pixel format i precede those for HAL
pixel format i+1. In my (chadversary) testing on Android Nougat, this
was good enough to pacify the buggy clients.

v2: Rebase to make patch cherry-pickable to stable.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915: Fix gl_Fragcoord interpolation
Ville Syrjälä [Tue, 20 Jun 2017 19:05:04 +0000 (22:05 +0300)]
i915: Fix gl_Fragcoord interpolation

gl_FragCoord contains the window coordinates so it seems to me that
we should not use perspective correct interpolation for it. At least
now I get similar output as i965/swrast/llvmpipe produce.

This fixes dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w.
dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_xyz was already
passing, though I'm not quite sure how it managed to do that.

v2: Add definitons for the S3 "wrap shortest" bits as well (Ian)

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoegl: simplify dri_config conditionals
Eric Engestrom [Wed, 21 Jun 2017 09:40:31 +0000 (10:40 +0100)]
egl: simplify dri_config conditionals

In the same spirit as 858f2f2ae6 (egl/dri2: ease srgb __DRIconfig
conditionals), let's merge dri_single_config and dri_double_config into
a single dri_config[2].

This moves the `if (double) dri_double_config else dri_single_config`
logic to `dri_config[double]`, reducing code duplication and making it
easier to read.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi/gfx9: enable DCC fast clear
Marek Olšák [Fri, 12 May 2017 22:44:24 +0000 (00:44 +0200)]
radeonsi/gfx9: enable DCC fast clear

It seems to work now.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: don't ever flush the TC metadata cache
Marek Olšák [Tue, 20 Jun 2017 16:26:12 +0000 (18:26 +0200)]
radeonsi/gfx9: don't ever flush the TC metadata cache

The closed Vulkan driver doesn't do it either.

Also remove some old comments that aren't useful.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: use TC L2 for fast color clear with CP DMA
Marek Olšák [Tue, 20 Jun 2017 16:25:05 +0000 (18:25 +0200)]
radeonsi/gfx9: use TC L2 for fast color clear with CP DMA

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fix DCC fast clear for luminance and alpha formats
Marek Olšák [Tue, 20 Jun 2017 15:20:34 +0000 (17:20 +0200)]
radeonsi: fix DCC fast clear for luminance and alpha formats

I reproduced this bug on Polaris11 and Raven.

I can't get this bug on Fiji. The reason might be that Fiji doesn't use
2D tiling for the test due to higher 2D tiling alignment requirements.

Fixes piglit: spec@ext_framebuffer_object@fbo-fast-clear

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't emit partial flushes at the end of IBs (v2)
Marek Olšák [Fri, 16 Jun 2017 12:25:34 +0000 (14:25 +0200)]
radeonsi: don't emit partial flushes at the end of IBs (v2)

The kernel sort of does the same thing with fences.

v2: do emit partial flushes on SI

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoanv: FORMAT_FEATURE_TRANSFER_SRC/DST_BIT_KHR not used with VkFormatProperties.bufferF...
Andres Gomez [Wed, 14 Jun 2017 16:55:56 +0000 (19:55 +0300)]
anv: FORMAT_FEATURE_TRANSFER_SRC/DST_BIT_KHR not used with VkFormatProperties.bufferFeatures

VK_FORMAT_FEATURE_TRANSFER_[SRC|DST]_BIT_KHR is a flag value of the
VkFormatFeatureFlagBits enum that can only be hold and checked against
the linearTilingFeatures or optimalTilingFeatures members of the
VkFormatProperties struct but not the bufferFeatures member.

>From the Vulkan® 1.0.51, with the VK_KHR_maintenance1 extension,
section 32.3.2 docs for VkFormatProperties:

   "* linearTilingFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by images created with a tiling
      parameter of VK_IMAGE_TILING_LINEAR.

    * optimalTilingFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by images created with a tiling
      parameter of VK_IMAGE_TILING_OPTIMAL.

    * bufferFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by buffers."

    ...

    Bits which can be set in the VkFormatProperties features
    linearTilingFeatures, optimalTilingFeatures, and bufferFeatures
    are:

    typedef enum VkFormatFeatureFlagBits {

    ...

      VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000,
      VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000,

    ...

    } VkFormatFeatureFlagBits;

    ...

    The following bits may be set in linearTilingFeatures and
    optimalTilingFeatures, specifying that the features are supported
    by images or image views created with the queried
    vkGetPhysicalDeviceFormatProperties::format:

    ...

    * VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR specifies that an image
      can be used as a source image for copy commands.

    * VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR specifies that an image
      can be used as a destination image for copy commands and clear
      commands."

Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agochange va max_entrypoints
Chandu Babu N [Sat, 17 Jun 2017 11:49:13 +0000 (11:49 +0000)]
change va max_entrypoints

As encode support is added along with decode, increase max_entrypoints to two.
vaMaxNumEntrypoints was returning incorrect value and causing
memory corruption before this commit

v2: assert when max_entrypoints needs to be bigger

CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Fix leak in VAAPI subpictures
Chandu Babu N [Thu, 22 Jun 2017 05:18:41 +0000 (10:48 +0530)]
st/va: Fix leak in VAAPI subpictures

sampler view allocated in vaAssociateSubpicture is not cleared
in vaiDeassociateSubpicture.

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoglsl: tidy up int declaration
Timothy Arceri [Wed, 21 Jun 2017 10:12:12 +0000 (20:12 +1000)]
glsl: tidy up int declaration

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: fix typo in comment
Timothy Arceri [Wed, 21 Jun 2017 10:12:11 +0000 (20:12 +1000)]
glsl: fix typo in comment

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: fix using texture id 0 with glTextureSubImage*()
Samuel Pitoiset [Wed, 21 Jun 2017 08:11:49 +0000 (10:11 +0200)]
mesa: fix using texture id 0 with glTextureSubImage*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with gl*TextureParameter*()
Samuel Pitoiset [Wed, 21 Jun 2017 08:04:49 +0000 (10:04 +0200)]
mesa: fix using texture id 0 with gl*TextureParameter*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with VDPAURegisterSurfaceNV()
Samuel Pitoiset [Wed, 21 Jun 2017 08:01:55 +0000 (10:01 +0200)]
mesa: fix using texture id 0 with VDPAURegisterSurfaceNV()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with glTextureStorage*()
Samuel Pitoiset [Wed, 21 Jun 2017 07:56:55 +0000 (09:56 +0200)]
mesa: fix using texture id 0 with glTextureStorage*()

This fixes an assertion in debug build, and probably a crash
in release build.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: pass the 'caller' function to texturestorage() helper
Samuel Pitoiset [Wed, 21 Jun 2017 07:54:49 +0000 (09:54 +0200)]
mesa: pass the 'caller' function to texturestorage() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use _mesa_lookup_texture_err() in get_tex_obj_for_clear()
Samuel Pitoiset [Wed, 21 Jun 2017 08:09:47 +0000 (10:09 +0200)]
mesa: use _mesa_lookup_texture_err() in get_tex_obj_for_clear()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove unused _mesa_delete_nameless_texture()
Samuel Pitoiset [Wed, 21 Jun 2017 07:41:50 +0000 (09:41 +0200)]
mesa: remove unused _mesa_delete_nameless_texture()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: check for allocation failures in _mesa_new_texture_object()
Samuel Pitoiset [Wed, 21 Jun 2017 07:07:36 +0000 (09:07 +0200)]
mesa: check for allocation failures in _mesa_new_texture_object()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradeonsi: use the correct LLVMTargetMachineRef in si_build_shader_variant
Nicolai Hähnle [Mon, 12 Jun 2017 20:33:56 +0000 (22:33 +0200)]
radeonsi: use the correct LLVMTargetMachineRef in si_build_shader_variant

si_build_shader_variant can actually be called directly from one of
normal-priority compiler threads. In that case, the thread_index is
only valid for the normal tm array.

v2:
- use the correct sel/shader->compiler_ctx_state

Fixes: 86cc8097266c ("radeonsi: use a compiler queue with a low priority for optimized shaders")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/gfx9: keep reusing the same buffer/address for the gfx9 flush fence
Marek Olšák [Tue, 6 Jun 2017 22:16:46 +0000 (00:16 +0200)]
radeonsi/gfx9: keep reusing the same buffer/address for the gfx9 flush fence

instead of using a monotonic suballocator

v2: initialize the memory at context creation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: enable the constant engine
Marek Olšák [Fri, 12 May 2017 22:40:34 +0000 (00:40 +0200)]
radeonsi/gfx9: enable the constant engine

I think this kernel commit fixes it:
     drm/amdgpu:use FRAME_CNTL for new GFX ucode

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: indirect buffers and all CP packets use TC L2
Marek Olšák [Tue, 6 Jun 2017 10:13:40 +0000 (12:13 +0200)]
radeonsi/gfx9: indirect buffers and all CP packets use TC L2

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: flush CB after MSAA only when transitioning from CB to textures
Marek Olšák [Wed, 14 Jun 2017 23:42:46 +0000 (01:42 +0200)]
radeonsi: flush CB after MSAA only when transitioning from CB to textures

The main flush before texturing is done after the FMASK decompress pass.

CB after MSAA rendering is not flushed in set_framebuffer_state and also
not in memory_barrier if the current color buffer is MSAA. We fully rely
on the FMASK decompress pass for the flushing.

Some CB decompress and resolve passes need an explicit flush before and
after.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: unify CB_RESOLVE blitter invocation code
Marek Olšák [Wed, 14 Jun 2017 23:23:22 +0000 (01:23 +0200)]
radeonsi: unify CB_RESOLVE blitter invocation code

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: flush DB caches only when transitioning from DB to texturing
Marek Olšák [Wed, 14 Jun 2017 22:34:08 +0000 (00:34 +0200)]
radeonsi: flush DB caches only when transitioning from DB to texturing

Use the mechanism of si_decompress_textures, but instead of doing
the actual decompression, just flag the DB cache flush there.

This removes a lot of unnecessary DB cache flushes.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add separate HUD counters for CB and DB cache flushes
Marek Olšák [Wed, 14 Jun 2017 22:29:41 +0000 (00:29 +0200)]
radeonsi: add separate HUD counters for CB and DB cache flushes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set the border color if it's unused
Marek Olšák [Thu, 15 Jun 2017 11:45:24 +0000 (13:45 +0200)]
st/mesa: don't set the border color if it's unused

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set 16 scissors and 16 viewports if they're unused
Marek Olšák [Wed, 14 Jun 2017 21:09:24 +0000 (23:09 +0200)]
st/mesa: don't set 16 scissors and 16 viewports if they're unused

Only do so if there is a shader writing gl_ViewportIndex.
This removes a lot of CPU overhead for the most common case.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: fix pipe_rasterizer_state::scissor with multiple viewports
Marek Olšák [Wed, 14 Jun 2017 21:02:04 +0000 (23:02 +0200)]
st/mesa: fix pipe_rasterizer_state::scissor with multiple viewports

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify st_update_viewport
Marek Olšák [Wed, 14 Jun 2017 20:45:13 +0000 (22:45 +0200)]
st/mesa: simplify st_update_viewport

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: remove redundant sample_mask checking
Marek Olšák [Wed, 14 Jun 2017 20:37:31 +0000 (22:37 +0200)]
st/mesa: remove redundant sample_mask checking

cso does that too

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: use precomputed st_fb_orientation
Marek Olšák [Wed, 14 Jun 2017 20:36:28 +0000 (22:36 +0200)]
st/mesa: use precomputed st_fb_orientation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: don't call _mesa_update_clip_plane in the GL core profile
Marek Olšák [Wed, 14 Jun 2017 12:46:43 +0000 (14:46 +0200)]
mesa: don't call _mesa_update_clip_plane in the GL core profile

It uses the projection matrix to transform the clip plane.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agost/mesa: set st_context::...num_samplers to 0 when there are no samplers
Marek Olšák [Wed, 14 Jun 2017 16:31:06 +0000 (18:31 +0200)]
st/mesa: set st_context::...num_samplers to 0 when there are no samplers

This was missed during my st/mesa series.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: unify fail paths for update_single_texture
Marek Olšák [Mon, 12 Jun 2017 17:29:37 +0000 (19:29 +0200)]
st/mesa: unify fail paths for update_single_texture

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't call u_sampler_view_default_template for sampler views
Marek Olšák [Sun, 11 Jun 2017 23:27:26 +0000 (01:27 +0200)]
st/mesa: don't call u_sampler_view_default_template for sampler views

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: always set sampler swizzle according to the texture base format
Marek Olšák [Sun, 11 Jun 2017 23:20:34 +0000 (01:20 +0200)]
st/mesa: always set sampler swizzle according to the texture base format

Mainly don't (indirectly) call util_format_description here.

If the driver supports texture swizzling, this will always do the right
thing. If the driver doesn't support it, it doesn't matter.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: samplers only need to track whether GLSL >= 130
Marek Olšák [Sun, 11 Jun 2017 23:15:59 +0000 (01:15 +0200)]
st/mesa: samplers only need to track whether GLSL >= 130

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify get_texture_format_swizzle
Marek Olšák [Sun, 11 Jun 2017 23:04:34 +0000 (01:04 +0200)]
st/mesa: simplify get_texture_format_swizzle

- Don't check GL_NONE (that was only for buffers).
- Don't use util_format_is_depth_or_stencil.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: add an entirely separate codepath for setting up buffer views
Marek Olšák [Sun, 11 Jun 2017 23:00:04 +0000 (01:00 +0200)]
st/mesa: add an entirely separate codepath for setting up buffer views

Remove handling of buffers from all texture paths.
This simplifies things for both buffers and textures.

get_sampler_view_format is also cleaned up not to call
util_format_is_depth_and_stencil.

v2: also update st_NewTextureHandle

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
7 years agost/mesa: don't return an error from update_single_texture
Marek Olšák [Sat, 10 Jun 2017 23:41:40 +0000 (01:41 +0200)]
st/mesa: don't return an error from update_single_texture

It can just return a NULL sampler view, which is better than not doing
anything at all.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: clean up trivial dereferences in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:40:15 +0000 (01:40 +0200)]
st/mesa: clean up trivial dereferences in update_textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't check MaxTextureImageUnits in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:37:18 +0000 (01:37 +0200)]
st/mesa: don't check MaxTextureImageUnits in update_textures

The linker takes care of it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't call st_shader_stage_to_ptarget in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:32:19 +0000 (01:32 +0200)]
st/mesa: don't call st_shader_stage_to_ptarget in update_textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: inline a few frequently-used functions
Marek Olšák [Sat, 10 Jun 2017 23:08:37 +0000 (01:08 +0200)]
cso: inline a few frequently-used functions

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: don't return errors from sampler functions
Marek Olšák [Sat, 10 Jun 2017 21:23:56 +0000 (23:23 +0200)]
cso: don't return errors from sampler functions

No code checks the errors.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: don't track the number of sampler states bound
Marek Olšák [Sat, 10 Jun 2017 21:12:25 +0000 (23:12 +0200)]
cso: don't track the number of sampler states bound

This removes 2 loops from hot codepaths and adds 1 loop to a rare codepath
(restore_sampler_states), and makes sanitize_hash() slightly worse.

Sampler states, when bound, are not unbound for draw calls that don't need
them. That's OK, because bound sampler states don't add any overhead.

This results in lower CPU overhead in most cases.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: sink and simplify texBaseFormat getting for sampler states
Marek Olšák [Sat, 10 Jun 2017 20:44:10 +0000 (22:44 +0200)]
st/mesa: sink and simplify texBaseFormat getting for sampler states

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set sampler states for TBOs
Marek Olšák [Thu, 15 Jun 2017 01:00:59 +0000 (03:00 +0200)]
st/mesa: don't set sampler states for TBOs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: optimize sampler state translation code
Marek Olšák [Sat, 10 Jun 2017 20:34:34 +0000 (22:34 +0200)]
st/mesa: optimize sampler state translation code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>