protonscr

[BUG] Heavy image warping in right eye on 2.19.1

steamvrclosed bugFixed in Main
ValveSoftware/SteamVR-for-Linux#1046 · opened 2026-11-03 by cosmepl · updated 2026-11-16 · 12 comments · github
Ccosmepl 2026-11-03 github

Describe the bug
This is on the Steam Frame. I updated the Frame to the beta client and unstable OS and the host to latest unstable SteamOS with SteamVR 2.19.1. While streaming games, the image in the right eye will warp and display artifacting similar to frame reprojection/frame generation during movement. I didn't really notice any warping in the left eye. In the case of Alyx, the warping was pretty extreme on menus, but smoothed out in actual gameplay. There were still a few blips where it could be seen in game, though.

To Reproduce
Steps to reproduce the behavior:

  1. Update Frame to Beta client and Unstable branches
  2. Update SteamOS to unstable, SteamVR to beta
  3. Go to desktop mode and launch Alyx through SteamVR streaming
  4. Move around the menu

System Information (please complete the following information):
Please use the latest Steam beta client and SteamVR beta for your bug reports!

  • Steam client version (build number or date):
  • SteamVR version: 2.19.1
  • Distribution: SteamOS
  • Steam runtime diagnostics: runtimediag.txt

Screenshots

https://github.com/user-attachments/assets/a7c3e5e9-6316-4681-a773-f67574bd6d27

Image
EEliteTK 2026-11-03 github

This is the very mildest version of the issue, but it's the first report, and from analysis this is introduced in the latest beta. Basically the latest beta changes a bunch of the rendering pipeline, and Legacy doesn't undo all of it. This bug seems to be caused by the compositor no longer waiting for the timeline semaphore indicating that a frame is complete, for each frame the game submits.

This means that the steamvr can end up encoding and sending whatever was previously in that frame's buffer. In case of some games like Alyx that's a 3 frame-old image.

Since the compositor gets a separate potentially incomplete buffer per eye and each buffer is read twice, once for the peripheral view and once for the sharp fovea region, this bug can exhibit as stutter in only one of the two image versions of one eye at its most mild, all the way up to both versions of each eye being delayed.

I've got a patch in the works (or well, I have a working patch, I just want to clean it up first).

I've updated my patching script [^updated] (instructions inside) to fix this (use at your own risk, etc).

[^updated]: updated, context

WWolfspiritM 2026-11-05 github

@EliteTK Thanks! That patch works. Before that patch HL Alyx showed flickering images all over the right eye

Ffrostwind8174 2026-11-08 github

Replying to https://github.com/ValveSoftware/SteamVR-for-Linux/issues/1046#issuecomment-6606147628

Hi @EliteTK , I'm not sure if I am having this same issue to a more severe degree or not. I am trying to use your patch to see if my issue is related or not, but I think your patch is not expecting files for SteamVR 2.19.2, are you able to update this?

Related, I seem to have this issue in 2.19.2, but I'm not sure to what extent it is the same. When my issue "stabilizes", I have a perceived latency but I don't think thats entirely the truth. It's as if my headset is lagging behind with some image instability here and there. Opening up the VR Dashboard will cause SteamVR to outright have a critical error and cause steam as a whole to restart most times. I've tried to capture the issue in headset, but the image looks stable and there is no way to really represent the true perceived delay happening. I am on Arch Linux kernel 7.2.14-arch1-1 with a NVIDIA RTX 2080ti using nvidia-open, and i9-9900k

EEliteTK 2026-11-08 github

@frostwind8174 I publish updates here: https://kramkow.ski/project/steamvr-patches.html[^aside]

The latest SteamVR patcher is here.

edit: Also, what you're describing is the most severe version of this bug.

[^aside]: I am going to re-work this page at some point as I want to add details of all of the bugs but I think that should be separate from a page which lists all the patches and their versions.

Ffrostwind8174 2026-11-09 github

The patch works wonders! Hope it gets merged, although I don't know if it's a result of this patch or another underlying issue, the view is "smooth", but if you look closely, and especially noticeable in games like Beat Saber, you can see what seems to be ghosting, and it is not running smooth. It feels as if it's a lower refresh rate while still being perceived as smooth.

Llonelyicer 2026-11-10 github

@EliteTK You're an absolute GOAT! The patch works great on my machine.

For reference:
B580 with PICO 4 Pro on steamlink

PPacketdancer 2026-11-11 github

FWIW, the actual issue was elsewhere from where the patch tweaks (though the patch appears to make an effective band-aid); tracking it down exposed some bigger underlying problems. These should now all be addressed in the next beta build.

EEliteTK 2026-11-11 github

FWIW, the actual issue was elsewhere from where the patch tweaks (though the patch appears to make an effective band-aid)

@Packetdancer hey, I don't have the source code, don't expect miracles ;) The problem was sampling eye textures that haven't finished being rendered, I was never under the impression that shoehorning a semaphore wait on any texture that it could possibly make sense to wait on, at a random point during command buffer submission batch preparation was the right approach.

These should now all be addressed in the next beta build.

I look forward to updating SteamVR one day and finding out that all my patches are obsolete...

Thanks for looking at this!

Ccosmepl 2026-11-14 github

The latest update did indeed fix the issue, thank you so much!!

Ffrostwind8174 2026-11-14 github

This issue is still present in 2.19.3, recently experienced in Beat Saber with NVidia Hardware. The Performance returns when the Dashboard is opened, but returns as soon as it is closed.

ETA: Now experiencing the exact same issue in Half-Life: Alyx.

This issue is present in all Wireless Headsets.

Ffrostwind8174 2026-11-14 github

To continue to update in this issue in case mine is closed as a duplicate, here is a video demonstrating this issue is very much present in 2.19.3 https://youtube.com/shorts/gp-TZOmd3H8

EEliteTK 2026-11-16 github

@Packetdancer it seems like you've added synchronisation between the video encoding and the downsampling/fovea-cropping, which has improved things a lot. But you still don't synchronise between the downsampling/fovea-cropping and the application finishing rendering. An application can submit an eye texture as soon as it has submitted the GPU work required to render it. Since you don't make your downsampling/fovea-cropping work wait for the eye texture completion semaphore, once you request the frame be encoded, you can end up sampling the eye texture too early. And if the application cycles multiple textures, you can still end up with a flicker.

Weird example application to demonstrate the issue. It switches between two colours once every second, and artificially delays the "rendering" of the frame after the switch in order to trigger the bug. This seems to trigger the bug with both the "Facet" and "Vulkan" renderers. It's artificially capped at 24FPS since it seems really difficult for our eyes to spot this bug even at 72FPS and with a black<->white transition.
# /// script
# requires-python = ">=3.10"
# dependencies = ["openvr==2.12.1401", "vulkan==1.3.275.1"]
# ///
import ctypes as ct
import time
from contextlib import ExitStack
from itertools import count
from threading import Timer

import openvr
import vulkan as vk

COLOURS = [
    (0.18, 0.50, 0.82),
    (0.72, 0.42, 0.18),
]

# Go to the bottom to skip the hideous Vulkan nonsense

SIZE = 512
FORMAT = vk.VK_FORMAT_R8G8B8A8_UNORM
AREA = vk.VkImageSubresourceRange(
    aspectMask=vk.VK_IMAGE_ASPECT_COLOR_BIT, levelCount=1, layerCount=1
)
cleanup = ExitStack()
device = None
images, texture_data, fences = [], [], []
layouts = [vk.VK_IMAGE_LAYOUT_UNDEFINED] * 3


def address(handle):
    return int(vk.ffi.cast("uintptr_t", handle))


def pointer(handle, kind):
    return ct.cast(address(handle), ct.POINTER(kind))


