diff --git a/projects/Amlogic/patches/kodi/kodi-PR15922.patch b/projects/Amlogic/patches/kodi/kodi-PR15922.patch deleted file mode 100644 index 577fb772e1..0000000000 --- a/projects/Amlogic/patches/kodi/kodi-PR15922.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 4d6af620f4d6a6645229dcf3403a397dfb1a8a93 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Mon, 15 Apr 2019 16:51:09 -0700 -Subject: [PATCH] CDRMUtils: rework modifiers flag selection - ---- - xbmc/windowing/gbm/DRMUtils.cpp | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp -index df46ad4bdc25..8e1ec9d0dcb5 100644 ---- a/xbmc/windowing/gbm/DRMUtils.cpp -+++ b/xbmc/windowing/gbm/DRMUtils.cpp -@@ -109,10 +109,13 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo) - memset(offsets, 0, 16); - #endif - -- if (modifiers[0] == DRM_FORMAT_MOD_INVALID) -- modifiers[0] = DRM_FORMAT_MOD_LINEAR; -+ uint32_t flags = 0; - -- CLog::Log(LOGDEBUG, "CDRMUtils::%s - using modifier: %lli", __FUNCTION__, modifiers[0]); -+ if (modifiers[0] && modifiers[0] != DRM_FORMAT_MOD_INVALID) -+ { -+ flags |= DRM_MODE_FB_MODIFIERS; -+ CLog::Log(LOGDEBUG, "CDRMUtils::{} - using modifier: {:#x}", __FUNCTION__, modifiers[0]); -+ } - - auto ret = drmModeAddFB2WithModifiers(m_fd, - width, -@@ -123,7 +126,7 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo) - offsets, - modifiers, - &fb->fb_id, -- (modifiers[0] > 0) ? DRM_MODE_FB_MODIFIERS : 0); -+ flags); - - if(ret) - { diff --git a/projects/Amlogic/patches/kodi/kodi-PR15928.patch b/projects/Amlogic/patches/kodi/kodi-PR15928.patch deleted file mode 100644 index e1f374c713..0000000000 --- a/projects/Amlogic/patches/kodi/kodi-PR15928.patch +++ /dev/null @@ -1,383 +0,0 @@ -From af01b284b158891d258b3a2617697b9779af11c5 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Thu, 7 Mar 2019 15:08:24 -0800 -Subject: [PATCH 1/4] CEGLFence: add class to help with EGL sync objects - ---- - xbmc/utils/CMakeLists.txt | 6 ++-- - xbmc/utils/EGLFence.cpp | 68 +++++++++++++++++++++++++++++++++++++++ - xbmc/utils/EGLFence.h | 32 ++++++++++++++++++ - 3 files changed, 104 insertions(+), 2 deletions(-) - create mode 100644 xbmc/utils/EGLFence.cpp - create mode 100644 xbmc/utils/EGLFence.h - -diff --git a/xbmc/utils/CMakeLists.txt b/xbmc/utils/CMakeLists.txt -index f0ce99014b84..6dbee35a1a60 100644 ---- a/xbmc/utils/CMakeLists.txt -+++ b/xbmc/utils/CMakeLists.txt -@@ -169,8 +169,10 @@ if(XSLT_FOUND) - list(APPEND HEADERS XSLTUtils.h) - endif() - if(EGL_FOUND) -- list(APPEND SOURCES EGLUtils.cpp) -- list(APPEND HEADERS EGLUtils.h) -+ list(APPEND SOURCES EGLUtils.cpp -+ EGLFence.cpp) -+ list(APPEND HEADERS EGLUtils.h -+ EGLFence.h) - endif() - - # The large map trips the clang optimizer -diff --git a/xbmc/utils/EGLFence.cpp b/xbmc/utils/EGLFence.cpp -new file mode 100644 -index 000000000000..55cc45c4282a ---- /dev/null -+++ b/xbmc/utils/EGLFence.cpp -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (C) 2017-2018 Team Kodi -+ * This file is part of Kodi - https://kodi.tv -+ * -+ * SPDX-License-Identifier: GPL-2.0-or-later -+ * See LICENSES/README.md for more information. -+ */ -+ -+#include "EGLFence.h" -+ -+#include "EGLUtils.h" -+ -+CEGLFence::CEGLFence(EGLDisplay display) : -+ m_display(display) -+{ -+ m_eglCreateSyncKHR = CEGLUtils::GetRequiredProcAddress("eglCreateSyncKHR"); -+ m_eglDestroySyncKHR = CEGLUtils::GetRequiredProcAddress("eglDestroySyncKHR"); -+ m_eglGetSyncAttribKHR = CEGLUtils::GetRequiredProcAddress("eglGetSyncAttribKHR"); -+} -+ -+bool CEGLFence::CreateFence() -+{ -+ m_fence = m_eglCreateSyncKHR(m_display, EGL_SYNC_FENCE_KHR, nullptr); -+ if (m_fence == EGL_NO_SYNC_KHR) -+ { -+ CEGLUtils::LogError("failed to create egl sync fence"); -+ return false; -+ } -+ -+ return true; -+} -+ -+void CEGLFence::DestroyFence() -+{ -+ if (m_fence == EGL_NO_SYNC_KHR) -+ { -+ return; -+ } -+ -+ if (m_eglDestroySyncKHR(m_display, m_fence) != EGL_TRUE) -+ { -+ CEGLUtils::LogError("failed to destroy egl sync fence"); -+ } -+ -+ m_fence = EGL_NO_SYNC_KHR; -+} -+ -+bool CEGLFence::IsSignaled() -+{ -+ if (m_fence == EGL_NO_SYNC_KHR) -+ { -+ return false; -+ } -+ -+ EGLint status = EGL_UNSIGNALED_KHR; -+ if (m_eglGetSyncAttribKHR(m_display, m_fence, EGL_SYNC_STATUS_KHR, &status) != EGL_TRUE) -+ { -+ CEGLUtils::LogError("failed to query egl sync fence"); -+ return false; -+ } -+ -+ if (status == EGL_SIGNALED_KHR) -+ { -+ return true; -+ } -+ -+ return false; -+} -diff --git a/xbmc/utils/EGLFence.h b/xbmc/utils/EGLFence.h -new file mode 100644 -index 000000000000..eb285ac4260e ---- /dev/null -+++ b/xbmc/utils/EGLFence.h -@@ -0,0 +1,32 @@ -+/* -+ * Copyright (C) 2017-2018 Team Kodi -+ * This file is part of Kodi - https://kodi.tv -+ * -+ * SPDX-License-Identifier: GPL-2.0-or-later -+ * See LICENSES/README.md for more information. -+ */ -+ -+#pragma once -+ -+#include -+#include -+ -+class CEGLFence -+{ -+public: -+ explicit CEGLFence(EGLDisplay display); -+ CEGLFence(CEGLFence const& other) = delete; -+ CEGLFence& operator=(CEGLFence const& other) = delete; -+ -+ bool CreateFence(); -+ void DestroyFence(); -+ bool IsSignaled(); -+ -+private: -+ EGLDisplay m_display{nullptr}; -+ EGLSyncKHR m_fence{nullptr}; -+ -+ PFNEGLCREATESYNCKHRPROC m_eglCreateSyncKHR{nullptr}; -+ PFNEGLDESTROYSYNCKHRPROC m_eglDestroySyncKHR{nullptr}; -+ PFNEGLGETSYNCATTRIBKHRPROC m_eglGetSyncAttribKHR{nullptr}; -+}; - -From eebac4f4e456aa3eb174286bf69073b1e740e4a9 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Thu, 7 Mar 2019 18:43:15 -0800 -Subject: [PATCH 2/4] CRendererDRMPRIMEGLES: use CEGLFence to sync rendering - ---- - .../HwDecRender/RendererDRMPRIMEGLES.cpp | 23 +++++++++++++++++++ - .../HwDecRender/RendererDRMPRIMEGLES.h | 8 +++++++ - 2 files changed, 31 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -index 330823196fbc..5b8d82c2cd2f 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -@@ -10,6 +10,7 @@ - - #include "cores/VideoPlayer/VideoRenderers/RenderFactory.h" - #include "ServiceBroker.h" -+#include "utils/EGLFence.h" - #include "utils/log.h" - #include "windowing/gbm/WinSystemGbmGLESContext.h" - -@@ -43,15 +44,32 @@ bool CRendererDRMPRIMEGLES::Configure(const VideoPicture &picture, float fps, un - for (auto &texture : m_DRMPRIMETextures) - texture.Init(winSystem->GetEGLDisplay()); - -+ for (auto& fence : m_fences) -+ { -+ fence.reset(new CEGLFence(winSystem->GetEGLDisplay())); -+ } -+ - return CLinuxRendererGLES::Configure(picture, fps, orientation); - } - - void CRendererDRMPRIMEGLES::ReleaseBuffer(int index) - { -+ m_fences[index]->DestroyFence(); -+ - m_DRMPRIMETextures[index].Unmap(); - CLinuxRendererGLES::ReleaseBuffer(index); - } - -+bool CRendererDRMPRIMEGLES::NeedBuffer(int index) -+{ -+ if (m_fences[index]->IsSignaled()) -+ { -+ return false; -+ } -+ -+ return true; -+} -+ - bool CRendererDRMPRIMEGLES::CreateTexture(int index) - { - CPictureBuffer &buf = m_buffers[index]; -@@ -188,3 +206,8 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index) - - return true; - } -+ -+void CRendererDRMPRIMEGLES::AfterRenderHook(int index) -+{ -+ m_fences[index]->CreateFence(); -+} -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -index f879b6cf5a38..1666f70443ac 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -@@ -11,6 +11,11 @@ - #include "cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h" - #include "DRMPRIMEEGL.h" - -+#include -+#include -+ -+class CEGLFence; -+ - class CRendererDRMPRIMEGLES : public CLinuxRendererGLES - { - public: -@@ -24,14 +29,17 @@ class CRendererDRMPRIMEGLES : public CLinuxRendererGLES - // CLinuxRendererGLES overrides - bool Configure(const VideoPicture &picture, float fps, unsigned int orientation) override; - void ReleaseBuffer(int index) override; -+ bool NeedBuffer(int index) override; - - protected: - // CLinuxRendererGLES overrides - bool LoadShadersHook() override; - bool RenderHook(int index) override; -+ void AfterRenderHook(int index) override; - bool UploadTexture(int index) override; - void DeleteTexture(int index) override; - bool CreateTexture(int index) override; - -+ std::array, NUM_BUFFERS> m_fences; - CDRMPRIMETexture m_DRMPRIMETextures[NUM_BUFFERS]; - }; - -From 86d11125437086b290ec380cbe200acd96e76475 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Mon, 18 Feb 2019 19:18:39 -0800 -Subject: [PATCH 3/4] CRendererDRMPRIMEGLES: update VBO's to be similar to - CLinuxRendererGL - ---- - .../HwDecRender/RendererDRMPRIMEGLES.cpp | 48 ++++++++++++------- - 1 file changed, 32 insertions(+), 16 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -index 5b8d82c2cd2f..1f3176422885 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -@@ -157,28 +157,44 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index) - { - float x, y, z; - float u1, v1; -- } vertex[4]; -+ }; -+ -+ std::array vertex; - - GLint vertLoc = renderSystem->GUIShaderGetPos(); - GLint loc = renderSystem->GUIShaderGetCoord0(); - -- for (unsigned int i = 0; i < 4; i++) -- { -- // Setup vertex position values -- vertex[i].x = m_rotatedDestCoords[i].x; -- vertex[i].y = m_rotatedDestCoords[i].y; -- vertex[i].z = 0.0f; -- } -- -- // Setup texture coordinates -- vertex[0].u1 = vertex[3].u1 = plane.rect.x1; -- vertex[0].v1 = vertex[1].v1 = plane.rect.y1; -- vertex[1].u1 = vertex[2].u1 = plane.rect.x2; -- vertex[2].v1 = vertex[3].v1 = plane.rect.y2; -+ // top left -+ vertex[0].x = m_rotatedDestCoords[0].x; -+ vertex[0].y = m_rotatedDestCoords[0].y; -+ vertex[0].z = 0.0f; -+ vertex[0].u1 = plane.rect.x1; -+ vertex[0].v1 = plane.rect.y1; -+ -+ // top right -+ vertex[1].x = m_rotatedDestCoords[1].x; -+ vertex[1].y = m_rotatedDestCoords[1].y; -+ vertex[1].z = 0.0f; -+ vertex[1].u1 = plane.rect.x2; -+ vertex[1].v1 = plane.rect.y1; -+ -+ // bottom right -+ vertex[2].x = m_rotatedDestCoords[2].x; -+ vertex[2].y = m_rotatedDestCoords[2].y; -+ vertex[2].z = 0.0f; -+ vertex[2].u1 = plane.rect.x2; -+ vertex[2].v1 = plane.rect.y2; -+ -+ // bottom left -+ vertex[3].x = m_rotatedDestCoords[3].x; -+ vertex[3].y = m_rotatedDestCoords[3].y; -+ vertex[3].z = 0.0f; -+ vertex[3].u1 = plane.rect.x1; -+ vertex[3].v1 = plane.rect.y2;; - - glGenBuffers(1, &vertexVBO); - glBindBuffer(GL_ARRAY_BUFFER, vertexVBO); -- glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex)*4, &vertex[0], GL_STATIC_DRAW); -+ glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex) * vertex.size(), vertex.data(), GL_STATIC_DRAW); - - glVertexAttribPointer(vertLoc, 3, GL_FLOAT, 0, sizeof(PackedVertex), reinterpret_cast(offsetof(PackedVertex, x))); - glVertexAttribPointer(loc, 2, GL_FLOAT, 0, sizeof(PackedVertex), reinterpret_cast(offsetof(PackedVertex, u1))); -@@ -188,7 +204,7 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index) - - glGenBuffers(1, &indexVBO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexVBO); -- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte)*4, idx, GL_STATIC_DRAW); -+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte) * 4, idx, GL_STATIC_DRAW); - - glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, 0); - - -From 8d4e4760cb92c90b56aa28a9260d364cd40e0245 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Mon, 18 Feb 2019 19:20:11 -0800 -Subject: [PATCH 4/4] CRendererDRMPRIMEGLES: add override methods for - ERENDERFEATURE and ESCALINGMETHOD - ---- - .../HwDecRender/RendererDRMPRIMEGLES.cpp | 24 +++++++++++++++++++ - .../HwDecRender/RendererDRMPRIMEGLES.h | 3 +++ - 2 files changed, 27 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -index 1f3176422885..ac01d52c10d7 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp -@@ -227,3 +227,27 @@ void CRendererDRMPRIMEGLES::AfterRenderHook(int index) - { - m_fences[index]->CreateFence(); - } -+ -+bool CRendererDRMPRIMEGLES::Supports(ERENDERFEATURE feature) -+{ -+ if (feature == RENDERFEATURE_STRETCH || -+ feature == RENDERFEATURE_ZOOM || -+ feature == RENDERFEATURE_VERTICAL_SHIFT || -+ feature == RENDERFEATURE_PIXEL_RATIO || -+ feature == RENDERFEATURE_ROTATION) -+ { -+ return true; -+ } -+ -+ return false; -+} -+ -+bool CRendererDRMPRIMEGLES::Supports(ESCALINGMETHOD method) -+{ -+ if (method == VS_SCALINGMETHOD_LINEAR) -+ { -+ return true; -+ } -+ -+ return false; -+} -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -index 1666f70443ac..4e9ae779daf8 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h -@@ -31,6 +31,9 @@ class CRendererDRMPRIMEGLES : public CLinuxRendererGLES - void ReleaseBuffer(int index) override; - bool NeedBuffer(int index) override; - -+ bool Supports(ERENDERFEATURE feature) override; -+ bool Supports(ESCALINGMETHOD method) override; -+ - protected: - // CLinuxRendererGLES overrides - bool LoadShadersHook() override; diff --git a/projects/Amlogic/patches/kodi/kodi-PR15946.patch b/projects/Amlogic/patches/kodi/kodi-PR15946.patch deleted file mode 100644 index 127bafb8ef..0000000000 --- a/projects/Amlogic/patches/kodi/kodi-PR15946.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2104dbd5e263b9f83c0e6cd451a486d6f3046f83 Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Sat, 20 Apr 2019 12:01:19 -0700 -Subject: [PATCH] CDRMUtils: fallback to drmModeAddFB2 if - drmModeAddFB2WithModifiers fails - ---- - xbmc/windowing/gbm/DRMUtils.cpp | 43 +++++++++++++++++++++------------ - 1 file changed, 28 insertions(+), 15 deletions(-) - -diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp -index 8e1ec9d0dcb5..6cae2176296f 100644 ---- a/xbmc/windowing/gbm/DRMUtils.cpp -+++ b/xbmc/windowing/gbm/DRMUtils.cpp -@@ -117,22 +117,35 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo) - CLog::Log(LOGDEBUG, "CDRMUtils::{} - using modifier: {:#x}", __FUNCTION__, modifiers[0]); - } - -- auto ret = drmModeAddFB2WithModifiers(m_fd, -- width, -- height, -- fb->format, -- handles, -- strides, -- offsets, -- modifiers, -- &fb->fb_id, -- flags); -+ int ret = drmModeAddFB2WithModifiers(m_fd, -+ width, -+ height, -+ fb->format, -+ handles, -+ strides, -+ offsets, -+ modifiers, -+ &fb->fb_id, -+ flags); -+ -+ if(ret < 0) -+ { -+ ret = drmModeAddFB2(m_fd, -+ width, -+ height, -+ fb->format, -+ handles, -+ strides, -+ offsets, -+ &fb->fb_id, -+ flags); - -- if(ret) -- { -- delete (fb); -- CLog::Log(LOGDEBUG, "CDRMUtils::%s - failed to add framebuffer", __FUNCTION__); -- return nullptr; -+ if (ret < 0) -+ { -+ delete (fb); -+ CLog::Log(LOGDEBUG, "CDRMUtils::{} - failed to add framebuffer: {} ({})", __FUNCTION__, strerror(errno), errno); -+ return nullptr; -+ } - } - - gbm_bo_set_user_data(bo, fb, DrmFbDestroyCallback); diff --git a/projects/Amlogic/patches/kodi/kodi-front-buffer-lock.patch b/projects/Amlogic/patches/kodi/kodi-front-buffer-lock.patch deleted file mode 100644 index 6eafb34858..0000000000 --- a/projects/Amlogic/patches/kodi/kodi-front-buffer-lock.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1667f2b95424f7c42fbd5b30aaadef53ab76e3ad Mon Sep 17 00:00:00 2001 -From: Lukas Rusak -Date: Fri, 12 Apr 2019 22:22:34 -0700 -Subject: [PATCH] CWinSystemGbm: only lock the front buffer if something is - rendered - ---- - xbmc/windowing/gbm/WinSystemGbm.cpp | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp -index 4a3291a55045..5cee802be2de 100644 ---- a/xbmc/windowing/gbm/WinSystemGbm.cpp -+++ b/xbmc/windowing/gbm/WinSystemGbm.cpp -@@ -207,11 +207,19 @@ void CWinSystemGbm::FlipPage(bool rendered, bool videoLayer) - m_videoLayerBridge->Disable(); - } - -- struct gbm_bo *bo = m_GBM->LockFrontBuffer(); -+ struct gbm_bo *bo = nullptr; -+ -+ if (rendered) -+ { -+ bo = m_GBM->LockFrontBuffer(); -+ } - - m_DRM->FlipPage(bo, rendered, videoLayer); - -- m_GBM->ReleaseBuffer(); -+ if (rendered) -+ { -+ m_GBM->ReleaseBuffer(); -+ } - - if (m_videoLayerBridge && !videoLayer) - {