summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_private.h
Commit message (Collapse)AuthorAgeFilesLines
* anv/image: Rename hiz_surface to aux_surfaceJason Ekstrand2016-12-141-4/+5
| | | | (cherry picked from commit c3eb58664e5e537b21a75172916b42bd4b5504b3)
* anv: Add missing error-checking to anv_block_pool_init (v2)Gwan-gyeong Mun2016-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | When the memfd_create() and u_vector_init() fail on anv_block_pool_init(), this patch makes to return VK_ERROR_INITIALIZATION_FAILED. All of initialization success on anv_block_pool_init(), it makes to return VK_SUCCESS. CID 1394319 v2: Fixes from Emil's review: a) Add the return type for propagating the return value to caller. b) Changed anv_block_pool_init() to return VK_ERROR_INITIALIZATION_FAILED on failure of initialization. Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit ecc618b0d88e462270ffedf01502ede4c60fdad9)
* anv: Rework fencesJason Ekstrand2016-11-231-1/+14
| | | | | | | | | | | | | | | | Our previous fence implementation was very simple. Fences had two states: signaled and unsignaled. However, this didn't properly handle all of the edge-cases that we need to handle. In order to handle the case where the client calls vkGetFenceStatus on a fence that has not yet been submitted via vkQueueSubmit, we need a three-status system. In order to handle the case where the client calls vkWaitForFences on fences which have not yet been submitted, we need more complex logic and a condition variable. It's rather annoying but, so long as the client doesn't do that, we should still hit the fast path and use i915_gem_wait to do all our waiting. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 843775bab78a6b4d5cb4f02bd95d9d0e95c1c5e3)
* anv: Move relocation handling from EndCommandBuffer to QueueSubmitJason Ekstrand2016-11-091-13/+0
| | | | | | | | | | | | | | | | | | | | Ever since the early days of the Vulkan driver, we've been setting up the lists of relocations at EndCommandBuffer time. The idea behind this was to move some of the CPU load out of QueueSubmit which the client is required to lock around and into command buffer building which could be done in parallel. Then QueueSubmit basically just becomes a bunch of execbuf2 calls. Technically, this works. However, when you start to do more in QueueSubmit than just execbuf2, you start to run into problems. In particular, if a block pool is resized between EndCommandBuffer and QueueSubmit, the list of anv_bo's and the execbuf2 object list can get out of sync. This can cause problems if, for instance, you wanted to do relocations in userspace. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 8b61c57049ff75766715ad4f7b1ad2d3657b9b4d)
* anv/batch: Move last_ss_pool_bo_offset to the command bufferJason Ekstrand2016-11-091-3/+3
| | | | | | | | | | | | | | | | The original reason for putting it in the batch_bo was to allow primaries to share it across secondaries or something like that. However, the relocation lists in secondary command buffers are are always left alone and copied into the primary command buffer's relocation list. This means that the offset really applies at the command buffer level and putting it in the batch_bo doesn't make sense. This fixes a couple of potential bugs around re-submission of command buffers that are not likely to be hit but are bugs none the less. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 595400d57745fba198b42d95f3c4f5d855023c33)
* anv: Add an anv_execbuf helper structJason Ekstrand2016-11-091-14/+12
| | | | | | | | | | | | This commit adds a little helper struct for storing everything we use to build an execbuf2 call. Since the add_bo function really has nothing to do with a command buffer, it makes sense to break it out a bit. This also reduces some of the churn in the next commit. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 0fe68294275a4ab1d9f71bb48d21a5e6b830e1ca)
* anv: Initialize anv_bo::offset to -1Jason Ekstrand2016-11-091-1/+1
| | | | | | | | | | | Since -1 is an invalid GPU address, this lets us know whether or not we have a valid address for a buffer. We don't get a valid address until the first time that buffer is used in an execbuf2 ioctl. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit d46bfb629725a5b8c327f3bd7f76d04f5ae262aa)
* anv/allocator: Simplify anv_scratch_poolJason Ekstrand2016-11-091-1/+6
| | | | | | | | | | | | | | | The previous implementation was being overly clever and using the anv_bo::size field as its mutex. Scratch pool allocations don't happen often, will happen at most a fixed number of times, and never happen in the critical path (they only happen in shader compilation). We can make this much simpler by just using the device mutex. This also means that we can start using anv_bo_init_new directly on the bo and avoid setting fields one-at-a-time. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit bd0f8d50706fce400ff0768c659acc90696aadb6)
* anv: Add a new bo_pool_init helperJason Ekstrand2016-11-091-0/+11
| | | | | | | | | This ensures that we're always setting all of the fields in anv_bo Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 6283b6d56a2bb731cfcb4c876566901075f9bd34)
* anv: Don't presume to know what address is in a surface relocationJason Ekstrand2016-11-091-2/+0
| | | | | | | | | | | | | Because our relocation processing happens at EndCommandBuffer time and because RENDER_SURFACE_STATE objects may be shared by batches, we really have no clue whatsoever what address is actually written to the relocation offset in the BO. We need to stop making such claims to the kernel and just let it relocate for us. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit ba1eea4f957ca068eceea121bc3a70e2fe07873d)
* anv: Add a cmd_buffer_execbuf helperJason Ekstrand2016-11-091-0/+2
| | | | | | | | | | This puts the actual execbuf2 call in anv_batch_chain.c along with the other relocation stuff. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit db9f4b2a2bbf1aff3c6c878735495fc7accbb11e)
* anv/device: Add an execbuf wrapperJason Ekstrand2016-11-091-0/+4
| | | | | | | | | | This wrapper ensures that we always update all anv_bo::offset fields based on the offsets returned by the kernel. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 07798c9c3ed29fd162ebc6b6d6beb8448218487f)
* anv/pipeline: Properly cache prog_data::paramJason Ekstrand2016-11-091-2/+2
| | | | | | | | | | | | Before we were caching the prog data but we weren't doing anything with brw_stage_prog_data::param so anything with push constants wasn't getting cached properly. This commit fixes that. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98012 Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 71cc1e188d52bebe86a1ac72fe90f4e2a7e76778)
* anv/pipeline: Put actual pointers in anv_shader_binJason Ekstrand2016-11-091-13/+15
| | | | | | | | | | | | | | | | While we can simply calculate offsets to get to things such as the prog_data and the key, it's much more user-friendly if there are just pointers. Also, it's a bit more fool-proof. While we're at it, we rework the pipeline cache API to use the brw_stage_prog_data type directly. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98012 Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit ff3185e3ba85b3635a1f645e8e951954f4022afe)
* anv/wsi: remove all anv references from WSI common codeDave Airlie2016-10-191-1/+1
| | | | | | the WSI code should be now be clean for sharing. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: move common wsi code to x11/wayland common files.Dave Airlie2016-10-191-4/+2
| | | | | | | Next task is to rename all the anv_ out of this, and move to a common location Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* anv/wsi: abstract wsi interfaces away from device a bit more.Dave Airlie2016-10-191-1/+5
| | | | | | This is a step towards separating out the wsi code for sharing Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: drop pointless struct decl.Dave Airlie2016-10-191-2/+0
| | | | | Acked-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* anv: move to using vk_alloc helpers.Dave Airlie2016-10-191-45/+1
| | | | | | | This moves all the alloc/free in anv to the generic helpers. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* anv: drop local MIN/MAX macros.Dave Airlie2016-10-191-4/+1
| | | | | | | Use the ones from mesa, most places already did. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* anv: port to using new u_vector shared helper.Dave Airlie2016-10-191-48/+4
| | | | | | | This just removes the anv vector code and uses the new helper. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* anv: Get rid of anv_cmd_buffer_emit_state_base_addressJason Ekstrand2016-10-171-2/+0
| | | | | | | | All code that would have once called this can now call the gen-specific version. The switching version is no longer needed. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* anv/cmd_buffer: Move descriptor flushing into genX_cmd_buffer.cJason Ekstrand2016-10-171-6/+0
| | | | | | | | It really should have gone here all along. We were trying a bit too hard to make it gen-agnostic just because it didn't have any #if's. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* anv/cmd_buffer: Expose ensure_push_constant_*Jason Ekstrand2016-10-171-0/+8
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* anv/cmd_buffer: Move Begin/End/Execute to genX_cmd_buffer.cJason Ekstrand2016-10-171-0/+2
| | | | | | | | | vkBeginCommandBuffer and vkCmdExecuteCommands both call into the gen-specific emit_state_base_address function and vkEndCommandBuffer belongs with begin. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* anv/image: Create views directly in VkCreate*ViewJason Ekstrand2016-10-141-10/+0
| | | | | | | Without meta, we no longer need the _init helpers and the ability to back an image view with surface states allocated out of the command buffer. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv/image: Get rid of the usage hacks for metaJason Ekstrand2016-10-141-2/+1
| | | | | | | | Now that meta is gone and we're using blorp, we don't need all of the usage hacks. Instead, the usage provided by the app is exactly the usage that we want because the app is the only thing creating image views. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: Move Create*Pipelines into genX_cmd_buffer.cJason Ekstrand2016-10-141-7/+0
| | | | | | | | Now that we don't have meta, we have no need for a gen-agnostic pipeline create path. We can, instead, just generate one Create*Pipelines function per gen and be done with it. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv/pipeline: Remove support for direct-from-nir shadersJason Ekstrand2016-10-141-4/+0
| | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: Make entrypoint resolution take a gen_device_infoJason Ekstrand2016-10-141-1/+2
| | | | | | | | | | | | In order for things such as the ANV_CALL and the ifuncs to work, we used to have a singleton gen_device_info structure that got assigned the first time you create a device. Given that the driver will never be used simultaneously on two different generations of hardware, this was fairly safe to do. However, it has caused a few hickups and isn't, in general, a good plan. Now that the two primary reasons for this singleton are gone, we can get rid of it and make things quite a bit safer. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: Get rid of the ANV_CALL macroJason Ekstrand2016-10-141-10/+0
| | | | | | | | This macro was needed by meta in order to make gen-specific calls from gen-agnostic code. Now that we don't have meta, the remaining two uses are fairly trivial to get rid of. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: Get rid of graphics_pipeline_create_info_extraJason Ekstrand2016-10-141-15/+0
| | | | | | | | | Now that we no longer have meta, all pipelines get created via the normal Vulkan pipeline creation mechanics. There is no more need for this bit of extra magic data that we've been passing around. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* anv: Get rid of metaJason Ekstrand2016-10-141-70/+0
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* anv/image: Add an isl_view to anv_image_viewJason Ekstrand2016-10-141-2/+2
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* anv: use correct header guardsEmil Velikov2016-10-141-1/+4
| | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Chad Versace <chadversary@chromium.org>
* anv: Add func anv_image_has_hiz()Chad Versace2016-10-071-0/+10
| | | | | Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* anv: Add anv_image::hiz_surfaceChad Versace2016-10-071-0/+2
| | | | | | | Unused. Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* anv/cmd_buffer: Don't call set_subpass in a secondaryJason Ekstrand2016-10-061-3/+0
| | | | | | | | | | | | | Initially, we had intended set_subpass to be an interesting function that did whatever (presumably a lot) setup we needed for a subpass. In reality, it just sets a pointer and a dirty bit and then emits depth and stencil state. When we call BeginCommandBuffer on a secondary, there's no point in setting depth and stencil state since it will already be set by the primary. Instead, the only thing we need to do at the start of a secondary is set the subpass pointer and the dirty bit. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
* anv: get rid of duplicated values from gen_device_infoLionel Landwerlin2016-09-231-11/+0
| | | | | Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* intel/i965: make gen_device_info mutableLionel Landwerlin2016-09-231-1/+1
| | | | | | | | | | | | Make gen_device_info a mutable structure so we can update the fields that can be refined by querying the kernel (like subslices and EU numbers). This patch does not make any functional change, it just makes gen_get_device_info() fill a structure rather than returning a const pointer. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* anv: device: calculate compute thread numbers using subslices numbersLionel Landwerlin2016-09-211-0/+14
| | | | | Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* anv: Make image_get_surface_for_aspect_mask constJason Ekstrand2016-09-131-2/+2
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* anv: Add initial blorp supportJason Ekstrand2016-09-131-0/+6
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* intel/anv: Use #defines for all __gen_ helpersJason Ekstrand2016-09-131-5/+6
| | | | | | | This allows us to #undef them later if we don't want them to persist Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* anv/pipeline: Roll compute_urb_partition into emit_urb_setupJason Ekstrand2016-09-131-6/+0
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* intel/isl: Add an isl_swizzle structure and use it for isl_view swizzlesJason Ekstrand2016-09-121-8/+1
| | | | | | | | | This should be more compact than the enum isl_channel_select[4] that we were using before. It's also very convenient because we already had such a structure in the Vulkan driver we just needed to pull it over. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* anv: Refactor pipeline l3 config setupJason Ekstrand2016-09-031-1/+1
| | | | | | | | | Now that we're using gen_l3_config.c, we no longer have one set of l3 config functions per gen and we can simplify a bit. Also, we know that only compute uses SLM so we don't need to look for it in all of the stages. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* anv: Leverage the shared L3$ config codeJason Ekstrand2016-09-031-3/+3
| | | | | | | | | When Jordan first implement L3$ configuration for Vulkan, he copied+pasted from the GL driver because we had no good place to share it. Now that we have src/intel/common, we should be sharing these tables. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* intel: s/brw_device_info/gen_device_info/Jason Ekstrand2016-09-031-5/+5
| | | | | | | | | | | | | Generated by: sed -i -e 's/brw_device_info/gen_device_info/g' src/intel/**/*.c sed -i -e 's/brw_device_info/gen_device_info/g' src/intel/**/*.h sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.c sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.cpp sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.h Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* intel: Add a new "common" library for more code sharingJason Ekstrand2016-09-031-1/+1
| | | | | | | The first thing to go in this new library is brw_device_info. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>