mesa.git
10 years agopipe-loader: introduce pipe_loader_sw_probe_xlib helper
Emil Velikov [Mon, 10 Feb 2014 20:19:20 +0000 (20:19 +0000)]
pipe-loader: introduce pipe_loader_sw_probe_xlib helper

Will be used in the upcoming patches.

v2: handle xlib_create_sw_winsys failure, drop unneeded header

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> (v1)
10 years agopipe-loader: use bool type for pipe_loader_drm_probe_fd()
Emil Velikov [Sat, 22 Feb 2014 03:15:42 +0000 (03:15 +0000)]
pipe-loader: use bool type for pipe_loader_drm_probe_fd()

v2: Rebase on top of the rendernode changes.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> (v1)
Reviewed-by: Francisco Jerez <currojerez@riseup.net> (v1)
10 years agowinsys/xlib: move xlib_create_sw_winsys within the winsys
Emil Velikov [Thu, 13 Feb 2014 15:24:16 +0000 (15:24 +0000)]
winsys/xlib: move xlib_create_sw_winsys within the winsys

v2: Rebase on top of vl_winsys_xsp.c removal
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> (v1)
10 years agopipe-loader: handle memory allocation failure
Emil Velikov [Mon, 10 Feb 2014 20:08:31 +0000 (20:08 +0000)]
pipe-loader: handle memory allocation failure

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
10 years agopipe-loader: build pipe_loader_drm_x_auth whenever HAVE_PIPE_LOADER_XCB is defined
Emil Velikov [Mon, 10 Feb 2014 18:45:32 +0000 (18:45 +0000)]
pipe-loader: build pipe_loader_drm_x_auth whenever HAVE_PIPE_LOADER_XCB is defined

Currently HAVE_PIPE_LOADER_XCB is defined, rather than being set to 1/0.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agopipe-loader: destroy sw_winsys on sw_release
Emil Velikov [Mon, 10 Feb 2014 20:03:19 +0000 (20:03 +0000)]
pipe-loader: destroy sw_winsys on sw_release

The sw pipe-loader implicitly handles winsys_create, thus we
it would make sense to implicitly destroy it upon releasing
the loader.

Currently we leak the sw_winsys when releasing the pipe-loader.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agovl/winsys_dri: cleanup vl_screen_create error path
Emil Velikov [Mon, 10 Feb 2014 18:29:43 +0000 (18:29 +0000)]
vl/winsys_dri: cleanup vl_screen_create error path

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/pipe-loader: link pipe-nouveau against libdrm
Emil Velikov [Mon, 10 Feb 2014 19:12:12 +0000 (19:12 +0000)]
targets/pipe-loader: link pipe-nouveau against libdrm

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agometa: Eliminate samplers[] array in favor of using vec4_prefix.
Kenneth Graunke [Sat, 22 Feb 2014 00:58:09 +0000 (16:58 -0800)]
meta: Eliminate samplers[] array in favor of using vec4_prefix.

We don't need an array mapping the shader index to "sampler2DMS",
"isampler2DMS", and so on.  We can simply do "%ssampler2DMS" and pass in
vec4_prefix, which is "", "i", or "u".

This eliminates the use of C99 array initializers and should fix the
MSVC build.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75344
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Delete the fabulous target_to_target() function.
Kenneth Graunke [Fri, 21 Feb 2014 21:47:29 +0000 (13:47 -0800)]
i965: Delete the fabulous target_to_target() function.

gl_texture_object's Target field is never a cube face enumeration, so
target_to_target is just the identity function.  Aptly named, at least.

I verified this by putting an assert(!"ZOMG, CUBES!") in the cube face
case, and running Piglit.  Nothing ever hit it.  Beyond that, I
inspected the code in mesa/main.

This could probably also be deleted from i915, but I haven't tested
there.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Fix S8 and X8 reversal in brw_depthbuffer_format refactor.
Kenneth Graunke [Fri, 21 Feb 2014 07:08:22 +0000 (23:08 -0800)]
i965: Fix S8 and X8 reversal in brw_depthbuffer_format refactor.

