mesa.git
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>
7 years agost/mesa: sink code needed for apply_texture_swizzle_to_border_color
Marek Olšák [Sat, 10 Jun 2017 20:13:48 +0000 (22:13 +0200)]
st/mesa: sink code needed for apply_texture_swizzle_to_border_color

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify update_shader_samplers
Marek Olšák [Sat, 10 Jun 2017 19:59:07 +0000 (21:59 +0200)]
st/mesa: simplify update_shader_samplers

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: when binding sampler states, don't check the max sampler limit
Marek Olšák [Sat, 10 Jun 2017 19:57:20 +0000 (21:57 +0200)]
st/mesa: when binding sampler states, don't check the max sampler limit

The GLSL linker takes care of it.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't unbind sampler states if none are used
Marek Olšák [Sat, 10 Jun 2017 19:39:16 +0000 (21:39 +0200)]
st/mesa: don't unbind sampler states if none are used

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agost/mesa: unify update_gp/tcp/tep code
Marek Olšák [Sat, 10 Jun 2017 18:13:14 +0000 (20:13 +0200)]
st/mesa: unify update_gp/tcp/tep code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't search through shader variants if there is only one
Marek Olšák [Sat, 10 Jun 2017 18:05:24 +0000 (20:05 +0200)]
st/mesa: don't search through shader variants if there is only one

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't track shader variants in st_context
Marek Olšák [Sat, 10 Jun 2017 17:58:06 +0000 (19:58 +0200)]
st/mesa: don't track shader variants in st_context

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: move blend color into its own state atom
Marek Olšák [Sat, 10 Jun 2017 17:36:11 +0000 (19:36 +0200)]
st/mesa: move blend color into its own state atom

This is now sensible thanks to the NewBlendColor flag.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: check correctly if multisampling is enabled
Marek Olšák [Sat, 10 Jun 2017 00:15:34 +0000 (02:15 +0200)]
st/mesa: check correctly if multisampling is enabled

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't invoke st_finalize_texture & st_convert_sampler for TBOs
Marek Olšák [Tue, 20 Jun 2017 19:32:28 +0000 (21:32 +0200)]
st/mesa: don't invoke st_finalize_texture & st_convert_sampler for TBOs

This is a v2 of the previous patch (v1 didn't skip st_finalize_texture).

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: simplify _mesa_is_image_unit_valid for buffers
Marek Olšák [Sun, 11 Jun 2017 22:49:15 +0000 (00:49 +0200)]
mesa: simplify _mesa_is_image_unit_valid for buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa
Marek Olšák [Sat, 10 Jun 2017 15:22:09 +0000 (17:22 +0200)]
mesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa

v2: also update _mesa_uniform_handle for bindless textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: Track whether uniforms are active per stage
Kenneth Graunke [Sat, 13 Sep 2014 18:13:26 +0000 (11:13 -0700)]
glsl: Track whether uniforms are active per stage

for finer granularity state flagging

v2: Marek - use a bitmask, add shader cache support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_PROGRAM_CONSTANTS for non-GLSL programs for st/mesa
Marek Olšák [Sat, 10 Jun 2017 15:22:09 +0000 (17:22 +0200)]
mesa: don't flag _NEW_PROGRAM_CONSTANTS for non-GLSL programs for st/mesa

This has the benefit that we get to set up constants for exactly
the shader stage that needs it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: flush vertices before updating ctx->_Shader
Marek Olšák [Sat, 10 Jun 2017 13:41:22 +0000 (15:41 +0200)]
mesa: flush vertices before updating ctx->_Shader

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: set driver flags for glPopAttrib(GL_ENABLE_BIT) properly
Marek Olšák [Sat, 10 Jun 2017 10:38:13 +0000 (12:38 +0200)]
mesa: set driver flags for glPopAttrib(GL_ENABLE_BIT) properly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_POLYGON_STIPPLE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:31:33 +0000 (12:31 +0200)]
mesa: don't flag _NEW_POLYGON_STIPPLE for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_LINE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:25:50 +0000 (12:25 +0200)]
mesa: don't flag _NEW_LINE for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_POLYGON for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:18:34 +0000 (12:18 +0200)]
mesa: don't flag _NEW_POLYGON for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for st/mesa if possible
Marek Olšák [Sat, 10 Jun 2017 10:09:43 +0000 (12:09 +0200)]
mesa: don't flag _NEW_TRANSFORM for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for Transform.RasterPositionUnclipped
Marek Olšák [Sat, 10 Jun 2017 09:55:50 +0000 (11:55 +0200)]
mesa: don't flag _NEW_TRANSFORM for Transform.RasterPositionUnclipped

