-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windowing: GBM - add off screen modesetting
This adds a new IModeSettingBase interface that is implemented by the DRMUtils class for the standard drm modesetting implementations. Furthermore the new OffScreenModeSetting implementation acts as sort of a dummy modesetting handler.
- Loading branch information
Showing
8 changed files
with
125 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "OffScreenModeSetting.h" | ||
#include "utils/log.h" | ||
|
||
bool COffScreenModeSetting::InitDrm() | ||
{ | ||
if (!CDRMUtils::OpenDrm(false)) | ||
{ | ||
return false; | ||
} | ||
|
||
CLog::Log(LOGDEBUG, "COffScreenModeSetting::%s - initialized offscreen DRM", __FUNCTION__); | ||
return true; | ||
} | ||
|
||
void COffScreenModeSetting::DestroyDrm() | ||
{ | ||
close(m_fd); | ||
m_fd = -1; | ||
} | ||
|
||
std::vector<RESOLUTION_INFO> COffScreenModeSetting::GetModes() | ||
{ | ||
std::vector<RESOLUTION_INFO> resolutions; | ||
resolutions.push_back(GetCurrentMode()); | ||
return resolutions; | ||
} | ||
|
||
RESOLUTION_INFO COffScreenModeSetting::GetCurrentMode() | ||
{ | ||
RESOLUTION_INFO res; | ||
res.iScreenWidth = DISPLAY_WIDTH; | ||
res.iWidth = DISPLAY_WIDTH; | ||
res.iScreenHeight = DISPLAY_HEIGHT; | ||
res.iHeight = DISPLAY_HEIGHT; | ||
res.fRefreshRate = DISPLAY_REFRESH; | ||
res.iSubtitles = static_cast<int>(0.965 * res.iHeight); | ||
res.fPixelRatio = 1.0f; | ||
res.bFullScreen = true; | ||
res.strId = "0"; | ||
|
||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2005-2018 Team XBMC | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with XBMC; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "DRMUtils.h" | ||
|
||
#ifdef TARGET_POSIX | ||
#include "platform/linux/XTimeUtils.h" | ||
#endif | ||
|
||
class COffScreenModeSetting : public CDRMUtils | ||
{ | ||
public: | ||
COffScreenModeSetting() = default; | ||
~COffScreenModeSetting() { DestroyDrm(); }; | ||
void FlipPage(struct gbm_bo *bo, bool rendered, bool videoLayer) override {} | ||
bool SetVideoMode(const RESOLUTION_INFO& res, struct gbm_bo *bo) override { return false; } | ||
bool SetActive(bool active) override { return false; } | ||
bool InitDrm() override; | ||
void DestroyDrm() override; | ||
|
||
RESOLUTION_INFO GetCurrentMode() override; | ||
std::vector<RESOLUTION_INFO> GetModes() override; | ||
bool SetMode(const RESOLUTION_INFO& res) override { return true; } | ||
void WaitVBlank() override { Sleep(20); } | ||
|
||
private: | ||
const int DISPLAY_WIDTH = 1280; | ||
const int DISPLAY_HEIGHT= 720; | ||
const float DISPLAY_REFRESH = 50.0f; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters