mesa.git
8 years agonir/spirv: fix build_mat4_det stack smasher
Mark Janes [Tue, 2 Feb 2016 23:30:54 +0000 (15:30 -0800)]
nir/spirv: fix build_mat4_det stack smasher

When generating a sub-determinate matrix, a 3-element swizzle array was
indexed with clever inline boolean logic.  Unfortunately, when i and j
are both 3, the index overruns the array, smashing the next variable on
the stack.

For 64 bit builds, the alignment of the 3-element unsigned array leaves
32 bits of spacing before the next local variable, hiding this bug.  On
i386, a subcolumn pointer was smashed then dereferenced.

8 years agoanv: Fix anv_descriptor_set reference error on deletion
Mark Janes [Tue, 2 Feb 2016 01:13:02 +0000 (17:13 -0800)]
anv: Fix anv_descriptor_set reference error on deletion

anv_descriptor_set_destroy uses the descriptor sets's set_layout member
to iterate the set's buffer views.  However, the set_layout reference
may have previously been freed.

On 64 bit builds, this bug generated valgrind errors but did not affect
CTS test results.  On 32 bit builds, it reliably produces assertions and
memory corruption.

8 years agoanv: Use @LIB_DIR@ in anv_icd.json
Kristian Høgsberg Kristensen [Tue, 2 Feb 2016 22:35:40 +0000 (14:35 -0800)]
anv: Use @LIB_DIR@ in anv_icd.json

Otherwise we may get a lib vs lib64 mismatch.

8 years agoanv/device: Improve version error reporting
Jason Ekstrand [Tue, 2 Feb 2016 21:15:18 +0000 (13:15 -0800)]
anv/device: Improve version error reporting

8 years agovulkan: Bump the header to 1.0.3
Jason Ekstrand [Tue, 2 Feb 2016 21:08:47 +0000 (13:08 -0800)]
vulkan: Bump the header to 1.0.3

8 years agoanv/fence: Default to not ready
Jason Ekstrand [Tue, 2 Feb 2016 20:22:00 +0000 (12:22 -0800)]
anv/fence: Default to not ready

This is kind-of silly.  We *really* need to do a better job of making sure
all objects have all their default values set.  We probably also want to,
eventually, put everything into the BO (to save memory) and, more
specifically, make the GPU write the "ready" flag.  That way GetFenceStatus
won't ever have to call into the kernel.

8 years agoi965: fix unsigned long overflows for i386
Mark Janes [Mon, 1 Feb 2016 22:28:00 +0000 (14:28 -0800)]
i965: fix unsigned long overflows for i386

bit-shifts on 32 bit unsigned longs overflow in several places.  The
intention was for 64 bit integers to be used.

8 years agonir/spirv: Fix UBO loads of a single element of a row-major matrix
Jason Ekstrand [Mon, 1 Feb 2016 22:00:25 +0000 (14:00 -0800)]
nir/spirv: Fix UBO loads of a single element of a row-major matrix

8 years agonir/spirv: Handle the LOD parameter of OpImageQuerySizeLod
Jason Ekstrand [Mon, 1 Feb 2016 21:52:47 +0000 (13:52 -0800)]
nir/spirv: Handle the LOD parameter of OpImageQuerySizeLod

8 years agonir/spirv: Add support for SpvOpImage
Jason Ekstrand [Mon, 1 Feb 2016 21:47:13 +0000 (13:47 -0800)]
nir/spirv: Add support for SpvOpImage

8 years agonir/spirv: Fix the UBO loading case of a single row-major matric column
Jason Ekstrand [Mon, 1 Feb 2016 21:26:59 +0000 (13:26 -0800)]
nir/spirv: Fix the UBO loading case of a single row-major matric column

8 years agonir/spirv: Fix the UBO loading case of a single row-major matric column
Jason Ekstrand [Mon, 1 Feb 2016 21:26:59 +0000 (13:26 -0800)]
nir/spirv: Fix the UBO loading case of a single row-major matric column

