mesa.git
8 years agonir/builder: Add a nir_ssa_undef helper
Jason Ekstrand [Sat, 14 Nov 2015 00:25:24 +0000 (16:25 -0800)]
nir/builder: Add a nir_ssa_undef helper

8 years agonir/spirv: Add support for creating image variables
Jason Ekstrand [Fri, 13 Nov 2015 23:53:08 +0000 (15:53 -0800)]
nir/spirv: Add support for creating image variables

8 years agonir/spirv: Add support for image types
Jason Ekstrand [Fri, 13 Nov 2015 23:52:52 +0000 (15:52 -0800)]
nir/spirv: Add support for image types

8 years agonir/types: Add image type helpers
Jason Ekstrand [Fri, 13 Nov 2015 23:49:13 +0000 (15:49 -0800)]
nir/types: Add image type helpers

8 years agoglsl/types: Add a get_image_instance helper
Jason Ekstrand [Fri, 13 Nov 2015 23:48:48 +0000 (15:48 -0800)]
glsl/types: Add a get_image_instance helper

8 years agoisl: Embed brw_device_info in isl_device
Chad Versace [Fri, 13 Nov 2015 19:12:46 +0000 (11:12 -0800)]
isl: Embed brw_device_info in isl_device

Suggested-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoanv: Use enum isl_tiling everywhere
Chad Versace [Fri, 13 Nov 2015 18:24:57 +0000 (10:24 -0800)]
anv: Use enum isl_tiling everywhere

In anv_surface and anv_image_create_info, replace member
'uint8_t tile_mode' with 'enum isl_tiling'.

As a nice side-effect, this patch also reduces bug potential because the
hardware enum values for tile modes are unstable across hardware
generations.

8 years agoanv/device: Embed isl_device
Chad Versace [Fri, 13 Nov 2015 18:12:51 +0000 (10:12 -0800)]
anv/device: Embed isl_device

Embed struct isl_device into anv_physical_device and anv_device.  It
will later be used for surface layout calculations.

8 years agoisl: Add enum isl_tiling and a query func
Chad Versace [Fri, 13 Nov 2015 17:45:55 +0000 (09:45 -0800)]
isl: Add enum isl_tiling and a query func

The query func is isl_tiling_get_extent.

8 years agoisl: Add structs isl_extent2d, isl_extent3d
Chad Versace [Fri, 13 Nov 2015 17:29:31 +0000 (09:29 -0800)]
isl: Add structs isl_extent2d, isl_extent3d

They are nowhere used yet.

8 years agoisl: Add struct isl_device
Chad Versace [Fri, 13 Nov 2015 17:27:06 +0000 (09:27 -0800)]
isl: Add struct isl_device

The struct is incomplete (it contains only the gen). And it's nowhere
used yet.

It will be used later for surface layout calculations.

8 years agoanv: Strip trailing whitespace from anv_device.c
Chad Versace [Fri, 13 Nov 2015 18:12:18 +0000 (10:12 -0800)]
anv: Strip trailing whitespace from anv_device.c

8 years agoanv: Strip trailing space in anv_private.h
Chad Versace [Thu, 12 Nov 2015 20:24:01 +0000 (12:24 -0800)]
anv: Strip trailing space in anv_private.h

8 years agoanv: Remove redundant fields anv_format::bs,bw,bh,bd
Chad Versace [Thu, 12 Nov 2015 20:14:43 +0000 (12:14 -0800)]
anv: Remove redundant fields anv_format::bs,bw,bh,bd

Instead, use the equivalent fields in anv_format::isl_layout.

8 years agoanv/formats: Re-indent the fmt() macro
Chad Versace [Thu, 12 Nov 2015 20:00:15 +0000 (12:00 -0800)]
anv/formats: Re-indent the fmt() macro

Use one line per struct member.

8 years agoanv: Use enum isl_format in anv_format
Chad Versace [Thu, 12 Nov 2015 19:31:02 +0000 (11:31 -0800)]
anv: Use enum isl_format in anv_format

This patch begins using isl.h in Anvil. More refactors will follow.

Change type of anv_format::surface_format from uint16_t -> enum
isl_format.

8 years agoisl: Generate isl_format_layout.c
Chad Versace [Thu, 12 Nov 2015 18:46:12 +0000 (10:46 -0800)]
isl: Generate isl_format_layout.c

Generate an array of struct isl_format_layout, using
isl_format_layout.csv as input.

Each entry follows the patten:

   [ISL_FORMAT_R32G32B32A32_FLOAT] = {
      ISL_FORMAT_R32G32B32A32_FLOAT,
      .bs = 16, .bpb = 128,
      .bw = 1, .bh = 1, .bd = 1,
      .channels = {
          .r = { ISL_SFLOAT, 32 },
          .g = { ISL_SFLOAT, 32 },
          .b = { ISL_SFLOAT, 32 },
          .a = { ISL_SFLOAT, 32 },
          .l = {},
          .i = {},
          .p = {},
      },
      .colorspace = ISL_COLORSPACE_LINEAR,
      .txc = ISL_TXC_NONE,
   },

8 years agoisl: Add CSV of format layouts
Chad Versace [Wed, 11 Nov 2015 18:35:14 +0000 (10:35 -0800)]
isl: Add CSV of format layouts

Add file isl_format_layout.csv, which describes the block layout,
channel layout, and colorspace of all hardware surface formats.

8 years agoisl: Add enum isl_format
Chad Versace [Mon, 9 Nov 2015 16:53:01 +0000 (08:53 -0800)]
isl: Add enum isl_format

8 years agoanv/gen7: Implement the VS state depth-stall workaround
Jason Ekstrand [Wed, 11 Nov 2015 00:42:34 +0000 (16:42 -0800)]
anv/gen7: Implement the VS state depth-stall workaround

8 years agoanv/gen7: Properly handle a GS with zero invocations
Jason Ekstrand [Wed, 11 Nov 2015 00:41:23 +0000 (16:41 -0800)]
anv/gen7: Properly handle a GS with zero invocations

8 years agoanv/gen7: Add push constant support
Jason Ekstrand [Tue, 10 Nov 2015 23:14:11 +0000 (15:14 -0800)]
anv/gen7: Add push constant support

8 years agoanv/device: Use an actual int64_t in WaitForFences
Jason Ekstrand [Tue, 10 Nov 2015 23:02:52 +0000 (15:02 -0800)]
anv/device: Use an actual int64_t in WaitForFences

8 years agoanv/meta: Create a sampler in meta_emit_blit
Jason Ekstrand [Tue, 10 Nov 2015 22:43:18 +0000 (14:43 -0800)]
anv/meta: Create a sampler in meta_emit_blit

8 years agoanv/gen7: Properly handle VS with VertexID but no vertices
Jason Ekstrand [Tue, 10 Nov 2015 19:31:31 +0000 (11:31 -0800)]
anv/gen7: Properly handle VS with VertexID but no vertices

8 years agoanv/device: Work around the i915 kernel driver timeout bug
Jason Ekstrand [Tue, 10 Nov 2015 19:24:08 +0000 (11:24 -0800)]
anv/device: Work around the i915 kernel driver timeout bug

There is a bug in some versions of the i915 kernel driver where it will
return immediately if the timeout is negative (it's supposed to wait
indefinitely).  We've worked around this in mesa for a few months but never
implemented the work-around in the Vulkan driver.

I rediscovered this bug again while working on Ivy Bridge becasuse the
drive in my Ivy Bridge currently has Fedora 21 installed which has one of
the offending kernels.

8 years agoanv/nir: Fix codegen in lower_push_constants
Jason Ekstrand [Tue, 10 Nov 2015 00:29:05 +0000 (16:29 -0800)]
anv/nir: Fix codegen in lower_push_constants

8 years agoanv/gen7: Fix the length of 3DSTATE_SF
Jason Ekstrand [Tue, 10 Nov 2015 00:03:49 +0000 (16:03 -0800)]
anv/gen7: Fix the length of 3DSTATE_SF

8 years agoanv/gen7: Properly handle missing color-blend state
Jason Ekstrand [Mon, 9 Nov 2015 23:58:19 +0000 (15:58 -0800)]
anv/gen7: Properly handle missing color-blend state

8 years agoanv/device: Add a newline to the end of a comment
Jason Ekstrand [Mon, 9 Nov 2015 20:18:12 +0000 (12:18 -0800)]
anv/device: Add a newline to the end of a comment

8 years agoanv/formats: Define ETC2 formats
Nanley Chery [Tue, 29 Sep 2015 22:47:39 +0000 (15:47 -0700)]
anv/formats: Define ETC2 formats

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoanv/image: Determine the alignment units for compressed formats
Nanley Chery [Fri, 2 Oct 2015 23:11:24 +0000 (16:11 -0700)]
anv/image: Determine the alignment units for compressed formats

Alignment units, i and j, match the compressed format block
width and height respectively.

v2: Don't assert against HALIGN* and VALIGN* enums (Chad)

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoanv/image: Handle compressed format qpitch and padding
Nanley Chery [Tue, 6 Oct 2015 00:27:32 +0000 (17:27 -0700)]
anv/image: Handle compressed format qpitch and padding

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoanv/image: Handle compressed format stride and size
Nanley Chery [Tue, 29 Sep 2015 00:51:30 +0000 (17:51 -0700)]
anv/image: Handle compressed format stride and size

These formulas did not take compressed formats into account.

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoanv/formats: Add fields for block dimensions
Nanley Chery [Tue, 29 Sep 2015 00:42:39 +0000 (17:42 -0700)]
anv/formats: Add fields for block dimensions

A non-compressed texture is a 1x1x1 block. Compressed
textures could have values which vary in different
dimensions WxHxD.

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoanv/formats: Add surface_format initializer
Nanley Chery [Tue, 29 Sep 2015 21:53:28 +0000 (14:53 -0700)]
anv/formats: Add surface_format initializer

v2: Rename __brw_fmt to __hw_fmt (Chad)

Suggested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chad Versace chad.versace@intel.com
8 years agoanv: Rename cpp variable to "bs"
Nanley Chery [Tue, 29 Sep 2015 00:54:59 +0000 (17:54 -0700)]
anv: Rename cpp variable to "bs"

cpp (chars-per-pixel) is an integer that fails to give useful data
about most compressed formats. Instead, rename it to "bs" which
stands for block size (in bytes).

v2: Rename vk_format_for_bs to vk_format_for_size (Chad)
    Use "block size" instead of "bs" in error message (Chad)

Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agonir/spirv: Give both block and buffer_block types an interface type
Jason Ekstrand [Sat, 7 Nov 2015 16:03:25 +0000 (08:03 -0800)]
nir/spirv: Give both block and buffer_block types an interface type

8 years agonir/spirv: Increment num_ubos/ssbos when creating variables
Jason Ekstrand [Sat, 7 Nov 2015 00:53:27 +0000 (16:53 -0800)]
nir/spirv: Increment num_ubos/ssbos when creating variables

8 years agoanv/apply_dynamic_offsets: Use the right sized immediate zero
Jason Ekstrand [Sat, 7 Nov 2015 00:49:24 +0000 (16:49 -0800)]
anv/apply_dynamic_offsets: Use the right sized immediate zero

8 years agoanv/pipeline: Set the right SSBO binding table start index for FS
Jason Ekstrand [Fri, 6 Nov 2015 23:57:51 +0000 (15:57 -0800)]
anv/pipeline: Set the right SSBO binding table start index for FS

8 years agoanv/cmd_buffer: Rework the way we emit UBO surface state
Jason Ekstrand [Fri, 6 Nov 2015 23:14:10 +0000 (15:14 -0800)]
anv/cmd_buffer: Rework the way we emit UBO surface state

The new mechanism should be able to handle SSBOs as well as properly handle
emitting surface state on gen7 where we need different strides depending on
shader stage.

8 years agoanv/pipeline: Expose is_scalar_shader_stage
Jason Ekstrand [Fri, 6 Nov 2015 23:12:33 +0000 (15:12 -0800)]
anv/pipeline: Expose is_scalar_shader_stage

8 years agonir/spirv: Add a helper for determining if a block is externally visable
Jason Ekstrand [Fri, 6 Nov 2015 22:49:15 +0000 (14:49 -0800)]
nir/spirv: Add a helper for determining if a block is externally visable

8 years agoanv: Use VkDescriptorType instead of anv_descriptor_type
Jason Ekstrand [Fri, 6 Nov 2015 22:09:52 +0000 (14:09 -0800)]
anv: Use VkDescriptorType instead of anv_descriptor_type

8 years agoanv: Do range-checking in the shader for dynamic buffers
Jason Ekstrand [Fri, 6 Nov 2015 21:32:52 +0000 (13:32 -0800)]
anv: Do range-checking in the shader for dynamic buffers

8 years agoanv/device: Increase the block size for instructions
Jason Ekstrand [Fri, 6 Nov 2015 21:29:47 +0000 (13:29 -0800)]
anv/device: Increase the block size for instructions

8 years agoanv: Remove all support for BufferViews
Jason Ekstrand [Fri, 6 Nov 2015 21:16:15 +0000 (13:16 -0800)]
anv: Remove all support for BufferViews

We never *actually* supported them, we just used them for binding UBOs.
Now that we have BufferInfo and we aren't supporting texture buffers yet,
we should get rid of them until we can do them properly.

8 years agoanv/device: Only support binding UBOs through BufferInfo
Jason Ekstrand [Fri, 6 Nov 2015 20:52:12 +0000 (12:52 -0800)]
anv/device: Only support binding UBOs through BufferInfo

8 years agoanv: Rework UpdateDescriptorSets
Jason Ekstrand [Fri, 6 Nov 2015 20:28:01 +0000 (12:28 -0800)]
anv: Rework UpdateDescriptorSets

Previously, UpdateDescriptorSets was wrong because it assumed that the
binding was the offset into the descriptor set.

8 years agoanv: Add a descriptor_index to anv_descriptor_set_binding_layout
Jason Ekstrand [Fri, 6 Nov 2015 20:07:36 +0000 (12:07 -0800)]
anv: Add a descriptor_index to anv_descriptor_set_binding_layout

8 years agoanv: Add a layout to anv_descriptor_set
Jason Ekstrand [Fri, 6 Nov 2015 19:56:48 +0000 (11:56 -0800)]
anv: Add a layout to anv_descriptor_set

8 years agoanv/meta: Finish load clears for stencil attachments
Chad Versace [Thu, 5 Nov 2015 01:00:01 +0000 (17:00 -0800)]
anv/meta: Finish load clears for stencil attachments

Tested by Crucible "func.depthstencil.stencil_triangles.*" in

  commit c194292d5eadb84e9d7489fc01ce0b653cdd4ca5 (HEAD -> master)
  Author: Chad Versace <chad.versace@intel.com>
  Date:   Wed Nov 4 16:19:24 2015 -0800
  Subject: func.depthstencil: Remove stencil clear workaround for Mesa

8 years agoanv/cmd_buffer: Fix SURFACE_STATE for non-view buffer bindings
Jason Ekstrand [Thu, 5 Nov 2015 03:51:46 +0000 (19:51 -0800)]
anv/cmd_buffer: Fix SURFACE_STATE for non-view buffer bindings

We were treating it as if it's a BufferView and weren't taking the offset
into account properly.

8 years agoanv/cmd_buffer: Don't use an anv_state pointer in emit_binding_table
Jason Ekstrand [Thu, 5 Nov 2015 03:48:59 +0000 (19:48 -0800)]
anv/cmd_buffer: Don't use an anv_state pointer in emit_binding_table

The anv_state is supposed to be a flyweight so we're not really saving
anything by using a pointer.  Also, we were creating one, setting a pointer
to it, and then having it go out-of-scope which is bad.

8 years agoanv: Remove unused anv_render_pass members
Chad Versace [Wed, 4 Nov 2015 23:54:38 +0000 (15:54 -0800)]
anv: Remove unused anv_render_pass members

Remove members
  num_color_clear_attachments
  has_depth_clear_attachment
  has_stencil_clear_attachment

The new clear code in anv_meta_clear.c does not use them.

8 years agoanv/meta: Rewrite clear code
Chad Versace [Tue, 3 Nov 2015 22:55:58 +0000 (14:55 -0800)]
anv/meta: Rewrite clear code

Fixes Crucible test "func.clear.load-clear.attachments-8".

The old clear code, when clearing attachments for
VK_ATTACHMENT_LOAD_OP_CLEAR, suffered from some fundamental bugs. The
bugs were not fixable with the old code's approach.

    - It assumed that a VkRenderPass contained at most one depthstencil
       attachment.

    - It tried to clear all attachments (color and the sole
      depthstencil) with a single instanced draw call, using the VUE
      header's RenderTargetArrayIndex to specify the instance's target
      color attachment. But the RenderTargetArrayIndex does not select
      entries in the binding table; it only selects an array index of
      a singled layered surface.

    - If at least one attachment of VkRenderPass had
      VK_ATTACHMENT_LOAD_OP_CLEAR,
      then the old code cleared *all* attachments. This was
      a consequence of using a single draw call and single pipeline for
      the clear.

The new clear code fixes those bugs by making a separate draw call for
each attachment, and using one pipeline when clearing color attachments
and a different pipeline for depth attachments.

The new code, like the old code, does not clear stencil attachments. It
is left as a FINISHME.

8 years agoanv/meta: Clear color attribute is always flat
Chad Versace [Tue, 3 Nov 2015 22:53:52 +0000 (14:53 -0800)]
anv/meta: Clear color attribute is always flat

No behavioral change. This patch just removes an unneeded function
parameter.

8 years agoanv/meta: Use consistent naming for dynamic state mask
Chad Versace [Wed, 4 Nov 2015 21:48:31 +0000 (13:48 -0800)]
anv/meta: Use consistent naming for dynamic state mask

Consistently rename bitmasks of Vulkan dynamic state to 'dynamic_mask'.

  anv_meta_saved_state::dynamic_flags -> dynamic_mask
  anv_meta_save(dynamic_state)        -> dynamic_mask

8 years agoanv/meta: Rename anv_cmd_buffer_save/restore
Chad Versace [Tue, 3 Nov 2015 22:31:19 +0000 (14:31 -0800)]
anv/meta: Rename anv_cmd_buffer_save/restore

As the functions are now exposed in anv_meta.h, let's rename them
to clarify that they are meta functions.

    anv_cmd_buffer_save -> anv_meta_save
    anv_cmd_buffer_restore -> anv_meta_restore

8 years agoanv: Move meta clear code to new file anv_meta_clear.c
Chad Versace [Tue, 3 Nov 2015 22:19:45 +0000 (14:19 -0800)]
anv: Move meta clear code to new file anv_meta_clear.c

anv_meta.c currently handles blits, copies, clears, and resolves.  The
clear code is about to grow, and anv_meta.c is already busting at the
seams.

8 years agoanv: Move struct anv_vue_header to anv_private.h
Chad Versace [Tue, 3 Nov 2015 22:08:44 +0000 (14:08 -0800)]
anv: Move struct anv_vue_header to anv_private.h

Move it from anv_meta.c to the common header anv_private.h. This allows
us to split the meta blit and meta clear code into separate files.

8 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Tue, 3 Nov 2015 23:45:04 +0000 (15:45 -0800)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

8 years agonir: remove sampler_set from nir_tex_instr
Jason Ekstrand [Tue, 3 Nov 2015 22:57:40 +0000 (14:57 -0800)]
nir: remove sampler_set from nir_tex_instr

Now that descriptor sets are handled in a lowering pass, this is no longer
needed.

8 years agoi965/gen8+: Extract color clear surface state
Ben Widawsky [Wed, 14 Oct 2015 03:50:19 +0000 (20:50 -0700)]
i965/gen8+: Extract color clear surface state

On future generation platforms the color clear value is stored elsewhere in the
surface state. By extracting this logic, we can cleanly implement the difference
in an upcoming patch.

Should have no functional impact.

v2: Move hunk from the next patch into this patch (Matt)
Whitespace fix (Ben)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
8 years agoi965/gen8+: Remove redundant zeroing of surface state
Ben Widawsky [Wed, 14 Oct 2015 03:50:18 +0000 (20:50 -0700)]
i965/gen8+: Remove redundant zeroing of surface state

The allocate_surface_state already zeroes out the surface state, and doing it
later in the function is destructive for what we want to accomplish when we
split out support for gen9 fast clears (next patch).

NOTE: Only dword 12 actually needed to be fixed, but it seemed more consistent
to remove the other instances as well. I can make an argument both ways (open
coding it, vs. not). I can rework the next patch if requires.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
8 years agoanv: Drop stale comment in anv_cmd_buffer_emit_binding_table()
Chad Versace [Tue, 3 Nov 2015 21:42:28 +0000 (13:42 -0800)]
anv: Drop stale comment in anv_cmd_buffer_emit_binding_table()

When emitting the binding table for the fragment shader stage, we no
longer "walk all of the attachments, [inserting only] the color
attachments into the binding table". Instead, we iterate only over the
subpass's color attachments, which is the minimal possible iteration.

While killing the comment, also rename the variable 'attachments' to
'color_count', as it's no longer a count of all framebuffer attachments
but only the subpass's color attachment count.

8 years agonvc0: add missing compute parameters required by clover
Samuel Pitoiset [Tue, 3 Nov 2015 18:33:08 +0000 (19:33 +0100)]
nvc0: add missing compute parameters required by clover

This fixes crashes with some piglit OpenCL tests.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: handle NULL pointer in nvc0_get_compute_param()
Samuel Pitoiset [Tue, 3 Nov 2015 18:32:49 +0000 (19:32 +0100)]
nvc0: handle NULL pointer in nvc0_get_compute_param()

To get the size (in bytes) of a compute parameter, clover first calls
get_compute_param() with a NULL data pointer. The RET() macro is based
on nv50.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965/skl: PCI ID cleanup and brand strings
Ben Widawsky [Fri, 23 Oct 2015 18:30:16 +0000 (11:30 -0700)]
i965/skl: PCI ID cleanup and brand strings

A few new PCI ids are added here, and one is removed (0x190B) because it no
longer seems to exist anywhere.

v2-4:
Only use ascii characters (Ilia)
0x1921 is no longer marked as f

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
8 years agoi965/skl: Add GT4 PCI IDs
Ben Widawsky [Fri, 30 Oct 2015 00:30:35 +0000 (17:30 -0700)]
i965/skl: Add GT4 PCI IDs

Like other gen8+ hardware, the hardware automatically scales up thread counts.
We must be careful about the URB sizes since GT4 adds another slice.

One of the existing PCI IDs is actually mislabeled as GT3. Arguably this is a
real bug since the URB size will be wrong. Because this patch is simply meant to
add the missing IDs, that will be fixed in a later patch.

v2: No longer relevant.

v3: Update the wm thread count to support GT4. The WM thread count is used to
determine the maximum scratch space required. Currently the code always
allocates the maximum amount even though lower GT SKUs require less. The formula
is threads_per_psd * subslices_per_slice * slices

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
8 years agomesa: Add spec citations for DispatchCompute*
Jordan Justen [Tue, 13 Oct 2015 22:04:54 +0000 (15:04 -0700)]
mesa: Add spec citations for DispatchCompute*

Note: The OpenGL 4.3 - 4.5 specification language for DispatchCompute
appears to have an error regarding the max allowed values. When adding
the specification citation, we note why the code does not match the
specification language.

v2:
 * Updates based on review from Iago

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agomesa: Update DispatchComputeIndirect errors for indirect parameter
Jordan Justen [Tue, 13 Oct 2015 22:04:54 +0000 (15:04 -0700)]
mesa: Update DispatchComputeIndirect errors for indirect parameter

There is some discrepancy between the return values for some error
cases for the DispatchComputeIndirect call in the ARB_compute_shader
specification. Regarding the indirect parameter, in one place the
extension spec lists that the error returned for invalid values should
be INVALID_OPERATION, while later it specifies INVALID_VALUE.

The OpenGL 4.3 and OpenGLES 3.1 specifications appear to be consistent
in requiring the INVALID_VALUE error return in this case.

Here we update the code to match the main specifications, and update
the citations use the main specification rather than the extension
specification.

v2:
 * Updates based on review from Iago

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoanv: Report 0 physical devices when not on Broadwell or Ivy Bridge
Jason Ekstrand [Mon, 2 Nov 2015 20:14:37 +0000 (12:14 -0800)]
anv: Report 0 physical devices when not on Broadwell or Ivy Bridge

Right now, Broadweel and Ivy Bridge are the only supported platforms.
Hopefully, this reduces the chances that someone will try the driver on
unsupported hardware and be confused that it doesn't work.

8 years agoi965/fs: Clean up FBH code.
Matt Turner [Mon, 26 Oct 2015 18:35:57 +0000 (11:35 -0700)]
i965/fs: Clean up FBH code.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/vec4: Clean up FBH code.
Matt Turner [Mon, 26 Oct 2015 18:35:57 +0000 (11:35 -0700)]
i965/vec4: Clean up FBH code.

It did a bunch of unnecessary stuff, emitting an extra MOV included.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Replace default case with list of enum values.
Matt Turner [Mon, 26 Oct 2015 13:58:56 +0000 (06:58 -0700)]
i965: Replace default case with list of enum values.

If we add a new file type, we'd like to get warnings if it's not
handled.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/vec4: Don't disable channels in any/all comparisons.
Matt Turner [Mon, 26 Oct 2015 03:49:08 +0000 (20:49 -0700)]
i965/vec4: Don't disable channels in any/all comparisons.

We've made a mistake in calling the Channel Enable bits "writemask",
because they do more than control which channels of the destination are
written -- they actually control which channels are enabled (surprise!
surprise!)

So, if we emit

               cmp.z.f0(8) null.xy<1>D  g10<4,4,1>.xyzzD g2<0,4,1>.xyzzD
               mov(8)      g12<1>.xUD   0x00000000UD
   (+f0.all4h) mov(8)      g12<1>.xUD   0xffffffffUD

where the CMP instruction has only .xy channel enables, it won't write
the .zw channels of the flag register, which are of course read by the
+f0.all4 predicate.

We need to always emit CMP instructions whose flag result might be read
by such a predicate with all channels enabled.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa: fix uniforms calculation in glGetProgramiv
Tapani Pälli [Fri, 30 Oct 2015 12:30:35 +0000 (14:30 +0200)]
mesa: fix uniforms calculation in glGetProgramiv

Since introduction of SSBO, UniformStorage contains not just uniforms
but also buffer variables, this needs to be taken in to account when
calculating active uniforms with GL_ACTIVE_UNIFORMS and
GL_ACTIVE_UNIFORM_MAX_LENGTH.

No Piglit regressions.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: fix program resource queries for atomic counter buffers
Tapani Pälli [Fri, 30 Oct 2015 10:02:51 +0000 (12:02 +0200)]
mesa: fix program resource queries for atomic counter buffers

gl_active_atomic_buffer contains index to UniformStorage, we need to
calculate resource index for that gl_uniform_storage.

Fixes following CTS tests:
   ES31-CTS.program_interface_query.atomic-counters
   ES31-CTS.program_interface_query.atomic-counters-one-buffer

No Piglit regressions.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoglsl: join calculate_array_size() and calculate_array_stride()
Juha-Pekka Heikkila [Wed, 21 Oct 2015 09:09:21 +0000 (12:09 +0300)]
glsl: join calculate_array_size() and calculate_array_stride()

These helpers are ran for same case the same loop. Here joined
their operation so the loop is ran just once. Also fixed
out-of-memory condition here.

v2: Make the loop simpler to read as per Tapani's suggestion

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
8 years agomesa: expose support for OES/EXT_draw_elements_base_vertex to OpenGL ES
Ryan Houdek [Mon, 2 Nov 2015 03:25:27 +0000 (21:25 -0600)]
mesa: expose support for OES/EXT_draw_elements_base_vertex to OpenGL ES

This has been tested with the piglits in the mailing list and
on the Dolphin emulator.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonouveau: set MaxDrawBuffers to the same value as MaxColorAttachments
Ilia Mirkin [Mon, 2 Nov 2015 01:13:13 +0000 (20:13 -0500)]
nouveau: set MaxDrawBuffers to the same value as MaxColorAttachments

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
8 years agonv50: use correct heaps for FP and GP code segments
Samuel Pitoiset [Sun, 1 Nov 2015 22:28:02 +0000 (23:28 +0100)]
nv50: use correct heaps for FP and GP code segments

This is just a cosmetic change. Trivial.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agomesa/sso: Add compute shader support
Jordan Justen [Sat, 17 Oct 2015 04:19:45 +0000 (21:19 -0700)]
mesa/sso: Add compute shader support

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
[itoral@igalia.com: Reviewed-by for all except the ctx->_Shader change]
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agomesa/sso: Add MESA_VERBOSE=api trace support
Jordan Justen [Sat, 17 Oct 2015 04:14:10 +0000 (21:14 -0700)]
mesa/sso: Add MESA_VERBOSE=api trace support

