mesa.git
8 years agoanv: Increate dynamic pool block size from 2k to 16k
Jordan Justen [Fri, 8 Jan 2016 20:15:29 +0000 (12:15 -0800)]
anv: Increate dynamic pool block size from 2k to 16k

This is needed because compute push constant data is replicated per
invocation. For gen7, this can be up to 64. With a push constant data
max of 128 bytes, this is 8k of data. We need additional space for
local-id payloads, so we are going with 16k for now.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/spirv: Fix a small bug in row-major matrix loading
Jason Ekstrand [Fri, 8 Jan 2016 20:27:25 +0000 (12:27 -0800)]
nir/spirv: Fix a small bug in row-major matrix loading

8 years agonir/spirv: Use create_ssa_value for block_load_store
Jason Ekstrand [Fri, 8 Jan 2016 19:50:32 +0000 (11:50 -0800)]
nir/spirv: Use create_ssa_value for block_load_store

8 years agonir/spirv: Add real support for outer products
Jason Ekstrand [Fri, 8 Jan 2016 19:38:59 +0000 (11:38 -0800)]
nir/spirv: Add real support for outer products

8 years agonir/spirv: Add support for add, subtract, and negate on matrices
Jason Ekstrand [Fri, 8 Jan 2016 19:18:47 +0000 (11:18 -0800)]
nir/spirv: Add support for add, subtract, and negate on matrices

8 years agonir/spirv: Split ALU operations out into their own file
Jason Ekstrand [Fri, 8 Jan 2016 19:02:17 +0000 (11:02 -0800)]
nir/spirv: Split ALU operations out into their own file

8 years agonir/spirv: Add support for SSBO atomics
Jason Ekstrand [Fri, 8 Jan 2016 04:44:04 +0000 (20:44 -0800)]
nir/spirv: Add support for SSBO atomics

8 years agonir/spirv: Rework UBOs and SSBOs
Jason Ekstrand [Fri, 8 Jan 2016 00:55:56 +0000 (16:55 -0800)]
nir/spirv: Rework UBOs and SSBOs

This completely reworks all block load/store operations.  In particular, it
should get row-major matrices working.

8 years agoanv/gen9: Fix cube surface state
Chad Versace [Fri, 8 Jan 2016 01:05:22 +0000 (17:05 -0800)]
anv/gen9: Fix cube surface state

For gen9 SURFTYPE_CUBE, the RENDER_SURFACE_STATE's Depth,
MinimumArrayElement, and RenderTargetViewExtent is in units of full
cubes and so must be divided by 6.

Fixes 'dEQP-VK.pipeline.image.view_type.cube_array.cube_array.*'.

Now all of 'dEQP-VK.pipeline.image.*' passes.

8 years agoanv/gen8: Refactor genX_image_view_init()
Chad Versace [Fri, 8 Jan 2016 01:02:49 +0000 (17:02 -0800)]
anv/gen8: Refactor genX_image_view_init()

Drop the temporary variables for RENDER_SURFACE_STATE's Depth and
RenderTargetViewExtent. Instead, assign them in-place.

This simplifies the next commit, which fixes gen9 cube surfaces.

8 years agovk: Make sure we emit binding table pointers after push constants
Kristian Høgsberg Kristensen [Fri, 8 Jan 2016 00:25:49 +0000 (16:25 -0800)]
vk: Make sure we emit binding table pointers after push constants

SKL needs this to make sure we flush the push constants. It gets a
little tricky, since we also need to emit binding tables before push
constants, since that may affect the push constants (dynamic buffer
offsets and storage image parameters).  This patch splits emitting
binding tables from emitting the pointers so that we can emit push
constants after binding tables but before emitting binding table
pointers.

8 years agovk: Implement VK_QUERY_RESULT_WITH_AVAILABILITY_BIT
Kristian Høgsberg Kristensen [Thu, 7 Jan 2016 05:57:24 +0000 (21:57 -0800)]
vk: Implement VK_QUERY_RESULT_WITH_AVAILABILITY_BIT

8 years agovk: Add missing DepthStallEnable to OQ pipe control
Kristian Høgsberg Kristensen [Thu, 7 Jan 2016 00:42:14 +0000 (16:42 -0800)]
vk: Add missing DepthStallEnable to OQ pipe control

8 years agovk: Issue PIPELINE_SELECT before setting up render pass
Kristian Høgsberg Kristensen [Thu, 7 Jan 2016 00:41:22 +0000 (16:41 -0800)]
vk: Issue PIPELINE_SELECT before setting up render pass

We need to make sure we're selected the 3D pipeline before we start
setting up depth and stencil buffers.

8 years agoanv/gen7: Setup state to enable barrier() function
Jordan Justen [Fri, 8 Jan 2016 01:10:02 +0000 (17:10 -0800)]
anv/gen7: Setup state to enable barrier() function

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8: Setup state to enable barrier() function
Jordan Justen [Fri, 8 Jan 2016 00:25:35 +0000 (16:25 -0800)]
anv/gen8: Setup state to enable barrier() function

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/meta: Fix hardcoded format size in anv_CmdCopy*
Chad Versace [Thu, 7 Jan 2016 21:46:20 +0000 (13:46 -0800)]
anv/meta: Fix hardcoded format size in anv_CmdCopy*

When looping through VkBufferImageCopy regions, for each region we
incremented the offset into the VkBuffer assuming the format size was 4.

Fixes CTS tests dEQP-VK.pipeline.image.view_type.cube_array.3d.* on
Skylake.

8 years agoisl: Add missing break statement in array pitch calculation
Chad Versace [Thu, 7 Jan 2016 19:07:44 +0000 (11:07 -0800)]
isl: Add missing break statement in array pitch calculation

Fixes regression in ed98c374bd3f1952fbab3031afaf5ff4d178ef41.

8 years agoisl/gen9: Fix array pitch of 3d surfaces
Chad Versace [Thu, 7 Jan 2016 19:00:29 +0000 (11:00 -0800)]
isl/gen9: Fix array pitch of 3d surfaces

For tiled 3D surfaces, the array pitch must aligned to the tile height.

From the Skylake BSpec >> RENDER_SURFACE_STATE >> Surface QPitch:

   Tile Mode != Linear: This field must be set to an integer multiple of
   the tile height

Fixes CTS tests 'dEQP-VK.pipeline.image.view_type.3d.format.r8g8b8a8_unorm.*'.
Fixes Crucible tests 'func.miptree.r8g8b8a8-unorm.aspect-color.view-3d.*'.

8 years agoisl: Refactor func isl_calc_array_pitch_sa_rows
Chad Versace [Thu, 7 Jan 2016 18:58:29 +0000 (10:58 -0800)]
isl: Refactor func isl_calc_array_pitch_sa_rows

Update the function to calculate the array pitch is *element rows*, and
it rename it accordingly to isl_calc_array_pitch_el_rows.

8 years agoisl: Assert that alignments are not 0 for isl_align
Jordan Justen [Wed, 6 Jan 2016 23:42:18 +0000 (15:42 -0800)]
isl: Assert that alignments are not 0 for isl_align

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Assert that alignments are not 0 for align_*
Jordan Justen [Wed, 6 Jan 2016 23:40:01 +0000 (15:40 -0800)]
anv: Assert that alignments are not 0 for align_*

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoisl: Fix image alignment calculation
Jordan Justen [Wed, 6 Jan 2016 23:43:11 +0000 (15:43 -0800)]
isl: Fix image alignment calculation

The previous code was resulting in an alignment of 0.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/state: Pull sampler vk-to-gen maps into genX_state_util.h
Jason Ekstrand [Thu, 7 Jan 2016 03:33:46 +0000 (19:33 -0800)]
anv/state: Pull sampler vk-to-gen maps into genX_state_util.h

8 years agonir/spirv: Wrap borrow/carry ops in b2i
Jason Ekstrand [Thu, 7 Jan 2016 01:13:04 +0000 (17:13 -0800)]
nir/spirv: Wrap borrow/carry ops in b2i

NIR specifies them as booleans but SPIR-V wants ints.

8 years agonir/spirv/cfg: Only set fall to true at the start of a case
Jason Ekstrand [Thu, 7 Jan 2016 01:00:01 +0000 (17:00 -0800)]
nir/spirv/cfg: Only set fall to true at the start of a case

Previously, we were setting it to true at the top of the switch statement.
However, this causes all of the cases to get executed until you hit a
break.  Instead, you want to be not executing at the start, start executing
when you hit your case, and end at a break.

8 years agoanv: Fix build without VALGRIND
Jordan Justen [Wed, 6 Jan 2016 18:27:57 +0000 (10:27 -0800)]
anv: Fix build without VALGRIND

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/compiler: Enable more lowering in NIR
Jason Ekstrand [Wed, 6 Jan 2016 22:09:47 +0000 (14:09 -0800)]
i965/compiler: Enable more lowering in NIR

We don't need these for GLSL or ARB, but we need them for SPIR-V

8 years agonir/algebraic: Add more lowering
Jason Ekstrand [Wed, 6 Jan 2016 23:05:10 +0000 (15:05 -0800)]
nir/algebraic: Add more lowering

This commit adds lowering options for the following opcodes:

 - nir_op_fmod
 - nir_op_bitfield_insert
 - nir_op_uadd_carry
 - nir_op_usub_borrow

8 years agonir/opcodes: Fix the folding expression for usub_borrow
Jason Ekstrand [Wed, 6 Jan 2016 22:46:31 +0000 (14:46 -0800)]
nir/opcodes: Fix the folding expression for usub_borrow

8 years agonir/spirv: Properly implement Modf
Jason Ekstrand [Wed, 6 Jan 2016 23:24:38 +0000 (15:24 -0800)]
nir/spirv: Properly implement Modf

8 years agonir/builder: Add a helper for storing to a deref
Jason Ekstrand [Wed, 6 Jan 2016 23:24:24 +0000 (15:24 -0800)]
nir/builder: Add a helper for storing to a deref

8 years agoanv/gen9: Teach gen9_image_view_init() about 1D surface qpitch
Chad Versace [Tue, 5 Jan 2016 22:35:52 +0000 (14:35 -0800)]
anv/gen9: Teach gen9_image_view_init() about 1D surface qpitch

QPitch is usually expressed as rows of surface elements (where a surface
element is an compression block or a single surface sample. Skylake 1D
is an outlier; there QPitch is expressed as individual surface
elements.

8 years agoisl: Add isl_surf_get_array_pitch_el()
Chad Versace [Tue, 5 Jan 2016 22:30:23 +0000 (14:30 -0800)]
isl: Add isl_surf_get_array_pitch_el()

Will be needed to program SurfaceQPitch for Skylake 1D arrays.

8 years agoisl/gen9: Support ISL_DIM_LAYOUT_GEN9_1D
Chad Versace [Tue, 5 Jan 2016 22:30:03 +0000 (14:30 -0800)]
isl/gen9: Support ISL_DIM_LAYOUT_GEN9_1D

8 years agoisl: Don't align phys_slice0_sa.width twice
Chad Versace [Tue, 5 Jan 2016 22:28:28 +0000 (14:28 -0800)]
isl: Don't align phys_slice0_sa.width twice

It's already aligned to the format's block width. Don't align it again
in isl_calc_row_pitch().

8 years agoisl: Fix the documented units of isl_surf::row_pitch
Chad Versace [Tue, 5 Jan 2016 22:26:30 +0000 (14:26 -0800)]
isl: Fix the documented units of isl_surf::row_pitch

It's the pitch between surface elements, not between surface samples.

8 years agoanv/gen9: Fix oob lookup of surface halign, valign
Chad Versace [Tue, 5 Jan 2016 22:32:44 +0000 (14:32 -0800)]
anv/gen9: Fix oob lookup of surface halign, valign

For 1D surfaces and for surfaces with Yf or Ys tiling, the hardware
ignores SurfaceVerticalAlignment and SurfaceHorizontalAlignment.
Moreover, the anv_halign[] and anv_valign[] lookup tables may not even
contain the surface's actual alignment values. So don't do the lookup
for those surfaces.

8 years agoanv/meta: Teach meta how to blit from a 1D image
Chad Versace [Tue, 5 Jan 2016 22:37:45 +0000 (14:37 -0800)]
anv/meta: Teach meta how to blit from a 1D image

Meta needed a VkShader with a 1D sampler type.

8 years agonir/spirv: Fix switch statements with duplicate cases
Jason Ekstrand [Wed, 6 Jan 2016 00:18:01 +0000 (16:18 -0800)]
nir/spirv: Fix switch statements with duplicate cases

8 years agonir/spirv/cfg: Assert that blocks only ever get added once
Jason Ekstrand [Tue, 5 Jan 2016 23:56:59 +0000 (15:56 -0800)]
nir/spirv/cfg: Assert that blocks only ever get added once

This effectively prevents infinite loops in cfg_walk_blocks.

8 years agonir/spirv: Simplify phi node handling
Jason Ekstrand [Tue, 5 Jan 2016 22:59:40 +0000 (14:59 -0800)]
nir/spirv: Simplify phi node handling

Instead of trying to crawl through predecessor chains and build phi nodes,
we just do a poor-man's out-of-ssa on the spot.  The into-SSA pass will
deal with putting the actual phi nodes in for us.

8 years agoanv/pipeline: Lower indirect temporaries and inputs
Jason Ekstrand [Tue, 5 Jan 2016 21:42:00 +0000 (13:42 -0800)]
anv/pipeline: Lower indirect temporaries and inputs

8 years agonir: Add an indirect deref lowering pass
Jason Ekstrand [Tue, 5 Jan 2016 21:04:07 +0000 (13:04 -0800)]
nir: Add an indirect deref lowering pass

8 years agovk: Implement a basic pipeline cache
Kristian Høgsberg Kristensen [Tue, 5 Jan 2016 20:00:54 +0000 (12:00 -0800)]
vk: Implement a basic pipeline cache

This is not really a cache yet, but it allows us to share one state
stream for all pipelines, which means we can bump the block size without
wasting a lot of memory.

8 years agovk: Destroy device->mutex when destroying the device
Kristian Høgsberg Kristensen [Tue, 5 Jan 2016 19:43:25 +0000 (11:43 -0800)]
vk: Destroy device->mutex when destroying the device

8 years agoisl: Don't force linear for 1d surfaces in gen7_filter_tiling()
Chad Versace [Tue, 5 Jan 2016 19:35:44 +0000 (11:35 -0800)]
isl: Don't force linear for 1d surfaces in gen7_filter_tiling()

gen7_filter_tiling() should filter out only tiling flags that are
incompatible with the surface. It shouldn't make performance decisions,
such as forcing linear for 1D; that's the role of the caller.

8 years agoisl: Document gen7_filter_tiling()
Chad Versace [Tue, 5 Jan 2016 19:28:49 +0000 (11:28 -0800)]
isl: Document gen7_filter_tiling()

8 years agoisl: Prefer linear tiling for 1D surfaces
Chad Versace [Tue, 5 Jan 2016 18:39:21 +0000 (10:39 -0800)]
isl: Prefer linear tiling for 1D surfaces

8 years agoisl: Remove isl_format_layout::bpb
Chad Versace [Tue, 5 Jan 2016 17:53:11 +0000 (09:53 -0800)]
isl: Remove isl_format_layout::bpb

struct isl_format_layout contained two near-redundant members: bpb (bits
per block) and bs (block size). There do exist some hardware formats for
which bpb != 8 * bs, but Vulkan does not use them. Therefore we don't
need bpb.

8 years agoanv: Use isl_format_layout::bs instead of ::bpb
Chad Versace [Tue, 5 Jan 2016 17:59:07 +0000 (09:59 -0800)]
anv: Use isl_format_layout::bs instead of ::bpb

For all formats used by Vulkan, 8 * bs == bpb.
(bs=block_size_in_bytes, bpb=bits_per_block)

8 years agoisl: Align isl_surf::phys_level0_sa to the format's compression block
Chad Versace [Tue, 5 Jan 2016 01:09:11 +0000 (17:09 -0800)]
isl: Align isl_surf::phys_level0_sa to the format's compression block

8 years agoisl: Fix mis-documented units of isl_surf::phys_level_sa
Chad Versace [Tue, 5 Jan 2016 01:00:49 +0000 (17:00 -0800)]
isl: Fix mis-documented units of isl_surf::phys_level_sa

It's in physical surface samples. Hence the _sa suffix.

8 years agonir/spirv: Add support for the ControlBarrier instruction
Jason Ekstrand [Tue, 5 Jan 2016 06:08:24 +0000 (22:08 -0800)]
nir/spirv: Add support for the ControlBarrier instruction

8 years agoanv/UpdateDescriptorSets: Use the correct index for the buffer view
Jason Ekstrand [Tue, 5 Jan 2016 05:36:11 +0000 (21:36 -0800)]
anv/UpdateDescriptorSets: Use the correct index for the buffer view

8 years agonir/spirv: Implement extended add, sub, and mul
Jason Ekstrand [Tue, 5 Jan 2016 04:59:16 +0000 (20:59 -0800)]
nir/spirv: Implement extended add, sub, and mul

8 years agonir/spirv: Add support for bitfield operations
Jason Ekstrand [Tue, 5 Jan 2016 01:32:33 +0000 (17:32 -0800)]
nir/spirv: Add support for bitfield operations

8 years agonir/spirv: Add support for msb/lsb opcodes
Jason Ekstrand [Tue, 5 Jan 2016 01:16:44 +0000 (17:16 -0800)]
nir/spirv: Add support for msb/lsb opcodes

8 years agonir/spirv: Add a documenting assert for OpConstantSampler
Jason Ekstrand [Tue, 5 Jan 2016 01:04:26 +0000 (17:04 -0800)]
nir/spirv: Add a documenting assert for OpConstantSampler

8 years agonir/spirv: Add initial support for ConstantNull
Jason Ekstrand [Tue, 5 Jan 2016 00:57:01 +0000 (16:57 -0800)]
nir/spirv: Add initial support for ConstantNull

8 years agoisl: Align single-level 2D surfaces to compression block
Chad Versace [Tue, 5 Jan 2016 00:31:10 +0000 (16:31 -0800)]
isl: Align single-level 2D surfaces to compression block

This fixes an assertion failure at isl.c:1003.

Reported-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoanv/formats: Hand out different formats based on tiled vs. linear
Jason Ekstrand [Fri, 1 Jan 2016 16:45:35 +0000 (08:45 -0800)]
anv/formats: Hand out different formats based on tiled vs. linear

8 years agoanv/image_view: Separate vulkan and isl formats
Jason Ekstrand [Fri, 1 Jan 2016 22:09:17 +0000 (14:09 -0800)]
anv/image_view: Separate vulkan and isl formats

Previously, anv_image_view had a anv_format pointer that we used for
everything.  This commit replaces that pointer with a VkFormat enum copied
from the API and an isl_format.  In order to implement RGB formats, we have
to use a different isl_format for the actual surface state than the obvious
one from the VkFormat.  Separating the two helps us keep things streight.

8 years agoanv_get_isl_format: Support depth+stencil aspect value
Jason Ekstrand [Fri, 1 Jan 2016 22:12:22 +0000 (14:12 -0800)]
anv_get_isl_format: Support depth+stencil aspect value

You just get the depth format in this case.

8 years agoanv/image: Do more work in anv_image_view_init
Jason Ekstrand [Fri, 1 Jan 2016 21:47:18 +0000 (13:47 -0800)]
anv/image: Do more work in anv_image_view_init

There was a bunch of common code in gen7/8_image_view_init that we really
should be sharing.

8 years agoanv/formats: Rework GetPhysicalDeviceFormatProperties
Jason Ekstrand [Fri, 1 Jan 2016 16:42:35 +0000 (08:42 -0800)]
anv/formats: Rework GetPhysicalDeviceFormatProperties

It now calls get_isl_format to get both linear and tiled views of the
format and determines linear/tiled properties from that.  Buffer properties
are determined from the linear format.

8 years agoanv/formats: Add a tiling parameter to get_isl_format
Jason Ekstrand [Fri, 1 Jan 2016 02:31:31 +0000 (18:31 -0800)]
anv/formats: Add a tiling parameter to get_isl_format

Currently, this parameter does nothing.

8 years agoisl/format: Add some helpers for working with RGB formats
Jason Ekstrand [Thu, 31 Dec 2015 22:57:51 +0000 (14:57 -0800)]
isl/format: Add some helpers for working with RGB formats

8 years agoisl: Add a file for format helpers
Jason Ekstrand [Thu, 31 Dec 2015 22:30:51 +0000 (14:30 -0800)]
isl: Add a file for format helpers

8 years agogenX/state: Pull some generic helpers into a shared header
Jason Ekstrand [Thu, 31 Dec 2015 21:51:15 +0000 (13:51 -0800)]
genX/state: Pull some generic helpers into a shared header

8 years agometa/blit: Rework how format and aspect choices are made
Jason Ekstrand [Thu, 31 Dec 2015 21:22:43 +0000 (13:22 -0800)]
meta/blit: Rework how format and aspect choices are made

This commit does two things.  First, it introduces choose_* functions for
chosing formats and aspects.  Second, it changes the copy (not blit) code
to use appropreately sized UINT formats for everything except depth.  There
are two main reasons for this:  First, it means that compressed and other
non-renderable texture upload should "just work" because it won't be
tripping over non-renderable formats.  Second, it allows us to easly copy
an RGB buffer to and from an RGBX image because the formats will get
switched over to their UINT variants and the shader will deal with the
extra channel for us.

8 years agoanv/image: Add a vk_format field
Jason Ekstrand [Thu, 31 Dec 2015 20:39:34 +0000 (12:39 -0800)]
anv/image: Add a vk_format field

We've been trying to move away from anv_format for a while and this should
help with the transition.  There are cases (mostly in meta) where we need
the original format for the image and not the isl_format.  These will be
moved over to the new vk_format and everythign else will use the isl_format
from the particular anv_surface.

8 years agoisl: Document mnemonic in Yf and Ys tiling
Chad Versace [Mon, 4 Jan 2016 23:30:27 +0000 (15:30 -0800)]
isl: Document mnemonic in Yf and Ys tiling

The 'f' means "four K". The 's' means "sixty-four K".

8 years agoisl: Use isl_align_npot for row_pitch
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 18:53:47 +0000 (10:53 -0800)]
isl: Use isl_align_npot for row_pitch

Many formats are not power-of-two bytes per pixels and we need the
non-power-of-two align macro here.

This reverts the revert from 4f9a211b, but keeps the change from a827b553
that fixed the yuv if-else mix-up.

8 years agovk: Don't leak pipeline if initialization fails
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 18:42:50 +0000 (10:42 -0800)]
vk: Don't leak pipeline if initialization fails

8 years agovk: Allocate subpass attachment in one big block
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:58:00 +0000 (22:58 -0800)]
vk: Allocate subpass attachment in one big block

This avoids making a lot of small allocations and handles allocation
failure correctly.

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Handle allocation failures in meta init paths
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:43:47 +0000 (22:43 -0800)]
vk: Handle allocation failures in meta init paths

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Handle allocation failure in anv_pipeline_init()
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:42:01 +0000 (22:42 -0800)]
vk: Handle allocation failure in anv_pipeline_init()

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Call vk_error when we generate a VK_ERROR
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 05:31:22 +0000 (21:31 -0800)]
vk: Call vk_error when we generate a VK_ERROR

8 years agovk: Only finish wayland wsi if we created it
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 05:15:29 +0000 (21:15 -0800)]
vk: Only finish wayland wsi if we created it

Failure during instance creation will leave instance->wayland_wsi
undefined. When we then try to clean that up we crash. Set
instance->wayland_wsi to NULL on failure and only clean it up if it's
non-NULL.

Fixes part of dEQP-VK.api.object_management.alloc_callback_fail.*

8 years agoisl: Fix row pitch for linear buffers
Chad Versace [Fri, 1 Jan 2016 17:52:57 +0000 (09:52 -0800)]
isl: Fix row pitch for linear buffers

isl always aligned the row pitch to the surface's image alignment.  This
was sometimes wrong when the surface backed a VkBuffer. For a VkBuffer,
the surface's row pitch is set by VkBufferImageCopy::bufferRowLength,
whose required alignment is only that of the VkFormat.

In particular, VkBuffer rows are packed in many dEQP and Crucible tests.
And packed rows are rarely aligned to the surface's image alignment.

Fixes: dEQP-VK.pipeline.image.view_type.2d.format.r8g8b8a8_unorm.size.13x13
8 years agoisl: Fix swapped if-else in isl_calc_row_pitch
Chad Versace [Fri, 1 Jan 2016 18:37:25 +0000 (10:37 -0800)]
isl: Fix swapped if-else in isl_calc_row_pitch

The YUV case was applied to non-YUV formats. Oops.

8 years agonir/spirv: Fix group decorations
Jason Ekstrand [Sat, 2 Jan 2016 19:51:40 +0000 (11:51 -0800)]
nir/spirv: Fix group decorations

They were completely bogus before.  For one thing, OpDecorationGroup
created a value of type undef rather than decoration_group.  Also
OpGroupMemberDecorate didn't properly apply the decoration to the different
members of the different groups.  It *should* be correct now but there's no
good way to test it yet.

8 years agoanv/device: Only allocate whole pages in AllocateMemory
Jason Ekstrand [Sat, 2 Jan 2016 15:52:22 +0000 (07:52 -0800)]
anv/device: Only allocate whole pages in AllocateMemory

The kernel is going to give us whole pages anyway, so allocating part of a
page doesn't help.  And this ensures that we can always work with whole
pages.

8 years agoanv/device: Handle non-4k-aligned calls to MapMemory
Jason Ekstrand [Fri, 1 Jan 2016 17:26:06 +0000 (09:26 -0800)]
anv/device: Handle non-4k-aligned calls to MapMemory