8 years agoanv/wsi/wayland: Advertise sRGB
Jason Ekstrand [Mon, 1 Feb 2016 21:06:21 +0000 (13:06 -0800)]
anv/wsi/wayland: Advertise sRGB

8 years agoanv/wsi/x11: Expose SRGB all the time
Jason Ekstrand [Mon, 1 Feb 2016 20:55:23 +0000 (12:55 -0800)]
anv/wsi/x11: Expose SRGB all the time

After a long discussion with Eric Anholt and Owen Taylor, I learned that
X11 is basically always sRGB as that's what the scanout hardware does and X
doesn't modify anything.  Therefore, we should just always expose sRGB
formats.

8 years agoanv: Structify a one-member union
Chad Versace [Mon, 1 Feb 2016 20:18:10 +0000 (12:18 -0800)]
anv: Structify a one-member union

anv_descriptor contained a union with one member.

8 years agoanv: Advertise robustBufferAccess
Kristian Høgsberg Kristensen [Mon, 1 Feb 2016 19:54:40 +0000 (11:54 -0800)]
anv: Advertise robustBufferAccess

The GPU does most of this for us as long as we set up tight bounds for
the buffers, which we do. Additionally, we range check dynamically
buffers in the shader. With that it's safe to turn on robustBufferAccess.

8 years agoanv/meta: Strip trailing whitespace
Chad Versace [Mon, 1 Feb 2016 18:51:01 +0000 (10:51 -0800)]
anv/meta: Strip trailing whitespace

8 years agoanv: Update MSAA status in README
Chad Versace [Mon, 1 Feb 2016 18:46:24 +0000 (10:46 -0800)]
anv: Update MSAA status in README

8 years agoUpdate the README
Jason Ekstrand [Mon, 1 Feb 2016 14:10:34 +0000 (06:10 -0800)]
Update the README

8 years agowsi/x11: Remove B8G8R8_UNORM
Jason Ekstrand [Mon, 1 Feb 2016 13:58:37 +0000 (05:58 -0800)]
wsi/x11: Remove B8G8R8_UNORM

We don't actually support that format yet because ISL doesn't have an enum
for it.  We need to beef up the formats table to allow for tiled-only
formats.

8 years agoanv/gen7: Rename gen7_batch_lr* to emit_lr*
Jordan Justen [Fri, 29 Jan 2016 23:08:19 +0000 (15:08 -0800)]
anv/gen7: Rename gen7_batch_lr* to emit_lr*

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7: Set BypassGatewayControl in MEDIA_VFE_STATE
Jordan Justen [Sat, 30 Jan 2016 22:56:03 +0000 (14:56 -0800)]
anv/gen7: Set BypassGatewayControl in MEDIA_VFE_STATE

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/genX_pipeline: Remove unnecessary #include files
Jordan Justen [Sat, 30 Jan 2016 17:30:50 +0000 (09:30 -0800)]
anv/genX_pipeline: Remove unnecessary #include files

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7: Set SLM size in interface descriptor
Jordan Justen [Sat, 30 Jan 2016 08:49:31 +0000 (00:49 -0800)]
anv/gen7: Set SLM size in interface descriptor

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Support MEDIA_VFE_STATE for gen7
Jordan Justen [Sat, 30 Jan 2016 08:31:58 +0000 (00:31 -0800)]
anv: Support MEDIA_VFE_STATE for gen7

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7: Subtract 1 from num_elements when setting up buffer surface state
Jordan Justen [Fri, 29 Jan 2016 01:19:15 +0000 (17:19 -0800)]
anv/gen7: Subtract 1 from num_elements when setting up buffer surface state

e8f51fe4 for gen7

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7: Disable fs dispatch for depth/stencil only pipelines
Jordan Justen [Thu, 28 Jan 2016 00:59:54 +0000 (16:59 -0800)]
anv/gen7: Disable fs dispatch for depth/stencil only pipelines

292031a for gen7

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7: Add support for gl_NumWorkGroups
Jordan Justen [Sat, 23 Jan 2016 00:26:34 +0000 (16:26 -0800)]
anv/gen7: Add support for gl_NumWorkGroups

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen7/compute: Setup push constants and local ids
Jordan Justen [Fri, 22 Jan 2016 19:18:22 +0000 (11:18 -0800)]
anv/gen7/compute: Setup push constants and local ids

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/genX: Add genX_pipeline.c for compute_pipeline_create
Jordan Justen [Fri, 22 Jan 2016 23:59:02 +0000 (15:59 -0800)]
anv/genX: Add genX_pipeline.c for compute_pipeline_create

Adds initial compute_pipeline_create implementation for gen7.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoMerge branch 'vulkan' into 'vulkan'
Jason Ekstrand [Sat, 30 Jan 2016 15:28:12 +0000 (10:28 -0500)]
Merge branch 'vulkan' into 'vulkan'

Vulkan WSI Wayland fixes

Two small fixes to make mailbox mode actually work again.

See merge request !4

8 years agoanv/pass: Initialize has_resolve
Jason Ekstrand [Sat, 30 Jan 2016 15:16:33 +0000 (07:16 -0800)]
anv/pass: Initialize has_resolve

8 years agoanv/wsi: Set the platform field of VkIcdSurfaceBase
Jason Ekstrand [Sat, 30 Jan 2016 15:05:53 +0000 (07:05 -0800)]
anv/wsi: Set the platform field of VkIcdSurfaceBase

8 years agoanv/wsi/x11: Actually pull information from the window's visual
Jason Ekstrand [Sat, 30 Jan 2016 11:49:10 +0000 (03:49 -0800)]
anv/wsi/x11: Actually pull information from the window's visual

8 years agoanv/wsi/x11: Actually check for DRI3
Jason Ekstrand [Sat, 30 Jan 2016 09:33:00 +0000 (01:33 -0800)]
anv/wsi/x11: Actually check for DRI3

8 years agoanv/WSI: Support more usage bits
Jason Ekstrand [Sat, 30 Jan 2016 04:52:42 +0000 (20:52 -0800)]
anv/WSI: Support more usage bits

They're just images and we have no intention of stompping alpha channels
(at least not yet), so there's no reason why you can't sample.

8 years agoanv/formats: Add more compressed formats
Jason Ekstrand [Thu, 28 Jan 2016 23:55:32 +0000 (15:55 -0800)]
anv/formats: Add more compressed formats

This adds support for the DX compression formats.  Given that ETC and EAC
are working fine, these should be ok too.

8 years agoanv/wsi: Rework to be compatable with the loader
Jason Ekstrand [Thu, 28 Jan 2016 23:34:22 +0000 (15:34 -0800)]
anv/wsi: Rework to be compatable with the loader

8 years agovulkan: Import vk_icd.h
Jason Ekstrand [Thu, 28 Jan 2016 21:36:41 +0000 (13:36 -0800)]
vulkan: Import vk_icd.h

8 years agoanv/device: Fix version check
Jason Ekstrand [Thu, 28 Jan 2016 23:43:44 +0000 (15:43 -0800)]
anv/device: Fix version check

The bottom-end check was wrong so it was only working on <= 1.0.0.  Oops.

8 years agoanv: Don't disable snooping for mempools
Kristian Høgsberg Kristensen [Fri, 29 Jan 2016 23:45:18 +0000 (15:45 -0800)]
anv: Don't disable snooping for mempools

There's an intermittent flushing problem with VkEvent that we need to
root cause. For now, using the snooping feature keeps the memory pools
up to date with GPU writes and fixes the problem.

8 years agoanv: clflush is only orderered against mfence
Kristian Høgsberg Kristensen [Fri, 29 Jan 2016 20:10:12 +0000 (12:10 -0800)]
anv: clflush is only orderered against mfence

We can't use the more fine-grained load and store fence commands (lfence
and mfence), since clflush is only guaranteed to be ordered with respect
to mfence.

8 years agoanv: Limit flushing to the range of mapped memory
Kristian Høgsberg Kristensen [Fri, 29 Jan 2016 20:07:34 +0000 (12:07 -0800)]
anv: Limit flushing to the range of mapped memory

8 years agoanv/cmd_buffer: Emit gen9 style SF state for CHV
Ben Widawsky [Fri, 29 Jan 2016 22:10:52 +0000 (14:10 -0800)]
anv/cmd_buffer: Emit gen9 style SF state for CHV

The state for line width changes on Cherryview to use the GEN9 bits (for extra
precision).

8 years agoanv/gen8: Extract SF state
Ben Widawsky [Fri, 29 Jan 2016 21:55:41 +0000 (13:55 -0800)]
anv/gen8: Extract SF state

For upcoming patch to address difference in Cherryview.

8 years agoanv: Do resolves at end of subpass
Chad Versace [Thu, 28 Jan 2016 04:42:54 +0000 (20:42 -0800)]
anv: Do resolves at end of subpass

8 years agoanv/meta: Remove unneeded resolve pipeline
Chad Versace [Thu, 28 Jan 2016 18:20:10 +0000 (10:20 -0800)]
anv/meta: Remove unneeded resolve pipeline

Vulkan does not allow resolving a single-sample image. So remove that
pipeline from anv_meta_state::resolve::pipelines.

8 years agoanv/meta_resolve: Remove redundant initialization params
Chad Versace [Thu, 28 Jan 2016 18:14:39 +0000 (10:14 -0800)]
anv/meta_resolve: Remove redundant initialization params

8 years agoanv: Drop const on anv_framebuffer::attachments
Chad Versace [Thu, 28 Jan 2016 04:42:45 +0000 (20:42 -0800)]
anv: Drop const on anv_framebuffer::attachments

The attachments should be const, but the driver's function signatures
are generally not const-friendly.

Drop the const because it conflicts with upcoming
anv_cmd_buffer_resolve_subpass().

8 years agoanv: Add anv_subpass::has_resolve
Chad Versace [Thu, 28 Jan 2016 02:03:34 +0000 (18:03 -0800)]
anv: Add anv_subpass::has_resolve

Indicates that the subpass has at least one resolve attachment.

8 years agoanv/meta_resolve: Save/Restore viewport and scissor
Chad Versace [Thu, 28 Jan 2016 04:13:10 +0000 (20:13 -0800)]
anv/meta_resolve: Save/Restore viewport and scissor

8 years agoanv/meta_resolve: Begin pass outside emit_resolve()
Chad Versace [Thu, 28 Jan 2016 04:00:29 +0000 (20:00 -0800)]
anv/meta_resolve: Begin pass outside emit_resolve()

This refactor is preparation for handling subpass resolve attachments.

8 years agoanv/image: Update usage flags for multisample images
Chad Versace [Thu, 28 Jan 2016 14:28:01 +0000 (06:28 -0800)]
anv/image: Update usage flags for multisample images

Meta resolves multisample images by binding them as textures. Therefore
we must add VK_IMAGE_USAGE_SAMPLED_BIT.

8 years agoanv/device: Add a better version check.
Jason Ekstrand [Thu, 28 Jan 2016 16:18:50 +0000 (08:18 -0800)]
anv/device: Add a better version check.

We now check that the requested version is precicely within the range of
versions that we support.

8 years agoanv/device: Advertise 1.0.2
Jason Ekstrand [Thu, 28 Jan 2016 06:02:51 +0000 (22:02 -0800)]
anv/device: Advertise 1.0.2

8 years agoanv/formats: Properly set FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
Jason Ekstrand [Thu, 28 Jan 2016 06:02:03 +0000 (22:02 -0800)]
anv/formats: Properly set FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT

This was added last minute and the API bumped to 1.0.2.

8 years agovulkan.h: Update to 1.0.2
Jason Ekstrand [Thu, 28 Jan 2016 05:59:00 +0000 (21:59 -0800)]
vulkan.h: Update to 1.0.2

8 years agoanv/device: Improve the api version check to allow 1.0.X
Jason Ekstrand [Thu, 28 Jan 2016 05:56:23 +0000 (21:56 -0800)]
anv/device: Improve the api version check to allow 1.0.X

8 years agovtn: Improve accuracy of acos approximation.
Francisco Jerez [Thu, 28 Jan 2016 02:39:48 +0000 (18:39 -0800)]
vtn: Improve accuracy of acos approximation.

The adjusted polynomial coefficients come from the numerical
minimization of the L2 norm of the relative error.  The old
coefficients would give a maximum relative error of about 15000 ULP in
the neighborhood around acos(x) = 0, the new ones give a relative
error bounded by less than 2000 ULP in the same neighborhood.

8 years agoAn alternate arccosine implementation
Jason Ekstrand [Thu, 28 Jan 2016 00:58:42 +0000 (16:58 -0800)]
An alternate arccosine implementation

8 years agoanv/meta_resolve: Fix a bug in the meta pipeline destroy path
Jason Ekstrand [Thu, 28 Jan 2016 03:48:43 +0000 (19:48 -0800)]
anv/meta_resolve: Fix a bug in the meta pipeline destroy path

8 years agoanv/skl: Fix crash in 16x multisampling
Chad Versace [Thu, 28 Jan 2016 01:26:18 +0000 (17:26 -0800)]
anv/skl: Fix crash in 16x multisampling

We built meta clear and resolve pipelines for only up to 8x samples.
There were no 16x pipelines.

8 years agoanv: Fix comment for anv_meta_state arrays
Chad Versace [Thu, 28 Jan 2016 01:22:20 +0000 (17:22 -0800)]
anv: Fix comment for anv_meta_state arrays

Array element i is for 2^i samples, not log2(i) samples.

8 years agoanv/push constants: Use constant buffer #2
Ben Widawsky [Wed, 27 Jan 2016 19:37:23 +0000 (11:37 -0800)]
anv/push constants: Use constant buffer #2

SKL has a workaround which requires either some weird programming of buffer 3,
OR, just never using buffer 0. Since we don't actually use multiple constant
buffers, it's easier to just not use 0.

Only SKL requires this workaround, but there is no harm in applying it to all
platforms. The big change here is that buffer #0 is relative to dynamic state
base normally (depending upon ISTPM), where buffer 1-3 is a GPU virtual address.

8 years agoanv/meta: Implement multisample clears
Chad Versace [Wed, 27 Jan 2016 22:34:27 +0000 (14:34 -0800)]
anv/meta: Implement multisample clears

8 years agoanv/meta: Simplify failure handling during clear init
Chad Versace [Wed, 27 Jan 2016 22:02:57 +0000 (14:02 -0800)]
anv/meta: Simplify failure handling during clear init

Remove all the fine-grained cleanup in
anv_device_init_meta_clear_state(). Instead, if anything fails during
initialization, simply call anv_device_finish_meta_clear_state() and let
it clean up the partially initialized anv_meta_state::clear.

8 years agoanv/meta: Implement vkCmdResolveImage
Chad Versace [Thu, 21 Jan 2016 01:10:41 +0000 (17:10 -0800)]
anv/meta: Implement vkCmdResolveImage

This handles multisample color images that have a floating-point or
normalized format and have a single array layer.

This does not yet handle integer formats nor multisample array images.

8 years agoanv/meta: Add func anv_meta_get_iview_layer()
Chad Versace [Mon, 25 Jan 2016 17:14:03 +0000 (09:14 -0800)]
anv/meta: Add func anv_meta_get_iview_layer()

This function is just meta_blit_get_dest_view_base_array_slice(), but
moved to the shared header anv_meta.h.

Will be needed by anv_meta_resolve.c.

8 years agoanv/gen8: Begin enabling pipeline multisample state
Chad Versace [Tue, 26 Jan 2016 18:56:06 +0000 (10:56 -0800)]
anv/gen8: Begin enabling pipeline multisample state