It's not a driver state, it's for glRasterPos.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for primitive restart
Marek Olšák [Sat, 10 Jun 2017 09:51:40 +0000 (11:51 +0200)]
mesa: don't flag _NEW_TRANSFORM for primitive restart

It's a draw state.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_VIEWPORT for st/mesa if possible
Marek Olšák [Sat, 10 Jun 2017 00:39:06 +0000 (02:39 +0200)]
mesa: don't flag _NEW_VIEWPORT for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: flush vertices before changing viewports
Marek Olšák [Sat, 10 Jun 2017 00:28:05 +0000 (02:28 +0200)]
mesa: flush vertices before changing viewports

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_MULTISAMPLE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 00:14:15 +0000 (02:14 +0200)]
mesa: don't flag _NEW_MULTISAMPLE for st/mesa

There are several new driver flags here so that it maps nicely to gallium.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_COLOR for st/mesa if possible
Marek Olšák [Fri, 9 Jun 2017 23:46:34 +0000 (01:46 +0200)]
mesa: don't flag _NEW_COLOR for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use DriverFlags.NewAlphaTest to communicate alphatest changes to st/mesa
Marek Olšák [Fri, 9 Jun 2017 23:07:59 +0000 (01:07 +0200)]
mesa: use DriverFlags.NewAlphaTest to communicate alphatest changes to st/mesa

Now AlphaFunc avoids the blend state update in st/mesa and avoids
_mesa_update_state_locked.

The GL_ALPHA_TEST enable won't trigger blend state updates in st/mesa
after st/mesa stops relying on _NEW_COLOR.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_DEPTH for st/mesa
Marek Olšák [Fri, 9 Jun 2017 22:58:04 +0000 (00:58 +0200)]
mesa: don't flag _NEW_DEPTH for st/mesa

skipping _mesa_update_state_locked

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_set_varying_vp_inputs a no-op in GL core profile
Marek Olšák [Fri, 9 Jun 2017 22:52:51 +0000 (00:52 +0200)]
mesa: make _mesa_set_varying_vp_inputs a no-op in GL core profile

just don't set _NEW_VARYING_VP_INPUTS.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove _NEW_BUFFER_OBJECT
Marek Olšák [Fri, 9 Jun 2017 22:48:53 +0000 (00:48 +0200)]
mesa: remove _NEW_BUFFER_OBJECT

not used

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_SCISSOR for st/mesa
Marek Olšák [Fri, 9 Jun 2017 22:30:18 +0000 (00:30 +0200)]
mesa: don't flag _NEW_SCISSOR for st/mesa

Not needed and we get to bypass _mesa_update_state_locked that would be
a no-op.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't execute most of _mesa_update_state_locked for GL core profile
Marek Olšák [Fri, 9 Jun 2017 22:14:11 +0000 (00:14 +0200)]
mesa: don't execute most of _mesa_update_state_locked for GL core profile

There is plenty of legacy stuff here.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: simplify handling the return value of update_program
Marek Olšák [Fri, 9 Jun 2017 22:01:21 +0000 (00:01 +0200)]
mesa: simplify handling the return value of update_program

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: simplify a loop in _mesa_update_texture_state
Marek Olšák [Fri, 9 Jun 2017 21:54:16 +0000 (23:54 +0200)]
mesa: simplify a loop in _mesa_update_texture_state

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: replace VP/FP/ATIfs _Enabled flags with helper functions
Marek Olšák [Fri, 9 Jun 2017 21:27:41 +0000 (23:27 +0200)]
mesa: replace VP/FP/ATIfs _Enabled flags with helper functions

These are only used in the GL compatibility profile.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't update draw buffer bounds in _mesa_update_state
Marek Olšák [Fri, 9 Jun 2017 20:19:33 +0000 (22:19 +0200)]
mesa: don't update draw buffer bounds in _mesa_update_state

st/mesa doesn't need the draw bounds for draw calls. I've added the call
where it's necessary in core Mesa and drivers, but I suspect that most
drivers can just move the call to the right places.

The core Mesa places aren't hot paths, so the call overhead doesn't matter
there.

