Skip to content

Commit f96fd3e

Browse files
committed
AML Windowing: add DRM vsync
Reduce CPU load when nothing is rendered.
1 parent 78c58aa commit f96fd3e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

xbmc/windowing/amlogic/AMLDisplay.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,17 @@ void CAMLDRMUtils::aml_set_framebuffer_resolution(unsigned int width,
376376
}
377377
}
378378

379+
void CAMLDRMUtils::aml_drmDevice_vsync()
380+
{
381+
if (m_fd != -1)
382+
{
383+
drmVBlank vbl = {};
384+
vbl.request.type = DRM_VBLANK_RELATIVE;
385+
vbl.request.sequence = 1;
386+
drmWaitVBlank(m_fd, &vbl);
387+
}
388+
}
389+
379390
// get drmDevice
380391
int CAMLDRMUtils::aml_get_drmDevice()
381392
{

xbmc/windowing/amlogic/AMLDisplay.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class CAMLDRMUtils
5050

5151
int aml_get_drmDevice_handle() const { return m_fd; }
5252
void aml_init_drmDevice();
53+
void aml_drmDevice_vsync();
5354
std::string aml_get_drmDevice_mode();
5455
std::string aml_get_drmDevice_modes();
5556
bool aml_set_drmDevice_mode(const RESOLUTION_INFO &res, std::string mode,
@@ -104,6 +105,7 @@ class CAMLDisplay
104105

105106
int aml_get_Device_handle() const { return m_amlDRMUtils->aml_get_drmDevice_handle(); }
106107
void aml_init_drmDevice() { m_amlDRMUtils->aml_init_drmDevice(); }
108+
void aml_drmDevice_vsync() { m_amlDRMUtils->aml_drmDevice_vsync(); };
107109
bool aml_get_display_connected() const { return m_amlDRMUtils->aml_get_drmDevice_connected(); }
108110
bool set_native_resolution(const RESOLUTION_INFO &res, std::string framebuffer_name,
109111
const int stereo_mode, bool force_mode_switch);

xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ void CWinSystemAmlogicGLESContext::PresentRender(bool rendered, bool videoLayer)
306306
(*i)->OnResetDisplay();
307307
}
308308
}
309+
else if (!rendered && !videoLayer)
310+
{
311+
m_amlDisplay->aml_drmDevice_vsync();
312+
}
309313
}
310314

311315
EGLDisplay CWinSystemAmlogicGLESContext::GetEGLDisplay() const

0 commit comments

Comments
 (0)