[Mesa-dev] [PATCH 00/13] anv: Implement VK_MESAX_image_dma_buf

Chad Versace chadversary at chromium.org
Mon Mar 6 20:40:09 UTC 2017


Patches 1-5 are prep patches, ready for upstreaming.
Patches 6-13 are RFC implementation patches, not ready yet for upstreaming.


Overview
========
I've been working on a Vulkan extension for importing/exporting
dma_bufs, named VK_MESAX_external_image_dma_buf. It's similar to
EGL_EXT_image_dma_buf_import_modiiers. But the Vulkan extension is more
complex than the EGL one, because everything in Vulkan is painful like
that. 

Actually, there are three extensions, all related:
    - VK_EXT_get_image_properties
    - VK_MESAX_external_memory_dma_buf
    - VK_MESAX_external_image_dma_buf

The MESAX extensions are layered atop VK_KHX_external_memory_fd anv
VK_EXT_get_image_properties. The EXT extension has no dependencies.

I have a working vkcube demo. See the "Testing" section below.

This Mesa patch series lives at:

    git://git.kiwitree.net/~chadv/mesa
    refs/tags/chadv/review/anv-external-dma-buf-v01
    GitWeb: http://git.kiwitree.net/cgit/~chadv/mesa/log/?h=refs/tags/chadv/review/anv-external-dma-buf-v01


How to Read the Extension Specs
===============================
The Vulkan spec used by this patch series:

  Live HTML: https://chadversary.github.io/vulkan-spec/tags/chadv/test/2017-03-06-VK_MESAX_external
  Source: https://github.com/chadversary/vulkan-spec/commits/chadv/test/2017-03-06-VK_MESAX_external

My up-to-date, work-in-progress Vulkan spec branch:

  Live HTML: https://chadversary.github.io/vulkan-spec/branches/wip/1.0-VK_MESAX_external/index.html
  Source: https://github.com/chadversary/vulkan-spec/commits/wip/1.0-VK_MESAX_external


Status of Extension Specs
=========================
There are still some ongoing discussions, internal to Khronos, about
these extensions. This mesa-dev email begins the *public* part of that
discussion.

All the specs are still drafts. Some drafts are more complete than
others. Khronos has not yet merged the drafts them into the official
Vulkan spec repo.

- VK_EXT_get_image_properties

  This draft is nearly complete. What remains is:
    - Need review to begin at Khronos.
    - Need to reserve an extension number.

- VK_MESAX_external_memory_dma_buf

  This draft is nearly complete. What remains is:
    - Need review feedback on mesa-dev.
    - Need to wrap up the Khronos-internal review.

    
- VK_MESAX_external_image_dma_buf

  This draft is the least complete. What remains is:
    - Need more review feedback.
    - Need to finalize the structure names.
    - I haven't yet wrote the extension's main text.

  Until I write the extension's main text, the only way to fully
  understand this one is to look at vulkan.h and this Mesa patch series.



Prerequisite Patches
====================
If all you want is to review are the big ideas, you don't need to read
the prerequisite patch series below.  I believe this patch series is
understandable as a stand-alone series.

The original patch series was too long. To make the patch review less
burdensome, and to get the prep patches upstream ASAP, I partiioned the
original series into several independent patch series.

  Subject: isl: Fix requests for exact row pitch
  Patchwork: https://patchwork.freedesktop.org/series/20778/
  Archived-At: https://lists.freedesktop.org/archives/mesa-dev/2017-March/146794.html
  GitWeb: http://git.kiwitree.net/cgit/~chadv/mesa/log/?h=refs/tags/chadv/review/isl-request-exact-row-pitch-v01

  Subject: anv: Some image refactors and a hiz fix
  Patchwork: https://patchwork.freedesktop.org/series/20779/
  Archived-At: https://lists.freedesktop.org/archives/mesa-dev/2017-March/146802.html
  GitWeb: http://git.kiwitree.net/cgit/~chadv/mesa/log/?h=refs/tags/chadv/review/anv-image-refactors-v01

  Subject: anv: Add an anv_outarray_append() macro
  Patchwork: https://patchwork.freedesktop.org/series/20781/
  Archived-At: https://lists.freedesktop.org/archives/mesa-dev/2017-March/146810.html
  GitWeb: http://git.kiwitree.net/cgit/~chadv/mesa/log/?h=refs/tags/chadv/review/anv-outarray-v01

Also, you need mine and Jason's patches for VK_KHX_external_memory_fd.
I'm maintaining an up-to-date branch, with fixes, for those:

  GitWeb: http://git.kiwitree.net/cgit/~chadv/mesa/log/?h=wip/anv-external-memory


Testing
=======
I tested this series on Skylake by running the below vk-gl-cts tests.
That included some tests for OPAQUE_FD, but of course there are no
dma_buf tests yet.

    dEQP-VK.wsi.xlib.*
    dEQP-VK.api.info.*
    dEQP-VK.api.external.memory.*

I also tested with a hacked up vkcube at:

    git://git.kiwitree.net/~chadv/vkcube
    refs/tags/chadv/test/2017-03-06-VK_MESAX_external_image_dma_buf
    gitweb: http://git.kiwitree.net/cgit/~chadv/vkcube/log/?h=chadv/test/2017-03-06-VK_MESAX_external_image_dma_buf

I haven't ran this through Intel's Jenkins yet. Apologies to Mark Janes.


Diffstat
=========
Chad Versace (13):
  isl: Add func isl_tiling_from_drm_format_mod()
  isl: Add isl_surf_get_drm_format_mod()
  anv: Add func anv_get_raw_format()
  anv: Annotate anv_get_*format() as pure
  anv: Set anv_surface::offset earlier
  RFC: vulkan: Update registry for MESAX dma_buf extensions
  RFC: anv: Implement VK_EXT_get_image_properties
  RFC: anv: Implement VK_MESAX_external_memory_dma_buf
  RFC: anv: Implement VK_MESAX_external_image_dma_buf
  RFC: anv: Drop vkCreateDmaBufImageINTEL()
  RFC: anv/wsi: Use VK_MESAX_external_image_dma_buf
  RFC: anv: Drop unused anv_image_create()
  RFC: anv: Drop unneeded struct anv_image_create_info

 include/vulkan/vulkan.h                 | 104 ++++++++++++++++
 include/vulkan/vulkan_intel.h           |  62 ----------
 src/intel/isl/isl.c                     |  58 +++++++++
 src/intel/isl/isl.h                     |  18 +++
 src/intel/vulkan/Makefile.am            |   3 -
 src/intel/vulkan/Makefile.sources       |   1 -
 src/intel/vulkan/anv_device.c           |  32 +++--
 src/intel/vulkan/anv_entrypoints_gen.py |   3 +
 src/intel/vulkan/anv_formats.c          | 174 +++++++++++++++++++++++++-
 src/intel/vulkan/anv_image.c            | 213 +++++++++++++++++++++++++++-----
 src/intel/vulkan/anv_intel.c            |  99 ---------------
 src/intel/vulkan/anv_private.h          |  36 +++---
 src/intel/vulkan/anv_wsi.c              |  19 ++-
 src/vulkan/registry/vk.xml              | 106 +++++++++++++++-
 14 files changed, 689 insertions(+), 239 deletions(-)
 delete mode 100644 include/vulkan/vulkan_intel.h
 delete mode 100644 src/intel/vulkan/anv_intel.c

-- 
2.12.0


More information about the mesa-dev mailing list