garbear / xbmc

XBMC Main Repository
http://xbmc.org
Other
132 stars 53 forks source link

[RetroPlayer] Add basic resolution changing #98

Closed GTechAlpha closed 6 years ago

GTechAlpha commented 6 years ago

Description

Add basic resolution changing.

Motivation and Context

RetroPlayer does not render after resolution change.

How Has This Been Tested?

PCSX, GenesisPlus, Nestopia. Example: FFVII on PCSX changes resolution every time the in-game menu is accessed.

Screenshots (if appropriate):

Types of change

garbear commented 6 years ago

In general this is a good approach. I only found one flaw, which I sent you in https://github.com/GTechAlpha/xbmc/pull/1. Once this gets cleaned up it's good to go.

garbear commented 6 years ago

https://github.com/GTechAlpha/xbmc/pull/3

garbear commented 6 years ago

I see one more change that's needed:

std::map<AVPixelFormat, SwsContext*> m_scalers;

m_scalers needs to be indexed by format, width and height instead of just format.

GTechAlpha commented 6 years ago

This should be good to go, AFAIK.

garbear commented 6 years ago

What about this? we could split configuration and reconfiguration: https://github.com/garbear/xbmc/commit/rp-video

Switch to Fullscreen msg should only be sent once. I imagine your amlogic patch doesn't need to be called multiple times either. "re"configuration of the renderers, by definition, doesn't need to happen in the first configuration. So having separate configuration and reconfiguration states makes sense.

garbear commented 6 years ago

Also this: https://github.com/garbear/xbmc/commit/rp-buffers

Buffers need to be protected by the buffer mutex.

GTechAlpha commented 6 years ago

The buffer is protected by m_bFlush plus this being on the render thread.

garbear commented 6 years ago

The game thread can access the buffers.

Also I looked into the m_scalers comment above and no changes are needed for this.

garbear commented 6 years ago

I see that m_bFlush protects the buffers. Still, should we be defensive?

GTechAlpha commented 6 years ago

It is inefficient to lock when unnecessary though right? Maybe a comment?

garbear commented 6 years ago

Comment is fine. When I see buffer access without a mutex I get worried, so explaining why would be good.

Also, thoughts on https://github.com/garbear/xbmc/pull/98#issuecomment-397124590?

GTechAlpha commented 6 years ago

What about this? we could split configuration and reconfiguration: rp-vide

Switch to Fullscreen msg should only be sent once. I imagine your amlogic patch doesn't need to be called multiple times either. "re"configuration of the renderers, by definition, doesn't need to happen in the first configuration. So having separate configuration and reconfiguration states makes sense.

Yes, the Amlogic code only needs to be called once. I think would be a good addition.

garbear commented 6 years ago

K, Configure() needs a way to know which state to set

GTechAlpha commented 6 years ago

I'll add when I get a chance.

GTechAlpha commented 6 years ago

Anything else on this one?

garbear commented 6 years ago

Almost :) In the buffer lock commit, m_bHasCachedFrame and m_cachedFrame should be reset within the lock. Also I'll send you a PR with a reconfig tweak that I think improves the code.

garbear commented 6 years ago

@GTechAlpha: https://github.com/GTechAlpha/xbmc/pull/4

garbear commented 6 years ago

squash into two commits and i'll merge!

GTechAlpha commented 6 years ago

:thumbsup: