-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
RetroPlayer: Add renderer for Windows, OpenGL, OpenGLES and MMAL #12715
Conversation
ddc9dac
to
b6a6b3b
Compare
Rebased after the merge of #12665. Still TODO are a few remaining steps to fully separate RP and VP, including the separation of CProcessInfo. |
m_dataCache->SetRenderClockSync(false); | ||
m_dataCache->SetStateSeeking(false); | ||
m_dataCache->SetSpeed(1.0f, 1.0f); | ||
m_dataCache->SetGuiRender(true); //! @todo |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
m_dataCache->SetStateSeeking(false); | ||
m_dataCache->SetSpeed(1.0f, 1.0f); | ||
m_dataCache->SetGuiRender(true); //! @todo | ||
m_dataCache->SetVideoRender(true); //! @todo |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
jenkins build this please (to check GLES code) |
Just a warning that rendering through GLES will be significantly less efficient. Prior to this PR on Pi we will directly render in the game's native bitmap format (e.g. RGB565, RGB888, RGBA32) to a separate layer without any copying required. A few years ago all ARM platforms rendered video through GL. But performance sucked and now all ARM platforms render video directly on a separate video plane, mostly using zero copy. I understand that for emulating 3D consoles you need GL rendering (although whether performance will be adequate for this class of emulation is questionable). Also you may want it for shader based scanline effects. But I worry this scheme will rule out a class of emulation that previously worked acceptably but will no longer with the GL renderer. It is possible we will want to support platform specific (e.g. MMAL) renderers for RP in the same way as we do for VP. |
Agreed, a MMAL renderer for RetroPlayer would be desirable. Do you have time to implement this? It's pretty much just a matter of copying the VP renderer and removing all the video stuff. If not, I can handle this eventually. Using MMAL for rendering would preclude the use of shaders, right? |
I can help with MMAL renderer support when I get some time. I don't see a good way to use shaders alongside MMAL (you would lose the zero copy path so may as well render with GL as your pixels are already there). |
Most ARMs (including IMX) offer some pseudo vendor optimized GL extensions to simulate a zero copy or at least a DMA copy to the 3D GPU. Still that would also be less performant as "passthrough" rendering, but perhaps some custom shader / GL code could be supported that way? eglCreateImage might be a candidate when doing it in a standard way? |
m_targetPixFormat = AV_PIX_FMT_BGRA; | ||
m_targetDxFormat = DXGI_FORMAT_B8G8R8X8_UNORM; | ||
if (g_Windowing.IsFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, D3D11_USAGE_DYNAMIC)) | ||
m_targetDxFormat = DXGI_FORMAT_B8G8R8A8_UNORM; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -69,7 +69,7 @@ bool CRPWinRenderer::Configure(AVPixelFormat format, unsigned int width, unsigne | |||
m_renderOrientation = orientation; | |||
|
|||
m_targetPixFormat = AV_PIX_FMT_BGRA; | |||
m_targetDxFormat = DXGI_FORMAT_B8G8R8X8_UNORM; | |||
m_targetDxFormat = g_Windowing.GetBackBuffer()->GetFormat(); | |||
if (g_Windowing.IsFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, D3D11_USAGE_DYNAMIC)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Updated with fixes from the last week |
1b90589
to
606dfde
Compare
Rebased after #12761, included recent changes from my shaders work and squashed. Just one bit of code in the GLES renderer needed before merging. |
/* | ||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | ||
|
||
glBegin(GL_QUADS); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
~CGUIRenderFullScreen() override = default; | ||
|
||
void Render() override; | ||
void RenderEx() override; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@popcornmix I've started working on MMAL support. The buffers in RetroPlayer are very basic and can't handle things like buffer pools. I'll let you know when the new buffer architecture is complete so we can get MMAL rendering to work. One of the features that flew into this PR before the last rebase was the ability to have multiple renderers at the same time. In the GSoC code, renderers are indexed by shader preset and are swapped around as needed. I don't see any reason we can't switch between MMAL and GLES depending on which features they support. |
@popcornmix I've added a MMAL renderer based on the VideoPlayer code. It needs some more work, but should serve as a good base for MMAL support. Now that we have a buffer and buffer pool abstraction, I'll port the existing renderers to it so that we can achieve zero-copy support. |
CGUIInfoLabel m_viewModeInfo; | ||
|
||
CGUIRenderSettings m_renderSettings; | ||
// Rendering properties | ||
bool m_bHasShaderPreset = false; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@garbear this needs a rebase |
b79a319
to
f1681f8
Compare
@MilhouseVH try applying this PR to newclock5 now |
Thanks, this now builds for both x86. For RPi (with newclock5), I had to revert fd269e5 and 940050c before applying this PR on top of newclock5, and this now fails to build: http://sprunge.us/NGjJ |
f1681f8
to
43f33a8
Compare
I applied this PR to newclock5. There was only 1 line that needed to be changed to fix the build breakage you just got. I've pushed the rebased PR to: https://github.com/garbear/xbmc/commits/rp-renderer-pi. Shall I open a PR against newclock5, or can you just cherry-pick the commits? |
43f33a8
to
f1681f8
Compare
I'm not sure you need to open a PR against newclock5 as newclock5 already contains the changes you have in this PR (1, 2), hence the two conflicts when applying this PR on top of newclock5. I'm locally reverting the two commits from this PR that I mentioned previously in order to be able to apply this PR on top of newclock5, and that works for me. Assuming this PR goes in first then @popcornmix can just rebase the newclock5 branch as normal and drop his two commits. I can cherry-pick garbear@af7aa57 for now. With it, this PR now builds for RPi (on top of newclock5), and x86 also builds so looking good. Not yet run-time tested, but will include in tonight's release if no obvious problems with video playback. |
@garbear legacy OpenGL aka fixed function pipeline does not use shaders. That means that we have to migrate GUI rendering and picture rendering to profile 3.2. VP does already make use of shaders. |
@VelocityRa you are right, there are some parts still legacy. |
I fixed the GLES renderer on the RPi. MMAL isn't ready yet, so it's been disabled. This PR is ready to go in now. @FernetMenta can you sign off on the two guilib changes? |
7385696
to
4c2bcda
Compare
xbmc/guilib/Texture.h
Outdated
@@ -91,7 +91,7 @@ class CBaseTexture | |||
|
|||
virtual void CreateTextureObject() = 0; | |||
virtual void DestroyTextureObject() = 0; | |||
virtual void LoadToGPU() = 0; | |||
virtual void LoadToGPU(bool bFreeSysMem = true) = 0; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This splits several enums and a typedef into a new header file, RenderSystemTypes.h. This avoids a dependence on the base rendering system class if external code only uses the type.
This better encapsulates RetroPlayer quirks.
This allows for a single frame to reach the RenderManager after pausing.
This renderer is based on a combination of the old RetroPlayer code and VP's renderer. Incomplete and untested, but a good starting point.
9fb157e
to
e00cb97
Compare
@FernetMenta sign off on the updated guilib commit? |
jenkins build this please |
@garbear much better. thanks |
win32 error unrelated |
This takes a significant step forward by separating the RetroPlayer and VideoPlayer renderers. The new RP renderer is pretty bare, and just contains enough code to render RGB images delivered from game add-ons.
Motivation and Context
Based on garbear#84
How Has This Been Tested?
Tested on Windows, Linux and OSX. The OpenGLES renderer hasn't been tested yet, but it uses mostly the same code as the OpenGL renderer.
Types of change