Commit Graph
66 Commits
Author SHA1 Message Date
elwrclandClaude Opus 5 636d2c2f70 hasvk: Add host_image_copy, H.264 encode and a batch of gen7 fixes.
Squashed work that had been sitting in the working tree. Grouped by area:

Extensions
  VK_EXT_host_image_copy, with a MEMCPY_BIT path that reads and writes the
  image's own tiled layout, VkSubresourceHostMemcpySizeEXT filled in, and
  VkHostImageCopyDevicePerformanceQueryEXT answered.  Depth/stencil and
  non-power-of-two bpb stay NotSupported.
  VK_EXT_pipeline_robustness, VK_KHR_shader_float_controls2,
  VK_KHR_shader_subgroup_rotate, VK_EXT_vertex_input_dynamic_state,
  VK_EXT_conditional_rendering (an MI_PREDICATE path for gen7, which has no
  GPRs), custom_border_color, border_color_swizzle, map_memory2,
  load_store_op_none, depth_clamp_zero_one,
  dynamic_rendering_unused_attachments, index_type_uint8,
  line_rasterization, vertex_attribute_divisor, mutable_descriptor_type.

H.264 encode
  MFC command emission and a bitstream writer, driving intra-only encode
  through the video queue.  Video profile reporting was also corrected from
  270 combinations down to the 11 that actually exist.

Correctness
  gfx7 routes typed surface writes through the render cache, so
  VK_ACCESS_SHADER_WRITE barriers have to flush it -- without that, nothing a
  fragment shader stored was visible.
  nir_opt_algebraic's fadd->flrp fusion rules dropped signed zero; '~' only
  excludes nir_fp_exact, not preserve_signed_zero, so reflect() with a -0
  input came out wrong.  Guarded with (nsz).
  Stop advertising STORAGE_READ_WITHOUT_FORMAT: shaderStorageImageReadWithout-
  Format is false here, and since Vulkan 1.3 the per-format bit is what grants
  permission, so reporting it while rejecting the pipeline is a contradiction.
  gfx7's typed data port ignores SURFTYPE_NULL -- the null surface still has
  one addressable texel, which read and wrote graphics address zero.  Bounds
  check typed image access against the image param when nullDescriptor is
  enabled, the same trick lower_image_atomic_instr already used on IVB.
  Formats that require a sampler Y'CbCr conversion no longer report
  BLIT_SRC/BLIT_DST/STORAGE_IMAGE.  Video decode does not need them.
  Check the surface state allocations in emit_binding_table() and in the push
  descriptor path instead of writing through a NULL map in release builds.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-09 00:32:40 +03:00
elwrcl 0e4983ca15 Add a .gitignore for build trees and local scratch.
The tree has no .gitignore at all, so build/, .cache/clangd, __pycache__,
the CTS/vkoverhead/vkmark checkouts and assorted test media had all found
their way into the index.
2026-08-09 00:31:56 +03:00
dancingmirrors cd91e8f22f hasvk: Remove now unreachable layered clamping. 2026-07-21 22:25:28 +03:00
dancingmirrors 409568b8d4 hasvk: We can use ARYSPC_LOD0 for layered DPB. 2026-07-21 22:25:28 +03:00
dancingmirrors 49447ce96e hasvk: Expose HASVK_DEBUG=video-debug and clean it up. 2026-07-21 22:25:28 +03:00
dancingmirrors c9dcef66aa hasvk: Emit MFX_AVC_WEIGHTOFFSET_STATE for both list 0 and list 1.
Fixes Haswell corruption with https://files.lynne.ee/testsamples/bbc2.sample.h264.
This is the correct thing to do anyway and only worked on Ivy Bridge by accident.

Assisted-by: Claude
2026-07-21 22:25:27 +03:00
dancingmirrors 1d4d7c0650 hasvk: Haswell doesn't have the same DMV buffer as earlier generations. 2026-07-21 22:25:27 +03:00
dancingmirrors 564cead081 hasvk: Without a QPitch override gen7 can't reliably handle layered DPB.
Just accept corruption and avoid intermittent hangs when not tile aligned.
Breaks: dEQP-VK.video.decode.h264.interleaved_layered_dpb_video_layout

Assisted-by: Claude
2026-07-21 22:25:27 +03:00
dancingmirrors 4204b5ff5b hasvk: Initial layered DPB support and plenty of debug output.
Assisted-by: Claude
2026-07-21 22:25:27 +03:00
dancingmirrors 72177c94e1 hasvk: Fix the length in MFX_AVC_SLICE_STATE. 2026-07-21 22:25:26 +03:00
dancingmirrors 083ee5051c hasvk: Properly handle complementary field pairs.
The else branch here was also unreachable.
Fixes the poisoned first field in https://files.lynne.ee/testsamples/bbc2.sample.h264.

Assisted-by: Claude
2026-07-21 22:25:26 +03:00
dancingmirrors 22ce819de6 hasvk: Account for unsupported shaderStorageImageReadWithoutFormat.
When mpv creates the bwdif_vulkan filter we can sometimes see
exactly what's happening:
shaderStorageImageReadWithoutFormat support is false, but
shaderStorageImageWriteWithoutFormat support is true.
SPIR-V complains and then the GPU hangs since elk can't do the
necessary lowering. See here:
if (var->data.image.format == PIPE_FORMAT_NONE)
   return false;
To make deinterlacing work again the fix probably needs to be in
FFmpeg. See its commit 779763181f85bf25c53af5789d8b9b99d3bb0d1d.

Assisted-by: Claude
2026-07-21 22:25:26 +03:00
dancingmirrors cd1018d5ea hasvk: Advertise VK_KHR_internally_synchronized_queues.
Advertise the extension and feature and accept the internally synchronized
queue create flag. FFmpeg has deprecated its own queue locking mechanism.

Assisted-by: Claude
2026-07-21 22:25:26 +03:00
dancingmirrors 2e5cca4d05 hasvk: Properly handle interlaced video.
There was no handling here at all so the GPU would just hang immediately.

Assisted-by: Claude
2026-07-21 22:25:25 +03:00
dancingmirrors a7089e8341 hasvk: Clamp several MFX_AVC_IMG_STATE fields in case the slice parser fails us.
Also cap the reference frame count at the supported 16.

Assisted-by: Claude
2026-07-21 22:25:25 +03:00
dancingmirrors 4a162aa46b hasvk: Range check and fail the parse upon lost bit alignment in the slice parser.
Assisted-by: Claude
2026-07-21 22:25:25 +03:00
dancingmirrors fac6387b34 hasvk: Account for frames wider than 128 MBs on gen7.
Fixes corruption and GPU hangs observed with a 4096 wide video.

Assisted-by: Claude
2026-07-21 22:25:25 +03:00
dancingmirrors bd3d4fc732 hasvk: Gate video decode behind HASVK_DEBUG=video-decode.
Assisted-by: Claude
2026-07-21 22:25:24 +03:00
dancingmirrors 31fd4c3ded hasvk: Simplify get_h264_video_session_mem_reqs.
Based on ANV code but with the same alignment of 64.

Assisted-by: Claude
2026-07-21 22:25:24 +03:00
dancingmirrors 3d258cbaf7 hasvk: Gate video decode behind VIDEO_CODEC_H264DEC so we don't advertise it without the codec.
Assisted-by: Claude
2026-07-21 22:25:24 +03:00
dancingmirrors a2727d71b6 hasvk: Neutralize the unwritten chroma with monochrome video.
Otherwise we sample garbage with, say, yuvj420p.

Assisted-by: Claude
2026-07-21 22:25:23 +03:00
dancingmirrors 881ec70b2f hasvk: Expose VK_KHR_video_maintenance1 and VK_KHR_video_maintenance2.
Assisted-by: Claude
2026-07-21 22:25:23 +03:00
dancingmirrors 0f70099a69 hasvk: Reject result status queries on the video decode queue.
Inline queries enabled by video_maintenance1 would just lock up my
machine and I'm not sure a proper workaround exists.

A few nits while here.

Assisted-by: Claude
2026-07-21 22:25:23 +03:00
dancingmirrors b0d1db9406 hasvk: Work around FFmpeg commit 24db09a881c9e0eb5b36dcf693c6ac17e9d56be8.
This is mostly for old versions of the VVL.

Assisted-by: Claude
2026-07-21 22:25:23 +03:00
dancingmirrors c96439dde4 hasvk: Flesh out the video decode format support.
Assisted-by: Claude
2026-07-21 22:25:22 +03:00
dancingmirrors 23b29b1f92 hasvk: Rework H.264 decode into long mode.
This is why the previously added slice header parser exists.

Assisted-by: Claude
2026-07-21 22:08:59 +03:00
dancingmirrors c3fe6d4a87 hasvk: Rename genX_video.c to genX_cmd_video.c to match ANV. 2026-07-21 22:08:59 +03:00
dancingmirrorsandirql-notlessorequal 9dad5c1a52 hasvk: Add a slice header parser for H.264 decode.
This is required for long mode, where the driver parses the slice header
itself rather than relying on the hardware to do it.

Co-authored-by: irql-notlessorequal <[email protected]>

[dancingmirrors: Assisted-by: Claude]
2026-07-21 22:08:59 +03:00
dancingmirrors 5c6ad1fb4c hasvk: Validate profiles and harden the video session objects.
Assisted-by: Claude
2026-07-21 22:08:59 +03:00
dancingmirrors cece575042 intel/genxml: A few additions and fixes for video decode.
Assisted-by: Claude
2026-07-21 22:08:58 +03:00
dancingmirrors ed56facc56 hasvk: Drop the video queue paths for CmdSetEvent2 and CmdResetEvent2.
Assisted-by: Claude
2026-07-21 22:08:58 +03:00
dancingmirrors 878d7c9717 hasvk: Sync the per-queue-family batch decoders with current ANV.
Assisted-by: Claude
2026-07-21 22:08:58 +03:00
dancingmirrors f885682e82 hasvk: Adapt the video decode series to current conventions.
No functional change.

Assisted-by: Claude
2026-07-21 22:08:58 +03:00
Dave Airlie 353385c186 fix gen7 bits
[dancingmirrors: Adapt for the current genxml format.]
2026-07-21 22:08:57 +03:00
Dave Airlie 5d68b51dca bunch of wip gfx75 fixes
[dancingmirrors: Adapt for the current genxml format.]
2026-07-21 22:08:57 +03:00
Dave Airlie 67635d1925 disable picture remapping 2026-07-21 22:08:57 +03:00
Dave Airlie 1ddc1b218a fix chroma qp offsets to be ints 2026-07-21 22:08:56 +03:00
Dave Airlie 824423d998 fix pic heights 2026-07-21 22:06:16 +03:00
Dave Airlie 0496c5dbc9 add some qm bits 2026-07-21 22:04:23 +03:00
Dave Airlie f4c05ec0dc another query fix 2026-07-21 22:02:20 +03:00
Dave Airlie 5e907af251 hasvk: fix broken break 2026-07-21 22:00:56 +03:00
Dave Airlie 1b28ad306b hasvk: maybe fix queries 2026-07-21 21:59:26 +03:00
dancingmirrors a5ae9c9200 hasvk: Advertise H.264 video decode.
Assisted-by: Claude
2026-07-21 21:37:26 +03:00
Dave Airlie bbdb233abe hasvk: enable video decode extensions 2026-07-21 21:36:06 +03:00
Dave Airlie 3a06bb4fc2 hasvk/query: add query status report 2026-07-21 21:34:40 +03:00
Dave Airlie 1db147a9ce hasvk: add initial video decode support for h264.
This just adds the files with the programming info, it doesn't
enable the extensions etc

[dancingmirrors: A few forward port fixes.]
2026-07-21 15:23:49 +03:00
Dave Airlie 4d12fc3ec6 hasvk/image: allocate some memory for mv storage after video images.
these images need motion vector storage allocated with them
2026-07-21 15:18:38 +03:00
Dave Airlie f75fb64c41 hasvk/format: handle video extensions structs by ignoring them 2026-07-21 15:16:41 +03:00
Dave Airlie 40260e83cb hasvk: add video format features for the one supported video output format 2026-07-21 15:14:49 +03:00
Dave Airlie 587311f645 hasvk: anv: set Y tiling for video decode images
The video decode hw only works with Y tiled images.
2026-07-21 15:05:04 +03:00