As per the spec:

   minMemoryMapAlignment is the minimum required alignment, in bytes, of
   host-visible memory allocations within the host address space. When
   mapping a memory allocation with vkMapMemory, subtracting offset bytes
   from the returned pointer will always produce a multiple of the value of
   this limit.

8 years agoanv/format: Get rid of num_channels
Jason Ekstrand [Thu, 31 Dec 2015 20:07:23 +0000 (12:07 -0800)]
anv/format: Get rid of num_channels

8 years agoanv/cmd_buffer: Fix a pointer-cast typo
Jason Ekstrand [Thu, 31 Dec 2015 20:07:10 +0000 (12:07 -0800)]
anv/cmd_buffer: Fix a pointer-cast typo

8 years agoisl: Document some isl_surf::phys_level0_sa invariants
Chad Versace [Thu, 31 Dec 2015 20:02:04 +0000 (12:02 -0800)]
isl: Document some isl_surf::phys_level0_sa invariants

isl_dim_layout restricts the range of isl_surf::phys_level0_sa.

8 years agoanv/pipeline: Better vertex input channel setup
Jason Ekstrand [Thu, 31 Dec 2015 20:00:58 +0000 (12:00 -0800)]
anv/pipeline: Better vertex input channel setup

First off, it now uses isl formats instead of anv_format.  Also, it
properly handles integer vs. floating-point default channels and can
properly handle alpha-only channels.  (Not sure if those are allowed).

8 years agoanv/pipeline: Move vk_to_gen tables into a shared header
Jason Ekstrand [Thu, 31 Dec 2015 19:58:24 +0000 (11:58 -0800)]
anv/pipeline: Move vk_to_gen tables into a shared header

8 years agoisl: Better document surface units
Chad Versace [Thu, 31 Dec 2015 19:56:13 +0000 (11:56 -0800)]
isl: Better document surface units

Logical pixels, physical surface samples, and physical surface elements.

Requested-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoisl: Document the 3D block extent of isl_format
Chad Versace [Thu, 31 Dec 2015 19:55:48 +0000 (11:55 -0800)]
isl: Document the 3D block extent of isl_format

8 years agonir/spirv: Add a missing break statement in handle_image
Jason Ekstrand [Thu, 31 Dec 2015 05:57:04 +0000 (21:57 -0800)]
nir/spirv: Add a missing break statement in handle_image

8 years agoRevert "isl: Fix assertion failure for npot pixel formats"
Jason Ekstrand [Thu, 31 Dec 2015 05:01:55 +0000 (21:01 -0800)]
Revert "isl: Fix assertion failure for npot pixel formats"

This reverts commit 96d1baa88d37c51c94579f650cfd9465d28634f4.

8 years agonir/spirv: Handle push constants after decorations
Jason Ekstrand [Thu, 31 Dec 2015 04:54:27 +0000 (20:54 -0800)]
nir/spirv: Handle push constants after decorations

8 years agoanv/device: Place memory types at heapIndex == 0
Jason Ekstrand [Thu, 31 Dec 2015 03:32:41 +0000 (19:32 -0800)]
anv/device: Place memory types at heapIndex == 0

Previously, they were at heapIndex == 1 even though we only advertised one
heap.

8 years agonir/spirv: Fix constant num_elements and allocation
Jason Ekstrand [Thu, 31 Dec 2015 02:51:57 +0000 (18:51 -0800)]
nir/spirv: Fix constant num_elements and allocation

Thanks to the addition of nir_clone, we now have a num_elements field in
nir_constant which we weren't setting.  Also, constants have to be parented
to the variable they initialize, so we have to make a copy.

8 years agonir/lower_outputs_to_temporaries: Reparent constant initializers
Jason Ekstrand [Thu, 31 Dec 2015 02:51:06 +0000 (18:51 -0800)]
nir/lower_outputs_to_temporaries: Reparent constant initializers

8 years agonir/clone: Expose nir_constant_clone
Jason Ekstrand [Thu, 31 Dec 2015 02:44:19 +0000 (18:44 -0800)]
nir/clone: Expose nir_constant_clone

8 years agonir/gather_info: Add support for end_primitive_with_counter
Jason Ekstrand [Thu, 31 Dec 2015 01:43:00 +0000 (17:43 -0800)]
nir/gather_info: Add support for end_primitive_with_counter