Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mfmediaengine: Remove Y-flip in TransferVideoFrame #157

Closed
wants to merge 495 commits into from

Conversation

Fraxul
Copy link

@Fraxul Fraxul commented Aug 6, 2022

This fixes inverted videos on some players in VRChat (ValveSoftware/Proton#1199). Players using IMFMediaEngine::TransferVideoFrame to populate a DXGI surface were showing inverted video, while players that use IMF2DBuffer::ContiguousCopyFrom to copy video data were showing correctly-oriented video.

As stated in the commit message, I'm pretty sure this issue was introduced in d552e54 when the video frames supplied to MediaFoundation by winegstreamer stopped being Y-flipped. The video was un-inverted in that commit, so we need to stop inverting it again in the pixel shader here to match.

rbernon and others added 30 commits July 27, 2022 18:14
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 962b432)
Adding H264 format support in wg_format.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 606505e)
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit f383694)
…ort in VMR9DefaultAllocatorPresenterImpl_create().

It doesn't check for hardware acceleration for the adapter that we're actually
going to use, and we don't actually care what the swapchain format is anyway. If
the device doesn't support hardware acceleration we'll fail later when trying to
actually create it.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 0e4620d)
…llocator_SetAllocationSettings().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 3105c22)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit e68a100)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 8a2cdd7)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 75b8dcd)
Cycle detection is done by native quartz.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 9942693)
…eckCircularConnection().

These are already checked in the callers.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit ae9d64e)
Use clearer variable names, and simplify the error handling.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit e41b352)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 4364ff8)
BaseOutputPinImpl_GetDeliveryBuffer() is doing nothing helpful here.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 9d5d8df)
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit e102068)
…er() helper.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 186b99c)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 98a2689)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 46f7d4c)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit aa9aa73)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 6302ca9)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit bd18fa2)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 859809b)
…ctly.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit ed4df69)
…itAllocator().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 72ede0e)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 2f95267)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 235effd)
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 50a06d0)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 7348ac6)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 9e32d45)
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit af3fcc3)
Some GStreamer video plugins such as vaapi do not expect their buffers
to be appended to each other, and it breaks some of their assertions.

We will also later need to queue caps change events, and the atomic
queue will let us queue GstSample instead to hold the caps too. It also
removes the need of a mutex or locking operations.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit b5d6c59)
Paul Gofman and others added 18 commits July 27, 2022 18:15
FFXIV dies on this, but works correctly if I just remove the check.
Maybe it's just a leftover from previous refactoring.

CW-Bug-Id: #20966
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Remove a work around that causes a crash in Unravel Two.

There is a callback in Unravel Two that appears to add a reference to a
IMediaSample, which this workaround treats as a leak and releases. However, the
application also later releases the reference itself, causing a use-after-free.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51616
Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 1113f42)
(minus the test changes)

Link: ValveSoftware#155
After 7161dcd, the timezone bias is calculated every time when SystemTimeOfDayInformation is queried.
This restores the cache for timezone bias.

Improve HROT framerate from ~100fps to ~500fps. The game calls RtlSystemTimeToLocalTime() frequently.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
(cherry picked from commit 208a8aa)
Fix Chuzzle Deluxe crash at start.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
(cherry picked from commit a0cac2e)
(cherry picked from commit 17ce835)
(minus test changes)

CW-Bug-Id: #20694
(cherry picked from commit 8a74acd)

CW-Bug-Id: #20694
It's important for the default broken formats like c_dfDIJoystick2 which
have multiple sets of sliders defined with the same offsets.

(cherry picked from commit 50690e0)

CW-Bug-Id: #20694
(cherry picked from commit 6719e6b)
(minus the test changes)

CW-Bug-Id: #20694
This prevents crashes when there is an invalid script
inside a tag property.

Because ParseProcedureText calls release_bytecode without
checking if compile_script failed, "code" is not set, and
this leads to a crash when release_bytecode tries to access it.

Signed-off-by: Santino Mazza <mazzasantino1206@gmail.com>
(cherry picked from commit d93712f)
… is IE.

For documents exposing a <!DOCTYPE> node but no specific X-UA-Compatible,
mshtml defaults to IE7 compat mode, unless the app is Internet Explorer and
is in Internet URL Zone. This checking for the `iexplore.exe` app name seems
hardcoded into mshtml; the FeatureControl registry keys do not affect this
directly, and none are set by default for iexplore.exe that would affect
this, anyway.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
(cherry picked from commit 3301a8e)
There can be multiple compat modes defined, separated by commas, but also
surrounded by whitespace. The highest mode in the list is picked as the
document mode, with 'edge' being the highest mode available.

It stops as soon as an invalid mode is found in the list and returns whatever
highest mode was found until then.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
(cherry picked from commit efdfd32)
Video handed off to clients by calling IMFMediaEngine::TransferVideoFrame was
flipped in the Y axis after the changes to winegstreamer in commit d552e54.
Remove the now-unneeded Y-flip from the pixel shader to restore the correct
output orientation.
@kisak-valve
Copy link
Member

Hello @Fraxul, can you send this upstream as well with a note to pair it with d552e54? (https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/mfmediaengine/main.c#L287)

@Fraxul
Copy link
Author

Fraxul commented Aug 6, 2022

Sure, I can probably manage that. I should wait until after it's accepted here to do that, right?

@GloriousEggroll
Copy link
Contributor

this fixes upside down videos for some games but not all. e.g. endless space 2 gets fixed but secret of mana doesnt

@rbernon
Copy link
Collaborator

rbernon commented Oct 19, 2022

Oh well I completely missed this, and worked on the same fix. It should be fixed now, including in upstream Wine.

@rbernon
Copy link
Collaborator

rbernon commented Oct 19, 2022

I'm closing this as a similar fix is now included. Thanks for working on this and sorry for having missed it.

@rbernon rbernon closed this Oct 19, 2022
@Fraxul
Copy link
Author

Fraxul commented Oct 19, 2022

No worries, just glad to hear it's fixed!

@Fraxul Fraxul deleted the video-flip branch October 19, 2022 19:07
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.

None yet