In commit 09d9a8913e8c28fc4c1c60d7da85a2f093786894, I accidentally
botched the X8 and S8 cases.  (I wrote this patch before realizing that
X8 and S8 had been swapped in the big MESA_FORMAT rename, and apparently
didn't rebase it properly after fixing that...)

Fixes regressions in 13 Piglit tests on Ironlake.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75291
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Move declarations before code.
Vinson Lee [Sat, 22 Feb 2014 03:09:30 +0000 (19:09 -0800)]
mesa: Move declarations before code.

This patch fixes these MSVC build errors introduced with
73b78f9c9f86dd38fb165f4730aeac9519635b07.

  Compiling src\mesa\main\uniforms.c ...
uniforms.c
src\mesa\main\uniforms.c(291) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(294) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(294) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(294) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(306) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(309) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(309) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(309) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(322) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(325) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(325) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(325) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(345) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(348) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(348) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(348) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(360) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(363) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(363) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(363) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(376) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(379) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(379) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(379) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(588) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(591) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(591) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(591) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(603) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(606) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(606) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(606) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2
src\mesa\main\uniforms.c(619) : error C2143: syntax error : missing ';' before 'type'
src\mesa\main\uniforms.c(622) : error C2065: 'shProg' : undeclared identifier
src\mesa\main\uniforms.c(622) : warning C4047: 'function' : 'gl_shader_program *' differs in levels of indirection from 'int'
src\mesa\main\uniforms.c(622) : warning C4024: '_mesa_uniform' : different types for formal and actual parameter 2

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agomesa/sso: Change CreateShaderProgramv return type from uint to GLuint.
Vinson Lee [Sat, 22 Feb 2014 01:16:14 +0000 (17:16 -0800)]
mesa/sso: Change CreateShaderProgramv return type from uint to GLuint.

This patch fixes this MinGW build error.

  Compiling src/mapi/glapi/glapi_dispatch.c ...
In file included from src/mapi/glapi/glapi_dispatch.c:41:0:
build/windows-x86_64-debug/mapi/glapi/glapitable.h:930:4: error: expected specifier-qualifier-list before 'uint'
    uint (GLAPIENTRYP CreateShaderProgramv)(GLenum type, GLsizei count, const GLchar * const * strings); /* 886 */
    ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoscons: Add main/pipelineobj.c to src/mesa/SConscript.
Vinson Lee [Sat, 22 Feb 2014 00:58:17 +0000 (16:58 -0800)]
scons: Add main/pipelineobj.c to src/mesa/SConscript.

This patch fixes this SCons build error.

build/linux-x86_64-debug/mesa/libmesa.a(context.os): In function `init_attrib_groups':
src/mesa/main/context.c:815: undefined reference to `_mesa_init_pipeline'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agomesa/sso: Fix typo of 'unsigned'.
Vinson Lee [Sat, 22 Feb 2014 00:38:45 +0000 (16:38 -0800)]
mesa/sso: Fix typo of 'unsigned'.

Fix build error introduced with commit f4c13a890fa24ff1f998e7cac0ecc31505a29403.

  CC       pixeltransfer.lo
main/pipelineobj.c: In function '_mesa_delete_pipeline_object':
main/pipelineobj.c:59:4: error: unknown type name 'unsinged'
    unsinged i;
    ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agomesa/sso: Implement _mesa_GetProgramPipelineiv
Gregory Hainaut [Fri, 28 Jun 2013 21:20:11 +0000 (14:20 -0700)]
mesa/sso: Implement _mesa_GetProgramPipelineiv

This was originally included in another patch, but it was split out by
Ian Romanick.

v2 (idr):
* Trivial reformatting.
* Remove GL_COMPUTE_SHADER.  Compute shaders don't participate in pipeline
  objects anyway.  Suggested by Matt Turner.

v3 (idr):
* Use _mesa_has_geometry_shaders.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Implement _mesa_ActiveShaderProgram
Gregory Hainaut [Fri, 28 Jun 2013 21:19:12 +0000 (14:19 -0700)]
mesa/sso: Implement _mesa_ActiveShaderProgram

This was originally included in another patch, but it was split out by
Ian Romanick.

v2 (idr): Return early from _mesa_ActiveShaderProgram if
_mesa_lookup_shader_program_err returns an error.  Suggested by Jordan.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v2]
10 years agomesa/sso: Implement _mesa_CreateShaderProgramv
Gregory Hainaut [Fri, 28 Jun 2013 21:13:49 +0000 (14:13 -0700)]
mesa/sso: Implement _mesa_CreateShaderProgramv

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Refactor implementation of _mesa_CreateShaderProgramEXT
Gregory Hainaut [Fri, 28 Jun 2013 21:11:38 +0000 (14:11 -0700)]
mesa/sso: Refactor implementation of _mesa_CreateShaderProgramEXT

This will allow the guts of the implementation to be shared with
_mesa_CreateShaderProgramv.

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Add support for GL_PROGRAM_SEPARABLE query
Gregory Hainaut [Fri, 28 Jun 2013 21:05:49 +0000 (14:05 -0700)]
mesa/sso: Add support for GL_PROGRAM_SEPARABLE query

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Implement _mesa_IsProgramPipeline
Gregory Hainaut [Fri, 28 Jun 2013 21:01:18 +0000 (14:01 -0700)]
mesa/sso: Implement _mesa_IsProgramPipeline

Implement IsProgramPipeline based on the VAO code.

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Implement _mesa_GenProgramPipelines
Gregory Hainaut [Fri, 28 Jun 2013 21:00:13 +0000 (14:00 -0700)]
mesa/sso: Implement _mesa_GenProgramPipelines

Implement GenProgramPipelines based on the VAO code.

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Implement _mesa_DeleteProgramPipelines
Gregory Hainaut [Fri, 28 Jun 2013 20:57:50 +0000 (13:57 -0700)]
mesa/sso: Implement _mesa_DeleteProgramPipelines

Implement DeleteProgramPipelines based on the VAO code.

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Add pipeline container/state
Gregory Hainaut [Fri, 28 Jun 2013 20:54:06 +0000 (13:54 -0700)]
mesa/sso: Add pipeline container/state

V1:
* Extend gl_shader_state as pipeline object state
* Add a new container gl_pipeline_shader_state that contains
   binding point of the previous object
* Update mesa init/free shader state due to the extension of
   the attibute
* Add an init/free pipeline function for the context

V2:
* Rename gl_shader_state to gl_pipeline_object
* Rename Pipeline.PipelineObj to Pipeline.Current
* Formatting improvement

V3 (idr):
* Split out from previous uber patch.
* Remove '#if 0' debug printfs.

V4 (idr):
* Fix some errors in comments.  Suggested by Jordan.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Add a mutex and refcounting to gl_shader_state
Gregory Hainaut [Fri, 28 Jun 2013 20:43:43 +0000 (13:43 -0700)]
mesa: Add a mutex and refcounting to gl_shader_state

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Make get_shader_flags publicly available
Gregory Hainaut [Fri, 28 Jun 2013 20:35:15 +0000 (13:35 -0700)]
mesa: Make get_shader_flags publicly available

Future patches will use this function outside shaderapi.c.

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Add extension entry points for GL_ARB_separate_shader_objects
Gregory Hainaut [Fri, 3 May 2013 17:44:05 +0000 (19:44 +0200)]
mesa/sso: Add extension entry points for GL_ARB_separate_shader_objects

Nothings implemented yet but glProgramUniform* which are mostly a
copy/paste of the older function glUniform*

I create dedicated pipelineobj.[ch] file that will contains function
related to the "new" pipeline container object.

V2: formatting improvement

V3:
* indentation fix
* Update copyright
* Add a comment on ProgramParameteri already present in another extension
* Remove TODO, will be readded on correct patch

V4 (idr):
* Fix dispatch_sanity unit test
* Make extension string available in core profiles (instead of just
  compatibility).
* Trivial reformating

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl/sso: Add parser and AST-to-HIR support for separate shader object layouts
Ian Romanick [Wed, 25 Sep 2013 23:16:00 +0000 (16:16 -0700)]
glsl/sso: Add parser and AST-to-HIR support for separate shader object layouts

GL_ARB_separate_shader_objects adds the ability to specify location
layouts for interstage inputs and outputs.

In addition, this extension makes 'in' and 'out' generally available for
shader inputs and outputs.  This mimics the behavior of
GL_ARB_explicit_attrib_location.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa/sso: Add extension tracking for ARB_separate_shader_objects
Ian Romanick [Wed, 25 Sep 2013 17:11:28 +0000 (10:11 -0700)]
mesa/sso: Add extension tracking for ARB_separate_shader_objects

This adds the necessary bits for both the API and the GLSL compiler.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Refactor per-stage link check to its own function
Ian Romanick [Sat, 8 Feb 2014 05:13:02 +0000 (21:13 -0800)]
mesa: Refactor per-stage link check to its own function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agospecs: MESA_query_renderer.spec resolve a couple of typos
Emil Velikov [Fri, 21 Feb 2014 22:52:46 +0000 (22:52 +0000)]
specs: MESA_query_renderer.spec resolve a couple of typos

Cc: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoconfigure: use shared-glapi when more than one gl* API is used
Emil Velikov [Wed, 19 Feb 2014 00:54:04 +0000 (00:54 +0000)]
configure: use shared-glapi when more than one gl* API is used

Current behaviour states that shared-glapi is usefull when building
with dri, which is not the case. Shared-glapi is used to dispatch
the gl* functions across the one or more gl api's which can be dri
based but do not need to be.

Fixed the following build

 ./configure --enable-gles2 --disable-dri --enable-gallium-egl \
      --with-egl-platforms=fbdev --with-gallium-drivers=swrast

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75098
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoconfigure: use default dri drivers whenever opengl and dri are enabled
Emil Velikov [Tue, 18 Feb 2014 00:57:24 +0000 (00:57 +0000)]
configure: use default dri drivers whenever opengl and dri are enabled

Commit ee55500c22a(configure: cleanup classic dri drivers handling)
cleaned up the logic handling autodetection of dri drivers, but missed
the case when one can explicitly disable dri, and still request opengl.

Fixes build issues for the following
./autogen.sh --disable-dri --with-gallium-drivers=swrast

While we're here, explicitly clear with_dri_drivers whenever building
without such drivers to prevent choking later on.

v2: Simplify with_dri_drivers handling.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75126
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Stop throwing away our double precision for time calculations.
Eric Anholt [Thu, 20 Feb 2014 22:54:29 +0000 (14:54 -0800)]
i965: Stop throwing away our double precision for time calculations.

Fixes negative times being reported in our perf debug.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Add support for integer blits.
Eric Anholt [Tue, 11 Feb 2014 07:44:54 +0000 (23:44 -0800)]
meta: Add support for integer blits.

Compared to i965, the code generated doesn't use the AVG instruction.  But
I'm not sure that multisampled integer resolves are really that important
to worry about.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Add support for doing MSAA to MSAA blits.
Eric Anholt [Mon, 10 Feb 2014 23:24:07 +0000 (15:24 -0800)]
meta: Add support for doing MSAA to MSAA blits.

These are non-stretched, non-resolving blits, so it's just a matter of
sampling once from our gl_SampleID and storing that to our color/depth.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Save and restore a bunch of MSAA state.
Eric Anholt [Tue, 11 Feb 2014 00:23:50 +0000 (16:23 -0800)]
meta: Save and restore a bunch of MSAA state.

We're disabling GL_MULTISAMPLE, so we didn't need to worry about a lot of
that state.  But to do MSAA to MSAA blits, we need to start handling more
state.

v2: Fix pasteo caught by Kenneth.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Try to do blending of sRGB values in linear colorspace.
Eric Anholt [Mon, 10 Feb 2014 19:20:11 +0000 (11:20 -0800)]
meta: Try to do blending of sRGB values in linear colorspace.

Blending of values would occur when doing GL_LINEAR filtering with
scaling, and in an upcoming commit when doing MSAA resolves.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Add support for doing multisample resolves.
Eric Anholt [Fri, 7 Feb 2014 22:00:31 +0000 (14:00 -0800)]
meta: Add support for doing multisample resolves.

Note that this doesn't handle GL_EXT_multisample_scaled_blit yet.  The
i965 code for that extension bakes in knowledge of the sample positions
(well, knowledge of the sample positions aligned to a lower-resolution
grid), which we would have to do at runtime somehow for meta.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Fix miptree matching for multisampled, non-interleaved miptrees.
Eric Anholt [Tue, 18 Feb 2014 23:14:30 +0000 (15:14 -0800)]
i965: Fix miptree matching for multisampled, non-interleaved miptrees.

We haven't been executing this code before the meta-blit case, because
we've been flagging the miptree as validated at texstorage time, and never
having to revalidate.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Remove unnecessary condition.
Courtney Goeltzenleuchter [Fri, 21 Feb 2014 17:31:43 +0000 (10:31 -0700)]
mesa: Remove unnecessary condition.

Identified by Valgrind memory check. Initialized block-opaque in a
different patch. This test seems unnecessary. If opaque must be true,
just set to true.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
10 years agoclover: Unabbreviate a few data accessor names for consistency.
Francisco Jerez [Tue, 18 Feb 2014 12:12:52 +0000 (13:12 +0100)]
clover: Unabbreviate a few data accessor names for consistency.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Replace the transfer(new ...) idiom with a safer create(...) helper function.
Francisco Jerez [Tue, 18 Feb 2014 16:13:39 +0000 (17:13 +0100)]
clover: Replace the transfer(new ...) idiom with a safer create(...) helper function.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Migrate a bunch of pointers and references in the object tree to smart refere...
Francisco Jerez [Tue, 18 Feb 2014 14:07:11 +0000 (15:07 +0100)]
clover: Migrate a bunch of pointers and references in the object tree to smart references.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Allow storing a range into a container of different (but compatible) element...
Francisco Jerez [Tue, 18 Feb 2014 13:52:25 +0000 (14:52 +0100)]
clover: Allow storing a range into a container of different (but compatible) element type.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Define an intrusive smart reference class.
Francisco Jerez [Tue, 18 Feb 2014 12:20:07 +0000 (13:20 +0100)]
clover: Define an intrusive smart reference class.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Some improvements for the intrusive pointer class.
Francisco Jerez [Tue, 18 Feb 2014 12:16:19 +0000 (13:16 +0100)]
clover: Some improvements for the intrusive pointer class.

Define some additional convenience operators, clean up the
implementation slightly, and rename it to 'intrusive_ptr' for reasons
that will be obvious in the next commit.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Fix up NULL constant pointer arguments.
Francisco Jerez [Sun, 16 Feb 2014 18:35:11 +0000 (19:35 +0100)]
clover: Fix up NULL constant pointer arguments.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agotgsi_ureg: add property_gs_invocations
Jordan Justen [Thu, 20 Feb 2014 22:36:33 +0000 (14:36 -0800)]
tgsi_ureg: add property_gs_invocations

Fixes a build break in state_tracker/st_program.c

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75278
Reviewed-by: Dave Airlie <airlied@redhat.com>
10 years agoi965: Enable Broadwell support.
Kenneth Graunke [Tue, 31 Dec 2013 06:07:20 +0000 (22:07 -0800)]
i965: Enable Broadwell support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Implement FS_OPCODE_[UN]PACK_HALF_2x16_SPLIT[_XY] opcodes.
Kenneth Graunke [Wed, 29 Jan 2014 21:45:27 +0000 (13:45 -0800)]
i965/fs: Implement FS_OPCODE_[UN]PACK_HALF_2x16_SPLIT[_XY] opcodes.

I'd neglected to port these to Broadwell.  Most of this code is copy
and pasted from Gen7, but instead of using F32TO16/F16TO32, we just
use MOV with HF register types.

Fixes fs-packHalf2x16 and fs-unpackHalf2x16 tests (both the ARB
extension and ES 3.0 variants).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Drop bogus F32TO16/F16TO32 instructions on Broadwell - use MOV.
Kenneth Graunke [Wed, 29 Jan 2014 22:16:27 +0000 (14:16 -0800)]
i965: Drop bogus F32TO16/F16TO32 instructions on Broadwell - use MOV.

Broadwell removed the F32TO16 and F16TO32 instructions.  However, it has
actual support for HF values, so they're actually just MOV.

Fixes vs-packHalf2x16 and vs-unpackHalf2x16 tests (both the ARB
extension and ES 3.0 variants).

v2: Emulate F32TO16's align16 zeroing bug, since Chad's front end code
    relies on it happening.  We can probably refactor this code to be
    better later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Create a hardware context before initializing state module.
Kenneth Graunke [Thu, 20 Feb 2014 01:20:11 +0000 (17:20 -0800)]
i965: Create a hardware context before initializing state module.

brw_init_state() calls brw_upload_initial_gpu_state().  If hardware
contexts are enabled (brw->hw_ctx != NULL), this will upload some
initial invariant state for the GPU.  Without hardware contexts, we
rely on this state being uploaded via atoms that subscribe to the
BRW_NEW_CONTEXT bit.