v2:
 * Use %u for unsigned values (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Setup pull constant state for compute programs
Jordan Justen [Thu, 15 Oct 2015 17:27:00 +0000 (10:27 -0700)]
i965: Setup pull constant state for compute programs

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agomain/get: Add MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS
Jordan Justen [Wed, 14 Oct 2015 00:19:54 +0000 (17:19 -0700)]
main/get: Add MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoglsl: OpenGLES GLSL 3.1 precision qualifiers ordering rules
Jordan Justen [Thu, 15 Oct 2015 21:47:34 +0000 (14:47 -0700)]
glsl: OpenGLES GLSL 3.1 precision qualifiers ordering rules

The OpenGLES GLSL 3.1 specification uses the precision qualifier
ordering rules from ARB_shading_language_420pack.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoglsl: Add compute shader builtin variables for OpenGLES 3.1
Jordan Justen [Wed, 14 Oct 2015 00:18:52 +0000 (17:18 -0700)]
glsl: Add compute shader builtin variables for OpenGLES 3.1

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agonouveau: get rid of tabs
Ilia Mirkin [Sat, 31 Oct 2015 23:54:38 +0000 (19:54 -0400)]
nouveau: get rid of tabs

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965/sched: don't calculate live intervals for post-RA scheduling
Connor Abbott [Fri, 30 Oct 2015 22:19:34 +0000 (18:19 -0400)]
i965/sched: don't calculate live intervals for post-RA scheduling

For some reason, this causes assertions on gm965 only. In any case, it's
unnecessary since we don't need liveness information in the post-RA
scheduler.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92744
Cc: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agovirgl/vtest: fix extra malloc
Dave Airlie [Sat, 31 Oct 2015 08:04:26 +0000 (18:04 +1000)]
virgl/vtest: fix extra malloc

This somehow got added twice, drop the first one.

Reported by Coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agovirgl: free sampler view on failure path
Dave Airlie [Sat, 31 Oct 2015 06:07:52 +0000 (16:07 +1000)]
virgl: free sampler view on failure path

Reported by Coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agogallium/swrast: fixup build breakage and warnings
Dave Airlie [Sat, 31 Oct 2015 06:11:29 +0000 (16:11 +1000)]
gallium/swrast: fixup build breakage and warnings

The front buffer rendering changes broke an interface, I didn't
fix up all of them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agogallium/swrast: fix front buffer blitting. (v2)
Dave Airlie [Fri, 9 Oct 2015 00:38:08 +0000 (01:38 +0100)]
gallium/swrast: fix front buffer blitting. (v2)

So I've known this was broken before, cogl has a workaround
for it from what I know, but with the gallium based swrast
drivers BlitFramebuffer from back to front or vice-versa
was pretty broken.

The legacy swrast driver tracks when a front buffer is used
and does the get/put images when it is mapped/unmapped,
so this patch attempts to add the same functionality to the
gallium drivers.

It creates a new context interface to denote when a front
buffer is being created, and passes a private pointer to it,
this pointer is then used to decide on map/unmap if the
contents should be updated from the real frontbuffer using
get/put image.

This is primarily to make gtk's gl code work, the only
thing I've tested so far is the glarea test from
https://github.com/ebassi/glarea-example.git

v2: bump extension version,
check extension version before calling get image. (Ian)

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

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: set image access qualifiers for AoA
Timothy Arceri [Thu, 15 Oct 2015 23:28:45 +0000 (10:28 +1100)]
glsl: set image access qualifiers for AoA

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Do legacy userclipping in OpenGL ES 1.x contexts.
Ian Romanick [Tue, 27 Oct 2015 21:50:14 +0000 (14:50 -0700)]
i965: Do legacy userclipping in OpenGL ES 1.x contexts.

Commit fba4823a disabled user clipping for everything except
compatibility profile.  Core profile and OpenGL ES 2.0+ have all removed
the classic, OpenGL 1.0 user clip planes.  ES 1.x, however, still has
them.

Fixes OpenGL ES 1.1 conformance mustpass.c and userclip.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Olivier Berthier <olivierx.berthier@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92639
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92641

8 years agogbm.h: Add a missing stddef.h include for size_t.
Emmanuel Gil Peyrot [Thu, 29 Oct 2015 15:22:19 +0000 (15:22 +0000)]
gbm.h: Add a missing stddef.h include for size_t.

This was causing compilation issues when one of its providers wasn’t
already included before gbm.h.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agowinsys/virgl: rework line wrapping/indent
Emil Velikov [Wed, 28 Oct 2015 09:54:15 +0000 (09:54 +0000)]
winsys/virgl: rework line wrapping/indent

Wrap some of the 'omg it's getting out of hand' long lines, and
re-indent where things feel off.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>