def setup(system, compositor):
    global device, queue, commands, semaphore
    instance = vk.vkCreateInstance(
        vk.VkInstanceCreateInfo(
            pApplicationInfo=vk.VkApplicationInfo(
                apiVersion=vk.VK_MAKE_VERSION(1, 2, 0)
            ),
            ppEnabledExtensionNames=(
                compositor.getVulkanInstanceExtensionsRequired().split()
            ),
        ),
        None,
    )
    cleanup.callback(vk.vkDestroyInstance, instance, None)

    # These two pyopenvr convenience wrappers get input/output arguments wrong.
    # Why did I think this would be cleaner in Python?
    physical_handle = ct.c_uint64()
    system.function_table.getOutputDevice(
        ct.byref(physical_handle),
        openvr.TextureType_Vulkan,
        pointer(instance, openvr.VkInstance_T),
    )
    assert physical_handle.value, "SteamVR did not provide a Vulkan GPU"
    physical = vk.ffi.cast("VkPhysicalDevice", physical_handle.value)
    required = compositor.function_table.getVulkanDeviceExtensionsRequired
    physical_pointer = pointer(physical, openvr.VkPhysicalDevice_T)
    extensions = ct.create_string_buffer(required(physical_pointer, None, 0))
    required(physical_pointer, extensions, len(extensions))
    families = vk.vkGetPhysicalDeviceQueueFamilyProperties(physical)
    family = next(
        i
        for i, f in enumerate(families)
        if f.queueCount and f.queueFlags & vk.VK_QUEUE_GRAPHICS_BIT
    )
    device = vk.vkCreateDevice(
        physical,
        vk.VkDeviceCreateInfo(
            pQueueCreateInfos=[
                vk.VkDeviceQueueCreateInfo(
                    queueFamilyIndex=family, pQueuePriorities=[1.0]
                )
            ],
            ppEnabledExtensionNames=extensions.value.decode().split(),
            pEnabledFeatures=vk.VkPhysicalDeviceFeatures(geometryShader=True),
            pNext=vk.VkPhysicalDeviceVulkan12Features(
                timelineSemaphore=True,
                shaderOutputLayer=True,
                shaderOutputViewportIndex=True,
            ),
        ),
        None,
    )
    cleanup.callback(vk.vkDestroyDevice, device, None)
    queue = vk.vkGetDeviceQueue(device, family, 0)
    pool = vk.vkCreateCommandPool(
        device,
        vk.VkCommandPoolCreateInfo(
            flags=vk.VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
            queueFamilyIndex=family,
        ),
        None,
    )
    cleanup.callback(vk.vkDestroyCommandPool, device, pool, None)
    commands = vk.vkAllocateCommandBuffers(
        device,
        vk.VkCommandBufferAllocateInfo(
            commandPool=pool,
            level=vk.VK_COMMAND_BUFFER_LEVEL_PRIMARY,
            commandBufferCount=3,
        ),
    )
    semaphore = vk.vkCreateSemaphore(
        device,
        vk.VkSemaphoreCreateInfo(
            pNext=vk.VkSemaphoreTypeCreateInfo(
                semaphoreType=vk.VK_SEMAPHORE_TYPE_TIMELINE
            )
        ),
        None,
    )
    cleanup.callback(vk.vkDestroySemaphore, device, semaphore, None)

    textures = []
    memory = vk.vkGetPhysicalDeviceMemoryProperties(physical)
    for _ in range(3):
        fence = vk.vkCreateFence(
            device, vk.VkFenceCreateInfo(flags=vk.VK_FENCE_CREATE_SIGNALED_BIT), None
        )
        cleanup.callback(vk.vkDestroyFence, device, fence, None)
        fences.append(fence)
        pair, handles = [], []
        for _ in range(2):
            image = vk.vkCreateImage(
                device,
                vk.VkImageCreateInfo(
                    imageType=vk.VK_IMAGE_TYPE_2D,
                    format=FORMAT,
                    extent=vk.VkExtent3D(SIZE, SIZE, 1),
                    mipLevels=1,
                    arrayLayers=1,
                    samples=vk.VK_SAMPLE_COUNT_1_BIT,
                    tiling=vk.VK_IMAGE_TILING_OPTIMAL,
                    usage=(
                        vk.VK_IMAGE_USAGE_TRANSFER_SRC_BIT
                        | vk.VK_IMAGE_USAGE_TRANSFER_DST_BIT
                        | vk.VK_IMAGE_USAGE_SAMPLED_BIT
                    ),
                ),
                None,
            )
            requirements = vk.vkGetImageMemoryRequirements(device, image)
            memory_type = next(
                i
                for i in range(memory.memoryTypeCount)
                if requirements.memoryTypeBits & (1 << i)
                and memory.memoryTypes[i].propertyFlags
                & vk.VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
            )
            allocation = vk.vkAllocateMemory(
                device,
                vk.VkMemoryAllocateInfo(
                    allocationSize=requirements.size, memoryTypeIndex=memory_type
                ),
                None,
            )
            cleanup.callback(vk.vkFreeMemory, device, allocation, None)
            cleanup.callback(vk.vkDestroyImage, device, image, None)
            vk.vkBindImageMemory(device, image, allocation, 0)
            data = openvr.VRVulkanTextureData_t(
                address(image),
                pointer(device, openvr.VkDevice_T),
                pointer(physical, openvr.VkPhysicalDevice_T),
                pointer(instance, openvr.VkInstance_T),
                pointer(queue, openvr.VkQueue_T),
                family,
                SIZE,
                SIZE,
                FORMAT,
                1,
            )
            texture_data.append(data)  # Keep the native structure alive.
            pair.append(
                openvr.Texture_t(
                    ct.addressof(data),
                    openvr.TextureType_Vulkan,
                    openvr.ColorSpace_Gamma,
                )
            )
            handles.append(image)
        textures.append(pair)
        images.append(handles)
    return textures


