Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add headless modesetting for linux gbm #14125

Merged
merged 1 commit into from
Jul 15, 2018
Merged

Conversation

a1rwulf
Copy link
Member

@a1rwulf a1rwulf commented Jun 28, 2018

This is a rework of my headless/hotplug proof of concept for linux gbm.

Description

In order to run kodi in headless mode I've extended the modesetting initialization.
The order of init tries is now as follows:

  • try init drm atomic
  • try init drm legacy
  • try to grab a rendernode and run headless

Motivation and Context

My plan is to detect hdmi connects/disconnects and reinit on the fly, which is actually
meant to be a userspace hotplug implementation.
Furthermore this allows you to run kodi without a screen, if you set audio to analog you
can for example control kodi via kore and use it as a music player.

How Has This Been Tested

Tested headless music playback and normal video playback on linux gbm (Intel NUC).

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the Code guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my change
  • All new and existing tests passed

@lrusak or @Kwiboo you may give it a shot on other gbm devices - however the DRMPrimeRenderer will fail hard if hdmi is not attached and you try to play a movie.

@a1rwulf a1rwulf added Type: Feature non-breaking change which adds functionality Platform: Linux v18 Leia labels Jun 28, 2018
@a1rwulf a1rwulf added this to the Leia 18.0-alpha3 milestone Jun 28, 2018
@a1rwulf a1rwulf requested a review from lrusak June 28, 2018 19:41
@a1rwulf
Copy link
Member Author

a1rwulf commented Jun 28, 2018

After talking to @fritsch I rechecked the code.
After @Kwiboo's change to GetCurrentMode I don't need the drmModeModeInfoPtr any more.
When killing it, I also changed res to 720p@50.

std::vector<RESOLUTION_INFO> COffScreenModeSetting::GetModes()
{
std::vector<RESOLUTION_INFO> resolutions;
RESOLUTION_INFO res;

This comment was marked as spam.

This comment was marked as spam.

@a1rwulf
Copy link
Member Author

a1rwulf commented Jul 12, 2018

@lrusak updated to your version.
Somehow authorship is not retained, I'll fix this if you insist ;)

@Rechi
Copy link
Member

Rechi commented Jul 12, 2018

git commit --amend --no-edit --author='Lukas Rusak <lorusak@gmail.com>'

RESOLUTION_INFO COffScreenModeSetting::GetCurrentMode()
{
RESOLUTION_INFO res;
res.iScreen = 0;

This comment was marked as spam.

This comment was marked as spam.

@a1rwulf
Copy link
Member Author

a1rwulf commented Jul 12, 2018

thx @Rechi
Retained authorship and fixed the rebase error.

@a1rwulf
Copy link
Member Author

a1rwulf commented Jul 12, 2018

@lrusak build is OK now.
I've successfully tested headless music playback through json api with analog audio and
normal playback with connected hdmi.

res.iSubtitles = static_cast<int>(0.965 * res.iHeight);
res.fPixelRatio = 1.0f;
res.bFullScreen = true;
res.strId = std::to_string(0);

This comment was marked as spam.

Copy link
Contributor

@lrusak lrusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.
@a1rwulf
Copy link
Member Author

a1rwulf commented Jul 13, 2018

OK I've squashed all of them as they were fixups, will merge once jenkins is happy.

@lrusak lrusak merged commit 952afb1 into xbmc:master Jul 15, 2018
@lrusak
Copy link
Contributor

lrusak commented Jul 15, 2018

thanks @a1rwulf !!!!

@@ -0,0 +1,42 @@
#include "OffScreenModeSetting.h"

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Linux Type: Feature non-breaking change which adds functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants