mesa.git
10 years agogallivm: Workaround http://llvm.org/PR18600
José Fonseca [Fri, 24 Jan 2014 14:25:46 +0000 (14:25 +0000)]
gallivm: Workaround http://llvm.org/PR18600

We have code generation paths that carry out swizzles of AoS vectors via
bitwise shifts, as these tend to generate more efficient code than
straightforward byte shuffles.  But when the input is a constant the
additional bitwise arithmetic operations somehow don't really get
constant propagated properly, evenutally causing assertion failure in
InstCombine pass.

Therefore avoid the bug by using the trivial shuffles for constant
inputs.

Although the sample LLVM IR can cause a crash with any LLVM version,
this was only seen in practice with LLVM 3.2.

Reviewed-by: Matthew McClure <mcclurem@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoglsl: Avoid combining statements from different basic blocks.
Matt Turner [Mon, 27 Jan 2014 18:49:12 +0000 (10:49 -0800)]
glsl: Avoid combining statements from different basic blocks.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74113
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Set proper swizzle when a channel is missing in vectorizing.
Matt Turner [Fri, 24 Jan 2014 23:17:08 +0000 (15:17 -0800)]
glsl: Set proper swizzle when a channel is missing in vectorizing.

Previously, for example if the x channel was missing from a series of
assignments we were attempting to vectorize, the wrong swizzle mask
would be applied.

   a.y = b.y;
   a.z = b.z;
   a.w = b.w;

would be incorrectly transformed into

   a.yzw = b.xyz;

Fixes two transform feedback tests in the ES3 conformance suite.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73978
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73954
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Use bitfieldInsert in ldexp() lowering.
Matt Turner [Mon, 27 Jan 2014 19:56:14 +0000 (11:56 -0800)]
glsl: Use bitfieldInsert in ldexp() lowering.

Shaves a few instructions off of lowered ldexp().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add constant evaluation of ir_binop_bfm.
Matt Turner [Thu, 23 Jan 2014 23:39:43 +0000 (15:39 -0800)]
glsl: Add constant evaluation of ir_binop_bfm.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglcpp: Resolve implicit GLSL version to 100 if the API is ES.
Matt Turner [Mon, 27 Jan 2014 02:06:18 +0000 (18:06 -0800)]
glcpp: Resolve implicit GLSL version to 100 if the API is ES.

Fixes a regression since b2d1c579 where ES shaders without a #version
declaration would fail to compile if their precision declaration was
wrapped in the standard #ifdef GL_ES check.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74066
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglcpp: Check version_resolved in the proper place.
Matt Turner [Sat, 25 Jan 2014 19:57:02 +0000 (11:57 -0800)]
glcpp: Check version_resolved in the proper place.

The check was in the wrong place, such that if a shader incorrectly put
a preprocessor token before the #version declaration, the version would
be resolved twice, leading to a segmentation fault when attempting to
redefine the __VERSION__ macro.

 #extension GL_ARB_sample_shading: require
 #version 130
 void main() {}

Also, rename glcpp_parser_resolve_version to
             glcpp_parser_resolve_implicit_version to avoid confusion.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agor600g: s/r600_llvm_gpu_string/r600_get_llvm_processor_name/
Michel Dänzer [Tue, 28 Jan 2014 01:12:32 +0000 (10:12 +0900)]
r600g: s/r600_llvm_gpu_string/r600_get_llvm_processor_name/

Fixes build failure introduced by commit
65dc588bfd3b8145131340ffe77f216be58378ac ('r600g,radeonsi: consolidate
get_compute_param'), which consolidated the former into the latter.

10 years agoradeonsi: cleanup includes, add missing license
Marek Olšák [Wed, 22 Jan 2014 17:50:36 +0000 (18:50 +0100)]
radeonsi: cleanup includes, add missing license

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: remove open-coded PS_PARTIAL_FLUSH event
Marek Olšák [Wed, 22 Jan 2014 17:30:21 +0000 (18:30 +0100)]
radeonsi: remove open-coded PS_PARTIAL_FLUSH event

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: move some inline functions from si_pipe.h to si_state.c
Marek Olšák [Wed, 22 Jan 2014 16:30:31 +0000 (17:30 +0100)]
radeonsi: move some inline functions from si_pipe.h to si_state.c

And si_tex_aniso_filter is unused.

v2: remove INLINE occurences

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: remove si_resource.h
Marek Olšák [Wed, 22 Jan 2014 14:37:53 +0000 (15:37 +0100)]
radeonsi: remove si_resource.h

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: remove si.h
Marek Olšák [Wed, 22 Jan 2014 11:45:02 +0000 (12:45 +0100)]
radeonsi: remove si.h

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: move si_upload_const_buffer to a better place
Marek Olšák [Wed, 22 Jan 2014 02:08:50 +0000 (03:08 +0100)]
radeonsi: move si_upload_const_buffer to a better place

This gets rid of another file.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: inline si_translate_index_buffer
Marek Olšák [Wed, 22 Jan 2014 02:05:21 +0000 (03:05 +0100)]
radeonsi: inline si_translate_index_buffer

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: inline si_upload_index_buffer
Marek Olšák [Wed, 22 Jan 2014 01:57:28 +0000 (02:57 +0100)]
radeonsi: inline si_upload_index_buffer

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate remaining obviously duplicated pipe_screen code
Marek Olšák [Wed, 22 Jan 2014 01:49:53 +0000 (02:49 +0100)]
r600g,radeonsi: consolidate remaining obviously duplicated pipe_screen code

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate get_compute_param
Marek Olšák [Wed, 22 Jan 2014 01:42:20 +0000 (02:42 +0100)]
r600g,radeonsi: consolidate get_compute_param

v2: added fprintf to r600_get_llvm_processor_name

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate get_paramf and get_video_param
Marek Olšák [Wed, 22 Jan 2014 01:12:51 +0000 (02:12 +0100)]
r600g,radeonsi: consolidate get_paramf and get_video_param

radeonsi now reports PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = true if UVD support
isn't available. It's what all the other drivers do.

Also, some #include directives were missing in radeon_uvd.h.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate variables for CS tracing
Marek Olšák [Wed, 22 Jan 2014 01:02:18 +0000 (02:02 +0100)]
r600g,radeonsi: consolidate variables for CS tracing

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate get_timestamp, get_driver_query_info
Marek Olšák [Wed, 22 Jan 2014 00:29:18 +0000 (01:29 +0100)]
r600g,radeonsi: consolidate get_timestamp, get_driver_query_info

This enables more queries for the Gallium HUD with radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate get_name and get_vendor queries
Marek Olšák [Wed, 22 Jan 2014 00:20:21 +0000 (01:20 +0100)]
r600g,radeonsi: consolidate get_name and get_vendor queries

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeon: place context-related functions first in r600_pipe_common.c
Marek Olšák [Wed, 22 Jan 2014 00:14:10 +0000 (01:14 +0100)]
radeon: place context-related functions first in r600_pipe_common.c

To follow the unwritten convention of r600g and radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g,radeonsi: consolidate the contents of r600_resource.c
Marek Olšák [Tue, 21 Jan 2014 23:58:12 +0000 (00:58 +0100)]
r600g,radeonsi: consolidate the contents of r600_resource.c

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: advertise the pipeline statistics query
Marek Olšák [Tue, 21 Jan 2014 23:08:11 +0000 (00:08 +0100)]
radeonsi: advertise the pipeline statistics query

Implemented by the common code. You can now visualize the statistics
with the HUD, see GALLIUM_HUD=help for all available queries. For example:

GALLIUM_HUD=clipper-primitives-generated

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoradeonsi: use queries from r600g
Marek Olšák [Tue, 21 Jan 2014 23:06:32 +0000 (00:06 +0100)]
radeonsi: use queries from r600g

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g: remove a no-op while loop
Marek Olšák [Tue, 21 Jan 2014 22:46:44 +0000 (23:46 +0100)]
r600g: remove a no-op while loop

for (;;) {

} while ();

I was surprised to see such a statement.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g: convert query emission code to radeon_emit
Marek Olšák [Tue, 21 Jan 2014 22:44:39 +0000 (23:44 +0100)]
r600g: convert query emission code to radeon_emit

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g: only emit NOP relocations for queries if VM is disabled
Marek Olšák [Tue, 21 Jan 2014 22:31:51 +0000 (23:31 +0100)]
r600g: only emit NOP relocations for queries if VM is disabled

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g: move queries to drivers/radeon
Marek Olšák [Tue, 21 Jan 2014 17:01:01 +0000 (18:01 +0100)]
r600g: move queries to drivers/radeon

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agomesa: Fix Type A _INT formats to MESA_FORMAT naming standard
Mark Mueller [Wed, 22 Jan 2014 06:37:20 +0000 (22:37 -0800)]
mesa: Fix Type A _INT formats to MESA_FORMAT naming standard

Replace Type A _INT formats names with _SINT to match naming spec,
and update type C formats as follows:
    s/MESA_FORMAT_R_INT8\b/MESA_FORMAT_R_SINT8/g
    s/MESA_FORMAT_R_INT16\b/MESA_FORMAT_R_SINT16/g
    s/MESA_FORMAT_R_INT32\b/MESA_FORMAT_R_SINT32/g
    s/MESA_FORMAT_RG_INT8\b/MESA_FORMAT_RG_SINT8/g
    s/MESA_FORMAT_RG_INT16\b/MESA_FORMAT_RG_SINT16/g
    s/MESA_FORMAT_RG_INT32\b/MESA_FORMAT_RG_SINT32/g
    s/MESA_FORMAT_RGB_INT8\b/MESA_FORMAT_RGB_SINT8/g
    s/MESA_FORMAT_RGB_INT16\b/MESA_FORMAT_RGB_SINT16/g
    s/MESA_FORMAT_RGB_INT32\b/MESA_FORMAT_RGB_SINT32/g
    s/MESA_FORMAT_RGBA_INT8\b/MESA_FORMAT_RGBA_SINT8/g
    s/MESA_FORMAT_RGBA_INT16\b/MESA_FORMAT_RGBA_SINT16/g
    s/MESA_FORMAT_RGBA_INT32\b/MESA_FORMAT_RGBA_SINT32/g
    s/\bMESA_FORMAT_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_UNORM/g
    s/\bMESA_FORMAT_SIGNED_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_SNORM/g
    s/\bMESA_FORMAT_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_UNORM/g
    s/\bMESA_FORMAT_SIGNED_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_SNORM/g
    s/\bMESA_FORMAT_L_LATC1\b/MESA_FORMAT_L_LATC1_UNORM/g
    s/\bMESA_FORMAT_SIGNED_L_LATC1\b/MESA_FORMAT_L_LATC1_SNORM/g
    s/\bMESA_FORMAT_LA_LATC2\b/MESA_FORMAT_LA_LATC2_UNORM/g
    s/\bMESA_FORMAT_SIGNED_LA_LATC2\b/MESA_FORMAT_LA_LATC2_SNORM/g

10 years agomesa: Fix MESA_FORMAT names containg SIGNED
Mark Mueller [Wed, 22 Jan 2014 06:27:40 +0000 (22:27 -0800)]
mesa: Fix MESA_FORMAT names containg SIGNED

Update comments. Replace format names containing SIGNED with
SNORM appended w/decoration per the format name spec:

    s/MESA_FORMAT_SIGNED_R8\b/MESA_FORMAT_R_SNORM8/g
    s/MESA_FORMAT_SIGNED_RG88_REV\b/MESA_FORMAT_R8G8_SNORM/g
    s/MESA_FORMAT_SIGNED_RGBX8888\b/MESA_FORMAT_X8B8G8R8_SNORM/g
    s/MESA_FORMAT_SIGNED_RGBA8888\b/MESA_FORMAT_A8B8G8R8_SNORM/g
    s/MESA_FORMAT_SIGNED_RGBA8888_REV\b/MESA_FORMAT_R8G8B8A8_SNORM/g
    s/MESA_FORMAT_SIGNED_R16\b/MESA_FORMAT_R_SNORM16/g
    s/MESA_FORMAT_SIGNED_GR1616\b/MESA_FORMAT_R16G16_SNORM/g
    s/MESA_FORMAT_SIGNED_RGB_16\b/MESA_FORMAT_RGB_SNORM16/g
    s/MESA_FORMAT_SIGNED_RGBA_16\b/MESA_FORMAT_RGBA_SNORM16/g
    s/MESA_FORMAT_SIGNED_A8\b/MESA_FORMAT_A_SNORM8/g
    s/MESA_FORMAT_SIGNED_I8\b/MESA_FORMAT_I_SNORM8/g
    s/MESA_FORMAT_SIGNED_L8\b/MESA_FORMAT_L_SNORM8/g
    s/MESA_FORMAT_SIGNED_A16\b/MESA_FORMAT_A_SNORM16/g
    s/MESA_FORMAT_SIGNED_I16\b/MESA_FORMAT_I_SNORM16/g
    s/MESA_FORMAT_SIGNED_L16\b/MESA_FORMAT_L_SNORM16/g
    s/MESA_FORMAT_SIGNED_AL88\b/MESA_FORMAT_L8A8_SNORM/g
    s/MESA_FORMAT_SIGNED_RG88\b/MESA_FORMAT_G8R8_SNORM/g
    s/MESA_FORMAT_SIGNED_RG1616\b/MESA_FORMAT_G16R16_SNORM/g

10 years agomesa: Fix MESA_FORMAT names with ALPH, INTENSITY, and LUMINANCE
Mark Mueller [Wed, 22 Jan 2014 05:44:59 +0000 (21:44 -0800)]
mesa: Fix MESA_FORMAT names with ALPH, INTENSITY, and LUMINANCE

Compressed spelled out color components ALPHA, INTENSITY, and LUMINANCE to A, I, and L:
    s/MESA_FORMAT_ALPHA_UINT8\b/MESA_FORMAT_A_UINT8/g'
    s/MESA_FORMAT_ALPHA_UINT16\b/MESA_FORMAT_A_UINT16/g'
    s/MESA_FORMAT_ALPHA_UINT32\b/MESA_FORMAT_A_UINT32/g'
    s/MESA_FORMAT_ALPHA_INT32\b/MESA_FORMAT_A_SINT32/g'
    s/MESA_FORMAT_ALPHA_INT16\b/MESA_FORMAT_A_SINT16/g'
    s/MESA_FORMAT_ALPHA_INT8\b/MESA_FORMAT_A_SINT8/g'
    s/MESA_FORMAT_INTENSITY_UINT8\b/MESA_FORMAT_I_UINT8/g'
    s/MESA_FORMAT_INTENSITY_UINT16\b/MESA_FORMAT_I_UINT16/g'
    s/MESA_FORMAT_INTENSITY_UINT32\b/MESA_FORMAT_I_UINT32/g'
    s/MESA_FORMAT_INTENSITY_INT32\b/MESA_FORMAT_I_SINT32/g'
    s/MESA_FORMAT_INTENSITY_INT16\b/MESA_FORMAT_I_SINT16/g'
    s/MESA_FORMAT_INTENSITY_INT8\b/MESA_FORMAT_I_SINT8/g'
    s/MESA_FORMAT_LUMINANCE_UINT8\b/MESA_FORMAT_L_UINT8/g'
    s/MESA_FORMAT_LUMINANCE_UINT16\b/MESA_FORMAT_L_UINT16/g'
    s/MESA_FORMAT_LUMINANCE_UINT32\b/MESA_FORMAT_L_UINT32/g'
    s/MESA_FORMAT_LUMINANCE_INT32\b/MESA_FORMAT_L_SINT32/g'
    s/MESA_FORMAT_LUMINANCE_INT16\b/MESA_FORMAT_L_SINT16/g'
    s/MESA_FORMAT_LUMINANCE_INT8\b/MESA_FORMAT_L_SINT8/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_UINT8\b/MESA_FORMAT_LA_UINT8/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_UINT16\b/MESA_FORMAT_LA_UINT16/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_UINT32\b/MESA_FORMAT_LA_UINT32/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_INT32\b/MESA_FORMAT_LA_SINT32/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_INT16\b/MESA_FORMAT_LA_SINT16/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_INT8\b/MESA_FORMAT_LA_SINT8/g'
    s/MESA_FORMAT_ALPHA_FLOAT16\b/MESA_FORMAT_A_FLOAT16/g'
    s/MESA_FORMAT_ALPHA_FLOAT32\b/MESA_FORMAT_A_FLOAT32/g'
    s/MESA_FORMAT_INTESITY_FLOAT16\b/MESA_FORMAT_I_FLOAT16/g'
    s/MESA_FORMAT_INTESITY_FLOAT32\b/MESA_FORMAT_I_FLOAT32/g'
    s/MESA_FORMAT_INTENSITY_FLOAT16\b/MESA_FORMAT_I_FLOAT16/g'
    s/MESA_FORMAT_INTENSITY_FLOAT32\b/MESA_FORMAT_I_FLOAT32/g'
    s/MESA_FORMAT_LUMINANCE_FLOAT16\b/MESA_FORMAT_L_FLOAT16/g'
    s/MESA_FORMAT_LUMINANCE_FLOAT32\b/MESA_FORMAT_L_FLOAT32/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16\b/MESA_FORMAT_LA_FLOAT16/g'
    s/MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32\b/MESA_FORMAT_LA_FLOAT32/g'

10 years agomesa: Change many Type P MESA_FORMATs to meet naming spec
Mark Mueller [Sun, 26 Jan 2014 23:12:56 +0000 (15:12 -0800)]
mesa: Change many Type P MESA_FORMATs to meet naming spec

Conversion of Type P formats as follows (w/related comment fixes):
    s/MESA_FORMAT_RGB565\b/MESA_FORMAT_B5G6R5_UNORM/g
    s/MESA_FORMAT_RGB565_REV\b/MESA_FORMAT_R5G6B5_UNORM/g
    s/MESA_FORMAT_ARGB4444\b/MESA_FORMAT_B4G4R4A4_UNORM/g
    s/MESA_FORMAT_ARGB4444_REV\b/MESA_FORMAT_A4R4G4B4_UNORM/g
    s/MESA_FORMAT_RGBA5551\b/MESA_FORMAT_A1B5G5R5_UNORM/g
    s/MESA_FORMAT_XBGR8888_SNORM\b/MESA_FORMAT_R8G8B8X8_SNORM/g
    s/MESA_FORMAT_XBGR8888_SRGB\b/MESA_FORMAT_R8G8B8X8_SRGB/g
    s/MESA_FORMAT_ARGB1555\b/MESA_FORMAT_B5G5R5A1_UNORM/g
    s/MESA_FORMAT_ARGB1555_REV\b/MESA_FORMAT_A1R5G5B5_UNORM/g
    s/MESA_FORMAT_AL44\b/MESA_FORMAT_L4A4_UNORM/g
    s/MESA_FORMAT_RGB332\b/MESA_FORMAT_B2G3R3_UNORM/g
    s/MESA_FORMAT_ARGB2101010\b/MESA_FORMAT_B10G10R10A2_UNORM/g
    s/MESA_FORMAT_Z24_S8\b/MESA_FORMAT_S8_UINT_Z24_UNORM/g
    s/MESA_FORMAT_S8_Z24\b/MESA_FORMAT_Z24_UNORM_S8_UINT/g
    s/MESA_FORMAT_X8_Z24\b/MESA_FORMAT_Z24_UNORM_X8_UINT/g
    s/MESA_FORMAT_Z24_X8\b/MESA_FORMAT_X8Z24_UNORM/g
    s/MESA_FORMAT_RGB9_E5_FLOAT\b/MESA_FORMAT_R9G9B9E5_FLOAT/g
    s/MESA_FORMAT_R11_G11_B10_FLOAT\b/MESA_FORMAT_R11G11B10_FLOAT/g
    s/MESA_FORMAT_Z32_FLOAT_X24S8\b/MESA_FORMAT_Z32_FLOAT_S8X24_UINT/g
    s/MESA_FORMAT_ABGR2101010_UINT\b/MESA_FORMAT_R10G10B10A2_UINT/g
    s/MESA_FORMAT_XRGB4444_UNORM\b/MESA_FORMAT_B4G4R4X4_UNORM/g
    s/MESA_FORMAT_XRGB1555_UNORM\b/MESA_FORMAT_B5G5R5X1_UNORM/g
    s/MESA_FORMAT_XRGB2101010_UNORM\b/MESA_FORMAT_B10G10R10X2_UNORM/g
    s/MESA_FORMAT_AL88\b/MESA_FORMAT_L8A8_UNORM/g
    s/MESA_FORMAT_AL88_REV\b/MESA_FORMAT_A8L8_UNORM/g
    s/MESA_FORMAT_AL1616\b/MESA_FORMAT_L16A16_UNORM/g
    s/MESA_FORMAT_AL1616_REV\b/MESA_FORMAT_A16L16_UNORM/g
    s/MESA_FORMAT_RG88\b/MESA_FORMAT_G8R8_UNORM/g
    s/MESA_FORMAT_GR88\b/MESA_FORMAT_R8G8_UNORM/g
    s/MESA_FORMAT_GR1616\b/MESA_FORMAT_R16G16_UNORM/g
    s/MESA_FORMAT_RG1616\b/MESA_FORMAT_G16R16_UNORM/g
    s/MESA_FORMAT_SRGBA8\b/MESA_FORMAT_A8B8G8R8_SRGB/g
    s/MESA_FORMAT_SARGB8\b/MESA_FORMAT_B8G8R8A8_SRGB/g
    s/MESA_FORMAT_SLA8\b/MESA_FORMAT_L8A8_SRGB/g

Conflicts:
src/mesa/drivers/dri/i965/brw_surface_formats.c
src/mesa/main/format_pack.c
src/mesa/main/format_unpack.c
src/mesa/main/formats.c
src/mesa/main/texformat.c
src/mesa/main/texstore.c

10 years agomesa: Change many Type A MESA_FORMATs to meet naming standard
Mark Mueller [Tue, 21 Jan 2014 03:08:54 +0000 (19:08 -0800)]
mesa: Change many Type A MESA_FORMATs to meet naming standard

Update comments. Conversion of the following Type A formats:
    s/MESA_FORMAT_RGB888\b/MESA_FORMAT_BGR_UNORM8/g
    s/MESA_FORMAT_BGR888\b/MESA_FORMAT_RGB_UNORM8/g
    s/MESA_FORMAT_A8\b/MESA_FORMAT_A_UNORM8/g
    s/MESA_FORMAT_A16\b/MESA_FORMAT_A_UNORM16/g
    s/MESA_FORMAT_L8\b/MESA_FORMAT_L_UNORM8/g
    s/MESA_FORMAT_L16\b/MESA_FORMAT_L_UNORM16/g
    s/MESA_FORMAT_I8\b/MESA_FORMAT_I_UNORM8/g
    s/MESA_FORMAT_I16\b/MESA_FORMAT_I_UNORM16/g
    s/MESA_FORMAT_R8\b/MESA_FORMAT_R_UNORM8/g
    s/MESA_FORMAT_R16\b/MESA_FORMAT_R_UNORM16/g
    s/MESA_FORMAT_Z16\b/MESA_FORMAT_Z_UNORM16/g
    s/MESA_FORMAT_Z32\b/MESA_FORMAT_Z_UNORM32/g
    s/MESA_FORMAT_S8\b/MESA_FORMAT_S_UINT8/g
    s/MESA_FORMAT_SRGB8\b/MESA_FORMAT_BGR_SRGB8/g
    s/MESA_FORMAT_RGBA_16\b/MESA_FORMAT_RGBA_UNORM16/g
    s/MESA_FORMAT_SL8\b/MESA_FORMAT_L_SRGB8/g
    s/MESA_FORMAT_Z32_FLOAT\b/MESA_FORMAT_Z_FLOAT32/g
    s/MESA_FORMAT_XBGR16161616_UNORM\b/MESA_FORMAT_RGBX_UNORM16/g
    s/MESA_FORMAT_XBGR16161616_SNORM\b/MESA_FORMAT_RGBX_SNORM16/g
    s/MESA_FORMAT_XBGR16161616_FLOAT\b/MESA_FORMAT_RGBX_FLOAT16/g
    s/MESA_FORMAT_XBGR16161616_UINT\b/MESA_FORMAT_RGBX_UINT16/g
    s/MESA_FORMAT_XBGR16161616_SINT\b/MESA_FORMAT_RGBX_SINT16/g
    s/MESA_FORMAT_XBGR32323232_FLOAT\b/MESA_FORMAT_RGBX_FLOAT32/g
    s/MESA_FORMAT_XBGR32323232_UINT\b/MESA_FORMAT_RGBX_UINT32/g
    s/MESA_FORMAT_XBGR32323232_SINT\b/MESA_FORMAT_RGBX_SINT32/g
    s/MESA_FORMAT_XBGR8888_UINT\b/MESA_FORMAT_RGBX_UINT8/g
    s/MESA_FORMAT_XBGR8888_SINT\b/MESA_FORMAT_RGBX_SINT8/g

10 years agomesa: Rename 4 color component unsigned byte MESA_FORMATs
Mark Mueller [Mon, 20 Jan 2014 22:21:43 +0000 (14:21 -0800)]
mesa: Rename 4 color component unsigned byte MESA_FORMATs

Change all 4 color component unsigned byte formats to meet spec for P
Type formats:
    s/MESA_FORMAT_RGBA8888\b/MESA_FORMAT_A8B8G8R8_UNORM/g
    s/MESA_FORMAT_RGBA8888_REV\b/MESA_FORMAT_R8G8B8A8_UNORM/g
    s/MESA_FORMAT_ARGB8888\b/MESA_FORMAT_B8G8R8A8_UNORM/g
    s/MESA_FORMAT_ARGB8888_REV\b/MESA_FORMAT_A8R8G8B8_UNORM/g
    s/MESA_FORMAT_RGBX8888\b/MESA_FORMAT_X8B8G8R8_UNORM/g
    s/MESA_FORMAT_RGBX8888_REV\b/MESA_FORMAT_R8G8B8X8_UNORM/g
    s/MESA_FORMAT_XRGB8888\b/MESA_FORMAT_B8G8R8X8_UNORM/g
    s/MESA_FORMAT_XRGB8888_REV\b/MESA_FORMAT_X8R8G8B8_UNORM/g

10 years agomesa: change gl_format to mesa_format
Mark Mueller [Sat, 4 Jan 2014 22:11:43 +0000 (14:11 -0800)]
mesa: change gl_format to mesa_format

s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum

10 years agodocs: Update GL3.txt due to recent work
Ian Romanick [Mon, 13 Jan 2014 22:48:16 +0000 (14:48 -0800)]
docs: Update GL3.txt due to recent work

v2: Note that Fredrik Höglund is working on GL_ARB_multi_bind, not
Maxence Le Doré.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglcpp: Make sure GL_AMD_shader_trinary_minmax is defined
Ian Romanick [Fri, 24 Jan 2014 21:28:24 +0000 (13:28 -0800)]
glcpp: Make sure GL_AMD_shader_trinary_minmax is defined

The define was only available if
gl_extensions::AMD_shader_trinary_minmax was set, but no driver set it.
Since the extension is advertised by default, remove that field too.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Maxence Le Doré <maxence.ledore@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Clean up bad code formatting left from previous commit
Ian Romanick [Wed, 13 Nov 2013 22:00:06 +0000 (14:00 -0800)]
mesa: Clean up bad code formatting left from previous commit

Also s/_EXT// on enums that are now part of core.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: GL_EXT_framebuffer_blit is not optional
Ian Romanick [Wed, 13 Nov 2013 21:30:37 +0000 (13:30 -0800)]
mesa: GL_EXT_framebuffer_blit is not optional

Every driver supports it.  All current and future Gallium drivers always
support it, and all existing classic drivers support it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon: Enable GL_EXT_framebuffer_blit
Ian Romanick [Wed, 13 Nov 2013 21:26:03 +0000 (13:26 -0800)]
radeon: Enable GL_EXT_framebuffer_blit

The dd_function_table::BlitFramebuffer is already initialized to
_mesa_meta_BlitFramebuffer, so it should just work.

Tested on a Radeon 7500 (OpenGL renderer string: Mesa DRI R100 (RV200
5157) TCL DRI2).  I couldn't do a full piglit run because it would tank
the system with or without this patch.  I just ran all the blit tests
(-t blit to piglit-run.py).  Only fbo-sys-sub-blit failed.  All of the
other tests that weren't skipped (i.e., all the multisample and sRGB
tests skip) passed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agor200: Enable GL_EXT_framebuffer_blit
Ian Romanick [Wed, 13 Nov 2013 21:25:04 +0000 (13:25 -0800)]
r200: Enable GL_EXT_framebuffer_blit