For now, only st/mesa is made such that this function is invoked very
rarely.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove update_framebuffer_size
Marek Olšák [Fri, 9 Jun 2017 20:47:16 +0000 (22:47 +0200)]
mesa: remove update_framebuffer_size

For the default framebuffer, _mesa_resize_framebuffer updates it.
For FBOs, _mesa_test_framebuffer_completeness updates it.

This code is redundant.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agomesa: replace ctx->Polygon._FrontBit with a helper function
Marek Olšák [Fri, 9 Jun 2017 19:42:12 +0000 (21:42 +0200)]
mesa: replace ctx->Polygon._FrontBit with a helper function

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: replace ctx->VertexProgram._TwoSideEnabled with a helper function
Marek Olšák [Fri, 9 Jun 2017 19:27:18 +0000 (21:27 +0200)]
mesa: replace ctx->VertexProgram._TwoSideEnabled with a helper function

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: stop using _NEW_STENCIL with st/mesa, use DriverFlags.NewStencil instead
Marek Olšák [Fri, 9 Jun 2017 18:51:20 +0000 (20:51 +0200)]
mesa: stop using _NEW_STENCIL with st/mesa, use DriverFlags.NewStencil instead

This bypasses _mesa_update_state_locked.

Before:
   DrawElements ( 1 VBOs, 4 UBOs,  8 Tex) w/ stencil enable change:    3.99 million
   DrawArrays   ( 1 VBOs, 4 UBOs,  8 Tex) w/ stencil enable change:    4.56 million

After:
   DrawElements ( 1 VBOs, 4 UBOs,  8 Tex) w/ stencil enable change:    4.93 million
   DrawArrays   ( 1 VBOs, 4 UBOs,  8 Tex) w/ stencil enable change:    5.84 million

It's quite a difference in the draw call rate when ctx->NewState stays
equal to 0 the whole time.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: replace _mesa_update_stencil() with helper functions
Marek Olšák [Fri, 9 Jun 2017 18:37:34 +0000 (20:37 +0200)]
mesa: replace _mesa_update_stencil() with helper functions

The idea is to remove the dependency on _mesa_update_state_locked,
so that st/mesa can skip it for stencil state updates, and then stop
setting _NEW_STENCIL in mesa/main if the driver is st/mesa.

The main motivation is to stop invoking _mesa_update_state_locked for
certain state groups.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agometa: do the full FBO completeness check in decompress_texture_image
Marek Olšák [Tue, 20 Jun 2017 11:44:31 +0000 (13:44 +0200)]
meta: do the full FBO completeness check in decompress_texture_image

_mesa_update_state will no longer recompute Width/Height if the framebuffer
is complete. We now rely on the FBO completeness check to do it.

The only code that needs to be fixed seems to be this one.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoi965/gen6: Use isl-based miptree also for stencil rbs
Pohjolainen, Topi [Wed, 21 Jun 2017 19:35:46 +0000 (22:35 +0300)]
i965/gen6: Use isl-based miptree also for stencil rbs

Fixes dEQP-EGL.functional.image.render_multiple_contexts.
gles2_renderbuffer_stencil_stencil_buffer

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Remove spurious mutex frobbing around call to intel_miptree_blit
Ian Romanick [Mon, 19 Jun 2017 19:28:54 +0000 (12:28 -0700)]
i965: Remove spurious mutex frobbing around call to intel_miptree_blit

These locks were added in 2f28a0dc, but I don't see anything in the
intel_miptree_blit path that should make this necessary.

When asked, Kristian says:

    I doubt it's needed now with the new blorp. If I remember correctly,
    I had to drop the lock there since intel_miptree_blit() could hit
    the XY blit path that requires a fast clear resolve. The fast
    resolve being meta, would then try to lock the texture again.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
7 years agoegl: turn one more boolean `int` into a `bool`
Eric Engestrom [Sun, 18 Jun 2017 23:16:51 +0000 (00:16 +0100)]
egl: turn one more boolean `int` into a `bool`

Same as the previous commit, but this one was split out because it's
a bit more complicated: this field is given as a pointer to a function,
so the function had to be changed as well, and the function was use in
a bunch of places, which needed updating as well.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: turn boolean `int`s into `bool`s
Eric Engestrom [Sun, 18 Jun 2017 23:16:21 +0000 (00:16 +0100)]
egl: turn boolean `int`s into `bool`s

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965/miptree: Move isl_surf_get_(hiz|mcs)_surf out of the assert
Jason Ekstrand [Wed, 21 Jun 2017 18:15:25 +0000 (11:15 -0700)]
i965/miptree: Move isl_surf_get_(hiz|mcs)_surf out of the assert

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101535
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101538
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101539
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/genxml: Use the same naming convention for Floating Point Mode.
Rafael Antognolli [Tue, 13 Jun 2017 23:50:08 +0000 (16:50 -0700)]
intel/genxml: Use the same naming convention for Floating Point Mode.

In newer gens, this field has a prefix and the non-IEEEE-745 mode is called
"Alternate", instead of simply "Alt".

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Normalize URB Data field in WM_STATE.
Rafael Antognolli [Tue, 13 Jun 2017 23:47:51 +0000 (16:47 -0700)]
intel/genxml: Normalize URB Data field in WM_STATE.

On gen6+, this is called "Dispatch GRF Start Register For Constant/Setup Data
0", while on gen5 and lower it's called only "Dispatch GRF Start Register For
URB Data", but it's essentially the same thing (URB data), so rename it to
match newer gens and simplify the C code that handles it.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Rename field on WM_STATE to match gen6+.
Rafael Antognolli [Tue, 13 Jun 2017 23:46:19 +0000 (16:46 -0700)]
intel/genxml: Rename field on WM_STATE to match gen6+.

"Pixel Shader Kill Pixel" -> "Pixel Shader Kills Pixel", which is how it's
called on newer gens.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Normalize fields on WM_STATE.
Rafael Antognolli [Tue, 13 Jun 2017 23:43:59 +0000 (16:43 -0700)]
intel/genxml: Normalize fields on WM_STATE.

On gen4, WM_STATE only has one Kernel Start Pointer and one GRF Register
Count, but we can make the code that handles this on multiple gens simpler if
we add an index 0 to it too.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Add missing field to CLIP_STATE.
Rafael Antognolli [Thu, 8 Jun 2017 23:03:05 +0000 (16:03 -0700)]
intel/genxml: Add missing field to CLIP_STATE.

Just because it's not set doesn't mean that it doesn't exist. And since the
field is there on newer gens, having it on gen5 simplifies the code when
porting gen5 and lower.

Also add missing value to API Mode on CLIP_STATE on gen4.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Fix type of UserClipFlags ClipTest Enable Bitmask.
Rafael Antognolli [Thu, 8 Jun 2017 22:48:02 +0000 (15:48 -0700)]
intel/genxml: Fix type of UserClipFlags ClipTest Enable Bitmask.

This is a bitmask, so it can't be a boolean. Also rename it so it matches
gen6+.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Add missing fields to CLIP_STATE on gen4-5.
Rafael Antognolli [Thu, 8 Jun 2017 19:31:10 +0000 (12:31 -0700)]
intel/genxml: Add missing fields to CLIP_STATE on gen4-5.

These fields are set by brw_clip_unit, so we need them when converting to
genxml.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/genxml: Normalize GS_STATE.
Rafael Antognolli [Wed, 7 Jun 2017 20:03:19 +0000 (13:03 -0700)]
intel/genxml: Normalize GS_STATE.

Rename "Rendering Enable" to "Rendering Enabled", so it matches gen6+.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi915: Always emit W on gen3
Ville Syrjälä [Fri, 16 Jun 2017 20:23:41 +0000 (23:23 +0300)]
i915: Always emit W on gen3

Unlike the older gen2 hardware, gen3 performs perspective
correct interpolation even for the primary/secondary colors.
To do that it naturally needs us to emit W for the vertices.

Currently we emit W only when at least one texture coordinate
set gets emitted. This means the interpolation of color will
change depending on whether texcoords/varyings are used or not.
That's probably not what anyone would expect, so let's just
always emit W to get consistent behaviour. Trying to avoid
emitting W seems like more hassle than it's worth, especially
as bspec seems to suggest that the hardware will perform the
perspective division anyway.

This used to be broken until it was accidentally fixed it in
commit c349031c27b7 ("i915: Fix texcoord vs. varying collision
in fragment programs") by introducing a bug that made the driver
always emit W. After fixing that bug in commit c1eedb43f32f
("i915: Fix wpos_tex vs. -1 comparison") we went back to the
old behaviour and caused an apparent regression.

Fixes: c1eedb43f32f ("i915: Fix wpos_tex vs. -1 comparison")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101451
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>