Commit 46d3c2bf4ddd227193b98861f1e632498fe547d8 accidentally moved
the call to brw_init_state() before creating a hardware context.
This meant brw_upload_initial_gpu_state would always early return.
Except on Gen6+, we stopped uploading the initial GPU state via
state atoms, so it never happened.

Fixes a regression since 46d3c2bf4ddd227193b98861f1e632498fe547d8.

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Implement scratch read/write support for Broadwell.
Kenneth Graunke [Mon, 27 Jan 2014 23:49:56 +0000 (15:49 -0800)]
i965/fs: Implement scratch read/write support for Broadwell.

To make sure that both the Gen4 and Gen7 style messages work, I
initially disabled the SHADER_OPCODE_GEN7_SCRATCH_READ optimization,
ran Piglit, re-enabled it, and ran Piglit again.  Both worked fine.

Fixes 40 Piglit tests (most of the varying-packing category).

v2: Move num_regs assertion from gen8_fs_generator to
    gen8_set_dp_scratch_message() (suggested by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add Gen8 assembly support for DP Scratch messages.
Kenneth Graunke [Mon, 27 Jan 2014 23:44:18 +0000 (15:44 -0800)]
i965: Add Gen8 assembly support for DP Scratch messages.

The new accessors will make it easy to do Gen7-style scratch messages.

v2: Move num_regs assertion from gen8_fs_generator into
    gen8_set_dp_scratch_message() (suggested by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Store absolute thread count in max_wm_threads on Broadwell.
Kenneth Graunke [Wed, 5 Feb 2014 06:18:03 +0000 (22:18 -0800)]
i965: Store absolute thread count in max_wm_threads on Broadwell.

In the past, 3DSTATE_PS took an absolute number of threads.  Conversely,
on Broadwell you always program 64, and it implicitly scales based on
the GT-level with no special programming.  So, I stored 64 in
brw_device_info::max_wm_threads.

However, I didn't realize that we also use max_wm_threads to compute the
size of the scratch space buffer.  In that case, we really need the
absolute number of threads.

This patch hardcodes 3DSTATE_PS to use the value it expects, and changes
max_wm_threads back to a (completely fake) absolute thread count (once
again copied from Haswell).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Use MOV, not OR for setting URB write channel enables on Gen8+.
Kenneth Graunke [Thu, 30 Jan 2014 23:30:19 +0000 (15:30 -0800)]
i965: Use MOV, not OR for setting URB write channel enables on Gen8+.

On Broadwell, g0.5 contains the "Scratch Space Pointer"; using OR
puts some bits of that into "ignored" sections of our message header.

While this doesn't hurt, it's also not terribly /useful/.  Using MOV
is sufficient to set the only interesting bits in this part of the
message header.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Implement a CS stall workaround on Broadwell.
Kenneth Graunke [Sun, 26 Jan 2014 08:20:21 +0000 (00:20 -0800)]
i965: Implement a CS stall workaround on Broadwell.

According to the latest documentation, any PIPE_CONTROL with the
"Command Streamer Stall" bit set must also have another bit set,
with five different options:

   - Render Target Cache Flush
   - Depth Cache Flush
   - Stall at Pixel Scoreboard
   - Post-Sync Operation
   - Depth Stall

I chose "Stall at Pixel Scoreboard" since we've used it effectively
in the past, but the choice is fairly arbitrary.

Implementing this in the PIPE_CONTROL emit helpers ensures that the
workaround will always take effect when it ought to.

Apparently, this workaround may be necessary on older hardware as well;
for now I've only added it to Broadwell as it's absolutely necessary
there.  Subsequent patches could add it to older platforms, provided
someone tests it there.

v2: Only flag "Stall at Pixel Scoreboard" when none of the other bits
    are set (suggested by Ian Romanick).

v3: Prefix the function with "gen8" (requested by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: support instanced GS on gen7
Jordan Justen [Sat, 25 Jan 2014 21:02:08 +0000 (13:02 -0800)]
i965: support instanced GS on gen7

v3:
 * Properly prevent dual object mode execution when
   the invocation count > 1

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: support gl_InvocationID for gen7
Jordan Justen [Sat, 25 Jan 2014 20:55:24 +0000 (12:55 -0800)]
i965: support gl_InvocationID for gen7

v2:
 * Make gl_InvocationID a system value

v3:
 * Properly shift from R0.1 into DST.4 by adding
   GS_OPCODE_GET_INSTANCE_ID

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: add gl_InvocationID variable for ARB_gpu_shader5
Jordan Justen [Sat, 25 Jan 2014 20:43:26 +0000 (12:43 -0800)]
glsl: add gl_InvocationID variable for ARB_gpu_shader5

v2:
 * Make gl_InvocationID a system value

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agomain/shaderapi: GL_GEOMETRY_SHADER_INVOCATIONS GetProgramiv support
Jordan Justen [Sat, 25 Jan 2014 20:37:40 +0000 (12:37 -0800)]
main/shaderapi: GL_GEOMETRY_SHADER_INVOCATIONS GetProgramiv support

v3:
 * Add check for ARB_gpu_shader5

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agomesa: initialize gl_geometry_program Invocations field
Jordan Justen [Sat, 25 Jan 2014 20:34:24 +0000 (12:34 -0800)]
mesa: initialize gl_geometry_program Invocations field

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl/linker: produce gl_shader_program Geom.Invocations
Jordan Justen [Sat, 25 Jan 2014 10:17:21 +0000 (02:17 -0800)]
glsl/linker: produce gl_shader_program Geom.Invocations

Grab the parsed invocation count, check for consistency
during linking, and finally save the result in
gl_shader_program Geom.Invocations.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: parse invocations layout qualifier for ARB_gpu_shader5
Jordan Justen [Mon, 3 Feb 2014 01:55:36 +0000 (17:55 -0800)]
glsl: parse invocations layout qualifier for ARB_gpu_shader5

_mesa_glsl_parse_state in_qualifier->invocations will store the
invocations count.

v3:
 * Use in_qualifier to allow the primitive to be specied
   separately from the invocations count (merge_qualifiers)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: Generate error for invalid input layout declarations
Jordan Justen [Tue, 4 Feb 2014 19:32:56 +0000 (11:32 -0800)]
glsl: Generate error for invalid input layout declarations

Fixes various piglit tests:
spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-*.geom

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: convert GS input primitive to use ast_type_qualifier
Jordan Justen [Mon, 3 Feb 2014 01:49:15 +0000 (17:49 -0800)]
glsl: convert GS input primitive to use ast_type_qualifier

We introduce a new merge_in_qualifier ast_type_qualifier
which allows specialized handling of merging input layout
qualifiers.

By merging layout qualifiers into state->in_qualifier, we
allow multiple input qualifiers. For example, the primitive
type can be specified specified separately from the
invocations count (ARB_gpu_shader5).

state->gs_input_prim_type is moved into state->in_qualifier->prim_type

state->gs_input_prim_type_specified is still processed separately
so we can determine when the input primitive is specified. This
is important since certain scenerios are not supported until after
the primitive type has been specified in the shader code.

v4:
 * Merge with compute shader input layout qualifiers

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Fix extra return value after winsys rb update refactor.
Eric Anholt [Thu, 20 Feb 2014 17:51:23 +0000 (09:51 -0800)]
i965: Fix extra return value after winsys rb update refactor.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75172
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/vs: Use samplers for UBOs in the VS like we do for non-UBO pulls.
Eric Anholt [Sat, 15 Feb 2014 00:06:31 +0000 (16:06 -0800)]
i965/vs: Use samplers for UBOs in the VS like we do for non-UBO pulls.

Improves performance of a dolphin emulator trace I had laying around by
3.60131% +/- 0.995887% (n=128).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Add an optimization pass to remove redundant flags movs.
Eric Anholt [Fri, 14 Feb 2014 23:29:01 +0000 (15:29 -0800)]
i965/fs: Add an optimization pass to remove redundant flags movs.

We generate steaming piles of these for the centroid workaround, and this
quickly cleans them up.

total instructions in shared programs: 1591228 -> 1590047 (-0.07%)
instructions in affected programs:     26111 -> 24930 (-4.52%)
GAINED:                                0
LOST:                                  0

(Improved apps are l4d2, csgo, and dolphin)

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogallivm: add smallfloat to float conversion not relying on cpu denorm handling
Roland Scheidegger [Thu, 20 Feb 2014 02:09:17 +0000 (03:09 +0100)]
gallivm: add smallfloat to float conversion not relying on cpu denorm handling

The previous code relied on cpu denorm support for converting small float
formats (such r11g11b10_float and r16_float) to floats, otherwise denorms
are flushed to zero. We worked around that in llvmpipe blend code by
reenabling denorms, but this did nothing for texture sampling. Now it would
be possible to reenable it there too but I'm not really a fan of messing
with fpu flags (and it seems we can't actually do it reliably with llvm in
any case looking at some bug reports). (Not to mention if you actually have
a lot of denorms in there, you can expect some order-of-magnitude slowdown
with x86 cpus.)
So instead use code which adjusts exponents etc. directly hence not relying
on cpu denorm support for the rescaling mul.
(We still need the fpu flag handling as we can't do float-to-smallfloat
without using cpu denorms at least for now - I actually wanted to keep
both the old and new code and using one or the other depending on from where
it's called but that didn't work out as the parameter would have to be passed
through too many layers than I'd like.)

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Si Chen <sichen@vmware.com>
10 years agost/omx/enc: add multi scaling buffers for performance improvement
Leo Liu [Wed, 19 Feb 2014 17:17:51 +0000 (12:17 -0500)]
st/omx/enc: add multi scaling buffers for performance improvement

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/omx/dec/h264: fix prevFrameNumOffset handling
Christian König [Wed, 19 Feb 2014 17:49:17 +0000 (18:49 +0100)]
st/omx/dec/h264: fix prevFrameNumOffset handling

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agoi965: Actually claim to support MSAA on Broadwell.
Kenneth Graunke [Mon, 10 Feb 2014 19:42:47 +0000 (11:42 -0800)]
i965: Actually claim to support MSAA on Broadwell.

We need to advertise 8x, 4x, and 2x multisamples.  Previously, we only
claimed to support 0/1 samples.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Update physical width/height munging for 2x IMS MSAA.
Kenneth Graunke [Tue, 11 Feb 2014 00:48:14 +0000 (16:48 -0800)]
i965: Update physical width/height munging for 2x IMS MSAA.

I can't find any documentation to explain what ought to be done here, so
I simply guessed based on the pattern I observed in the 4x/8x cases.
It appears to work, but it could be totally wrong.

I was able to find the Sandybridge PRM quote from the comments in the
latest documentation: Shared Functions > 3D Sampler > Multisampled
Surface Behavior.  However, it only mentions 4x MSAA - not even 8x.

After a substantial amount more digging, I was able to find a second
page (incorrectly tagged) which confirmed the formulas in our code for
8x MSAA.  However, that page didn't mention 2x MSAA at all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Enable smooth points when multisampling without point sprites.
Kenneth Graunke [Tue, 11 Feb 2014 03:37:08 +0000 (19:37 -0800)]
i965: Enable smooth points when multisampling without point sprites.

According to the "Point Multisample Rasterization" of the OpenGL
specification (3.0 or later), smooth points are supposed to be enabled
implicitly when multisampling, regardless of the GL_POINT_SMOOTH flag.

However, if GL_POINT_SPRITE is enabled, you get square points no matter
what.  Core contexts always enable point sprites, so this effectively
makes smooth points go away, even in the case of multisampling.

Fixes Piglit's EXT_framebuffer_multisample/point-smooth tests.
(Yes, that's right folks, we actually have Piglit tests for this.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Thwack multisample enable bit in 3DSTATE_RASTER.
Kenneth Graunke [Tue, 11 Feb 2014 02:17:10 +0000 (18:17 -0800)]
i965: Thwack multisample enable bit in 3DSTATE_RASTER.

The meaning and effects of this bit are surprisingly complicated.

See Rasterization > Windower > Multisampling > Multisample ModesState.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Only use the SIMD16 program for per-sample shading on Broadwell.
Kenneth Graunke [Tue, 11 Feb 2014 01:40:24 +0000 (17:40 -0800)]
i965: Only use the SIMD16 program for per-sample shading on Broadwell.

This restriction carries forward from earlier platforms.  The code is
ported straight from gen7_wm_state.c.

v2: Actually do it right.
v3: Add missing _NEW_MULTISAMPLE bit (caught by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Set "Position XY Offset Select" bits in 3DSTATE_PS on Broadwell.
Kenneth Graunke [Tue, 11 Feb 2014 01:31:00 +0000 (17:31 -0800)]
i965: Set "Position XY Offset Select" bits in 3DSTATE_PS on Broadwell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Add missing sample shading bits to Gen8's 3DSTATE_PS_EXTRA.
Kenneth Graunke [Tue, 21 Jan 2014 07:06:30 +0000 (23:06 -0800)]
i965: Add missing sample shading bits to Gen8's 3DSTATE_PS_EXTRA.

v2: Also set the "oMask Present to Render Target" bit, which is required
    for shaders that write oMask.  Otherwise the hardware won't expect
    the extra data.

v3: Add missing _NEW_MULTISAMPLE (caught by Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/fs: Implement FS_OPCODE_SET_OMASK on Broadwell.
Kenneth Graunke [Mon, 10 Feb 2014 23:46:56 +0000 (15:46 -0800)]
i965/fs: Implement FS_OPCODE_SET_OMASK on Broadwell.

I made a few changes which I think simplify the code a bit compared to
the Gen7 implementation, but which are largely pointless.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/fs: Implement FS_OPCODE_SET_SAMPLE_ID on Broadwell.
Kenneth Graunke [Mon, 10 Feb 2014 23:09:22 +0000 (15:09 -0800)]
i965/fs: Implement FS_OPCODE_SET_SAMPLE_ID on Broadwell.

Largely cut and paste from Gen7; it works the same way.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Disable MCS on Broadwell for now.
Kenneth Graunke [Mon, 10 Feb 2014 20:02:14 +0000 (12:02 -0800)]
i965: Disable MCS on Broadwell for now.

v2: Add a perf_debug() message to remind us to come back to this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Use gen7_surface_msaa_bits in Broadwell SURFACE_STATE code.
Kenneth Graunke [Mon, 10 Feb 2014 19:18:41 +0000 (11:18 -0800)]
i965: Use gen7_surface_msaa_bits in Broadwell SURFACE_STATE code.

We already set the number of samples, but were missing the MSAA layout
mode.  Reusing gen7_surface_msaa_bits makes it easy to set both.

This also lets us drop the Gen8 surface_num_multisamples function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Use ffs() for sample counting in gen7_surface_msaa_bits().
Kenneth Graunke [Mon, 10 Feb 2014 19:06:03 +0000 (11:06 -0800)]
i965: Use ffs() for sample counting in gen7_surface_msaa_bits().

The enumerations are just log2(num_samples) shifted by 3, which we can
easily compute via ffs().

This also makes it reusable for Broadwell, which has 2x MSAA.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Simplify Broadwell's 3DSTATE_MULTISAMPLE sample count handling.
Kenneth Graunke [Mon, 10 Feb 2014 00:14:27 +0000 (16:14 -0800)]
i965: Simplify Broadwell's 3DSTATE_MULTISAMPLE sample count handling.

These enumerations are simply log2 of the number of multisamples shifted
by a bit, so we can calculate them using ffs() in a lot less code.

Suggested by Eric Anholt.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: Silence "type qualifiers ignored on function return type" warning
Ian Romanick [Tue, 18 Feb 2014 17:38:04 +0000 (09:38 -0800)]
glsl: Silence "type qualifiers ignored on function return type" warning

The const in

   const unsigned foo(void);

is meaningless.  Removing it silences this warning:

src/glsl/ast_to_hir.cpp:1802:56: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: Only warn for macro names containing __
Ian Romanick [Tue, 18 Feb 2014 17:36:08 +0000 (09:36 -0800)]
glsl: Only warn for macro names containing __

From page 14 (page 20 of the PDF) of the GLSL 1.10 spec:

    "In addition, all identifiers containing two consecutive underscores
     (__) are reserved as possible future keywords."

The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos.  Names simply containing __ are dangerous to use, but should
be allowed.

Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
Cc: Tapani Pälli <lemody@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702

10 years agoglcpp: Only warn for macro names containing __
Ian Romanick [Tue, 18 Feb 2014 17:10:36 +0000 (09:10 -0800)]
glcpp: Only warn for macro names containing __

Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the
GLSL ES spec (all versions) say:

    "All macro names containing two consecutive underscores ( __ ) are
    reserved for future use as predefined macro names. All macro names
    prefixed with "GL_" ("GL" followed by a single underscore) are also
    reserved."

The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos.  Since every extension adds a name prefixed with GL_ (i.e.,
the name of the extension), that should be an error.  Names simply
containing __ are dangerous to use, but should be allowed.  In similar
cases, the C++ preprocessor specification says, "no diagnostic is
required."

Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
Cc: Tapani Pälli <lemody@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702

10 years agoconfigure: Use LLVM shared libraries by default
Tom Stellard [Tue, 4 Feb 2014 16:54:38 +0000 (11:54 -0500)]
configure: Use LLVM shared libraries by default

Linking with LLVM static libraries is easily broken by changes to
the llvm-config program or when LLVM adds, removes, or changes library
components.  Keeping up with these changes requires a lot of maintanence
effort to keep the build working on the master and stable branches.

Also, because of issues in the past LLVM static libraries, the release
manager is currently configuring with --with-llvm-shared-libs when
checking the build before release.  Enabling shared libraries by
default would allow the release manager to run ./configure with
no arguments, and be reasonably confident that the build would succeed.

Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965/fs: Allocate the param_size array dynamically.
Francisco Jerez [Wed, 19 Feb 2014 14:36:48 +0000 (15:36 +0100)]
i965/fs: Allocate the param_size array dynamically.

Useful because the total number of uniform components might exceed
MAX_UNIFORMS * 4 in some cases because of the image metadata we'll be
passing as push constants.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Use a separate variable to keep track of the last uniform index seen.
Francisco Jerez [Wed, 19 Feb 2014 14:27:01 +0000 (15:27 +0100)]
i965/fs: Use a separate variable to keep track of the last uniform index seen.

Like the VEC4 back-end does.  It will make dynamic allocation of the
param_size array easier in a future commit.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agofreedreno: tweak ringbuffer sizes/count
Rob Clark [Wed, 19 Feb 2014 17:02:57 +0000 (12:02 -0500)]
freedreno: tweak ringbuffer sizes/count

Since we are now consuming two ringbuffers at a time, we probably want a
pool larger than 4.. but we don't need each individual ringbuffer to be
so large, so offset the pool size increase by reducing rb size.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx/compiler: scheduling/legalize fixes
Rob Clark [Wed, 19 Feb 2014 16:55:25 +0000 (11:55 -0500)]
freedreno/a3xx/compiler: scheduling/legalize fixes

It seems the write-after-read hazard that applies to texture fetch
instructions, also applies to sfu instructions.

Also, cat5/cat6 instructions do not have a (ss) bit, so in these
cases we need to insert a dummy nop instruction with (ss) bit set.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoi965: Have brw_imm_vf4() take the vector components as integer values.
Francisco Jerez [Fri, 22 Nov 2013 23:59:56 +0000 (15:59 -0800)]
i965: Have brw_imm_vf4() take the vector components as integer values.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965: Add helper function to find out the signedness of a register type.
Francisco Jerez [Sat, 23 Nov 2013 20:08:00 +0000 (12:08 -0800)]
i965: Add helper function to find out the signedness of a register type.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/vec4: Use swizzle() in the ARB_vertex_program code.
Francisco Jerez [Fri, 29 Nov 2013 02:13:18 +0000 (18:13 -0800)]
i965/vec4: Use swizzle() in the ARB_vertex_program code.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Use offset() in the ARB_fragment_program code.
Francisco Jerez [Fri, 29 Nov 2013 02:04:10 +0000 (18:04 -0800)]
i965/fs: Use offset() in the ARB_fragment_program code.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Remove fs_reg::retype.
Francisco Jerez [Sun, 8 Dec 2013 03:59:11 +0000 (04:59 +0100)]
i965/fs: Remove fs_reg::retype.

There doesn't seem to be any reason for it to be a method, and it's
surprising that the expression 'reg.retype(t)' doesn't retype its
object but rather it creates a temporary with the new type.  Use
'retype(reg, t)' instead.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/vec4: Trivial improvements to the with_writemask() function.
Francisco Jerez [Thu, 28 Nov 2013 23:07:06 +0000 (15:07 -0800)]
i965/vec4: Trivial improvements to the with_writemask() function.

Add assertion that the register is not in the HW_REG or IMM file,
calculate the conjunction of the old and new mask instead of replacing
the old [consistent with the behavior of brw_writemask(), causes no
functional changes right now], make it static inline to let the
compiler do a slightly better job at optimizing things, and shorten
its name.

v2: Assert that the new writemask is not zero to avoid undefined
    hardware behaviour.

Reviewed-by: Paul Berry <stereotype441@gmail.com>