The dd_function_table::BlitFramebuffer is already initialized to
_mesa_meta_BlitFramebuffer, so it should just work.

Tested on a FireGL 8800 (OpenGL renderer string: Mesa DRI R200 (R200
5148) TCL DRI).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon / r200: Pass the API into _mesa_initialize_context
Ian Romanick [Thu, 19 Dec 2013 19:04:29 +0000 (11:04 -0800)]
radeon / r200: Pass the API into _mesa_initialize_context

Otherwise an application that requested an OpenGL ES 1.x context would
actually get a desktop OpenGL context.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Validate internalFormat with target in glTexStorage paths
Ian Romanick [Wed, 18 Dec 2013 22:38:16 +0000 (14:38 -0800)]
mesa: Validate internalFormat with target in glTexStorage paths

Fixes the glTexStorage3D failure in
ext_packed_depth_stencil-depth-stencil-texture and
oes_packed_depth_stencil-depth-stencil-texture_gles2.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Refactor internalFormat / target checks to a separate function
Ian Romanick [Wed, 18 Dec 2013 22:35:01 +0000 (14:35 -0800)]
mesa: Refactor internalFormat / target checks to a separate function

We need almost identical code in the glTexStorage path.

v2: Fix typo in a comment noticed by Topi.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Generate the correct error for a depth format with a 3D texture
Ian Romanick [Wed, 18 Dec 2013 22:09:58 +0000 (14:09 -0800)]
mesa: Generate the correct error for a depth format with a 3D texture

All versions of the OpenGL spec are quite clear that
GL_INVALID_OPERATION should be generated.  I added a quotation from the
3.3 core profile spec.

Fixes the glTexImage3D subcases of
ext_packed_depth_stencil-depth-stencil-texture and
oes_packed_depth_stencil-depth-stencil-texture_gles2.  The same subtests
of oes_packed_depth_stencil-depth-stencil-texture_gles1 fail, but they
fail with a different wrong error code.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglx: Update glxext.h to revision 24777.
Matt Turner [Sun, 26 Jan 2014 03:12:13 +0000 (19:12 -0800)]
glx: Update glxext.h to revision 24777.

It readds the GLXContextID typedef, but under #ifndef GLX_VERSION_1_3
and glx.h already defines GLX_VERSION_1_3.

Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=11454
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoloader: Add missing \n on message printing
Emil Velikov [Mon, 27 Jan 2014 12:53:32 +0000 (12:53 +0000)]
loader: Add missing \n on message printing

Cover both loader and glx/dri_glx
Drop \n from the default loader logger

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agodri: Reuse dri_message to implement our other message handlers.
Eric Anholt [Thu, 23 Jan 2014 19:14:16 +0000 (11:14 -0800)]
dri: Reuse dri_message to implement our other message handlers.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri: Fix the logger error message handling.
Eric Anholt [Thu, 23 Jan 2014 19:03:53 +0000 (11:03 -0800)]
dri: Fix the logger error message handling.

Since the loader changes, there has been a compiler warning that the
prototype didn't match.  It turns out that if a loader error message was
ever thrown, you'd segfault because of trying to use the warning level as
a format string.

Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri2: Trust our own driver name lookup over the server's.
Eric Anholt [Thu, 23 Jan 2014 18:21:09 +0000 (10:21 -0800)]
dri2: Trust our own driver name lookup over the server's.

This allows Mesa to choose to rename driver .sos (or split drivers),
without needing a flag day with the corresponding 2D driver.

v2: Undo the loader-only-for-dri3 change.

Reviewed-by: Keith Packard <keithp@keithp.com> [v1]
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> [v1]
10 years agodri2: Open the fd before loading the driver.
Eric Anholt [Thu, 23 Jan 2014 18:17:11 +0000 (10:17 -0800)]
dri2: Open the fd before loading the driver.

I want to stop trusting the server for the driver name, and instead decide
on our own based on the fd, so I needed this code motion.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri3: Fix two little memory leaks.
Eric Anholt [Thu, 23 Jan 2014 18:25:58 +0000 (10:25 -0800)]
dri3: Fix two little memory leaks.

Noticed when valgrinding an unrelated bug.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoloader: Use dlsym to get our udev symbols instead of explicit linking.
Eric Anholt [Thu, 23 Jan 2014 21:12:26 +0000 (13:12 -0800)]
loader: Use dlsym to get our udev symbols instead of explicit linking.

Steam links against libudev.so.0, while we're linking against
libudev.so.1.  The result is that the symbol names (which are the same in
the two libraries) end up conflicting, and some of the usage of .so.1
calls the .so.0 bits, which have different internal structures, and
segfaults happen.

By using a dlopen() with RTLD_LOCAL, we can explicitly look for the
symbols we want, while they get the symbols they want.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Tested-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
10 years agor600g/compute: Emit DEALLOC_STATE on cayman after dispatching a compute shader.
Tom Stellard [Fri, 24 Jan 2014 20:48:26 +0000 (15:48 -0500)]
r600g/compute: Emit DEALLOC_STATE on cayman after dispatching a compute shader.

This is necessary to prevent the next SURFACE_SYNC packet from
hanging the GPU.

https://bugs.freedesktop.org/show_bug.cgi?id=73418

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
CC: "9.2" "10.0" <mesa-stable@lists.freedesktop.org>
10 years agodocs: sync up nv50/nvc0 status on GL4.x extensions
Ilia Mirkin [Tue, 21 Jan 2014 05:26:14 +0000 (00:26 -0500)]
docs: sync up nv50/nvc0 status on GL4.x extensions

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agodocs: update GL3.txt, relnotes to reflect current nv50/nvc0 status
Ilia Mirkin [Wed, 15 Jan 2014 11:05:44 +0000 (06:05 -0500)]
docs: update GL3.txt, relnotes to reflect current nv50/nvc0 status

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50, nvc0: update reported glsl version to 330
Ilia Mirkin [Wed, 15 Jan 2014 10:48:51 +0000 (05:48 -0500)]
nv50, nvc0: update reported glsl version to 330

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/st: expose ARB_texture_rgb10_a2ui if R10G10B10A2_UINT is supported v2
Christoph Bumiller [Thu, 26 Dec 2013 18:06:25 +0000 (19:06 +0100)]
mesa/st: expose ARB_texture_rgb10_a2ui if R10G10B10A2_UINT is supported v2

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agonv50: add more RGB10A2 formats
Christoph Bumiller [Wed, 25 Dec 2013 16:53:50 +0000 (17:53 +0100)]
nv50: add more RGB10A2 formats

10 years agost/mesa: fix GS varyings for PIPE_CAP_TGSI_TEXCOORD
Christoph Bumiller [Wed, 25 Dec 2013 16:53:49 +0000 (17:53 +0100)]
st/mesa: fix GS varyings for PIPE_CAP_TGSI_TEXCOORD

10 years agonv50: enable seamless cube maps on all hw
Ilia Mirkin [Fri, 29 Nov 2013 06:17:25 +0000 (01:17 -0500)]
nv50: enable seamless cube maps on all hw

Some of the hardware support is missing. The NVIDIA-provided driver,
which claims seamless cube map support fails the relevant tests as well.
As this is the last extension before we can have OpenGL 3.2, doing this
allows us to expose geometry shaders without doing the additional
work involved in supporting ARB_geometry_shader4.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: report glsl 1.50 now that gp tests pass
Ilia Mirkin [Mon, 25 Nov 2013 18:56:12 +0000 (13:56 -0500)]
nv50: report glsl 1.50 now that gp tests pass

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: add support for texelFetch'ing MS textures, ARB_texture_multisample
Ilia Mirkin [Sun, 12 Jan 2014 08:32:30 +0000 (03:32 -0500)]
nv50: add support for texelFetch'ing MS textures, ARB_texture_multisample

Creates two areas in the AUX constbuf:
 - Sample offsets for MS textures
 - Per-texture MS settings

When executing a texelFetch with a MS sampler, looks up that texture's
settings and adjusts the parameters given to the texfetch instruction.

With this change, all the ARB_texture_multisample piglits pass, so turn
on PIPE_CAP_TEXTURE_MULTISAMPLE.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: copy nvc0's get_sample_position implementation
Ilia Mirkin [Mon, 13 Jan 2014 02:51:04 +0000 (21:51 -0500)]
nv50: copy nvc0's get_sample_position implementation

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: add comments about CB_AUX contents
Ilia Mirkin [Mon, 13 Jan 2014 04:23:44 +0000 (23:23 -0500)]
nv50: add comments about CB_AUX contents

Updates a few inconsistencies as well, like the size of the buffer,
location of the runout, etc.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: don't forget to also clear additional layers
Ilia Mirkin [Sun, 12 Jan 2014 09:51:09 +0000 (04:51 -0500)]
nvc0: don't forget to also clear additional layers

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: don't forget to also clear additional layers
Ilia Mirkin [Sun, 12 Jan 2014 09:45:22 +0000 (04:45 -0500)]
nv50: don't forget to also clear additional layers

