-
Notifications
You must be signed in to change notification settings - Fork 11
Fix macOS support #74
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,9 +36,9 @@ | |
| #include "gl/YUVConverter.h" | ||
| #include "gl/gles2_dec/gles2_dec.h" | ||
| #include "gl/glestranslator/EGL/EglGlobalInfo.h" | ||
| #include "ContextHelper.h" | ||
| #endif | ||
|
|
||
| #include "ContextHelper.h" | ||
| #include "Hwc2.h" | ||
| #include "NativeSubWindow.h" | ||
| #include "RenderThreadInfo.h" | ||
|
|
@@ -477,12 +477,6 @@ class FrameBuffer::Impl : public gfxstream::base::EventNotificationSupport<Frame | |
| gl::EmulationGl& getEmulationGl(); | ||
| bool hasEmulationGl() const { return m_emulationGl != nullptr; } | ||
|
|
||
| vk::VkEmulation& getEmulationVk(); | ||
| bool hasEmulationVk() const { return m_emulationVk != nullptr; } | ||
|
|
||
| bool setColorBufferVulkanMode(HandleType colorBufferHandle, uint32_t mode); | ||
| int32_t mapGpaToBufferHandle(uint32_t bufferHandle, uint64_t gpa, uint64_t size); | ||
|
|
||
| // Return the host EGLDisplay used by this instance. | ||
| EGLDisplay getDisplay() const; | ||
| EGLSurface getWindowSurface() const; | ||
|
|
@@ -579,6 +573,12 @@ class FrameBuffer::Impl : public gfxstream::base::EventNotificationSupport<Frame | |
| const gl::GLESv2Dispatch* getGles2Dispatch(); | ||
| #endif | ||
|
|
||
| vk::VkEmulation& getEmulationVk(); | ||
| bool hasEmulationVk() const { return m_emulationVk != nullptr; } | ||
|
|
||
| bool setColorBufferVulkanMode(HandleType colorBufferHandle, uint32_t mode); | ||
| int32_t mapGpaToBufferHandle(uint32_t bufferHandle, uint64_t gpa, uint64_t size); | ||
|
|
||
| // Retrieve the vendor info strings for the GPU driver used for the emulation. | ||
| // On return, |*vendor|, |*renderer| and |*version| will point to strings | ||
| // that are owned by the instance (and must not be freed by the caller). | ||
|
|
@@ -726,7 +726,9 @@ class FrameBuffer::Impl : public gfxstream::base::EventNotificationSupport<Frame | |
| } | ||
| }; | ||
| std::map<uint32_t, onPost> m_onPost; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| ReadbackWorker* m_readbackWorker = nullptr; | ||
| #endif | ||
| gfxstream::base::WorkerThread<Readback> m_readbackThread; | ||
| std::atomic_bool m_readbackThreadStarted = false; | ||
|
|
||
|
|
@@ -1277,6 +1279,7 @@ FrameBuffer::Impl::~Impl() { | |
|
|
||
| WorkerProcessingResult FrameBuffer::Impl::sendReadbackWorkerCmd(const Readback& readback) { | ||
| ensureReadbackWorker(); | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code block is not directly using GL, so instead of disabling the functionality here I think we need to implement a vulkan version of the readback worker class, or a dummy one that throws errors for now, to make sure |
||
| switch (readback.cmd) { | ||
| case ReadbackCmd::Init: | ||
| m_readbackWorker->init(); | ||
|
|
@@ -1293,6 +1296,7 @@ WorkerProcessingResult FrameBuffer::Impl::sendReadbackWorkerCmd(const Readback& | |
| case ReadbackCmd::Exit: | ||
| return WorkerProcessingResult::Stop; | ||
| } | ||
| #endif | ||
| return WorkerProcessingResult::Stop; | ||
| } | ||
|
|
||
|
|
@@ -1721,9 +1725,11 @@ HandleType FrameBuffer::Impl::genHandle_locked() { | |
|
|
||
| bool FrameBuffer::Impl::isFormatSupported(GLenum format) { | ||
| bool supported = true; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| if (m_emulationGl) { | ||
| supported &= m_emulationGl->isFormatSupported(format); | ||
| } | ||
| #endif | ||
| if (m_emulationVk) { | ||
| supported &= m_emulationVk->isFormatSupported(format); | ||
| } | ||
|
|
@@ -2078,8 +2084,8 @@ void FrameBuffer::Impl::cleanupProcGLObjects(uint64_t puid) { | |
| std::vector<HandleType> FrameBuffer::Impl::cleanupProcGLObjects_locked(uint64_t puid, bool forced) { | ||
| std::vector<HandleType> colorBuffersToCleanup; | ||
| { | ||
| std::unique_ptr<RecursiveScopedContextBind> bind = nullptr; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| std::unique_ptr<RecursiveScopedContextBind> bind = nullptr; | ||
| if (m_emulationGl) { | ||
| bind = std::make_unique<RecursiveScopedContextBind>(getPbufferSurfaceContextHelper()); | ||
| } | ||
|
|
@@ -2438,11 +2444,13 @@ AsyncResult FrameBuffer::Impl::postImpl(HandleType p_colorbuffer, Post::Completi | |
|
|
||
| if (asyncReadbackSupported()) { | ||
| ensureReadbackWorker(); | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| const auto status = m_readbackWorker->doNextReadback( | ||
| iter.first, cb.get(), iter.second.img, repaint, iter.second.readBgra); | ||
| if (status == ReadbackWorker::DoNextReadbackResult::OK_READY_FOR_READ) { | ||
| doPostCallback(iter.second.img, iter.first); | ||
| } | ||
| #endif | ||
| } else { | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| cb->glOpReadback(iter.second.img, iter.second.readBgra); | ||
|
|
@@ -2489,10 +2497,12 @@ void FrameBuffer::Impl::flushReadPipeline(int displayId) { | |
|
|
||
| ensureReadbackWorker(); | ||
|
|
||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| const auto status = m_readbackWorker->flushPipeline(displayId); | ||
| if (status == ReadbackWorker::FlushResult::OK_READY_FOR_READ) { | ||
| doPostCallback(nullptr, displayId); | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
| void FrameBuffer::Impl::ensureReadbackWorker() { | ||
|
|
@@ -2825,8 +2835,8 @@ void FrameBuffer::Impl::onSave(Stream* stream, const ITextureSaverPtr& textureSa | |
| // m_prevDrawSurf | ||
| AutoLock mutex(m_lock); | ||
|
|
||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| if (m_emulationGl) { | ||
| // Some snapshot commands try using GL. | ||
| bind = std::make_unique<RecursiveScopedContextBind>(getPbufferSurfaceContextHelper()); | ||
|
|
@@ -2953,8 +2963,8 @@ bool FrameBuffer::Impl::onLoad(Stream* stream, const ITextureLoaderPtr& textureL | |
| { | ||
| sweepColorBuffersLocked(); | ||
|
|
||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| if (m_emulationGl) { | ||
| // Some snapshot commands try using GL. | ||
| bind = std::make_unique<RecursiveScopedContextBind>(getPbufferSurfaceContextHelper()); | ||
|
|
@@ -3175,8 +3185,8 @@ bool FrameBuffer::Impl::onLoad(Stream* stream, const ITextureLoaderPtr& textureL | |
| #endif | ||
|
|
||
| { | ||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| std::unique_ptr<RecursiveScopedContextBind> bind; | ||
| if (m_emulationGl) { | ||
| // Some snapshot commands try using GL. | ||
| bind = std::make_unique<RecursiveScopedContextBind>(getPbufferSurfaceContextHelper()); | ||
|
|
@@ -4718,7 +4728,9 @@ void FrameBuffer::unlockContextStructureRead() { mImpl->unlockContextStructureRe | |
|
|
||
| void FrameBuffer::createTrivialContext(HandleType shared, HandleType* contextOut, | ||
| HandleType* surfOut) { | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| mImpl->createTrivialContext(shared, contextOut, surfOut); | ||
| #endif | ||
| } | ||
|
|
||
| void FrameBuffer::setShuttingDown() { mImpl->setShuttingDown(); } | ||
|
|
@@ -4759,7 +4771,9 @@ float FrameBuffer::getPy() const { return mImpl->getPy(); } | |
| int FrameBuffer::getZrot() const { return mImpl->getZrot(); } | ||
|
|
||
| void FrameBuffer::setScreenMask(int width, int height, const uint8_t* rgbaData) { | ||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| mImpl->setScreenMask(width, height, rgbaData); | ||
| #endif | ||
| } | ||
|
|
||
| #ifdef CONFIG_AEMU | ||
|
|
@@ -4913,7 +4927,9 @@ std::optional<BlobDescriptorInfo> FrameBuffer::exportBuffer(HandleType bufferHan | |
| return mImpl->exportBuffer(bufferHandle); | ||
| } | ||
|
|
||
| #if GFXSTREAM_ENABLE_HOST_GLES | ||
| bool FrameBuffer::hasEmulationGl() const { return mImpl->hasEmulationGl(); } | ||
| #endif | ||
|
|
||
| bool FrameBuffer::hasEmulationVk() const { return mImpl->hasEmulationVk(); } | ||
|
|
||
|
|
@@ -4970,11 +4986,6 @@ EGLint FrameBuffer::chooseConfig(EGLint* attribs, EGLint* configs, EGLint config | |
| return mImpl->chooseConfig(attribs, configs, configsSize); | ||
| } | ||
|
|
||
| void FrameBuffer::getDeviceInfo(const char** vendor, const char** renderer, | ||
| const char** version) const { | ||
| mImpl->getDeviceInfo(vendor, renderer, version); | ||
| } | ||
|
|
||
| HandleType FrameBuffer::createEmulatedEglContext(int p_config, HandleType p_share, | ||
| GLESApi version) { | ||
| return mImpl->createEmulatedEglContext(p_config, p_share, version); | ||
|
|
@@ -5110,6 +5121,11 @@ const void* FrameBuffer::getGles2Dispatch() { return mImpl->getGles2Dispatch(); | |
|
|
||
| #endif | ||
|
|
||
| void FrameBuffer::getDeviceInfo(const char** vendor, const char** renderer, | ||
| const char** version) const { | ||
| mImpl->getDeviceInfo(vendor, renderer, version); | ||
| } | ||
|
|
||
| const FeatureSet& FrameBuffer::getFeatures() const { return mImpl->getFeatures(); } | ||
|
|
||
| RepresentativeColorBufferMemoryTypeInfo FrameBuffer::getRepresentativeColorBufferMemoryTypeInfo() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo ';'I think this function is not being used, please remove.