From f2ce6d0201235a029f9695a247037b9cc2735fb4 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 28 Sep 2023 22:44:19 -0700 Subject: CGBMUtils: return a reference to CGBMDevice Signed-off-by: Lukas Rusak --- xbmc/utils/GBMBufferObject.cpp | 2 +- xbmc/windowing/gbm/GBMUtils.h | 2 +- xbmc/windowing/gbm/WinSystemGbm.cpp | 4 ++-- xbmc/windowing/gbm/WinSystemGbm.h | 2 +- xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp | 10 +++++----- 5 files changed, 10 insertions(+), 10 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(CServiceBroker::GetWinSystem())->GetGBMDevice()->Get(); + static_cast(CServiceBroker::GetWinSystem())->GetGBMDevice().Get(); } CGBMBufferObject::~CGBMBufferObject() diff --git a/xbmc/windowing/gbm/GBMUtils.h b/xbmc/windowing/gbm/GBMUtils.h index 291a93a32d..876cc31148 100644 --- a/xbmc/windowing/gbm/GBMUtils.h +++ b/xbmc/windowing/gbm/GBMUtils.h @@ -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 34c8c16fe4..2509f288d6 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(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) if (rendered) { - bo = m_GBM->GetDevice()->GetSurface()->LockFrontBuffer()->Get(); + bo = m_GBM->GetDevice().GetSurface()->LockFrontBuffer()->Get(); } m_DRM->FlipPage(bo, rendered, videoLayer); diff --git a/xbmc/windowing/gbm/WinSystemGbm.h b/xbmc/windowing/gbm/WinSystemGbm.h index a800acef6b..8993b6d278 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 GetDrm() const { return m_DRM; } std::vector GetConnectedOutputs() override; diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp index 83a59413f7..a80026fc32 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; } @@ -87,8 +87,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; @@ -98,8 +98,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(m_GBM->GetDevice()->GetSurface()->Get()))) + m_GBM->GetDevice().GetSurface()->Get(), + reinterpret_cast(m_GBM->GetDevice().GetSurface()->Get()))) { return false; } -- cgit v1.2.3 From e0c7d9b54b552fb3e676ae78bbbace2c27e18c98 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 28 Sep 2023 22:46:46 -0700 Subject: CGBMDevice: return a reference to CGBMSurface Signed-off-by: Lukas Rusak --- xbmc/windowing/gbm/GBMUtils.h | 2 +- xbmc/windowing/gbm/WinSystemGbm.cpp | 4 ++-- xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xbmc/windowing/gbm/GBMUtils.h b/xbmc/windowing/gbm/GBMUtils.h index 876cc31148..259a2870c2 100644 --- a/xbmc/windowing/gbm/GBMUtils.h +++ b/xbmc/windowing/gbm/GBMUtils.h @@ -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}; diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp index 2509f288d6..2b087d8f81 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(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) if (rendered) { - bo = m_GBM->GetDevice().GetSurface()->LockFrontBuffer()->Get(); + bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer()->Get(); } m_DRM->FlipPage(bo, rendered, videoLayer); diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp index a80026fc32..2fb742efed 100644 --- a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp +++ b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp @@ -98,8 +98,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(m_GBM->GetDevice().GetSurface()->Get()))) + m_GBM->GetDevice().GetSurface().Get(), + reinterpret_cast(m_GBM->GetDevice().GetSurface().Get()))) { return false; } -- cgit v1.2.3 From 237c3cd09d8a1b5a3d2f157ab7f900cd8a8b6319 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 28 Sep 2023 22:48:26 -0700 Subject: CGBMSurface: return a reference to CGBMSurfaceBuffer Signed-off-by: Lukas Rusak --- xbmc/windowing/gbm/GBMUtils.cpp | 4 ++-- xbmc/windowing/gbm/GBMUtils.h | 2 +- xbmc/windowing/gbm/WinSystemGbm.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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(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 259a2870c2..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}; diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp index 2b087d8f81..da5609490a 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(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) if (rendered) { - bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer()->Get(); + bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer().Get(); } m_DRM->FlipPage(bo, rendered, videoLayer); -- cgit v1.2.3