Fixes most of the tests/spec/gl-3.2/layered-rendering/* piglits.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: allocate an extra code bo to avoid dmesg spam
Ilia Mirkin [Mon, 13 Jan 2014 18:36:28 +0000 (13:36 -0500)]
nv50: allocate an extra code bo to avoid dmesg spam

Each code BO is a heap that allocates at the end first, and so GPs are
allocated at the very end of the allocated space. When executing, we see
PAGE_NOT_PRESENT errors for the next page. Just over-allocate to make
sure that there's something there.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: GP_REG_ALLOC_RESULT must be positive
Ilia Mirkin [Sun, 12 Jan 2014 04:26:03 +0000 (23:26 -0500)]
nv50: GP_REG_ALLOC_RESULT must be positive

Set max_out to 1 when there are no outputs.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: VP_RESULT_MAP_SIZE has to be positive
Ilia Mirkin [Sun, 12 Jan 2014 02:04:52 +0000 (21:04 -0500)]
nv50: VP_RESULT_MAP_SIZE has to be positive

Make sure that we never try to use a 0-sized map. This can happen when
using a gp, so add a dummy mapping when computing vp_gp_mapping in that
case.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: enable primitive id generation when it is an FP input without GP
Ilia Mirkin [Wed, 15 Jan 2014 08:49:57 +0000 (03:49 -0500)]
nv50: enable primitive id generation when it is an FP input without GP

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: handle gl_Layer writes in GP
Ilia Mirkin [Wed, 15 Jan 2014 08:47:48 +0000 (03:47 -0500)]
nv50: handle gl_Layer writes in GP

Marks gl_Layer as only having one component, and makes sure to keep
track of where it is and emit it in the output map, since it is not an
input to the FP.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: properly set the PRIMITIVE_ID enable flag when it is a gp input.
Ilia Mirkin [Sun, 12 Jan 2014 01:12:18 +0000 (20:12 -0500)]
nv50: properly set the PRIMITIVE_ID enable flag when it is a gp input.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: add support for gl_PrimitiveIDIn
Ilia Mirkin [Sun, 12 Jan 2014 00:42:04 +0000 (19:42 -0500)]
nv50/ir: add support for gl_PrimitiveIDIn

Note that the primitive id is stored in a[0x18], while usually the
geometry instructions are of the form a[$a1 + 0x4] which gets mapped to
p[] space. We need to avoid the change from a[] to p[] here, so it's
keyed on whether the access is indirect or not.

Note that there's also a use-case for accessing e.g. a[$r1], however
that's not supported for now. (Could be added by checking the register
file of the indirect parameter.)

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: fix support for shader input + immediate in gp
Ilia Mirkin [Sat, 18 Jan 2014 08:18:19 +0000 (03:18 -0500)]
nv50/ir: fix support for shader input + immediate in gp

This only works for up to $a3, hopefully we won't go that high.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: disallow shader input + cbuf in same instruction in gp
Ilia Mirkin [Sat, 11 Jan 2014 03:17:04 +0000 (22:17 -0500)]
nv50/ir: disallow shader input + cbuf in same instruction in gp

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: disallow predicates on emit/restart ops
Ilia Mirkin [Mon, 25 Nov 2013 08:19:06 +0000 (03:19 -0500)]
nv50/ir: disallow predicates on emit/restart ops

10 years agonv50: allow vert_count to be >255
Ilia Mirkin [Mon, 25 Nov 2013 08:18:34 +0000 (03:18 -0500)]
nv50: allow vert_count to be >255

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50: add support for geometry shaders
Bryan Cain [Wed, 17 Apr 2013 20:55:47 +0000 (15:55 -0500)]
nv50: add support for geometry shaders

Layer output probably doesn't work yet, but other than that everything seems
to be working.

Signed-off-by: Bryan Cain <bryancain3@gmail.com>
[calim: fix up minor bugs, code formatting]
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: delay calculation of indirect addresses
Bryan Cain [Wed, 17 Apr 2013 20:55:46 +0000 (15:55 -0500)]
nv50/ir: delay calculation of indirect addresses

Instead of emitting an SHL 4 io an address register on the TGSI ARL and UARL
instructions, emit the shift when the loaded address is actually used.  This
is necessary because input vertex and attribute indices in geometry shaders on
nv50 need to be shifted left by 2 instead of 4.

Signed-off-by: Bryan Cain <bryancain3@gmail.com>
[calim: various updates to the indirect address logic]
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
[imirkin: remove OP_MAD change that calim made, add OP_RESTART handling
          same as OP_EMIT for code flow analysis]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: fix PFETCH and add RDSV to get VSTRIDE for GPs
Christoph Bumiller [Thu, 4 Apr 2013 20:57:42 +0000 (22:57 +0200)]
nv50/ir: fix PFETCH and add RDSV to get VSTRIDE for GPs

10 years agonv50/ir: txg not available on nvaa/nvac
Ilia Mirkin [Sun, 19 Jan 2014 03:19:16 +0000 (22:19 -0500)]
nv50/ir: txg not available on nvaa/nvac

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50, nvc0: only clear out the buffers that we were asked to clear
Ilia Mirkin [Thu, 16 Jan 2014 23:52:49 +0000 (18:52 -0500)]
nv50, nvc0: only clear out the buffers that we were asked to clear

Fixes fbo-drawbuffers-none glClearBuffer piglit test.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agonv50, nvc0: clear out RT on a null cbuf
Ilia Mirkin [Wed, 15 Jan 2014 07:14:06 +0000 (02:14 -0500)]
nv50, nvc0: clear out RT on a null cbuf

This is needed since commit 9baa45f78b (st/mesa: bind NULL colorbuffers
as specified by glDrawBuffers).

This implementation is highly based on a larger commit by
Christoph Bumiller <e0425955@student.tuwien.ac.at> in his gallium-nine
branch.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agonv50: don't leak heap on tls alloc failure
Ilia Mirkin [Sun, 12 Jan 2014 03:03:19 +0000 (22:03 -0500)]
nv50: don't leak heap on tls alloc failure

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonouveau/codegen: set dType to S32 for OP_NEG U32
Ilia Mirkin [Fri, 10 Jan 2014 22:58:37 +0000 (17:58 -0500)]
nouveau/codegen: set dType to S32 for OP_NEG U32

It doesn't make sense to do an OP_NEG from U32 to U32. This was
manifested on nv50 in glsl-fs-atan-3 which was generating a

UMAD TEMP[0].x, TEMP[0].xxxx, -TEMP[5].xxxx, TEMP[0].xxxx

instruction. (For some reason, nvc0 causes a different shader to be
generated.) This led to a

cvt neg u32 $r1 u32 $r1

Which did not yield the desired result. This changes the final output to

cvt neg s32 $r1 u32 $r1

which produces the desired output and the piglit tests passes. My
assumption is that this is also what we want on nvc0, but could not test
as there was no suitable shader that generated the problem instruction.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoutil/u_vbuf: correct map offset calculation for crazy offsets
Ilia Mirkin [Thu, 23 Jan 2014 02:30:07 +0000 (21:30 -0500)]
util/u_vbuf: correct map offset calculation for crazy offsets

When the min_index is very large (or very negative), the multipliation
can overflow 32 bits and result in an incorrect map pointer
modification.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agotranslate: deal with size overflows by casting to ptrdiff_t
Ilia Mirkin [Wed, 22 Jan 2014 00:45:18 +0000 (19:45 -0500)]
translate: deal with size overflows by casting to ptrdiff_t

This was discovered as a result of the draw-elements-base-vertex-neg
piglit test, which passes very negative offsets in, followed up by large
indices. The nouveau code correctly adjusts the pointer, but the
translate code needs to do the proper inverse correction. Similarly fix
up the SSE code to do a 64-bit multiply to compute the proper offset.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallium/rtasm: handle mmap failures appropriately
Emil Velikov [Fri, 10 Jan 2014 18:00:17 +0000 (18:00 +0000)]
gallium/rtasm: handle mmap failures appropriately

For a variety of reasons mmap (selinux and pax to name
a few) and can fail and with current code. This will
result in a crash in the driver, if not worse.

This has been the case since the inception of the
gallium copy of rtasm.

Cc: 9.1 9.2 10.0 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73473
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
10 years agohaiku: change atomic int to non-volatile
Alexander von Gluck IV [Thu, 23 Jan 2014 01:55:39 +0000 (19:55 -0600)]
haiku: change atomic int to non-volatile

* Our atomic calls changed recently and no longer want atomic int
  pointers to be volatile
* Spellcheck

10 years agoi965: Don't store qpitch / 4 as mt->qpitch for compressed surfaces.
Kenneth Graunke [Thu, 23 Jan 2014 00:48:03 +0000 (16:48 -0800)]
i965: Don't store qpitch / 4 as mt->qpitch for compressed surfaces.

Broadwell requires software to specify QPitch in a bunch of packets,
so we decided to store it in the miptree.  However, when I did that
refactoring, I missed a subtlety: the hardware expects QPitch to be
"in units of rows in the uncompressed surface".

This is the value we originally compute.  However, for compressed
surfaces, we then divided it by 4 (the block height), to obtain the
physical layout.  This is no longer the QPitch Broadwell expects.

So, store the original undivided value in mt->qpitch, but continue to
use the divided value in brw_miptree_layout_texture_array().  For
non-Broadwell platforms, this should have no impact at all.

Helps fix Piglit's "getteximage-targets S3TC CUBE" test on Broadwell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoc11: Do not use pthread_mutex_timedlock on NetBSD.
Vinson Lee [Fri, 24 Jan 2014 23:35:18 +0000 (15:35 -0800)]
c11: Do not use pthread_mutex_timedlock on NetBSD.

This patch fixes the NetBSD build.

NetBSD does not have pthread_mutex_timedlock.

  CC       glapi_dispatch.lo
threads_posix.h: In function 'mtx_timedlock':
threads_posix.h:216:5: error: implicit declaration of function 'pthread_mutex_timedlock'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoglsl: Simplify built-in generator functions for min3/max3/mid3.
Kenneth Graunke [Mon, 6 Jan 2014 22:39:19 +0000 (14:39 -0800)]
glsl: Simplify built-in generator functions for min3/max3/mid3.

The type of all three parameters are identical, so we don't need to
specify it three times.  The predicate is always identical too, so we
don't need to make it a parameter, either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Fix chained assignments of vector channels.
Kenneth Graunke [Fri, 24 Jan 2014 18:47:49 +0000 (10:47 -0800)]
glsl: Fix chained assignments of vector channels.

Simple shaders such as:

    void splat(vec2 v, float f) {
        v[0] = v[1] = f;
    }

failed to compile with the following error:
error: value of type vec2 cannot be assigned to variable of type float

First, we would process v[1] = f, and transform:
LHS: (expression float vector_extract (var_ref v) (constant int (1)))
RHS: (var_ref f)
into:
LHS: (var_ref v)
RHS: (expression vec2 vector_insert (var_ref v) (constant int (1))
                 (var_ref f))

Note that the LHS type is now vec2, not a float.  This is surprising,
but not the real problem.

After emitting assignments, this ultimately becomes:
(declare (temporary) vec2 assignment_tmp)
(assign (xy)
  (var_ref assignment_tmp)
  (expression vec2 vector_insert (var_ref v) (constant int (1))
              (var_ref f)))
  (assign (xy) (var_ref v) (var_ref assignment_tmp))

We would then return (var_ref assignment_tmp) as the rvalue, which has
the wrong type---it should be float, but is instead a vec2.

To fix this, we simply return (vector_extract (var_ref assignment_temp)
<the appropriate channel>) to pull out the desired float value.

Fixes Piglit's chained-assignment-with-vector-constant-index.vert and
chained-assignment-with-vector-dynamic-index.vert tests.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74026
Reported-by: Dan Ginsburg <dang@valvesoftware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Rename "expr" to "lhs_expr" in vector_extract munging code.
Kenneth Graunke [Fri, 24 Jan 2014 18:42:48 +0000 (10:42 -0800)]
glsl: Rename "expr" to "lhs_expr" in vector_extract munging code.

When processing assignments, we have both an LHS and RHS.  At a glance,
"lhs_expr" clearly refers to the LHS, while a generic name like "expr"
is ambiguous.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoUpdate .gitignore for Catalan translations build artifacts
Paul Berry [Fri, 24 Jan 2014 21:43:43 +0000 (13:43 -0800)]
Update .gitignore for Catalan translations build artifacts

Causes git to ignore the new build artifacts introduced by commit
d5e5367e8992c2e5322d35fba8d86c33a0db6825 (driconf: Add Catalan
translations).

10 years agomesa: Increment the list pointer while freeing instruction data
Ian Romanick [Wed, 22 Jan 2014 00:52:42 +0000 (16:52 -0800)]
mesa: Increment the list pointer while freeing instruction data

Since the list pointer was never incremented when a OPCODE_PIXEL_MAP
opcode was encountered, the data for the instruction would get freed
over and over and over... resulting in a crash.

Fixes gl-1.0-beginend-coverage.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72214
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: Lu Ha <huax.lu@intel.com>
10 years agosvga: rename "tex_usage" to "bindings", add comments
Brian Paul [Thu, 23 Jan 2014 22:04:40 +0000 (15:04 -0700)]
svga: rename "tex_usage" to "bindings", add comments

Trivial.