Skip to content

Conversation

@abaire
Copy link
Member

@abaire abaire commented Nov 13, 2025

DreamWorks: Over the Hedge performs D3D resets before playing FMVs at startup. As a part of this process, an initialization is performed that checks to see if a DirectX frame counter aligns with the counter reported by the TV encoder (at least if Conexant is the encoder, it looks like it is bypassed for other cases). If there is a mismatch, the DirectX frame counter is incremented.

This can cause an issue where the vblank interrupt handler misses the expected frame counter, causing it to fail to update the nv2a buffer read index via the NV_PGRAPH_INCREMENT PGRAPH register. In this particular title, this leads to a livelock where the pushbuffer is waiting on a buffer flip that cannot be triggered until the current buffer is marked as read via the register write.

This change populates the low nibble of the Conexant device with a simple frame counter. See https://xboxdevwiki.net/Video_Encoder for a link to the datasheet.

Unfortunately testing this on HW has proved difficult, as some state is changed during D3D Present calls that causes SMBus reads to stop providing accurate data. Thus, this change is mostly a guess at the actual behavior along with some light testing without using D3D that shows the field value incrementing from 0-3 and wrapping around forever, presumably aligned with vsync.

Fixes #1962

VGACommonState *vga = opaque;
vga->hw_ops->gfx_update(vga);

smbus_cx25871_notify_vblank();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When investigating #1962 it appeared that the code checking for the field count was only run for the Conexant encoder. That said, it seems plausible that the other encoders might have a similar mechanism that could be queried in other cases.

I wonder if there's a callback mechanism that we could use to notify (at least TV encoder) devices of vblank instead of calling out from here? That would potentially let us remove the object_resolve_path_type call as well.

@abaire abaire marked this pull request as draft November 14, 2025 00:58
@abaire abaire force-pushed the fix_1962_update_conexant_field_count_on_vblank branch from dc764c1 to 37f262a Compare November 14, 2025 01:47
@abaire abaire marked this pull request as ready for review November 15, 2025 01:27
@abaire
Copy link
Member Author

abaire commented Nov 15, 2025

Verified that the report of the fix not working is related to M8+ bios use. I suspect the bios does something that stops it from checking the field count.

@abaire
Copy link
Member Author

abaire commented Dec 9, 2025

/gemini review

(Testing to see if code assist is enabled)

@abaire abaire force-pushed the fix_1962_update_conexant_field_count_on_vblank branch from 37f262a to 2ce1d00 Compare January 19, 2026 13:44
DreamWorks: Over the Hedge performs D3D resets before playing FMVs at startup.
As a part of this process, an initialization is performed that checks to see if
a DirectX frame counter aligns with the counter reported by the TV encoder (at
least if Conexant is the encoder, it looks like it is bypassed for other cases).
If there is a mismatch, the DirectX frame counter is incremented.

This can cause an issue where the vblank interrupt handler misses the expected
frame counter, causing it to fail to update the nv2a buffer read index via the
NV_PGRAPH_INCREMENT PGRAPH register. In this particular title, this leads to a
livelock where the pushbuffer is waiting on a buffer flip that cannot be
triggered until the current buffer is marked as read via the register write.

This change populates the low nibble of the Conexant device with a simple frame
counter. See https://xboxdevwiki.net/Video_Encoder for a link to the datasheet.

Unfortunately testing this on HW has proved difficult, as some state is changed
during D3D Present calls that causes SMBus reads to stop providing accurate
data. Thus, this change is mostly a guess at the actual behavior along with
some light testing without using D3D that shows the field value incrementing
from 0-3 and wrapping around forever, presumably aligned with vsync.

Fixes xemu-project#1962
@abaire abaire force-pushed the fix_1962_update_conexant_field_count_on_vblank branch from 2ce1d00 to 6a7ee08 Compare February 10, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DreamWorks Over the Hedge: Doesn't make it past the intro FMV's

1 participant