mesa.git
9 years agovk/image: Enable 2d single-sample color miptrees
Chad Versace [Sat, 27 Jun 2015 04:27:54 +0000 (21:27 -0700)]
vk/image: Enable 2d single-sample color miptrees

What's been tested, for both image views and color attachment views:

    - VK_FORMAT_R8G8B8A8_UNORM
    - VK_IMAGE_VIEW_TYPE_2D
    - mipLevels: 1, 2
    - baseMipLevel: 0, 1
    - arraySize: 1, 2
    - baseArraySlice: 0, 1

What's known to be broken:

    - Depth and stencil miptrees. To fix this, anv_depth_stencil_view
      needs major rework.
    - VkImageViewType != 2D
    - MSAA

Fixes Crucible tests:

  func.miptree.view-2d.levels02.array01.*
  func.miptree.view-2d.levels01.array02.*
  func.miptree.view-2d.levels02.array02.*

9 years agovk/image: Define anv_surface, refactor anv_image
Chad Versace [Sat, 27 Jun 2015 01:48:34 +0000 (18:48 -0700)]
vk/image: Define anv_surface, refactor anv_image

This prepares for upcoming miptree support.

anv_surface is a proxy for color surfaces, depth surfaces, and stencil
surfaces.  Embed two instances of anv_surface into anv_image: the
primary surface (color or depth), and an optional stencil surface.

9 years agovk/image: Reformat function signatures
Chad Versace [Sat, 27 Jun 2015 03:12:42 +0000 (20:12 -0700)]
vk/image: Reformat function signatures

Reformat them to match Mesa code-style.

9 years agovk/image: Embed VkImageCreateInfo* into anv_image_create_info
Chad Versace [Sat, 27 Jun 2015 03:06:08 +0000 (20:06 -0700)]
vk/image: Embed VkImageCreateInfo* into anv_image_create_info

All function signatures that matched this pattern,
  old: f(const VkImageCreateInfo *, const struct anv_image_create_info *)

were rewritten as
  new: f(const struct anv_image_create_info *)

9 years agovk/image: Drop some tmp vars in anv_image_view_init()
Chad Versace [Sat, 27 Jun 2015 02:50:04 +0000 (19:50 -0700)]
vk/image: Drop some tmp vars in anv_image_view_init()

Variables 'tile_mode' and 'format' are unneeded.

9 years agovk/image: Abort on stencil image views
Chad Versace [Sat, 27 Jun 2015 02:23:21 +0000 (19:23 -0700)]
vk/image: Abort on stencil image views

The code doesn't work. Not even close.

Replace the broken code with a FINISHME and abort.

9 years agovk: Reindent struct anv_image
Chad Versace [Fri, 26 Jun 2015 22:27:20 +0000 (15:27 -0700)]
vk: Reindent struct anv_image

9 years agovk: Define MIN(a, b) macro
Chad Versace [Fri, 26 Jun 2015 22:06:09 +0000 (15:06 -0700)]
vk: Define MIN(a, b) macro

9 years agovk: Rename functions ALIGN_*32 -> align_*32
Chad Versace [Fri, 26 Jun 2015 22:07:59 +0000 (15:07 -0700)]
vk: Rename functions ALIGN_*32 -> align_*32

ALIGN_U32 and ALIGN_I32 are functions, not macros. So stop using
allcaps.

9 years agoMerge branch 'wip/nir-vtn' into vulkan
Connor Abbott [Fri, 26 Jun 2015 19:14:05 +0000 (12:14 -0700)]
Merge branch 'wip/nir-vtn' into vulkan

Adds composites and matrix multiplication, plus some control flow fixes.

9 years agovk/formats: Remove the cpp=0 stencil hack
Chad Versace [Fri, 26 Jun 2015 16:47:17 +0000 (09:47 -0700)]
vk/formats: Remove the cpp=0 stencil hack

The format table defined cpp = 0 for stencil-only formats. The real cpp
is 1.

When code begins to lie, especially about stencil buffers, code becomes
increasingly fragile as time progresses, and the damage becomes
increasingly hard to undo. (For precedent, see the painful history of
stencil buffer cpp in the git log for gen6 and gen7 in the i965 driver).
Let's undo the stencil buffer cpp lie now to avoid future pain.

In the format table, set cpp = 1 for VK_FORMAT_S8; replace checks for
cpp == 0; and delete all comments about the hack.

9 years agovk/image: Refactor anv_image_create()
Chad Versace [Fri, 26 Jun 2015 16:17:52 +0000 (09:17 -0700)]
vk/image: Refactor anv_image_create()

From my experience with intel_mipmap_tree.c, I learned that for struct's
like anv_image and intel_mipmap_tree, which have sprawling
multi-function construction codepaths, it's easy to mistakenly use
unitialized struct members during construction.

Let's eliminate the risk of using unitialized anv_image members during
construction.  Fill the struct at the function bottom instead of
piecemeal throughout the constructor.

9 years agovk/image: Group some assertions closer together
Chad Versace [Fri, 26 Jun 2015 16:05:46 +0000 (09:05 -0700)]
vk/image: Group some assertions closer together

In anv_image_create(), group together the assertions on
VkImageCreateInfo.

9 years agovk/formats: #undef fmt at end of format table
Chad Versace [Fri, 26 Jun 2015 14:38:02 +0000 (07:38 -0700)]
vk/formats: #undef fmt at end of format table

9 years agovk: Fix comment for anv_depth_stencil_view::stencil_qpitch
Chad Versace [Fri, 26 Jun 2015 14:31:57 +0000 (07:31 -0700)]
vk: Fix comment for anv_depth_stencil_view::stencil_qpitch

s/DEPTH/STENCIL/

9 years agovk/image: Add qpitch fields to anv_depth_stencil_view
Chad Versace [Fri, 26 Jun 2015 02:46:42 +0000 (19:46 -0700)]
vk/image: Add qpitch fields to anv_depth_stencil_view

For now, hard-code them to 0.

9 years agovk: Reindent and document struct anv_depth_stencil_view
Chad Versace [Fri, 26 Jun 2015 02:42:09 +0000 (19:42 -0700)]
vk: Reindent and document struct anv_depth_stencil_view

9 years agovk/formats: Fix incorrect depth formats
Chad Versace [Fri, 26 Jun 2015 02:29:59 +0000 (19:29 -0700)]
vk/formats: Fix incorrect depth formats

anv_format::surface_format was incorrect for Vulkan depth formats.
For example, the format table mapped

    VK_FORMAT_D24_UNORM -> .surface_format = D24_UNORM_X8_UINT
    VK_FORMAT_D32_FLOAT -> .surface_format = D32_FLOAT

but should have mapped

    VK_FORMAT_D24_UNORM -> .surface_format = R24_UNORM_X8_TYPELESS
    VK_FORMAT_D32_FLOAT -> .surface_format = R32_FLOAT

The Crucible test func.depthstencil.basic passed despite the bug, but
only because it did not attempt to texture from the depth surface.

The core problem is that RENDER_SURFACE_STATE.SurfaceFormat and
3DSTATE_DEPTH_BUFFER.SurfaceFormat are distinct types. Considering them
as enum spaces, the two enum spaces have incompatible collisions.

Fix this by adding a new field 'depth_format' to struct anv_format.

Refer to brw_surface_formats.c:translate_tex_format() for precedent.

9 years agovk/image: Rename local variable in anv_image_create()
Chad Versace [Fri, 26 Jun 2015 02:03:43 +0000 (19:03 -0700)]
vk/image: Rename local variable in anv_image_create()

This function has many local variables for info structs. Having one
named simply 'info' is confusing.  Rename it to 'format_info'.

9 years agovk/formats: Fix table entry for R8G8B8_SNORM
Chad Versace [Fri, 26 Jun 2015 01:22:59 +0000 (18:22 -0700)]
vk/formats: Fix table entry for R8G8B8_SNORM

