Added
Link Here
|
1 |
From 4c7ea4b5564d224d60a080d105ae299407239dcb Mon Sep 17 00:00:00 2001 |
2 |
From: Rozhuk Ivan <rozhuk.im@gmail.com> |
3 |
Date: Sun, 10 Nov 2024 02:24:16 +0200 |
4 |
Subject: [PATCH] Revert "CDRMAtomic: add support for using DRM_MODE_ATOMIC_NONBLOCK" |
5 |
|
6 |
This reverts commit e9710033029d86efa0c18a6121d2c6376f74ef10. |
7 |
--- |
8 |
xbmc/windowing/gbm/WinSystemGbm.cpp | 8 ++++---- |
9 |
xbmc/windowing/gbm/WinSystemGbm.h | 2 +- |
10 |
xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp | 11 ----------- |
11 |
xbmc/windowing/gbm/WinSystemGbmEGLContext.h | 3 --- |
12 |
xbmc/windowing/gbm/WinSystemGbmGLContext.cpp | 26 +------------------------- |
13 |
xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp | 27 +-------------------------- |
14 |
xbmc/windowing/gbm/drm/DRMAtomic.cpp | 19 +++---------------- |
15 |
xbmc/windowing/gbm/drm/DRMAtomic.h | 2 +- |
16 |
xbmc/windowing/gbm/drm/DRMLegacy.cpp | 2 +- |
17 |
xbmc/windowing/gbm/drm/DRMLegacy.h | 2 +- |
18 |
xbmc/windowing/gbm/drm/DRMUtils.h | 13 +------------ |
19 |
xbmc/windowing/gbm/drm/OffScreenModeSetting.h | 2 +- |
20 |
12 files changed, 15 insertions(+), 102 deletions(-) |
21 |
|
22 |
diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp |
23 |
index 6569718..da56094 100644 |
24 |
--- xbmc/windowing/gbm/WinSystemGbm.cpp |
25 |
+++ xbmc/windowing/gbm/WinSystemGbm.cpp |
26 |
@@ -269,64 +269,64 @@ bool CWinSystemGbm::DisplayHardwareScalingEnabled() |
27 |
void CWinSystemGbm::UpdateDisplayHardwareScaling(const RESOLUTION_INFO& resInfo) |
28 |
{ |
29 |
if (!DisplayHardwareScalingEnabled()) |
30 |
return; |
31 |
|
32 |
//! @todo The PR that made the res struct constant was abandoned due to drama. |
33 |
// It should be const-corrected and changed here. |
34 |
RESOLUTION_INFO& resMutable = const_cast<RESOLUTION_INFO&>(resInfo); |
35 |
|
36 |
SetFullScreen(true, resMutable, false); |
37 |
} |
38 |
|
39 |
-void CWinSystemGbm::FlipPage(bool rendered, bool videoLayer, bool async) |
40 |
+void CWinSystemGbm::FlipPage(bool rendered, bool videoLayer) |
41 |
{ |
42 |
if (m_videoLayerBridge && !videoLayer) |
43 |
{ |
44 |
// disable video plane when video layer no longer is active |
45 |
m_videoLayerBridge->Disable(); |
46 |
} |
47 |
|
48 |
struct gbm_bo *bo = nullptr; |
49 |
|
50 |
if (rendered) |
51 |
{ |
52 |
bo = m_GBM->GetDevice().GetSurface().LockFrontBuffer().Get(); |
53 |
} |
54 |
|
55 |
- m_DRM->FlipPage(bo, rendered, videoLayer, async); |
56 |
+ m_DRM->FlipPage(bo, rendered, videoLayer); |
57 |
|
58 |
if (m_videoLayerBridge && !videoLayer) |
59 |
{ |
60 |
// delete video layer bridge when video layer no longer is active |
61 |
m_videoLayerBridge.reset(); |
62 |
} |
63 |
} |
64 |
|
65 |
bool CWinSystemGbm::UseLimitedColor() |
66 |
{ |
67 |
return CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_VIDEOSCREEN_LIMITEDRANGE); |
68 |
} |
69 |
|
70 |
bool CWinSystemGbm::Hide() |
71 |
{ |
72 |
bool ret = m_DRM->SetActive(false); |
73 |
- FlipPage(false, false, false); |
74 |
+ FlipPage(false, false); |
75 |
return ret; |
76 |
} |
77 |
|
78 |
bool CWinSystemGbm::Show(bool raise) |
79 |
{ |
80 |
bool ret = m_DRM->SetActive(true); |
81 |
- FlipPage(false, false, false); |
82 |
+ FlipPage(false, false); |
83 |
return ret; |
84 |
} |
85 |
|
86 |
void CWinSystemGbm::Register(IDispResource *resource) |
87 |
{ |
88 |
std::unique_lock<CCriticalSection> lock(m_resourceSection); |
89 |
m_resources.push_back(resource); |
90 |
} |
91 |
|
92 |
void CWinSystemGbm::Unregister(IDispResource *resource) |
93 |
{ |
94 |
std::unique_lock<CCriticalSection> lock(m_resourceSection); |
95 |
diff --git a/xbmc/windowing/gbm/WinSystemGbm.h b/xbmc/windowing/gbm/WinSystemGbm.h |
96 |
index 9609675..8993b6d 100644 |
97 |
--- xbmc/windowing/gbm/WinSystemGbm.h |
98 |
+++ xbmc/windowing/gbm/WinSystemGbm.h |
99 |
@@ -40,25 +40,25 @@ public: |
100 |
~CWinSystemGbm() override; |
101 |
|
102 |
const std::string GetName() override { return "gbm"; } |
103 |
|
104 |
bool InitWindowSystem() override; |
105 |
bool DestroyWindowSystem() override; |
106 |
|
107 |
bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; |
108 |
bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; |
109 |
bool DisplayHardwareScalingEnabled() override; |
110 |
void UpdateDisplayHardwareScaling(const RESOLUTION_INFO& resInfo) override; |
111 |
|
112 |
- void FlipPage(bool rendered, bool videoLayer, bool async); |
113 |
+ void FlipPage(bool rendered, bool videoLayer); |
114 |
|
115 |
bool CanDoWindowed() override { return false; } |
116 |
void UpdateResolutions() override; |
117 |
|
118 |
bool UseLimitedColor() override; |
119 |
|
120 |
bool Hide() override; |
121 |
bool Show(bool raise = true) override; |
122 |
void Register(IDispResource* resource) override; |
123 |
void Unregister(IDispResource* resource) override; |
124 |
|
125 |
bool SetHDR(const VideoPicture* videoPicture) override; |
126 |
diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp |
127 |
index fac914d..2fb742e 100644 |
128 |
--- xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp |
129 |
+++ xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp |
130 |
@@ -49,35 +49,24 @@ bool CWinSystemGbmEGLContext::InitWindowSystemEGL(EGLint renderableType, EGLint |
131 |
if (!m_eglContext.ChooseConfig(renderableType, CDRMUtils::FourCCWithAlpha(visualId)) && |
132 |
!m_eglContext.ChooseConfig(renderableType, CDRMUtils::FourCCWithoutAlpha(visualId))) |
133 |
{ |
134 |
return false; |
135 |
} |
136 |
} |
137 |
|
138 |
if (!CreateContext()) |
139 |
{ |
140 |
return false; |
141 |
} |
142 |
|
143 |
- if (CEGLUtils::HasExtension(m_eglContext.GetEGLDisplay(), "EGL_ANDROID_native_fence_sync") && |
144 |
- CEGLUtils::HasExtension(m_eglContext.GetEGLDisplay(), "EGL_KHR_fence_sync")) |
145 |
- { |
146 |
- m_eglFence = std::make_unique<KODI::UTILS::EGL::CEGLFence>(m_eglContext.GetEGLDisplay()); |
147 |
- } |
148 |
- else |
149 |
- { |
150 |
- CLog::Log(LOGWARNING, "[GBM] missing support for EGL_KHR_fence_sync and " |
151 |
- "EGL_ANDROID_native_fence_sync - performance may be impacted"); |
152 |
- } |
153 |
- |
154 |
return true; |
155 |
} |
156 |
|
157 |
bool CWinSystemGbmEGLContext::CreateNewWindow(const std::string& name, |
158 |
bool fullScreen, |
159 |
RESOLUTION_INFO& res) |
160 |
{ |
161 |
//Notify other subsystems that we change resolution |
162 |
OnLostDevice(); |
163 |
|
164 |
if (!DestroyWindow()) |
165 |
{ |
166 |
diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.h b/xbmc/windowing/gbm/WinSystemGbmEGLContext.h |
167 |
index fbd5235..84f863d 100644 |
168 |
--- xbmc/windowing/gbm/WinSystemGbmEGLContext.h |
169 |
+++ xbmc/windowing/gbm/WinSystemGbmEGLContext.h |
170 |
@@ -1,24 +1,23 @@ |
171 |
/* |
172 |
* Copyright (C) 2005-2018 Team Kodi |
173 |
* This file is part of Kodi - https://kodi.tv |
174 |
* |
175 |
* SPDX-License-Identifier: GPL-2.0-or-later |
176 |
* See LICENSES/README.md for more information. |
177 |
*/ |
178 |
|
179 |
#pragma once |
180 |
|
181 |
#include "WinSystemGbm.h" |
182 |
-#include "utils/EGLFence.h" |
183 |
#include "utils/EGLUtils.h" |
184 |
#include "windowing/linux/WinSystemEGL.h" |
185 |
|
186 |
#include <memory> |
187 |
|
188 |
namespace KODI |
189 |
{ |
190 |
namespace WINDOWING |
191 |
{ |
192 |
namespace GBM |
193 |
{ |
194 |
|
195 |
@@ -38,24 +37,22 @@ public: |
196 |
protected: |
197 |
CWinSystemGbmEGLContext(EGLenum platform, std::string const& platformExtension) |
198 |
: CWinSystemEGL{platform, platformExtension} |
199 |
{} |
200 |
|
201 |
/** |
202 |
* Inheriting classes should override InitWindowSystem() without parameters |
203 |
* and call this function there with appropriate parameters |
204 |
*/ |
205 |
bool InitWindowSystemEGL(EGLint renderableType, EGLint apiType); |
206 |
virtual bool CreateContext() = 0; |
207 |
|
208 |
- std::unique_ptr<KODI::UTILS::EGL::CEGLFence> m_eglFence; |
209 |
- |
210 |
struct delete_CVaapiProxy |
211 |
{ |
212 |
void operator()(CVaapiProxy *p) const; |
213 |
}; |
214 |
std::unique_ptr<CVaapiProxy, delete_CVaapiProxy> m_vaapiProxy; |
215 |
}; |
216 |
|
217 |
} |
218 |
} |
219 |
} |
220 |
diff --git a/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp |
221 |
index adbb539..e4ff49c 100644 |
222 |
--- xbmc/windowing/gbm/WinSystemGbmGLContext.cpp |
223 |
+++ xbmc/windowing/gbm/WinSystemGbmGLContext.cpp |
224 |
@@ -110,55 +110,31 @@ bool CWinSystemGbmGLContext::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res |
225 |
return true; |
226 |
} |
227 |
|
228 |
void CWinSystemGbmGLContext::PresentRender(bool rendered, bool videoLayer) |
229 |
{ |
230 |
if (!m_bRenderCreated) |
231 |
return; |
232 |
|
233 |
if (rendered || videoLayer) |
234 |
{ |
235 |
if (rendered) |
236 |
{ |
237 |
-#if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync) |
238 |
- if (m_eglFence) |
239 |
- { |
240 |
- int fd = m_DRM->TakeOutFenceFd(); |
241 |
- if (fd != -1) |
242 |
- { |
243 |
- m_eglFence->CreateKMSFence(fd); |
244 |
- m_eglFence->WaitSyncGPU(); |
245 |
- } |
246 |
- |
247 |
- m_eglFence->CreateGPUFence(); |
248 |
- } |
249 |
-#endif |
250 |
- |
251 |
if (!m_eglContext.TrySwapBuffers()) |
252 |
{ |
253 |
CEGLUtils::Log(LOGERROR, "eglSwapBuffers failed"); |
254 |
throw std::runtime_error("eglSwapBuffers failed"); |
255 |
} |
256 |
- |
257 |
-#if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync) |
258 |
- if (m_eglFence) |
259 |
- { |
260 |
- int fd = m_eglFence->FlushFence(); |
261 |
- m_DRM->SetInFenceFd(fd); |
262 |
- |
263 |
- m_eglFence->WaitSyncCPU(); |
264 |
- } |
265 |
-#endif |
266 |
} |
267 |
- CWinSystemGbm::FlipPage(rendered, videoLayer, static_cast<bool>(m_eglFence)); |
268 |
+ CWinSystemGbm::FlipPage(rendered, videoLayer); |
269 |
|
270 |
if (m_dispReset && m_dispResetTimer.IsTimePast()) |
271 |
{ |
272 |
CLog::Log(LOGDEBUG, "CWinSystemGbmGLContext::{} - Sending display reset to all clients", |
273 |
__FUNCTION__); |
274 |
m_dispReset = false; |
275 |
std::unique_lock<CCriticalSection> lock(m_resourceSection); |
276 |
|
277 |
for (auto resource : m_resources) |
278 |
resource->OnResetDisplay(); |
279 |
} |
280 |
} |
281 |
diff --git a/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp b/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp |
282 |
index ad80abf..0d071c3 100644 |
283 |
--- xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp |
284 |
+++ xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp |
285 |
@@ -119,56 +119,31 @@ bool CWinSystemGbmGLESContext::SetFullScreen(bool fullScreen, RESOLUTION_INFO& r |
286 |
return true; |
287 |
} |
288 |
|
289 |
void CWinSystemGbmGLESContext::PresentRender(bool rendered, bool videoLayer) |
290 |
{ |
291 |
if (!m_bRenderCreated) |
292 |
return; |
293 |
|
294 |
if (rendered || videoLayer) |
295 |
{ |
296 |
if (rendered) |
297 |
{ |
298 |
-#if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync) |
299 |
- if (m_eglFence) |
300 |
- { |
301 |
- int fd = m_DRM->TakeOutFenceFd(); |
302 |
- if (fd != -1) |
303 |
- { |
304 |
- m_eglFence->CreateKMSFence(fd); |
305 |
- m_eglFence->WaitSyncGPU(); |
306 |
- } |
307 |
- |
308 |
- m_eglFence->CreateGPUFence(); |
309 |
- } |
310 |
-#endif |
311 |
- |
312 |
if (!m_eglContext.TrySwapBuffers()) |
313 |
{ |
314 |
CEGLUtils::Log(LOGERROR, "eglSwapBuffers failed"); |
315 |
throw std::runtime_error("eglSwapBuffers failed"); |
316 |
} |
317 |
- |
318 |
-#if defined(EGL_ANDROID_native_fence_sync) && defined(EGL_KHR_fence_sync) |
319 |
- if (m_eglFence) |
320 |
- { |
321 |
- int fd = m_eglFence->FlushFence(); |
322 |
- m_DRM->SetInFenceFd(fd); |
323 |
- |
324 |
- m_eglFence->WaitSyncCPU(); |
325 |
- } |
326 |
-#endif |
327 |
} |
328 |
- |
329 |
- CWinSystemGbm::FlipPage(rendered, videoLayer, static_cast<bool>(m_eglFence)); |
330 |
+ CWinSystemGbm::FlipPage(rendered, videoLayer); |
331 |
|
332 |
if (m_dispReset && m_dispResetTimer.IsTimePast()) |
333 |
{ |
334 |
CLog::Log(LOGDEBUG, "CWinSystemGbmGLESContext::{} - Sending display reset to all clients", |
335 |
__FUNCTION__); |
336 |
m_dispReset = false; |
337 |
std::unique_lock<CCriticalSection> lock(m_resourceSection); |
338 |
|
339 |
for (auto resource : m_resources) |
340 |
resource->OnResetDisplay(); |
341 |
} |
342 |
} |
343 |
diff --git a/xbmc/windowing/gbm/drm/DRMAtomic.cpp b/xbmc/windowing/gbm/drm/DRMAtomic.cpp |
344 |
index ff7f137..029b5ca 100644 |
345 |
--- xbmc/windowing/gbm/drm/DRMAtomic.cpp |
346 |
+++ xbmc/windowing/gbm/drm/DRMAtomic.cpp |
347 |
@@ -102,107 +102,94 @@ void CDRMAtomic::DrmAtomicCommit(int fb_id, int flags, bool rendered, bool video |
348 |
AddProperty(m_gui_plane, "CRTC_Y", 0); |
349 |
//! @todo: disabled until upstream kernel changes are merged |
350 |
// if (DisplayHardwareScalingEnabled()) |
351 |
// { |
352 |
// SetScalingFilter(m_gui_plane, "SCALING_FILTER", "Nearest Neighbor"); |
353 |
// } |
354 |
// else |
355 |
{ |
356 |
AddProperty(m_gui_plane, "CRTC_W", m_mode->hdisplay); |
357 |
AddProperty(m_gui_plane, "CRTC_H", m_mode->vdisplay); |
358 |
} |
359 |
|
360 |
- if (m_inFenceFd != -1) |
361 |
- { |
362 |
- AddProperty(m_crtc, "OUT_FENCE_PTR", reinterpret_cast<uint64_t>(&m_outFenceFd)); |
363 |
- AddProperty(m_gui_plane, "IN_FENCE_FD", m_inFenceFd); |
364 |
- } |
365 |
} |
366 |
else if (videoLayer && !CServiceBroker::GetGUI()->GetWindowManager().HasVisibleControls()) |
367 |
{ |
368 |
// disable gui plane when video layer is active and gui has no visible controls |
369 |
AddProperty(m_gui_plane, "FB_ID", 0); |
370 |
AddProperty(m_gui_plane, "CRTC_ID", 0); |
371 |
} |
372 |
|
373 |
if (CServiceBroker::GetLogging().CanLogComponent(LOGWINDOWING)) |
374 |
m_req->LogAtomicRequest(); |
375 |
|
376 |
auto ret = drmModeAtomicCommit(m_fd, m_req->Get(), flags | DRM_MODE_ATOMIC_TEST_ONLY, nullptr); |
377 |
if (ret < 0) |
378 |
{ |
379 |
CLog::Log(LOGERROR, |
380 |
"CDRMAtomic::{} - test commit failed: ({}) - falling back to last successful atomic " |
381 |
"request", |
382 |
__FUNCTION__, strerror(errno)); |
383 |
|
384 |
auto oldRequest = m_atomicRequestQueue.front().get(); |
385 |
CDRMAtomicRequest::LogAtomicDiff(m_req, oldRequest); |
386 |
m_req = oldRequest; |
387 |
|
388 |
// update the old atomic request with the new fb id to avoid tearing |
389 |
if (rendered) |
390 |
AddProperty(m_gui_plane, "FB_ID", fb_id); |
391 |
} |
392 |
|
393 |
ret = drmModeAtomicCommit(m_fd, m_req->Get(), flags, nullptr); |
394 |
if (ret < 0) |
395 |
{ |
396 |
CLog::Log(LOGERROR, "CDRMAtomic::{} - atomic commit failed: {}", __FUNCTION__, |
397 |
strerror(errno)); |
398 |
} |
399 |
|
400 |
- if (m_inFenceFd != -1) |
401 |
- { |
402 |
- close(m_inFenceFd); |
403 |
- m_inFenceFd = -1; |
404 |
- } |
405 |
- |
406 |
if (flags & DRM_MODE_ATOMIC_ALLOW_MODESET) |
407 |
{ |
408 |
if (drmModeDestroyPropertyBlob(m_fd, blob_id) != 0) |
409 |
CLog::Log(LOGERROR, "CDRMAtomic::{} - failed to destroy property blob: {}", __FUNCTION__, |
410 |
strerror(errno)); |
411 |
} |
412 |
|
413 |
if (m_atomicRequestQueue.size() > 1) |
414 |
m_atomicRequestQueue.pop_back(); |
415 |
|
416 |
m_atomicRequestQueue.emplace_back(std::make_unique<CDRMAtomicRequest>()); |
417 |
m_req = m_atomicRequestQueue.back().get(); |
418 |
} |
419 |
|
420 |
-void CDRMAtomic::FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) |
421 |
+void CDRMAtomic::FlipPage(struct gbm_bo *bo, bool rendered, bool videoLayer) |
422 |
{ |
423 |
struct drm_fb *drm_fb = nullptr; |
424 |
- uint32_t flags = 0; |
425 |
|
426 |
if (rendered) |
427 |
{ |
428 |
if (videoLayer) |
429 |
m_gui_plane->SetFormat(CDRMUtils::FourCCWithAlpha(m_gui_plane->GetFormat())); |
430 |
else |
431 |
m_gui_plane->SetFormat(CDRMUtils::FourCCWithoutAlpha(m_gui_plane->GetFormat())); |
432 |
|
433 |
drm_fb = CDRMUtils::DrmFbGetFromBo(bo); |
434 |
if (!drm_fb) |
435 |
{ |
436 |
CLog::Log(LOGERROR, "CDRMAtomic::{} - Failed to get a new FBO", __FUNCTION__); |
437 |
return; |
438 |
} |
439 |
- |
440 |
- if (async && !m_need_modeset) |
441 |
- flags |= DRM_MODE_ATOMIC_NONBLOCK; |
442 |
} |
443 |
|
444 |
+ uint32_t flags = 0; |
445 |
+ |
446 |
if (m_need_modeset) |
447 |
{ |
448 |
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; |
449 |
m_need_modeset = false; |
450 |
CLog::Log(LOGDEBUG, "CDRMAtomic::{} - Execute modeset at next commit", __FUNCTION__); |
451 |
} |
452 |
|
453 |
DrmAtomicCommit(!drm_fb ? 0 : drm_fb->fb_id, flags, rendered, videoLayer); |
454 |
} |
455 |
|
456 |
bool CDRMAtomic::InitDrm() |
457 |
{ |
458 |
diff --git a/xbmc/windowing/gbm/drm/DRMAtomic.h b/xbmc/windowing/gbm/drm/DRMAtomic.h |
459 |
index 6b19657..ca2cd9a 100644 |
460 |
--- xbmc/windowing/gbm/drm/DRMAtomic.h |
461 |
+++ xbmc/windowing/gbm/drm/DRMAtomic.h |
462 |
@@ -18,25 +18,25 @@ |
463 |
namespace KODI |
464 |
{ |
465 |
namespace WINDOWING |
466 |
{ |
467 |
namespace GBM |
468 |
{ |
469 |
|
470 |
class CDRMAtomic : public CDRMUtils |
471 |
{ |
472 |
public: |
473 |
CDRMAtomic() = default; |
474 |
~CDRMAtomic() override = default; |
475 |
- void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) override; |
476 |
+ void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer) override; |
477 |
bool SetVideoMode(const RESOLUTION_INFO& res, struct gbm_bo* bo) override; |
478 |
bool SetActive(bool active) override; |
479 |
bool InitDrm() override; |
480 |
void DestroyDrm() override; |
481 |
bool AddProperty(CDRMObject* object, const char* name, uint64_t value); |
482 |
|
483 |
bool DisplayHardwareScalingEnabled(); |
484 |
|
485 |
private: |
486 |
void DrmAtomicCommit(int fb_id, int flags, bool rendered, bool videoLayer); |
487 |
|
488 |
bool SetScalingFilter(CDRMObject* object, const char* name, const char* type); |
489 |
diff --git a/xbmc/windowing/gbm/drm/DRMLegacy.cpp b/xbmc/windowing/gbm/drm/DRMLegacy.cpp |
490 |
index 4e9c3a6..418d067 100644 |
491 |
--- xbmc/windowing/gbm/drm/DRMLegacy.cpp |
492 |
+++ xbmc/windowing/gbm/drm/DRMLegacy.cpp |
493 |
@@ -99,25 +99,25 @@ bool CDRMLegacy::QueueFlip(struct gbm_bo *bo) |
494 |
auto ret = drmModePageFlip(m_fd, m_crtc->GetCrtcId(), drm_fb->fb_id, DRM_MODE_PAGE_FLIP_EVENT, |
495 |
&flip_happening); |
496 |
|
497 |
if(ret) |
498 |
{ |
499 |
CLog::Log(LOGDEBUG, "CDRMLegacy::{} - failed to queue DRM page flip", __FUNCTION__); |
500 |
return false; |
501 |
} |
502 |
|
503 |
return true; |
504 |
} |
505 |
|
506 |
-void CDRMLegacy::FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) |
507 |
+void CDRMLegacy::FlipPage(struct gbm_bo *bo, bool rendered, bool videoLayer) |
508 |
{ |
509 |
if (rendered || videoLayer) |
510 |
{ |
511 |
flip_happening = QueueFlip(bo); |
512 |
WaitingForFlip(); |
513 |
} |
514 |
} |
515 |
|
516 |
bool CDRMLegacy::InitDrm() |
517 |
{ |
518 |
if (!CDRMUtils::OpenDrm(true)) |
519 |
return false; |
520 |
diff --git a/xbmc/windowing/gbm/drm/DRMLegacy.h b/xbmc/windowing/gbm/drm/DRMLegacy.h |
521 |
index e763f29..2b7ff45 100644 |
522 |
--- xbmc/windowing/gbm/drm/DRMLegacy.h |
523 |
+++ xbmc/windowing/gbm/drm/DRMLegacy.h |
524 |
@@ -13,25 +13,25 @@ |
525 |
namespace KODI |
526 |
{ |
527 |
namespace WINDOWING |
528 |
{ |
529 |
namespace GBM |
530 |
{ |
531 |
|
532 |
class CDRMLegacy : public CDRMUtils |
533 |
{ |
534 |
public: |
535 |
CDRMLegacy() = default; |
536 |
~CDRMLegacy() override = default; |
537 |
- void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) override; |
538 |
+ void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer) override; |
539 |
bool SetVideoMode(const RESOLUTION_INFO& res, struct gbm_bo* bo) override; |
540 |
bool SetActive(bool active) override; |
541 |
bool InitDrm() override; |
542 |
|
543 |
private: |
544 |
bool WaitingForFlip(); |
545 |
bool QueueFlip(struct gbm_bo *bo); |
546 |
static void PageFlipHandler(int fd, unsigned int frame, unsigned int sec, |
547 |
unsigned int usec, void *data); |
548 |
}; |
549 |
|
550 |
} |
551 |
diff --git a/xbmc/windowing/gbm/drm/DRMUtils.h b/xbmc/windowing/gbm/drm/DRMUtils.h |
552 |
index f92f716..5327e35 100644 |
553 |
--- xbmc/windowing/gbm/drm/DRMUtils.h |
554 |
+++ xbmc/windowing/gbm/drm/DRMUtils.h |
555 |
@@ -6,98 +6,87 @@ |
556 |
* See LICENSES/README.md for more information. |
557 |
*/ |
558 |
|
559 |
#pragma once |
560 |
|
561 |
#include "DRMConnector.h" |
562 |
#include "DRMCrtc.h" |
563 |
#include "DRMEncoder.h" |
564 |
#include "DRMPlane.h" |
565 |
#include "windowing/Resolution.h" |
566 |
#include "windowing/gbm/GBMUtils.h" |
567 |
|
568 |
-#include <utility> |
569 |
#include <vector> |
570 |
|
571 |
#include <gbm.h> |
572 |
#include <xf86drm.h> |
573 |
|
574 |
namespace KODI |
575 |
{ |
576 |
namespace WINDOWING |
577 |
{ |
578 |
namespace GBM |
579 |
{ |
580 |
|
581 |
struct drm_fb |
582 |
{ |
583 |
struct gbm_bo *bo = nullptr; |
584 |
uint32_t fb_id; |
585 |
uint32_t format; |
586 |
}; |
587 |
|
588 |
class CDRMUtils |
589 |
{ |
590 |
public: |
591 |
CDRMUtils() = default; |
592 |
virtual ~CDRMUtils(); |
593 |
- virtual void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) {} |
594 |
+ virtual void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer) {} |
595 |
virtual bool SetVideoMode(const RESOLUTION_INFO& res, struct gbm_bo* bo) { return false; } |
596 |
virtual bool SetActive(bool active) { return false; } |
597 |
virtual bool InitDrm(); |
598 |
virtual void DestroyDrm(); |
599 |
|
600 |
int GetFileDescriptor() const { return m_fd; } |
601 |
int GetRenderNodeFileDescriptor() const { return m_renderFd; } |
602 |
const char* GetRenderDevicePath() const { return m_renderDevicePath; } |
603 |
CDRMPlane* GetVideoPlane() const { return m_video_plane; } |
604 |
CDRMPlane* GetGuiPlane() const { return m_gui_plane; } |
605 |
CDRMCrtc* GetCrtc() const { return m_crtc; } |
606 |
CDRMConnector* GetConnector() const { return m_connector; } |
607 |
|
608 |
std::vector<std::string> GetConnectedConnectorNames(); |
609 |
|
610 |
virtual RESOLUTION_INFO GetCurrentMode(); |
611 |
virtual std::vector<RESOLUTION_INFO> GetModes(); |
612 |
virtual bool SetMode(const RESOLUTION_INFO& res); |
613 |
|
614 |
static uint32_t FourCCWithAlpha(uint32_t fourcc); |
615 |
static uint32_t FourCCWithoutAlpha(uint32_t fourcc); |
616 |
|
617 |
- void SetInFenceFd(int fd) { m_inFenceFd = fd; } |
618 |
- int TakeOutFenceFd() |
619 |
- { |
620 |
- int fd{-1}; |
621 |
- return std::exchange(m_outFenceFd, fd); |
622 |
- } |
623 |
- |
624 |
protected: |
625 |
bool OpenDrm(bool needConnector); |
626 |
drm_fb* DrmFbGetFromBo(struct gbm_bo *bo); |
627 |
|
628 |
int m_fd; |
629 |
CDRMConnector* m_connector{nullptr}; |
630 |
CDRMEncoder* m_encoder{nullptr}; |
631 |
CDRMCrtc* m_crtc{nullptr}; |
632 |
CDRMCrtc* m_orig_crtc{nullptr}; |
633 |
CDRMPlane* m_video_plane{nullptr}; |
634 |
CDRMPlane* m_gui_plane{nullptr}; |
635 |
drmModeModeInfo *m_mode = nullptr; |
636 |
|
637 |
int m_width = 0; |
638 |
int m_height = 0; |
639 |
|
640 |
- int m_inFenceFd{-1}; |
641 |
- int m_outFenceFd{-1}; |
642 |
- |
643 |
std::vector<std::unique_ptr<CDRMPlane>> m_planes; |
644 |
|
645 |
private: |
646 |
bool FindConnector(); |
647 |
bool FindEncoder(); |
648 |
bool FindCrtc(); |
649 |
bool FindPlanes(); |
650 |
bool FindPreferredMode(); |
651 |
bool RestoreOriginalMode(); |
652 |
RESOLUTION_INFO GetResolutionInfo(drmModeModeInfoPtr mode); |
653 |
void PrintDrmDeviceInfo(drmDevicePtr device); |
654 |
|
655 |
diff --git a/xbmc/windowing/gbm/drm/OffScreenModeSetting.h b/xbmc/windowing/gbm/drm/OffScreenModeSetting.h |
656 |
index bba0db9..4270d4e 100644 |
657 |
--- xbmc/windowing/gbm/drm/OffScreenModeSetting.h |
658 |
+++ xbmc/windowing/gbm/drm/OffScreenModeSetting.h |
659 |
@@ -13,25 +13,25 @@ |
660 |
namespace KODI |
661 |
{ |
662 |
namespace WINDOWING |
663 |
{ |
664 |
namespace GBM |
665 |
{ |
666 |
|
667 |
class COffScreenModeSetting : public CDRMUtils |
668 |
{ |
669 |
public: |
670 |
COffScreenModeSetting() = default; |
671 |
~COffScreenModeSetting() override = default; |
672 |
- void FlipPage(struct gbm_bo* bo, bool rendered, bool videoLayer, bool async) override {} |
673 |
+ void FlipPage(struct gbm_bo *bo, bool rendered, bool videoLayer) override {} |
674 |
bool SetVideoMode(const RESOLUTION_INFO& res, struct gbm_bo *bo) override { return false; } |
675 |
bool SetActive(bool active) override { return false; } |
676 |
bool InitDrm() override; |
677 |
void DestroyDrm() override {} |
678 |
|
679 |
RESOLUTION_INFO GetCurrentMode() override; |
680 |
std::vector<RESOLUTION_INFO> GetModes() override; |
681 |
bool SetMode(const RESOLUTION_INFO& res) override { return true; } |
682 |
}; |
683 |
|
684 |
} |
685 |
} |
686 |
-- |
687 |
libgit2 1.8.4 |
688 |
|