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

Wayland windowing system #12664

Merged
merged 41 commits into from
Aug 17, 2017
Merged

Wayland windowing system #12664

merged 41 commits into from
Aug 17, 2017

Conversation

yol
Copy link
Member

@yol yol commented Aug 12, 2017

Add native Wayland windowing implementation as result of GSoC 2017 project from https://github.com/pkerling/xbmc/

Description

This has been in the works for the last three months.

I have squashed the commits so that modifications and additions to the non-Wayland Kodi code are separate commits and that the Wayland windowing implementation itself is one commit. That implementation of course also has a history and is made up of a large number of commits (available via the linked GitHub repository) that were reviewed in feature chunks by @FernetMenta, but it would probably not be useful to keep it in mainline.

I realize that this is quite a lot of code to merge so I'm open to any suggestions that make it easier to handle.

Building with Wayland is fully integrated into the depends system and can be achieved by calling tools/depends/configure with --enable-wayland, so it should be easily integratable into Jenkins.

Motivation and Context

Linux is transitioning to the Wayland protocol instead of X11 for the long term. To offer a competitive user experience on Linux and get all the shiny new features, Kodi must support Wayland natively instead of running via Xwayland X11 emulation.

How Has This Been Tested?

Build and run test on linux64 with GL and GLES

Screenshots (if appropriate):

It really looks just like on X :-)
(except for the window decorations which are better not shown off)

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)
    (This PR is mostly "new feature," but contains some commits that fix or improve core Kodi. I can list them individually if it helps.)

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

@fritsch
Copy link
Member

fritsch commented Aug 13, 2017

Nice :-) I followed every issue and every issue review - really nice work. From my pov can go in every time if it does not break anything. Perhaps - only a suggestion - it would be good to add "Wayland:" to the commits actually doing wayland features. This is especially useful when going just through a git log without seeing directly which file it changes.

But it's on your mentor to decide on this minor - only a suggestion.

@yol
Copy link
Member Author

yol commented Aug 13, 2017

iOS is OK now, Windows fail is unrelated

Regarding actually building the Wayland stuff, should I just copy linux64 to linux64wayland so that it can be added to jenkins?

@@ -1,7 +1,5 @@
#pragma once

This comment was marked as spam.

This comment was marked as spam.

// change is confirmed.
// But other windowing code expects these variables to be already set when
// SetFullScreen() is called, so set them anyway and remember the old values.
int origScreenWidth = m_iScreenWidth, origScreenHeight = m_iScreenHeight, origScreenId = m_iScreenId;

This comment was marked as spam.

This comment was marked as spam.

@@ -196,6 +196,10 @@ class CRenderManager
ERENDERSTATE m_renderState;
CEvent m_stateEvent;

/// Display latency tweak value from AdvancedSettings for the current refresh rate
/// in seconds

This comment was marked as spam.

This comment was marked as spam.

@@ -375,11 +375,7 @@ void CAdvancedSettings::Initialize()

m_enableMultimediaKeys = false;

#if defined(TARGET_DARWIN_IOS)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

* that was put there
*/
template<typename OutputIt>
static OutputIt SplitTo(OutputIt d_first, const std::string& input, const std::string& delimiter, unsigned int iMaxStrings = 0)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -78,6 +80,10 @@ typedef struct XBMC_MoveEvent {
int y; /* New y position */
} XBMC_MoveEvent;

