diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-12-09 14:41:30 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-09 14:41:30 +1000 |
commit | a1a54171625b757889ca137c8169ba48fdd4b181 (patch) | |
tree | ab54f9b5e961866f0ffd00d09a6f8373b586260c | |
parent | 36e24482e2ecc8c62d0f3d049f67db98ca162f9e (diff) | |
parent | 237c3cd09d8a1b5a3d2f157ab7f900cd8a8b6319 (diff) |
Merge pull request #23869 from lrusak/drm-gbm-references
CGBMUtils: return references to objects in getters
-rw-r--r-- | xbmc/utils/GBMBufferObject.cpp | 2 | ||||
-rw-r--r-- | xbmc/windowing/gbm/GBMUtils.cpp | 4 | ||||
-rw-r--r-- | xbmc/windowing/gbm/GBMUtils.h | 6 | ||||
-rw-r--r-- | xbmc/windowing/gbm/WinSystemGbm.cpp | 4 | ||||
-rw-r--r-- | xbmc/windowing/gbm/WinSystemGbm.h | 2 | ||||
-rw-r--r-- | xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp | 10 |
6 files changed, 14 insertions, 14 deletions
diff --git a/xbmc/utils/GBMBufferObject.cpp b/xbmc/utils/GBMBufferObject.cpp index 90c4017c3d..c3b21ecea9 100644 --- a/xbmc/utils/GBMBufferObject.cpp +++ b/xbmc/utils/GBMBufferObject.cpp @@ -30,7 +30,7 @@ void CGBMBufferObject::Register() CGBMBufferObject::CGBMBufferObject() { m_device = - static_cast<CWinSystemGbmEGLContext*>(CServiceBroker::GetWinSystem())->GetGBMDevice()->Get(); + static_cast<CWinSystemGbmEGLContext*>(CServiceBroker::GetWinSystem())->GetGBMDevice().Get(); } CGBMBufferObject::~CGBMBufferObject() diff --git a/xbmc/windowing/gbm/GBMUtils.cpp b/xbmc/windowing/gbm/GBMUtils.cpp index 5267c93c8f..0ac2b854ba 100644 --- a/xbmc/windowing/gbm/GBMUtils.cpp +++ b/xbmc/windowing/gbm/GBMUtils.cpp @@ -74,7 +74,7 @@ CGBMUtils::CGBMDevice::CGBMSurface::CGBMSurface(gbm_surface* surface) : m_surfac { } -CGBMUtils::CGBMDevice::CGBMSurface::CGBMSurfaceBuffer* CGBMUtils::CGBMDevice::CGBMSurface:: +CGBMUtils::CGBMDevice::CGBMSurface::CGBMSurfaceBuffer& CGBMUtils::CGBMDevice::CGBMSurface:: LockFrontBuffer() { m_buffers.emplace(std::make_unique<CGBMSurfaceBuffer>(m_surface)); @@ -92,7 +92,7 @@ CGBMUtils::CGBMDevice::CGBMSurface::CGBMSurfaceBuffer* CGBMUtils::CGBMDevice::CG m_buffers.pop(); } - return m_buffers.back().get(); + return *m_buffers.back(); } CGBMUtils::CGBMDevice::CGBMSurface::CGBMSurfaceBuffer::CGBMSurfaceBuffer(gbm_surface* surface) diff --git a/xbmc/windowing/gbm/GBMUtils.h b/xbmc/windowing/gbm/GBMUtils.h index 291a93a32d..0312834619 100644 --- a/xbmc/windowing/gbm/GBMUtils.h +++ b/xbmc/windowing/gbm/GBMUtils.h @@ -125,7 +125,7 @@ public: * * @return CGBMSurfaceBuffer* A pointer to a CGBMSurfaceBuffer object */ - CGBMSurfaceBuffer* LockFrontBuffer(); + CGBMSurfaceBuffer& LockFrontBuffer(); private: gbm_surface* m_surface{nullptr}; @@ -137,7 +137,7 @@ public: * * @return CGBMSurface* A pointer to the CGBMSurface object */ - CGBMDevice::CGBMSurface* GetSurface() const { return m_surface.get(); } + CGBMDevice::CGBMSurface& GetSurface() const { return *m_surface; } private: gbm_device* m_device{nullptr}; @@ -158,7 +158,7 @@ public: * * @return CGBMDevice* A pointer to the CGBMDevice object */ - CGBMUtils::CGBMDevice* GetDevice() const { return m_device.get(); } + CGBMUtils::CGBMDevice& GetDevice() const { return *m_device; } private: struct CGBMDeviceDeleter diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp index f334156d89..6569718b3d 100644 --- a/xbmc/windowing/gbm/WinSystemGbm.cpp +++ b/xbmc/windowing/gbm/WinSystemGbm.cpp @@ -242,7 +242,7 @@ bool CWinSystemGbm::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl if (!std::dynamic_pointer_cast<CDRMAtomic>(m_DRM)) { - bo = m_GBM->GetDevice()->GetSurface()->LockFrontBuffer()->Get(); + bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer().Get(); } auto result = m_DRM->SetVideoMode(res, bo); @@ -290,7 +290,7 @@ void CWinSystemGbm::FlipPage(bool rendered, bool videoLayer, bool async) if (rendered) { - bo = m_GBM->GetDevice()->GetSurface()->LockFrontBuffer()->Get(); + bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer().Get(); } m_DRM->FlipPage(bo, rendered, videoLayer, async); diff --git a/xbmc/windowing/gbm/WinSystemGbm.h b/xbmc/windowing/gbm/WinSystemGbm.h index 879d0f58f8..9609675d72 100644 --- a/xbmc/windowing/gbm/WinSystemGbm.h +++ b/xbmc/windowing/gbm/WinSystemGbm.h @@ -71,7 +71,7 @@ public: m_videoLayerBridge = std::move(bridge); }; - CGBMUtils::CGBMDevice* GetGBMDevice() const { return m_GBM->GetDevice(); } + CGBMUtils::CGBMDevice& GetGBMDevice() const { return m_GBM->GetDevice(); } std::shared_ptr<CDRMUtils> GetDrm() const { return m_DRM; } std::vector<std::string> GetConnectedOutputs() override; diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp index ee27fba1bd..fac914d5e9 100644 --- a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp +++ b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp @@ -23,7 +23,7 @@ bool CWinSystemGbmEGLContext::InitWindowSystemEGL(EGLint renderableType, EGLint return false; } - if (!m_eglContext.CreatePlatformDisplay(m_GBM->GetDevice()->Get(), m_GBM->GetDevice()->Get())) + if (!m_eglContext.CreatePlatformDisplay(m_GBM->GetDevice().Get(), m_GBM->GetDevice().Get())) { return false; } @@ -98,8 +98,8 @@ bool CWinSystemGbmEGLContext::CreateNewWindow(const std::string& name, if (plane) modifiers = plane->GetModifiersForFormat(format); - if (!m_GBM->GetDevice()->CreateSurface(res.iWidth, res.iHeight, format, modifiers.data(), - modifiers.size())) + if (!m_GBM->GetDevice().CreateSurface(res.iWidth, res.iHeight, format, modifiers.data(), + modifiers.size())) { CLog::Log(LOGERROR, "CWinSystemGbmEGLContext::{} - failed to initialize GBM", __FUNCTION__); return false; @@ -109,8 +109,8 @@ bool CWinSystemGbmEGLContext::CreateNewWindow(const std::string& name, static_assert(sizeof(EGLNativeWindowType) == sizeof(gbm_surface*), "Declaration specifier differs in size"); if (!m_eglContext.CreatePlatformSurface( - m_GBM->GetDevice()->GetSurface()->Get(), - reinterpret_cast<khronos_uintptr_t>(m_GBM->GetDevice()->GetSurface()->Get()))) + m_GBM->GetDevice().GetSurface().Get(), + reinterpret_cast<khronos_uintptr_t>(m_GBM->GetDevice().GetSurface().Get()))) { return false; } |