As far as I can tell, this patch sets all pipeline multisample state
except:
    - alpha to coverage
    - alpha to one
    - the dispatch count for per-sample dispatch

8 years agoanv/gen8: Set multisample surface state
Chad Versace [Tue, 26 Jan 2016 17:55:05 +0000 (09:55 -0800)]
anv/gen8: Set multisample surface state

8 years agoanv/meta: Merge anv_meta_clear.h into anv_meta.h
Chad Versace [Mon, 25 Jan 2016 16:56:36 +0000 (08:56 -0800)]
anv/meta: Merge anv_meta_clear.h into anv_meta.h

The header was too small.

8 years agovtn: Make tanh implementation even stupider
Kenneth Graunke [Wed, 27 Jan 2016 23:31:53 +0000 (15:31 -0800)]
vtn: Make tanh implementation even stupider

The dEQP "precision" test tries to verify that the reference functions

   float sinh(float a) { return ((exp(a) - exp(-a)) / 2); }
   float cosh(float a) { return ((exp(a) + exp(-a)) / 2); }
   float tanh(float a) { return (sinh(a) / cosh(a)); }

produce the same values as the built-ins.  We simplified away the
multiplication by 0.5 in the numerator and denominator, and apparently
this causes them not to match for exactly 1 out of 13,632 values.

So, put it back in, fixing the test, but making our code generation
(and precision?) worse.

8 years agonir/opt_algebraic: Use a more elementary mechanism for lowering ldexp
Jason Ekstrand [Wed, 27 Jan 2016 23:21:28 +0000 (15:21 -0800)]
nir/opt_algebraic: Use a more elementary mechanism for lowering ldexp

8 years agogen8/state: Fix QPitch for compressed textures on Broadwell
Jason Ekstrand [Wed, 27 Jan 2016 20:55:36 +0000 (12:55 -0800)]
gen8/state: Fix QPitch for compressed textures on Broadwell

8 years agoanv/image: Use the entire image height for compressed meta blits
Jason Ekstrand [Wed, 27 Jan 2016 20:37:15 +0000 (12:37 -0800)]
anv/image: Use the entire image height for compressed meta blits

8 years agoanv/image: Enlarge the image level 0 extent
Nanley Chery [Wed, 27 Jan 2016 20:08:56 +0000 (12:08 -0800)]
anv/image: Enlarge the image level 0 extent

The extent previously was supposed to match the mip at a given level
under the assumption that the base address would be that of the mip
as well.

Now however, the base address only matches the offset of the
containing tile. Therefore, enlarge the extent to match that of
phys_slice0, so that we don't draw/fetch in out of bounds territory.

This solution isn't perfect because the base adress isn't always at
the first tile, therefore the assumed valid memory region by the HW
contains some number of invalid tiles on two edges.

8 years agoanv/image: Minify before dividing by block dimensions
Jason Ekstrand [Wed, 27 Jan 2016 19:47:07 +0000 (11:47 -0800)]
anv/image: Minify before dividing by block dimensions

8 years agoanv/meta: Don't double-call choose_buffer_format
Jason Ekstrand [Wed, 27 Jan 2016 18:47:42 +0000 (10:47 -0800)]
anv/meta: Don't double-call choose_buffer_format

This fixes all the renderpass tests

8 years agoanv/meta: Modify make_image_for_buffer()'s image
Nanley Chery [Wed, 27 Jan 2016 05:51:36 +0000 (21:51 -0800)]
anv/meta: Modify make_image_for_buffer()'s image

Always use a valid buffer format and convert the extent to units of
elements with respect to original image format.

8 years agoanv/image: Use custom VkBufferImageCopy for iview initialization
Nanley Chery [Wed, 27 Jan 2016 02:40:54 +0000 (18:40 -0800)]
anv/image: Use custom VkBufferImageCopy for iview initialization

Use a custom VkBufferImageCopy with the user-provided struct as
the base. A few fields are modified when the iview is uncompressed
and the underlying image is compressed.

8 years agoanv: Add offset parameter to anv_image_view_init()
Nanley Chery [Wed, 27 Jan 2016 02:53:21 +0000 (18:53 -0800)]
anv: Add offset parameter to anv_image_view_init()

This is the offset of the tile that contains the mip specified by
isl_surf_get_image_intratile_offset_el(). Used to draw to/from the
specified mip.

8 years agoanv/meta: Calculate mip offset for compressed texture
Nanley Chery [Wed, 27 Jan 2016 02:10:12 +0000 (18:10 -0800)]
anv/meta: Calculate mip offset for compressed texture

This value will be used in a later commit.

8 years agoanv/meta: Disambiguate slice variable value
Nanley Chery [Wed, 27 Jan 2016 02:00:14 +0000 (18:00 -0800)]
anv/meta: Disambiguate slice variable value

This will simplify the usage of
isl_surf_get_image_intratile_offset_el().

8 years agogen8_state: use iview extent to program RENDER_SURFACE_STATE
Nanley Chery [Mon, 4 Jan 2016 22:53:55 +0000 (14:53 -0800)]
gen8_state: use iview extent to program RENDER_SURFACE_STATE

When creating an uncompressed ImageView on an compressed Image, the
SurfaceFormat is updated to match the ImageView's. The surface
dimensions must also change so that the HW sees the same size image
instead of a 4x larger one.

Fixes the following error which results from running many VulkanCTS
compressed tests in one shot:
  ResourceError (vk.queueSubmit(queue, 1, &submitInfo, *m_fence):
  VK_ERROR_OUT_OF_DEVICE_MEMORY at
  vktPipelineImageSamplingInstance.cpp:921)

Makes all compressed format tests with a height > 1 pass.

8 years agoanv/image: Scale iview extent by backing image
Nanley Chery [Mon, 4 Jan 2016 20:41:22 +0000 (12:41 -0800)]
anv/image: Scale iview extent by backing image

Aligns with formula's presented in Vulkan spec concerning CopyBufferToImage.
18.4 Copying Data Between Buffers and Images

This won't conflict with valid API usage, because:
1) Users are not allowed to create an uncompressed ImageView with a
compressed Image.
see: VkSpec - 11.5 Image Views - VkImageViewCreateInfo's Valid Usage box

2) If users create a differently formatted compressed ImageView with a
compressed Image, the block dimensions will still match.
see: VkSpec - 28.3.1.5 Format Compatibility Classes - Table 28.5

8 years agoanv/meta: Set depth to 0 for buffer image in CopyBufferToImage()
Nanley Chery [Wed, 27 Jan 2016 00:19:33 +0000 (16:19 -0800)]
anv/meta: Set depth to 0 for buffer image in CopyBufferToImage()

The buffer image is a flat 2D surface. Each surface represents an
array/depth layer, therefore, the Z-offset is 0 when blitting.

8 years agoanv/meta: Use the uncompressed rectangle when blitting
Nanley Chery [Tue, 5 Jan 2016 20:13:56 +0000 (12:13 -0800)]
anv/meta: Use the uncompressed rectangle when blitting

For an uncompressed ImageView of a compressed Image, the
dimensions and offsets are all divided by the appropriate
block dimensions.

We are not yet using an uncompressed ImageView for a
compressed Image, but will do so in a future commit.

8 years agoi965: Update the surface_format table for ETC formats
Nanley Chery [Tue, 29 Dec 2015 19:06:25 +0000 (11:06 -0800)]
i965: Update the surface_format table for ETC formats

Enable ETC support for BDW+. In Vulkan, an array lookup on
surface_format[] is used to determine HW support for certain
formats. In contrast, Mesa dynamically populates an array
which reports this information.

8 years agoanv/image: Update usages of isl_surf_get_image_offset_sa
Nanley Chery [Wed, 27 Jan 2016 17:29:09 +0000 (09:29 -0800)]
anv/image: Update usages of isl_surf_get_image_offset_sa