struct XBMC_ModeChangeEvent {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,351 @@
/*

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@FernetMenta FernetMenta added Type: Feature non-breaking change which adds functionality v18 Leia labels Aug 13, 2017
@FernetMenta FernetMenta added this to the L 18.0-alpha1 milestone Aug 13, 2017
@FernetMenta
Copy link
Contributor

Very good! Some minors then I think this is ready to go in.

@yol
Copy link
Member Author

yol commented Aug 14, 2017

OK I think that was all of the minors

cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)

.installed-$(PLATFORM): $(PLATFORM)
cd $(PLATFORM); $(PREFIX)/bin/python setup.py install --prefix=$(PREFIX)

This comment was marked as spam.

This comment was marked as spam.

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)

This comment was marked as spam.

This comment was marked as spam.

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)

This comment was marked as spam.

This comment was marked as spam.

[AS_HELP_STRING([--enable-wayland],
[build libraries needed for Wayland. default is no])],
[enable_wayland=$enableval],
[enable_wayland=no])

This comment was marked as spam.

This comment was marked as spam.

@yol
Copy link
Member Author

yol commented Aug 15, 2017

Just give me a ping if this is ready for squashing

@Rechi
Copy link
Member

Rechi commented Aug 16, 2017

please switch to the new style of component logging which was introduced at #12676

leftover from Wayland cleanup
This prevents having WinSystemEGL break other platforms because the
if() condition was not updated.
This is useful for debugging AV sync etc. but should usually be disabled
because it generates a lot of information.
instead of using hardcoded number of frames and multiplying with
refresh rate
The current calculation is weird and the DVD clock which is the only
user of this class has its own offset correction anyway.
Previous code was wrong because it fails on slightly imprecise values.
For example fmod(60,29.999) is 0.002, which is OK.
But fmod(60,30.001) yields is 29.999, which will get rejected as being
above 0.01. There is no reason why 30.001 should be rejected while
29.999 is accepted.
…or renderPts

Signed-off-by: Philipp Kerling <pkerling@casix.org>
… unit

New unit is milliseconds (instead of seconds) since most of the player
code uses it.

Renaming because the time is not related to the "real" display latency
that can somehow be measured, but rather an unspecific tweak.

Signed-off-by: Philipp Kerling <pkerling@casix.org>
At least for Wayland, window must have already been created in order
to create the OS screen saver implementation as it depends on the
window surface. Moving the default value setting until after the
window was created should not have any negative effects.
Preparation for adding Wayland windowing implementation
Depending on the windowing implementation, there might be cases
when the Kodi resolution must be updated not because of a request
of the application, but because the windowing system demands it.
In this case, it does not make sense to call e.g. SetFullScreen
on windowing because windowing is the entity that initiated the
resolution change in the first place.
To simplify control flow in windowing implementations that need
this functionality and make it more explicit what is going on,
add new modesetting event that windowing can generate and
then get informed when the resolution was switched. Similarly,
call back into windowing when an XBMC_VIDEORESIZE event is
processed.
so it can be modified from other threads without problems
* Use in-class default member initializers
* Mark default constructor noexcept
* Use member initializers in constructors instead of assignment
* Use brace-initialization
* Do not make references returned from arithmetic operators const
* Consistently add (in)equality operators as free functions
* Use using instead of typedef
* Simplify conditions
* Remove superfluous "inline"
* Add multiplication and division operators to CPoint
@yol
Copy link
Member Author

yol commented Aug 16, 2017

please switch to the new style of component logging which was introduced at #12676

Done. Had to rebase anyway, squashed while at it.

@fritsch
Copy link
Member

fritsch commented Aug 16, 2017

@FernetMenta when do you push the button? Need to buy champagne before that I think :-)

@FernetMenta
Copy link
Contributor

if no objections, I will merge this this evening.

elseif(WAYLAND_RENDER_SYSTEM STREQUAL "gles")
list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES)
else()
message(SEND_ERROR "You need to decide whether you want to use GL- or GLES-based rendering in combination with the Wayland windowing system. Please set WAYLAND_RENDER_SYSTEM to either \"gl\" or \"gles\". For normal desktop systems, you will usually want to use \"gl\".")

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@FernetMenta
Copy link
Contributor

congratualtions and many thanks to @pkerling

@FernetMenta FernetMenta merged commit 3716e49 into xbmc:master Aug 17, 2017
@MartijnKaijser
Copy link
Member

Congrats and well done. Also for the other semi related fixes.

@fritsch
Copy link
Member

fritsch commented Aug 17, 2017

No need to stop helping and improving kodi for us, now that is merged :-) Thanks very much for this milestone work that pushes kodi to the next level into a great standard linux future.

Your work is highly appreciated.

@paulpach
Copy link

This was exciting to watch. This was the only reason why I don't have fedora in my HTPC, A million thanks to @pkerling

@da-anda
Copy link
Member

da-anda commented Aug 17, 2017

congrats and thanks a lot pkerling

@yol yol deleted the wayland-for-master branch August 18, 2017 07:10
@yol
Copy link
Member Author

yol commented Aug 18, 2017

And there it goes 🎉 Thanks a lot to @FernetMenta for reviewing all of this stuff and giving valuable advice at every stage :-)

@ghost
Copy link

ghost commented Aug 18, 2017

Thank you so much pkerling!!! Highly appreciated :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

10 participants