mesa.git
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>
7 years agomesa: add KHR_no_error support for glStencilOp()
Samuel Pitoiset [Tue, 20 Jun 2017 16:41:19 +0000 (18:41 +0200)]
mesa: add KHR_no_error support for glStencilOp()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add stencil_op() helper
Samuel Pitoiset [Tue, 20 Jun 2017 16:40:08 +0000 (18:40 +0200)]
mesa: add stencil_op() 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 glStencilFunc()
Samuel Pitoiset [Tue, 20 Jun 2017 16:35:02 +0000 (18:35 +0200)]
mesa: add KHR_no_error support for glStencilFunc()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add stencil_func() helper
Samuel Pitoiset [Tue, 20 Jun 2017 16:33:30 +0000 (18:33 +0200)]
mesa: add stencil_func() 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 glStencilOpSeparate()
Samuel Pitoiset [Tue, 20 Jun 2017 16:24:47 +0000 (18:24 +0200)]
mesa: add KHR_no_error support for glStencilOpSeparate()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add stencil_op_separate() helper
Samuel Pitoiset [Tue, 20 Jun 2017 16:23:07 +0000 (18:23 +0200)]
mesa: add stencil_op_separate() 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 glStencilMaskSeparate()
Samuel Pitoiset [Tue, 20 Jun 2017 16:17:29 +0000 (18:17 +0200)]
mesa: add KHR_no_error support for glStencilMaskSeparate()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add stencil_mask_separate() helper
Samuel Pitoiset [Tue, 20 Jun 2017 16:16:05 +0000 (18:16 +0200)]
mesa: add stencil_mask_separate() 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 glStencilFuncSeparate()
Samuel Pitoiset [Tue, 20 Jun 2017 16:13:36 +0000 (18:13 +0200)]
mesa: add KHR_no_error support for glStencilFuncSeparate()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add stencil_func_separate() helper
Samuel Pitoiset [Tue, 20 Jun 2017 16:09:02 +0000 (18:09 +0200)]
mesa: add stencil_func_separate() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoetnaviv: fix blend color for RB swapped rendertargets
Lucas Stach [Mon, 5 Jun 2017 19:11:02 +0000 (21:11 +0200)]
etnaviv: fix blend color for RB swapped rendertargets

Same as with the colormasks, the blend color needs to be swizzled according
to the rendertarget format.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agospirv: Work around the Doom shader bug
Jason Ekstrand [Tue, 20 Jun 2017 16:06:44 +0000 (09:06 -0700)]
spirv: Work around the Doom shader bug

Doom shipped with a broken version of GLSLang which handles samplers as
function arguments in a way that isn't spec-compliant.  In particular,
it creates a temporary local sampler variable and copies the sampler
into it.  While Dave has had a hack patch out for a while that gets it
working, we've never landed it because we've been hoping that a game
update would come out with fixed shaders.  Unfortunately, no game update
appears on to be on the horizon and I've found this issue in yet another
application so I think we're stuck working around it.  Hopefully, we can
delete this code one day.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99467
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: Update build instructions for int64.glsl
Ian Romanick [Wed, 21 Jun 2017 00:44:59 +0000 (17:44 -0700)]
glsl: Update build instructions for int64.glsl

Trivial

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoglsl: Fix indent in dump code
Elie Tournier [Mon, 6 Mar 2017 15:27:56 +0000 (15:27 +0000)]
glsl: Fix indent in dump code

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agost/xvmc: deal with drivers wanting different texture formats
Ilia Mirkin [Mon, 8 May 2017 01:45:41 +0000 (21:45 -0400)]
st/xvmc: deal with drivers wanting different texture formats

Previously, texture formats were being used unconditionally without
checking. However nv30 supports neither RGBX8 nor R4A4/A4R4 formats. Add
sufficient fallbacks so that the nv30 driver can have working OSD.

Tested on a NV44A/PCI.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: fix transfer of larger rectangles with DmaCopy on gk104 and up
Ben Skeggs [Sat, 28 Jan 2017 03:14:10 +0000 (13:14 +1000)]
nvc0: fix transfer of larger rectangles with DmaCopy on gk104 and up

By treating the rectangles as 1cpp, we can run up against some internal
copy engine limits and trigger a MEM2MEM_RECT_OUT_OF_BOUNDS error check
at launch time.

This commit enables the REMAP hardware, which allows us to specify both
the component size and number of components for a transfer.  We're then
able to pass in the real width/nblocksx values and not hit the limits.

There's a couple of "supported" CPPs in the list that we can't actually
hit, but are there simply because they're possible.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: copy engine surface params are only relevant for tiled surfaces
Ben Skeggs [Sat, 28 Jan 2017 03:14:09 +0000 (13:14 +1000)]
nvc0: copy engine surface params are only relevant for tiled surfaces

Aside from reducing pushbuf usage in some situations, this commit should
have no other effect, and is just to make it somewhat obvious that those
methods have zero effect on linear surfaces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agost/mesa: fix assert to be simpler
Dave Airlie [Tue, 20 Jun 2017 05:50:37 +0000 (15:50 +1000)]
st/mesa: fix assert to be simpler

I just noticed a warning with a non-debug build, but really
this could all be one line, and I'm not even 100% the assert
makes sense here.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agointel: compiler/i965: fix is_broxton checks
Lionel Landwerlin [Tue, 20 Jun 2017 10:06:24 +0000 (11:06 +0100)]
intel: compiler/i965: fix is_broxton checks

In 5f2fe9302c is_geminilake was introduced for the differenciate
broxton from geminilake. Unfortunately I failed as verifying that
is_broxton is throughout the code base to mean Gen9lp.

Fixes: 5f2fe9302c ("intel: common: add flag to identify platforms by name")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa/main: Move NULL pointer check.
Plamena Manolova [Wed, 14 Jun 2017 16:33:12 +0000 (19:33 +0300)]
mesa/main: Move NULL pointer check.

In blit_framebuffer we're already doing a NULL
pointer check for readFb and drawFb so it makes
sense to do it before we actually use the pointers.

CID: 1412569
Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoswr: Include definition of missing function
George Kyriazis [Tue, 20 Jun 2017 15:13:16 +0000 (10:13 -0500)]
swr: Include definition of missing function

Inline function SWR_MULTISAMPLE_POS::PrecalcSampleData() was missing
definition.  Include definition in core/state_funcs.h.

Fixes windows build.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoi965/cnl: Add l3 configuration for Cannonlake
Ben Widawsky [Mon, 1 May 2017 17:07:47 +0000 (10:07 -0700)]
i965/cnl: Add l3 configuration for Cannonlake

V2 (Anuj):
Squash the changes in one patch rebase on master.
Address the review comments made by Francisco Jerez.
Do the URB allocation per slice (not per bank).

V3 (Anuj):
Update the comment.
Format the table as other l3 config tables.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
---
V1 was sent out with the heading:
"i965/cnl: Properly handle l3 configuration"

7 years agoi965: Add a variable for way size per bank in get_l3_way_size()
Anuj Phogat [Sat, 10 Jun 2017 22:48:21 +0000 (15:48 -0700)]
i965: Add a variable for way size per bank in get_l3_way_size()

Adding this variable better explains the computation of L3 way
size in the function.

V2: Use const variable for way_size_per_bank.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965: Fix broxton 2x6 l3 config
Anuj Phogat [Wed, 7 Jun 2017 22:47:24 +0000 (15:47 -0700)]
i965: Fix broxton 2x6 l3 config

The new table added in this patch matches with the table
in gfxspecs. We were programming the wrong values earlier.

V2: Update the comment.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>