8 years agoisl: Add logical z offset to GEN4_2D surfaces
Nanley Chery [Wed, 27 Jan 2016 06:56:21 +0000 (22:56 -0800)]
isl: Add logical z offset to GEN4_2D surfaces

3D surfaces in Skylake are stored with ISL_DIM_LAYOUT_GEN4_2D. Any
delta in the logical z offset causes an equivalent delta in the
surface's array layer.

8 years agoisl/tests: Add some tests for intratile offsets
Chad Versace [Tue, 26 Jan 2016 00:22:17 +0000 (16:22 -0800)]
isl/tests: Add some tests for intratile offsets

Test isl_surf_get_image_intratile_offset_el() in the tests:
  test_bdw_2d_r8g8b8a8_unorm_512x512_array01_samples01_noaux_tiley0
  test_bdw_2d_r8g8b8a8_unorm_1024x1024_array06_samples01_noaux_tiley0

8 years agoisl: Add func isl_get_intratile_image_offset_el()
Chad Versace [Mon, 25 Jan 2016 20:43:56 +0000 (12:43 -0800)]
isl: Add func isl_get_intratile_image_offset_el()

8 years agoisl/tests: Rename t_assert_offset()
Chad Versace [Mon, 25 Jan 2016 23:08:33 +0000 (15:08 -0800)]
isl/tests: Rename t_assert_offset()

Rename it to t_assert_offset_el(), clarifying that the offset in units
of surface elements, not samples.

8 years agoisl: Add func isl_surf_get_image_offset_el()
Chad Versace [Mon, 25 Jan 2016 20:15:07 +0000 (12:15 -0800)]
isl: Add func isl_surf_get_image_offset_el()

This replaces function isl_surf_get_image_offset_sa()

8 years agoisl: Fix row pitch for compressed formats
Chad Versace [Mon, 25 Jan 2016 20:23:57 +0000 (12:23 -0800)]
isl: Fix row pitch for compressed formats

When calculating row pitch, the row's width in samples must be divided
by the format's block width. The commit below accidentally removed the
division.

    commit eea2d4d05987b4f8ad90a1588267f9495f1e9e99
    Author: Chad Versace <chad.versace@intel.com>
    Date:   Tue Jan 5 14:28:28 2016 -0800
    Subject: isl: Don't align phys_slice0_sa.width twice

8 years agoisl: Add func isl_surf_get_tile_info()
Chad Versace [Mon, 25 Jan 2016 19:45:12 +0000 (11:45 -0800)]
isl: Add func isl_surf_get_tile_info()

8 years agovtn: Fix atan2 for non-scalars.
Kenneth Graunke [Wed, 27 Jan 2016 23:07:18 +0000 (15:07 -0800)]
vtn: Fix atan2 for non-scalars.

The if/then/else block was bogus, as it can only take a scalar
condition, and we need to select component-wise.  The GLSL IR
implementation of atan2 handles this by looping over components,
but I decided to try and do it vector-wise, and messed up.

For now, just bcsel.  It means that we do the atan1 math even if
all components hit the quick case, but it works, and presumably
at least one component will hit the expensive path anyway.

8 years agovtn: Fix Modf.
Kenneth Graunke [Wed, 27 Jan 2016 22:20:47 +0000 (14:20 -0800)]
vtn: Fix Modf.

We were botching this for negative numbers - floor of a negative rounds
the wrong way.  Additionally, both results are supposed to retain the
sign of the original.

To fix this, just take the abs of both values, then put the sign back.
There's probably a better way to do this, but this works for now.

8 years agoi965: Fix SIN/COS precision problems.
Kenneth Graunke [Wed, 27 Jan 2016 20:21:04 +0000 (12:21 -0800)]
i965: Fix SIN/COS precision problems.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv: Put back code to grow shader scratch space
Kristian Høgsberg Kristensen [Wed, 27 Jan 2016 19:36:44 +0000 (11:36 -0800)]
anv: Put back code to grow shader scratch space

This was lost in commit a71e614d33e8d869bbaced8948349a7180783ab7.