def transition(command, image, old, new, source, destination):
    barrier = vk.VkImageMemoryBarrier(
        image=image,
        subresourceRange=AREA,
        oldLayout=old,
        newLayout=new,
        srcAccessMask=source,
        dstAccessMask=destination,
        srcQueueFamilyIndex=vk.VK_QUEUE_FAMILY_IGNORED,
        dstQueueFamilyIndex=vk.VK_QUEUE_FAMILY_IGNORED,
    )
    vk.vkCmdPipelineBarrier(
        command,
        vk.VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
        vk.VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
        0,
        0,
        None,
        0,
        None,
        1,
        [barrier],
    )


def draw(slot, colour, gate):
    command, fence = commands[slot], fences[slot]
    vk.vkWaitForFences(device, 1, [fence], True, 2_000_000_000)
    vk.vkResetCommandBuffer(command, 0)
    vk.vkBeginCommandBuffer(command, vk.VkCommandBufferBeginInfo())
    for image in images[slot]:
        transition(
            command,
            image,
            layouts[slot],
            vk.VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
            vk.VK_ACCESS_MEMORY_READ_BIT,
            vk.VK_ACCESS_TRANSFER_WRITE_BIT,
        )
        vk.vkCmdClearColorImage(
            command,
            image,
            vk.VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
            vk.VkClearColorValue(float32=[*colour, 1.0]),
            1,
            [AREA],
        )
        transition(
            command,
            image,
            vk.VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
            vk.VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
            vk.VK_ACCESS_TRANSFER_WRITE_BIT,
            vk.VK_ACCESS_TRANSFER_READ_BIT,
        )
    layouts[slot] = vk.VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
    vk.vkEndCommandBuffer(command)
    submit = vk.VkSubmitInfo(pCommandBuffers=[command])
    if gate:
        submit = vk.VkSubmitInfo(
            pCommandBuffers=[command],
            pWaitSemaphores=[semaphore],
            pWaitDstStageMask=[vk.VK_PIPELINE_STAGE_ALL_COMMANDS_BIT],
            pNext=vk.VkTimelineSemaphoreSubmitInfo(pWaitSemaphoreValues=[gate]),
        )
    vk.vkResetFences(device, 1, [fence])
    vk.vkQueueSubmit(queue, 1, [submit], fence)


def release(value):
    vk.vkSignalSemaphore(
        device, vk.VkSemaphoreSignalInfo(semaphore=semaphore, value=value)
    )


def main():
    system = openvr.init(openvr.VRApplication_Scene)
    try:
        compositor = openvr.VRCompositor()
        textures = setup(system, compositor)
        bounds = openvr.VRTextureBounds_t(0, 0, 1, 1)
        start = time.monotonic()
        for frame in count():
            frame_start = time.monotonic()
            if frame_start - start >= 30:
                break
            compositor.waitGetPoses(None, None)
            slot = frame % 3
            phase, frame_in_colour = divmod(frame, 24)
            colour = COLOURS[phase % len(COLOURS)]

            # Artificialy delay the frame after the first frame which shows the
            # new colour to try to trigger the bug.
            gate = frame + 1 if phase and frame_in_colour == 1 else 0
            timer = Timer(0.020, release, args=(gate,)) if gate else None
            if timer:
                timer.start()
            try:
                draw(slot, colour, gate)
                for eye in (0, 1):
                    compositor.submit(eye, textures[slot][eye], bounds)
            finally:
                if timer:
                    timer.join()
            compositor.postPresentHandoff()
            time.sleep(max(0, 1 / 24 - (time.monotonic() - frame_start)))
    except KeyboardInterrupt:
        pass
    finally:
        if device is not None:
            vk.vkDeviceWaitIdle(device)
            openvr.shutdown()
            vk.vkDeviceWaitIdle(device)
            cleanup.close()


if __name__ == "__main__":
    main()

Nothing extracted yet.