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

[D3D11] Hack to fix refresh rate issue in full screen exclusive mode. #10083

Merged
merged 2 commits into from
Jul 13, 2016

Conversation

afedchin
Copy link
Member

@afedchin afedchin commented Jul 7, 2016

There is an ugly "bug" in DX11 which causes DX system is unable switch to desired display mode in full screen exclusive mode

23.976 <-> 24.00
29.970 <-> 30.00
47.952 <-> 48.00
59.940 <-> 60.00

On some system DX is unable to switch to 24.00 on others to 23.976 mode. Some systems has no the issue. This trick fixes the issue.

This also requires:

ping @Voyager1 @Paxxi @FernetMenta

@afedchin afedchin added Type: Fix non-breaking change which fixes an issue RFC PR submitted for gathering feedback v17 Krypton Component: Video rendering Platform: Windows labels Jul 7, 2016
@FernetMenta
Copy link
Contributor

Is there still any advantage in running Kodi windowless an Windows?

@afedchin
Copy link
Member Author

afedchin commented Jul 7, 2016

on win10 there are no advantages I think, but on pre win10 systems FSE mode requires less resources. In my oppinion windowed mode is still a bit stuttery when compared to full screen. also FSE exclusive supports 10bit output on all systems (we don't use 10b output, but this may change in future)

@Jalle19
Copy link
Member

Jalle19 commented Jul 7, 2016

@FernetMenta lots of people use Kodi in windowed mode, especially when looking at things on the computer while doing other things.

// 4. and then reverse vector to start iterate with the best candidate for d3d11 driver
std::reverse(drivers.begin(), drivers.end());

for (auto it = drivers.begin(); it != drivers.end(); ++it)

This comment was marked as spam.

This comment was marked as spam.

@Voyager1
Copy link

Voyager1 commented Jul 7, 2016

(edited)
I agree with @afedchin - windowed mode has some disadvantages (as you all know), like on a relatively low-powered APU (like my current A4-5000) used in a living-room HTPC setting it's slightly less fluent. Furthermore, I would suggest that we do one of three things:

  1. implement this fix/hack, OR
  2. document in the UI that full screen exclusive sometimes does not allow the fully matching refresh rate, OR
  3. simply turn off the possibility to use full screen exclusive.
    My preference is (1).

@Paxxi
Copy link
Member

Paxxi commented Jul 7, 2016

full screen windowed mode is my preference as it avoid the ugly switching that you get with full screen exclusive. Maybe not the one a hardcore movie-buff would choose but it's perfect for say having kodi up on a second screen(which my daughter use extensively) and ofc during debugging as it's so much faster when hitting a breakpoint.

Can't say I understand it all but codewise it looks fine so no objections to merging

@AchimTuran
Copy link
Member

@FernetMenta

Is there still any advantage in running Kodi windowless an Windows?

Sure, I use it daily for development 😄 or listening to music.

@FernetMenta
Copy link
Contributor

I was referring to true / faked fullscreen. On Linux and OSX for example there is only faked fullstreen, means Kodi is running in a window without any title bar or frame visible.

@Jalle19
Copy link
Member

Jalle19 commented Jul 7, 2016

Based on the level black arts involved in this hack I'd vote in favor of dropping exclusive fullscreen.

@afedchin
Copy link
Member Author

afedchin commented Jul 7, 2016

dropping FSE mode will cause a shit storm on windows forum

@FernetMenta
Copy link
Contributor

Hacky or not, this is fairly self contained. I support any decision the Windows devs take.

@Sorien
Copy link

Sorien commented Jul 7, 2016

real fullscreen mode(Use fullscreen window = false) is almost useless on win10 and multi screen setup (huge flickering/crashing/no picture when system wakes up from suspend/hibernate sometimes even when you bring another app to top) and 50% more CPU usages 4-5% at idle compared to 1-2% when Use fullscreen window is is enabled

Edit: yes you are right its just useless for me, mainly ;) ... maybe it has something to do with intel CPUs and their graphic drivers couse i see same issues at multiple PCs

@afedchin
Copy link
Member Author

afedchin commented Jul 7, 2016

@Sorien why I have results opposite than yours, on win10? If you have an issue with fse mode this does not mean that fse mode is useless.

@@ -57,8 +57,7 @@
void APIENTRY HookCreateResource(D3D10DDI_HDEVICE hDevice, const D3D10DDIARG_CREATERESOURCE* pResource, D3D10DDI_HRESOURCE hResource, D3D10DDI_HRTRESOURCE hRtResource);
HRESULT APIENTRY HookCreateDevice(D3D10DDI_HADAPTER hAdapter, D3D10DDIARG_CREATEDEVICE* pCreateData);
HRESULT APIENTRY HookOpenAdapter10_2(D3D10DDIARG_OPENADAPTER *pOpenData);
typedef HRESULT(APIENTRY *pfnOpenAdapter10_2)(_Inout_ D3D10DDIARG_OPENADAPTER *);

This comment was marked as spam.

This comment was marked as spam.

@afedchin
Copy link
Member Author

afedchin commented Jul 7, 2016

hm.. appveyor is happy, jenkins build this please

@Voyager1
Copy link

Voyager1 commented Jul 8, 2016

does jenkins have WDK8.1 installed?

@afedchin
Copy link
Member Author

afedchin commented Jul 8, 2016

I don't think so. It fails because has not found header file.

@Jalle19
Copy link
Member

Jalle19 commented Jul 8, 2016

@afedchin @FernetMenta okay, let's not drop it then :-)

@Voyager1
Copy link

Voyager1 commented Jul 8, 2016

@afedchin - I would suggest the addition of another patch: Voyager1@5a5d35d - the reason being that Numerator is UINT and you assign it a float value. This is each time used for FindClosestMatchingMode, so if refreshrate to be matched is 23.976 or 59.940 the decimals are dropped. Not a big deal, because one can assume that the closest matching mode will return the one you're looking for anyway. Maybe this is another "cosmetic" fix.

@afedchin
Copy link
Member Author

afedchin commented Jul 8, 2016

jenkins build this please

@afedchin
Copy link
Member Author

afedchin commented Jul 8, 2016

@Voyager1 take a look please 8e5ab83

@Voyager1
Copy link

Voyager1 commented Jul 8, 2016

@Voyager1 take a look please 8e5ab83

nice!

@@ -1915,6 +1914,13 @@ void CRenderSystemDX::FixRefreshRateIfNecessary(const D3D10DDIARG_CREATERESOURCE
}
}

void CRenderSystemDX::GetRefreshRatio(uint32_t refresh, uint32_t * num, uint32_t * den)

This comment was marked as spam.

This comment was marked as spam.

@afedchin
Copy link
Member Author

afedchin commented Jul 8, 2016

jenkins build this please

@afedchin
Copy link
Member Author

if no objections I will merge this tonight
jenkins build this please

@afedchin afedchin merged commit 0f1afa6 into xbmc:master Jul 13, 2016
@afedchin afedchin deleted the d3d11_refresh_hack branch July 13, 2016 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Video rendering Platform: Windows RFC PR submitted for gathering feedback Type: Fix non-breaking change which fixes an issue v17 Krypton
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants