1. 19 Oct, 2019 4 commits
    • Niklas Haas's avatar
      (WIP) utils/libav: add helpers for mangling av pixfmt into libplacebo · 3830eba3
      Niklas Haas authored
      These structs are designed in not-quite-compatible ways, and the mapping
      is not at all intuitive or obvious.
      
      TODO:
      - more testing, make sure it actually does the right thing
      - more helper functions (cf. colorspace conversions etc.)
      - pin down minimum version requirement?
      - figure out how to handle yuv420p10 etc. properly
      3830eba3
    • Niklas Haas's avatar
      README: make wording less offensive · f9e58750
      Niklas Haas authored
      f9e58750
    • Niklas Haas's avatar
      gpu: slightly clarify pl_buf_poll's interaciton with _write/_read · a91def9e
      Niklas Haas authored
      These are not considered libplacebo-internal buffer operations and
      therefore are not guaranteed to be explcitily synchronized (even though,
      in practice, they are synchronized in cases where the buffer is not host
      mapped).
      a91def9e
    • Niklas Haas's avatar
      gpu: turn undefined behavior into explicit errors · e2c2f427
      Niklas Haas authored
      Wherever possible/appropriate. Bumped the API version for this because
      it is quite a significant change in semantics. At last, API users are
      freed from the responsibility of needing to duplicate every check under
      the sun...
      
      Annoyingly, some functions return `void`, so there's not much we can do
      except print an error and hope the user notices it before it's too late.
      Maybe we should introduce some sort of internal `error bit` allowing the
      user to later check for presence of an error?
      e2c2f427
  2. 07 Oct, 2019 5 commits
  3. 26 Sep, 2019 2 commits
    • Niklas Haas's avatar
      vulkan: make debug layer loading more robust · 1b96a0fd
      Niklas Haas authored
      1. Try VK_LAYER_KHRONOS_validation before VK_LAYER_LUNARG_standard_validation
      2. Fail gracefully if neither are supported
      
      It would also be nice if we could fail more gracefully if the debug
      report extension is not supported, but that's a problem for another
      commit.
      1b96a0fd
    • Niklas Haas's avatar
      vulkan: add additional extensions/layers diagnostics · 341d2491
      Niklas Haas authored
      It's useful to have these in the logs for debugging, since I can't
      always ask users to run `vulkaninfo` on their devices.
      341d2491
  4. 22 Sep, 2019 7 commits
    • Niklas Haas's avatar
      ci: update to eoan · 16075a26
      Niklas Haas authored
      This makes the GPU CI stuff actually work. Finally, coverage \o/
      16075a26
    • Niklas Haas's avatar
      vulkan: brute force hack around (suspected) ANV bugs · f8f90f5d
      Niklas Haas authored
      ANV seems to deadlock on our compute shaders. Pending investigation. For
      now, this makes it work on intel iGPUs, even though it's an ugly hack.
      f8f90f5d
    • Niklas Haas's avatar
      vulkan: make storage buffers robust against compute nonexistance · ffa511e0
      Niklas Haas authored
      Even though vulkan technically requires the compute queue be a thing, we
      might disable it internally for debugging purposes. So we want our code
      to be robust against this queue simply not existing.
      ffa511e0
    • Niklas Haas's avatar
      meson: fix C++ -Werror flags · 20b25109
      Niklas Haas authored
      Some of those are invalid for C++, so restrict them to C.
      20b25109
    • Niklas Haas's avatar
      swapchain: satisfy switch coverage check · 9621e7dd
      Niklas Haas authored
      By adding support for VK_AMD_display_native_hdr, even though we can't
      really do much with it at the moment since we don't know *which* color
      space it is.
      9621e7dd
    • Niklas Haas's avatar
      ci: add gpu-based tests · 48e0c1ca
      Niklas Haas authored
      All hail the cloud overlords and their VMs with GPUs
      48e0c1ca
    • Niklas Haas's avatar
      meson: make spirv-tools optional · fd9e5cdb
      Niklas Haas authored
      This fixes the CI/licensing issues introduced by 68375667 without
      regressing #67. We will now link against SPIRV-Tools where we can, and
      won't otherwise. Apparently glslang can sometimes depend on SPIRV-Tools
      and sometimes not...
      
      A better solution for this might still be needed to avoid licensing
      issues. But for now, I don't particularly care, especially since we
      don't actually use any code from SPIRV-Tools so in theory the license
      shouldn't matter.
      fd9e5cdb
  5. 15 Sep, 2019 2 commits
  6. 14 Sep, 2019 3 commits
    • Niklas Haas's avatar
      renderer: automatically adjust deband grain scale · 3499cd61
      Niklas Haas authored
      This fixes blowing up with excessive grain on e.g. HDR sources. I
      decided not to change the signature of the deband shader itself at this
      time, since the deband shader doesn't really know anything about the
      meaning / interpretation of what it's debanding. This is the user's
      responsibility when using the shader directly.
      
      Fixes #59.
      3499cd61
    • Niklas Haas's avatar
      vulkan: permit non-coherent memory · 22d8002d
      Niklas Haas authored
      Since we control to a very fine degree when and where memory flushing
      and invalidation happens anyway, there's no reason for us to require
      coherent memory.
      
      This is a very slight performance gain on my tested platforms, but more
      importantly, this allows libplacebo to work on platforms which only have
      noncoherent memory (such as some iGPUs).
      22d8002d
    • Niklas Haas's avatar
      meson: add missing glslang dependencies · 68375667
      Niklas Haas authored
      In some configurations (perhaps related to linker settings), glslang
      seems to depend on SPIRV-Tools, and failing to explicitly load this
      dependency causes link issues.
      
      Fix this by simply adding the dependencies to the dependency list.
      (Seriously, can glslang get a .pc file already?)
      
      Fixes #67
      68375667
  7. 02 Jun, 2019 1 commit
    • Niklas Haas's avatar
      config: replace PL_FIX_VER/PL_VERSION by runtime functions · 22a99191
      Niklas Haas authored
      Since the fix version is not part of the ABI, we can't use a header
      define for it. (And indeed, users can't use this information as part of
      any preprocessor check - nor should they need to)
      
      I won't bother bumping the API version for this change because it's
      unlikely to result in any breakage.
      22a99191
  8. 31 May, 2019 1 commit
    • Philip Langdale's avatar
      vulkan: Suppress validation errors when binding imported image memory · dc1059b2
      Philip Langdale authored
      Importing image memory is a funny thing; there's no core mechanism
      to communicate the layout of the image. Depending on how exactly
      the memory was imported, and where it was imported from, it might
      be possible to manage without explicit knowledge of layout, or
      out-of-band mechanisms might exist to communicate it.
      
      Today, we specifically can handle importing of memory via dma_buf
      fds. While there is a Vulakn extension defined that could help
      to communicate layout (VK_EXT_image_drm_format_modifier), this
      extension isn't actually implemented in any driver and it doesn't
      look like it will happen any time soon.
      
      Without it, we have to hope that imported memory has the same layout
      that Vulkan expects, based on the declared image format. In
      practice, this has proven to be true for the real world scenario
      we care about - which is importing decoded video from VAAPI - there
      are only a couple of relevant formats, and the drivers for both
      Vulkan and VAAPI are written by the same sets of people following
      the same hardware driven recommendations for layout.
      
      However, just because layouts match in practice, doesn't mean that
      they pass validation. What we see is that, for some formats,
      validation will fail when binding memory, saying that the memory
      segment is smaller than the vulkan-calcuated memory size. I assume
      this happens due to a difference in memory alignment (pretty much
      any other cause would lead to visible errors).
      
      As we would like to be able to use VAAPI imported surfaces without
      sacrificing validation, we need a way to filter out these expected
      errors, and let validation proceed as normal elsewhere.
      
      The mechanism we've decided on is to provide a way to ignore
      errors on a specified vulkan object (in our specific case, the
      VkImage). We store the object ID before the bind call, and clear
      it afterwards. While it is set, errors on that object will be
      suppressed.
      
      It's a simple mechanism that isn't thread safe, but could be made
      so if/when the need arises.
      dc1059b2
  9. 26 May, 2019 1 commit
    • Niklas Haas's avatar
      vulkan: change infinite loop polls to block indefinitely · 644f9d57
      Niklas Haas authored
      I forgot what the original justification was for using short timeouts
      here (perhaps some driver bug?) but in any case, it doesn't seem to make
      any sense anymore.
      
      This reduces CPU usage drastically on some drivers. I kept one loop at
      10 ms since it shouldn't be hit anyways, and this way we know it's stuck
      in that loop for absurd amounts of time.
      644f9d57
  10. 24 May, 2019 3 commits
  11. 15 May, 2019 1 commit
  12. 25 Apr, 2019 1 commit
  13. 15 Apr, 2019 1 commit
    • Philip Langdale's avatar
      xtalloc: Re-prefix all ta_* symbols to xta_* · 12aab84a
      Philip Langdale authored
      xtalloc was copied from mpv, which means that we see symbol
      collisions if libplacebo is statically linked into mpv. So
      use an `xta_` prefix for all the functions. In practice, this
      has almost no effect on the consuming code because everything
      is accessed via macros.
      12aab84a
  14. 14 Apr, 2019 1 commit
    • Philip Langdale's avatar
      spirv: Prefix spirv compiler function struct names · 4912e344
      Philip Langdale authored
      These structs are included via extern declarations, so they can
      silently conflict with equivalently named declarations in an
      application if libplacebo is included statically.
      
      And this happens with mpv, which also declares a `spirv_shaderc`
      struct.
      
      So, prefix the struct names with `pl_` to avoid this.
      4912e344
  15. 01 Apr, 2019 2 commits
  16. 18 Mar, 2019 1 commit
    • Niklas Haas's avatar
      vulkan: fix overzealous misalignment check on texture transfers · e16dd395
      Niklas Haas authored
      These made it so that the async transfer queue was never actually used.
      This is obviously a massive performance regression on all drivers
      supporting asynchronous transfer (e.g. AMDVLK).
      
      The spec explicitly allows the case where the transfer spans the entire
      image, i.e. offset+extent = size.
      e16dd395
  17. 07 Mar, 2019 1 commit
    • Niklas Haas's avatar
      shaders/av1: release under MIT · 2ee4b041
      Niklas Haas authored
      dav1d people want this to be permissive so they can adapt it for
      documentation purposes. I have no problems releasing this specific file
      under a permissive license.
      
      Note that since both the header and source code heavily depend on the
      LGPLv2.1+ parts of libplacebo, this licensing change isn't terribly
      useful unless you're just interested in copying fragments of the glsl
      code or some of the C helper functions.
      2ee4b041
  18. 24 Feb, 2019 3 commits
    • Niklas Haas's avatar
      vulkan: fix external memory vs external semaphore type confusion · cd7d4be8
      Niklas Haas authored
      These are different enums, with different legal members. Not only does
      this avoid a warning, it also avoids future disaster by conflating the
      two.
      cd7d4be8
    • Niklas Haas's avatar
      shaders: compat for GLSL < 130 · bd502804
      Niklas Haas authored
      We need to use the explicitly named functions like texture2D(),
      texture3D() etc. for low GLSL versions. Add a bunch of shitty
      compatibility code to template out the function name.
      
      The specific way I solved it also opens us up to allowing e.g. rectangle
      textures in the future.
      bd502804
    • Niklas Haas's avatar
      shaders: cosmetic (code moving) · 02a2f7bd
      Niklas Haas authored
      Make this a function instead of a static inline, since it's complicated
      enough.
      02a2f7bd