kodi: misc patches to go upstream

This commit is contained in:
chewitt 2018-10-24 08:48:07 +01:00 committed by kszaq
parent 78f5c1d6b8
commit a5f1eda331
6 changed files with 751 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From 4d6af620f4d6a6645229dcf3403a397dfb1a8a93 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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)
{

View File

@ -0,0 +1,383 @@
From af01b284b158891d258b3a2617697b9779af11c5 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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<PFNEGLCREATESYNCKHRPROC>("eglCreateSyncKHR");
+ m_eglDestroySyncKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYSYNCKHRPROC>("eglDestroySyncKHR");
+ m_eglGetSyncAttribKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLGETSYNCATTRIBKHRPROC>("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 <EGL/egl.h>
+#include <EGL/eglext.h>
+
+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 <lorusak@gmail.com>
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 <array>
+#include <memory>
+
+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<std::unique_ptr<CEGLFence>, NUM_BUFFERS> m_fences;
CDRMPRIMETexture m_DRMPRIMETextures[NUM_BUFFERS];
};
From 86d11125437086b290ec380cbe200acd96e76475 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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<PackedVertex, 4> 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<const GLvoid*>(offsetof(PackedVertex, x)));
glVertexAttribPointer(loc, 2, GL_FLOAT, 0, sizeof(PackedVertex), reinterpret_cast<const GLvoid*>(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 <lorusak@gmail.com>
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;

View File

@ -0,0 +1,65 @@
From 2104dbd5e263b9f83c0e6cd451a486d6f3046f83 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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);

View File

@ -0,0 +1,75 @@
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index e04c3c6ff6..dcf97af4ef 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -156,7 +156,7 @@ void CVideoBufferPoolDRMPRIME::Return(int id)
//------------------------------------------------------------------------------
CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo)
- : CDVDVideoCodec(processInfo)
+ : CDVDVideoCodec(processInfo), m_prevTime(0), m_seeking(false)
{
m_pFrame = av_frame_alloc();
m_videoBufferPool = std::make_shared<CVideoBufferPoolDRMPRIME>();
@@ -406,6 +406,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
return VC_ERROR;
}
+ if (m_prevTime && std::abs(m_prevTime - m_processInfo.GetTime()) >= 5000)
+ m_seeking = true;
+
+ m_prevTime = m_processInfo.GetTime();
+
+ // Drop frames too far away from the target time
+ if (m_seeking && std::abs(m_pFrame->pts/1000 - m_processInfo.GetTime()) >= 5000) {
+ CLog::Log(LOGDEBUG, "CDVDVideoCodecDRMPRIME::%s - Dropping pts %llu time %lld", __FUNCTION__, m_pFrame->pts/1000, m_processInfo.GetTime());
+ av_frame_unref(m_pFrame);
+ return VC_BUFFER;
+ }
+
+ m_seeking = false;
+
if (pVideoPicture->videoBuffer)
pVideoPicture->videoBuffer->Release();
pVideoPicture->videoBuffer = nullptr;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index ffcdf1a7b6..4455280e38 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -79,4 +79,6 @@ protected:
AVCodecContext* m_pCodecContext = nullptr;
AVFrame* m_pFrame = nullptr;
std::shared_ptr<CVideoBufferPoolDRMPRIME> m_videoBufferPool;
+ int64_t m_prevTime;
+ bool m_seeking;
};
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
index e8d9023a9f..4299894c00 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
@@ -635,6 +635,13 @@ bool CProcessInfo::GetVideoRender()
return m_renderVideoLayer;
}
+int64_t CProcessInfo::GetTime()
+{
+ CSingleLock lock(m_stateSection);
+
+ return m_time;
+}
+
void CProcessInfo::SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max)
{
CSingleLock lock(m_stateSection);
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
index e8042c2bc2..5b4aea9b9d 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
@@ -101,6 +101,7 @@ public:
bool GetGuiRender();
void SetVideoRender(bool video);
bool GetVideoRender();
+ int64_t GetTime();
void SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max);
int64_t GetMaxTime();

View File

@ -0,0 +1,36 @@
From 1667f2b95424f7c42fbd5b30aaadef53ab76e3ad Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
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)
{

View File

@ -0,0 +1,153 @@
From 7a88b0ad7a90a8ac2266f87ccb08dca5df0c0867 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 14 Oct 2018 14:20:03 +0200
Subject: [PATCH] WIP: windowing/gbm: add option to limit gui size
---
.../resources/strings.po | 52 ++++++++++++++++++-
system/settings/gbm.xml | 15 ++++++
xbmc/windowing/gbm/DRMUtils.cpp | 28 ++++++++++
3 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 97211d3b718a..eaa5b3fed759 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -7256,7 +7256,57 @@ msgctxt "#13465"
msgid "EGL"
msgstr ""
-#empty strings from id 13466 to 13504
+#empty strings from id 13466 to 13485
+
+#. String for options 3 of setting with label #13482 "HDMI Quantization Range"
+#: system/settings/gbm.xml
+msgctxt "#13486"
+msgid "Limited"
+msgstr ""
+
+#. Option for setting Limit GUI Size
+#: system/settings/gbm.xml
+msgctxt "#13487"
+msgid "Limit GUI Size"
+msgstr ""
+
+#. Description of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13488"
+msgid "This option limits GUI size for screen resolutions above 1080p. Requires restart."
+msgstr ""
+
+#. String for options 1 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13489"
+msgid "No limit"
+msgstr ""
+
+#. String for options 2 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13490"
+msgid "720p"
+msgstr ""
+
+#. String for options 3 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13491"
+msgid "1080p / 720p (>30hz)"
+msgstr ""
+
+#. String for options 4 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13492"
+msgid "1080p"
+msgstr ""
+
+#. String for options 5 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13493"
+msgid "No limit / 1080p (>30hz)"
+msgstr ""
+
+#empty strings from id 13494 to 13504
#: system/settings/settings.xml
msgctxt "#13505"
diff --git a/system/settings/gbm.xml b/system/settings/gbm.xml
index c5e4d98e0bef..830576c156a6 100644
--- a/system/settings/gbm.xml
+++ b/system/settings/gbm.xml
@@ -41,6 +41,21 @@
<setting id="videoscreen.screen">
<visible>false</visible>
</setting>
+ <setting id="videoscreen.limitguisize" type="integer" label="13487" help="13488">
+ <visible>false</visible>
+ <level>3</level>
+ <default>0</default>
+ <constraints>
+ <options>
+ <option label="13489">0</option> <!-- No limit -->
+ <option label="13490">1</option> <!-- 720p -->
+ <option label="13491">2</option> <!-- 1080p / 720p (>30hz) -->
+ <option label="13492">3</option> <!-- 1080p -->
+ <option label="13493">4</option> <!-- No limit / 1080p (>30hz) -->
+ </options>
+ </constraints>
+ <control type="list" format="string" />
+ </setting>
<setting id="videoscreen.limitedrange" type="boolean" label="36042" help="36359">
<level>3</level>
<default>false</default>
diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp
index fceaf770d363..21a6f8f1b926 100644
--- a/xbmc/windowing/gbm/DRMUtils.cpp
+++ b/xbmc/windowing/gbm/DRMUtils.cpp
@@ -17,6 +17,8 @@
#include <unistd.h>
#include "platform/linux/XTimeUtils.h"
+#include "settings/Settings.h"
+#include "settings/SettingsComponent.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "windowing/GraphicContext.h"
@@ -25,6 +27,8 @@
using namespace KODI::WINDOWING::GBM;
+const std::string SETTING_VIDEOSCREEN_LIMITGUISIZE = "videoscreen.limitguisize";
+
CDRMUtils::CDRMUtils()
: m_connector(new connector)
, m_encoder(new encoder)
@@ -731,6 +735,30 @@ RESOLUTION_INFO CDRMUtils::GetResolutionInfo(drmModeModeInfoPtr mode)
res.iWidth = res.iScreenWidth;
res.iHeight = res.iScreenHeight;
+ int limit = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(SETTING_VIDEOSCREEN_LIMITGUISIZE);
+ if (limit > 0 && res.iScreenWidth > 1920 && res.iScreenHeight > 1080)
+ {
+ switch (limit)
+ {
+ case 1:
+ res.iWidth = 1280;
+ res.iHeight = 720;
+ break;
+ case 2:
+ res.iWidth = mode->vrefresh > 30 ? 1280 : 1920;
+ res.iHeight = mode->vrefresh > 30 ? 720 : 1080;
+ break;
+ case 3:
+ res.iWidth = 1920;
+ res.iHeight = 1080;
+ break;
+ case 4:
+ res.iWidth = mode->vrefresh > 30 ? 1920 : res.iScreenWidth;
+ res.iHeight = mode->vrefresh > 30 ? 1080 : res.iScreenHeight;
+ break;
+ }
+ }
+
if (mode->clock % 5 != 0)
res.fRefreshRate = static_cast<float>(mode->vrefresh) * (1000.0f/1001.0f);
else