Now that anv_formats[] is formatted like a table, buggy entries are
easier to see.

9 years agovk/formats: Rename anv_format::format -> surface_format
Chad Versace [Fri, 26 Jun 2015 01:18:06 +0000 (18:18 -0700)]
vk/formats: Rename anv_format::format -> surface_format

I misinterpreted anv_format::format as a VkFormat. Instead, it is
a hardware surface format (RENDER_SURFACE_STATE.SurfaceFormat). Rename
the field to 'surface_format' to make it unambiguous.

9 years agovk/formats: Rename anv_format::channels -> num_channels
Chad Versace [Fri, 26 Jun 2015 01:01:08 +0000 (18:01 -0700)]
vk/formats: Rename anv_format::channels -> num_channels

I misinterpreted anv_format::channels as a bitmask of channels.
Renaming it to 'num_channels' makes it unambiguous.

9 years agovk: Reindent struct anv_format
Chad Versace [Fri, 26 Jun 2015 00:58:17 +0000 (17:58 -0700)]
vk: Reindent struct anv_format

9 years agovk/formats: Don't abbreviate tokens in the format table
Chad Versace [Fri, 26 Jun 2015 00:56:20 +0000 (17:56 -0700)]
vk/formats: Don't abbreviate tokens in the format table

Abbreviating the VK_FORMAT_* tokens doesn't help much. To the contrary,
it means grep and ctags can't find them.

9 years agovk/compiler: Add the initial hacks to get SPIR-V up and going
Jason Ekstrand [Fri, 26 Jun 2015 00:36:22 +0000 (17:36 -0700)]
vk/compiler: Add the initial hacks to get SPIR-V up and going

9 years agoHACK: Get rid of sanity_param_count for FS
Jason Ekstrand [Fri, 26 Jun 2015 00:34:11 +0000 (17:34 -0700)]
HACK: Get rid of sanity_param_count for FS

9 years agoi965: Don't print the GLSL IR if it doesn't exist
Jason Ekstrand [Fri, 26 Jun 2015 00:33:18 +0000 (17:33 -0700)]
i965: Don't print the GLSL IR if it doesn't exist

9 years agonir/spirv: Set the right location for shader input/outputs
Jason Ekstrand [Fri, 26 Jun 2015 00:32:25 +0000 (17:32 -0700)]
nir/spirv: Set the right location for shader input/outputs

We need to add FRAG_RESULT_DATA0 etc. to the input/output location.

9 years agonir/spirv: Set the interface type on uniform blocks
Jason Ekstrand [Fri, 26 Jun 2015 00:32:10 +0000 (17:32 -0700)]
nir/spirv: Set the interface type on uniform blocks

9 years agonir/spirv: Set the system value mode on builtins
Jason Ekstrand [Fri, 26 Jun 2015 00:31:56 +0000 (17:31 -0700)]
nir/spirv: Set the system value mode on builtins

9 years agonir/spirv: Actually put variables on the right linked list
Jason Ekstrand [Fri, 26 Jun 2015 00:31:07 +0000 (17:31 -0700)]
nir/spirv: Actually put variables on the right linked list

9 years agoglsl: Move vert_attrib varying_slot and frag_result enums to shader_enums.h
Jason Ekstrand [Thu, 25 Jun 2015 23:37:12 +0000 (16:37 -0700)]
glsl: Move vert_attrib varying_slot and frag_result enums to shader_enums.h

9 years agovk/image: Check extent does not exceed surface type limits
Chad Versace [Thu, 28 May 2015 14:40:22 +0000 (07:40 -0700)]
vk/image: Check extent does not exceed surface type limits

9 years agovk/image: Stop hardcoding SurfaceType of VkImageView
Chad Versace [Thu, 28 May 2015 14:46:31 +0000 (07:46 -0700)]
vk/image: Stop hardcoding SurfaceType of VkImageView

Instead, translate VkImageViewType to a gen SurfaceType.

9 years agovk/image: Add anv_image::surf_type
Chad Versace [Thu, 28 May 2015 14:45:31 +0000 (07:45 -0700)]
vk/image: Add anv_image::surf_type

This the gen SurfaceType, such as SURFTYPE_2D.

9 years agovk/image: Add tables for gen SurfaceType
Chad Versace [Thu, 28 May 2015 14:37:59 +0000 (07:37 -0700)]
vk/image: Add tables for gen SurfaceType

Tables for mapping VkImageType and VkImageViewType to gen SurfaceType.
Tables are unused.

9 years agovk/util: Add anv_loge() for logging error messages
Chad Versace [Thu, 28 May 2015 15:07:54 +0000 (08:07 -0700)]
vk/util: Add anv_loge() for logging error messages

9 years agovk: Add func anv_is_aligned()
Chad Versace [Thu, 25 Jun 2015 23:26:07 +0000 (16:26 -0700)]
vk: Add func anv_is_aligned()

9 years agovk: Add anv_minify()
Chad Versace [Thu, 28 May 2015 16:50:26 +0000 (09:50 -0700)]
vk: Add anv_minify()

9 years agovk: Define MAX(a, b) macro
Chad Versace [Thu, 28 May 2015 16:50:18 +0000 (09:50 -0700)]
vk: Define MAX(a, b) macro

9 years agonir/spirv: Fix up some dererf ralloc parenting
Jason Ekstrand [Thu, 25 Jun 2015 04:39:07 +0000 (21:39 -0700)]
nir/spirv: Fix up some dererf ralloc parenting

9 years agoi965/nir: Handle returns as long as they're at the end of a function
Jason Ekstrand [Thu, 25 Jun 2015 04:38:49 +0000 (21:38 -0700)]
i965/nir: Handle returns as long as they're at the end of a function

9 years agoi965/nir: Split NIR shader handling into two functions
Jason Ekstrand [Thu, 25 Jun 2015 04:22:05 +0000 (21:22 -0700)]
i965/nir: Split NIR shader handling into two functions

The brw_create_nir function takes a GLSL or ARB shader and turns it into a
NIR shader.  The guts of the optimization and lowering code is now split
into a new brw_process_shader function.

9 years agonir/spirv: Use vtn_ssa_value for texture coordinates
Jason Ekstrand [Thu, 25 Jun 2015 03:38:52 +0000 (20:38 -0700)]
nir/spirv: Use vtn_ssa_value for texture coordinates

9 years agonir/spirv: Add support for the Uniform storage class
Jason Ekstrand [Thu, 25 Jun 2015 03:32:03 +0000 (20:32 -0700)]
nir/spirv: Add support for the Uniform storage class

This is kida sketchy.  I'm not really sure this is the way it's supposed to
be used.

9 years agonir/spirv: Add support for some more decorations including built-in
Jason Ekstrand [Thu, 25 Jun 2015 03:29:33 +0000 (20:29 -0700)]
nir/spirv: Add support for some more decorations including built-in

9 years agonir/spirv: Make the header file C++ safe
Jason Ekstrand [Thu, 25 Jun 2015 02:01:10 +0000 (19:01 -0700)]
nir/spirv: Make the header file C++ safe

9 years agovk: Build xmlconfig stuff into libi965_compiler
Jason Ekstrand [Wed, 24 Jun 2015 22:58:45 +0000 (15:58 -0700)]
vk: Build xmlconfig stuff into libi965_compiler

9 years agovk/headers: Handle MBO fields
Kristian Høgsberg Kristensen [Mon, 22 Jun 2015 06:47:10 +0000 (23:47 -0700)]
vk/headers: Handle MBO fields

These must be set to one.

9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Wed, 24 Jun 2015 01:05:25 +0000 (18:05 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agoi965/fs: Get rid of an unused variable in emit_barrier()
Jason Ekstrand [Tue, 23 Jun 2015 22:39:42 +0000 (15:39 -0700)]
i965/fs: Get rid of an unused variable in emit_barrier()

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965: Remove the brw_context from the visitors
Jason Ekstrand [Tue, 23 Jun 2015 00:17:56 +0000 (17:17 -0700)]
i965: Remove the brw_context from the visitors

As of this commit, nothing actually needs the brw_context.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/vec4_vs: Add an explicit use_legacy_snorm_formula flag
Jason Ekstrand [Tue, 23 Jun 2015 00:30:23 +0000 (17:30 -0700)]
i965/vec4_vs: Add an explicit use_legacy_snorm_formula flag

This way we can stop doing is_gles3 checks inside of the compiler.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/vec4: Turn some _mesa_problem calls into asserts
Jason Ekstrand [Tue, 23 Jun 2015 00:17:51 +0000 (17:17 -0700)]
i965/vec4: Turn some _mesa_problem calls into asserts

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/vs: Pass the current set of clip planes through run() and run_vs()
Jason Ekstrand [Sat, 20 Jun 2015 00:29:42 +0000 (17:29 -0700)]
i965/vs: Pass the current set of clip planes through run() and run_vs()

Previously, these were pulled out of the GL context conditionally based on
whether we were running ff/ARB or a GLSL program.  Now, we just pass them
in so that the visitor doesn't have to grab them itself.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/fs: Add a do_rep_send flag to run_fs
Jason Ekstrand [Sat, 20 Jun 2015 00:25:28 +0000 (17:25 -0700)]
i965/fs: Add a do_rep_send flag to run_fs

Previously, we were pulling it from brw->do_rep_send

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Pull calls to get_shader_time_index out of the visitor
Jason Ekstrand [Fri, 19 Jun 2015 22:40:09 +0000 (15:40 -0700)]
i965: Pull calls to get_shader_time_index out of the visitor

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Use a single index per shader for shader_time.
Jason Ekstrand [Fri, 19 Jun 2015 21:46:03 +0000 (14:46 -0700)]
i965: Use a single index per shader for shader_time.

Previously, each shader took 3 shader time indices which were potentially
at arbirary points in the shader time buffer.  Now, each shader gets a
single index which refers to 3 consecutive locations in the buffer.  This
simplifies some of the logic at the cost of having a magic 3 a few places.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Add compiler options to brw_compiler
Jason Ekstrand [Thu, 16 Apr 2015 22:28:17 +0000 (15:28 -0700)]
i965: Add compiler options to brw_compiler

This creates the options at screen cration time and then we just copy them
into the context at context creation time.  We also move is_scalar to the
brw_compiler structure.

We also end up manually setting some values that the core would have set by
default for us.  Fortunately, there are only two non-zero shader compiler
option defaults that we aren't overriding anyway so this isn't a big deal.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/fs: Plumb compiler debug logging through brw_compiler
Jason Ekstrand [Tue, 23 Jun 2015 00:01:22 +0000 (17:01 -0700)]
i965/fs: Plumb compiler debug logging through brw_compiler

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/fs: Do the no16 perf logging directly in fs_visitor::no16()
Jason Ekstrand [Mon, 22 Jun 2015 23:32:06 +0000 (16:32 -0700)]
i965/fs: Do the no16 perf logging directly in fs_visitor::no16()

While we're at it, we'll drop the note about 10-20% performance loss.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/fs: Make no16 non-variadic
Jason Ekstrand [Mon, 22 Jun 2015 23:30:04 +0000 (16:30 -0700)]
i965/fs: Make no16 non-variadic

We never used the fact that it was variadic anyway.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Move INTEL_DEBUG variable parsing to screen creation time
Jason Ekstrand [Fri, 17 Apr 2015 00:39:13 +0000 (17:39 -0700)]
i965: Move INTEL_DEBUG variable parsing to screen creation time

v2: Do bufmgr set_debug and set_aub_dump at screen time as well.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Remove the dependance on brw_context from the generators
Jason Ekstrand [Thu, 16 Apr 2015 21:34:04 +0000 (14:34 -0700)]
i965: Remove the dependance on brw_context from the generators

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Plumb compiler debug logging through a function pointer in brw_compiler
Jason Ekstrand [Thu, 16 Apr 2015 21:13:52 +0000 (14:13 -0700)]
i965: Plumb compiler debug logging through a function pointer in brw_compiler

v2 (Ken): Make shader_debug_log a printf-like function.
v3 (Jason): Add a void * to pass the brw_context through

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Add a va_args variant of _mesa_gl_debug().
Kenneth Graunke [Sat, 18 Apr 2015 19:23:33 +0000 (12:23 -0700)]
mesa: Add a va_args variant of _mesa_gl_debug().

This will be useful for wrapper functions.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Replace some instances of brw->gen with devinfo->gen
Jason Ekstrand [Sat, 20 Jun 2015 00:19:38 +0000 (17:19 -0700)]
i965: Replace some instances of brw->gen with devinfo->gen

9 years agoi965: Initialize backend_shader::mem_ctx in its constructor.
Matt Turner [Mon, 22 Jun 2015 18:42:15 +0000 (11:42 -0700)]
i965: Initialize backend_shader::mem_ctx in its constructor.

We were initializing it in each subclasses' constructors for some
reason.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965: Assert that the GL primitive isn't out of range.
Matt Turner [Mon, 22 Jun 2015 18:20:32 +0000 (11:20 -0700)]
i965: Assert that the GL primitive isn't out of range.

Coverity sees the if (mode >= BRW_PRIM_OFFSET (128)) test and assumes
that the else-branch might execute for mode to up 127, which out be out
of bounds.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965/cfg: Assert that cur_do/while/if pointers are non-NULL.
Matt Turner [Mon, 22 Jun 2015 18:09:49 +0000 (11:09 -0700)]
i965/cfg: Assert that cur_do/while/if pointers are non-NULL.

Coverity sees that the functions immediately below the new assertions
dereference these pointers, but is unaware that an ENDIF always follows
an IF, etc.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agomesa: Delete unused ICEIL().
Matt Turner [Sat, 20 Jun 2015 03:40:15 +0000 (20:40 -0700)]
mesa: Delete unused ICEIL().

Can't find any uses of it in git history.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965/fs: Don't mess up stride for uniform integer multiplication.
Matt Turner [Mon, 22 Jun 2015 17:59:33 +0000 (10:59 -0700)]
i965/fs: Don't mess up stride for uniform integer multiplication.

If the stride is 0, the source is a uniform and we should not modify the
stride.

Cc: "10.6" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91047
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoegl/x11: Remove duplicate call to dri2_x11_add_configs_for_visuals
Boyan Ding [Sat, 13 Jun 2015 07:33:20 +0000 (15:33 +0800)]
egl/x11: Remove duplicate call to dri2_x11_add_configs_for_visuals

The call to dri2_x11_add_configs_for_visuals (previously
dri2_add_configs_for_visuals) was moved downwards in commit f8c5b8a1,
but appeared again in its original position after its rename in
d019cd81. Remove it.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agonir/vtn: add support for phi nodes
Connor Abbott [Tue, 23 Jun 2015 17:34:55 +0000 (10:34 -0700)]
nir/vtn: add support for phi nodes

9 years agonir/builder: add support for inserting before/after blocks
Connor Abbott [Tue, 23 Jun 2015 17:34:22 +0000 (10:34 -0700)]
nir/builder: add support for inserting before/after blocks

9 years agoi965/gen9: Don't use encrypted MOCS
Ben Widawsky [Wed, 17 Jun 2015 22:50:13 +0000 (15:50 -0700)]
i965/gen9: Don't use encrypted MOCS

On gen9+ MOCS is an index into a table. It is 7 bits, and AFAICT, bit 0 is for
doing encrypted reads.

I don't recall how I decided to do this for BXT. I don't know this patch was
ever needed, since it seems nothing is broken today on SKL. Furthermore, this
patch may no longer be needed because of the ongoing changes with MOCS setup. It
is what is being used/tested, so it's included in the series.

The chosen values are the old values left shifted. That was also an arbitrary
choice.

v2: Use shift in MOCS to make it clear what we're doing. (Ken)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonv50,nvc0: make sure to pushbuf_refn before putting bo into pushbuf_data
Ilia Mirkin [Sun, 21 Jun 2015 23:03:35 +0000 (19:03 -0400)]
nv50,nvc0: make sure to pushbuf_refn before putting bo into pushbuf_data

Without first running the bo through pushbuf_refn, the nouveau drm
library will have uninitialized structures regarding this bo, and will
insert incorrect data.

This fixes supertuxkart 0.9 crash on start (where it ends up doing a lot
of indirect draws).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
9 years agonvc0: always put all tfb bufs into bufctx
Ilia Mirkin [Sun, 21 Jun 2015 19:00:16 +0000 (15:00 -0400)]
nvc0: always put all tfb bufs into bufctx

Since we clear the TFB bufctx binding point above, we need to put all of
the active tfb's back in, even if they haven't changed since last time.
Otherwise the tfb may get moved into sysmem and the underlying mapping
will generate write errors.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: binding point is a texture unit, which is a combined space
Ilia Mirkin [Tue, 23 Jun 2015 04:16:59 +0000 (00:16 -0400)]
glsl: binding point is a texture unit, which is a combined space

This fixes compilation failures in Dota 2 Reborn where a texture unit
binding point was used that was numerically higher than the max
per stage.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
9 years agoandroid: egl: do not link against libglapi
Emil Velikov [Fri, 19 Jun 2015 18:35:19 +0000 (19:35 +0100)]
android: egl: do not link against libglapi

The only reason we touch glapi is to dlopen it in order to:
 - make sure that the unresolved _glapi* symbols in the dri modules are
provided.
 - fetch glFlush() and use it at various stages in the dri2 driver.

Cc: Chih-Wei Huang <cwhuang@linux.org.tw>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agogbm: do not (over)link against libglapi.so
Emil Velikov [Fri, 19 Jun 2015 18:22:38 +0000 (19:22 +0100)]
gbm: do not (over)link against libglapi.so

The whole of GBM does not rely on even a single symbol from the GL
dispatch library, unsuprisingly. The only need for it comes from the
unresolved symbols in the DRI modules, which are now correctly handled
with Frank's commit.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agogbm: dlopen libglapi so gbm_create_device works
Frank Henigman [Thu, 6 Nov 2014 21:29:26 +0000 (16:29 -0500)]
gbm: dlopen libglapi so gbm_create_device works

Dri driver libs are not linked to pull in libglapi so gbm_create_device()
fails when it tries to dlopen them (unless the application is linked
with something that does pull in libglapi, like libGL).
Until dri drivers can be fixed properly, dlopen libglapi before trying
to dlopen them.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Frank Henigman <fjhenigman@google.com>
[Emil Velikov: Drop misleading bugzilla link, mention that libname differs]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure: drop unused variable GBM_BACKEND_DIRS
Emil Velikov [Fri, 19 Jun 2015 16:48:30 +0000 (17:48 +0100)]
configure: drop unused variable GBM_BACKEND_DIRS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoconfigure: error out when building libEGL without shared-glapi
Emil Velikov [Fri, 19 Jun 2015 16:46:41 +0000 (17:46 +0100)]
configure: error out when building libEGL without shared-glapi

The latter is a hard requirement and without it we'll error out later
on in the build.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoconfigure: error out when building backend-less libEGL
Emil Velikov [Fri, 19 Jun 2015 16:44:02 +0000 (17:44 +0100)]
configure: error out when building backend-less libEGL

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agodrivers/x11: drop unneeded HAVE_X11_DRIVER check
Emil Velikov [Fri, 19 Jun 2015 16:37:18 +0000 (17:37 +0100)]
drivers/x11: drop unneeded HAVE_X11_DRIVER check

Already handled in the Makefile which includes the drivers/x11 subdir.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoconfigure: allow building shared-glapi powered libgl-xlib
Emil Velikov [Fri, 19 Jun 2015 18:43:23 +0000 (19:43 +0100)]
configure: allow building shared-glapi powered libgl-xlib

Cc: Brian Paul <brianp@vmware.com>
Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
9 years agotargets/libgl-xlib: fix the build against shared_glapi
Emil Velikov [Fri, 19 Jun 2015 16:30:13 +0000 (17:30 +0100)]
targets/libgl-xlib: fix the build against shared_glapi

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
9 years agodrivers/x11: fix the build against shared_glapi
Emil Velikov [Fri, 19 Jun 2015 16:28:25 +0000 (17:28 +0100)]
drivers/x11: fix the build against shared_glapi

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoconfigure: warn about shared_glapi & xlib-glx only when both are set
Emil Velikov [Fri, 19 Jun 2015 16:19:46 +0000 (17:19 +0100)]
configure: warn about shared_glapi & xlib-glx only when both are set

Printing out the message when shared_glapi is disabled only leads to
confusion.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglapi: remap_helper.py: remove unused argument 'es'
Emil Velikov [Thu, 18 Jun 2015 22:30:34 +0000 (23:30 +0100)]
glapi: remap_helper.py: remove unused argument 'es'

Identical to the previous commit - unused by neither the Autotools,
Android or SCons build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoglapi: gl_table.py: remove unused variable 'es'
Emil Velikov [Thu, 18 Jun 2015 22:28:05 +0000 (23:28 +0100)]
glapi: gl_table.py: remove unused variable 'es'

None of the three build systems ever set it, as such we can clear things
up a bit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoegl: Use the loader_open_device() helper to do open with CLOEXEC
Derek Foreman [Wed, 17 Jun 2015 16:28:51 +0000 (11:28 -0500)]
egl: Use the loader_open_device() helper to do open with CLOEXEC

We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code.

This also replaces a couple of opens that didn't properly do CLOEXEC.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglx: Use loader_open_device() helper
Derek Foreman [Wed, 17 Jun 2015 16:28:50 +0000 (11:28 -0500)]
glx: Use loader_open_device() helper

We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code here.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoloader: Rename drm_open_device() to loader_open_device() and share it
Derek Foreman [Wed, 17 Jun 2015 16:28:49 +0000 (11:28 -0500)]
loader: Rename drm_open_device() to loader_open_device() and share it

This is already our common idiom for opening files with CLOEXEC and
it's a little ugly, so let's share this one implementation.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoegl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak
Derek Foreman [Wed, 17 Jun 2015 16:28:48 +0000 (11:28 -0500)]
egl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak

Replacing dup() with fcntl F_DUPFD_CLOEXEC creates the duplicate
file descriptor with CLOEXEC so it won't be leaked to child
processes if the process fork()s later.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodraw,tgsi: Assume TGSI_PROPERTY_GS_INVOCATIONS default of 1.
Jose Fonseca [Tue, 23 Jun 2015 11:18:06 +0000 (12:18 +0100)]
draw,tgsi: Assume TGSI_PROPERTY_GS_INVOCATIONS default of 1.

If the shader doesn't specify number of invocations, assume one.

This fixes geometry shaders on state trackers other than Mesa (and
probably graw tests too.)

Trivial.

9 years agoglsl: Specify the shader stage in linker errors due to too many in/outputs.
Jose Fonseca [Fri, 19 Jun 2015 12:53:46 +0000 (13:53 +0100)]
glsl: Specify the shader stage in linker errors due to too many in/outputs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agodocs: update GL3 with softpipe/llvmpipe gpu_shader5 pieces.
Dave Airlie [Tue, 23 Jun 2015 05:55:30 +0000 (15:55 +1000)]
docs: update GL3 with softpipe/llvmpipe gpu_shader5 pieces.

This just updates the bits I've added in the previous few patches.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodraw/gallivm: add invocation ID support for llvmpipe.
Dave Airlie [Mon, 22 Jun 2015 03:59:25 +0000 (13:59 +1000)]
draw/gallivm: add invocation ID support for llvmpipe.

This extends the draw code to add support for invocations.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>