Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Mir windowing system for Kodi #10898
Conversation
|
Good work. Looks really nice after a fist glance. |
| @@ -29,6 +29,12 @@ | ||
| #elif defined(TARGET_WINDOWS) && defined(HAS_DX) | ||
| #include "windows/WinSystemWin32DX.h" | ||
| +#elif defined(TARGET_LINUX) && defined(HAVE_MIR) && defined(HAS_GL) | ||
| +#include "mir/WinSystemMirGLContext.h" |
hudokkow
Nov 8, 2016
•
Member
Not a code review but please use only one space around operators here and below.
Yes, I know... existing code doesn't follow this request.
BrandonSchaefer
commented
Nov 8, 2016
|
Also note I do plan on maintaining this port. I Plan to maintain with the latest Mir release (currently 0.24.1 but 0.25 is coming soon). That is until I need to support multiple Mir versions. |
fetzerch
reviewed
Nov 9, 2016
Nice to see this feature wise :)
I can only comment on the cmake part and found a few minors.
| @@ -118,6 +118,12 @@ if(CORE_SYSTEM_NAME STREQUAL android) | ||
| list(APPEND required_deps Zip) | ||
| endif() | ||
| +# Missing mir support in these libraries | ||
| +if (ENABLE_MIR) |
| - core_optional_dep(X ENABLE_X11) | ||
| - core_optional_dep(LibDRM ENABLE_X11) | ||
| - core_optional_dep(XRandR ENABLE_X11) | ||
| + if (ENABLE_MIR) |
fetzerch
Nov 9, 2016
Member
Good reminder that I need to clean up this spaghetti code. Ok for now, but make it if( without the space everywhere please.
| +# | ||
| +# and the following imported targets:: | ||
| +# | ||
| +# Mir::Mir - The Mir library |
fetzerch
Nov 9, 2016
Member
You don't define the imported target. Since we currently don't use them you can just drop those lines here.
| +# Missing mir support in these libraries | ||
| +if (ENABLE_MIR) | ||
| + set(ENABLE_VAAPI OFF CACHE BOOL "Disabling VAAPI since no mir support" FORCE) | ||
| + set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU since no mir support" FORCE) |
wsnipex
Nov 9, 2016
Member
please also add a message telling the user that HW acceleration is disabled because of mir
BrandonSchaefer
Nov 9, 2016
Hmm its still using opengl/es meaning its accelerated. Whats not implemented is hardware encoding/decoding for mir in these libraries.
| - core_optional_dep(LibDRM ENABLE_X11) | ||
| - core_optional_dep(XRandR ENABLE_X11) | ||
| + if (ENABLE_MIR) | ||
| + core_optional_dep(Mir ENABLE_MIR) |
wsnipex
Nov 9, 2016
Member
core_require_dep please. The dependency is required once the user enables mir.
And please add an option on line 58 for ENABLE_MIR
BrandonSchaefer
Nov 9, 2016
For the option on line 58, how would we define a system is mir and not x11? As any system thats linux will most likely be for an x11 system (that possibly supports mir)
| + PATHS ${PC_MIR_INCLUDE_DIRS}) | ||
| + | ||
| +find_library(MIR_LIBRARY NAMES mirclient | ||
| + PATHS ${PC_MIR_LIBRARIES} ${PC_LIBRARY_DIRS}) |
wsnipex
added
Feature
Linux
labels
Nov 9, 2016
|
@FernetMenta is this something we could consider for v17, because it's very contained and doesn't touch existing code? |
|
What I wonder is: Can we get VAAPI working? We don't use any X11 dependencies in the code. What is currently missing in that regard? |
|
For my part v17: I does not harm, we have a maintainer with it. It is not build by default via our ppa - so users using it will most likely be only self compilers. If ubuntu considers it for their next release, the hw decoding, especially with vaapi should be considered investigating. |
| @@ -41,6 +42,7 @@ class CWinEventsMir : public IWinEvents | ||
| private: | ||
| std::queue<XBMC_Event> events; | ||
| + std::mutex mutex; |
| @@ -329,10 +331,12 @@ bool CWinEventsMir::MessagePump() | ||
| size_t CWinEventsMir::GetQueueSize() | ||
| { | ||
| + std::lock_guard<decltype(mutex)> event_lock(mutex); |
fritsch
Nov 10, 2016
•
Member
that's a nice c++11 feature which could replace most of our own locking patterns, that implemented this "by hand", when there was no std::mutex and no std::lock_guard available.
|
no objection |
BrandonSchaefer
commented
Nov 10, 2016
|
For VAAPI support (I dug into a little bit) it needs a mir backend pretty much. Something Im interested in as well. No promises of when though! |
|
I thought that would somehow work via EGL / DRM via: https://cgit.freedesktop.org/libva/tree/va/egl/va_backend_egl.h |
BrandonSchaefer
commented
Nov 10, 2016
|
That... should work, ill have to test that out! |
BrandonSchaefer
commented
Nov 10, 2016
|
Im seeing some issues with the egl windowing system battling against mir when using opengles. I would prefer not to add an EGL Mir type soo im going to mess with that a bit. |
|
If you have comments on how we can improve that without you having to introduce pseudo types that duplicate given definitions, please do not hessitate to point them out. |
|
Mir won't work with vaapi unless someone implements something like vaGetDisplayMIR |
|
If they can use DRM directly: https://cgit.freedesktop.org/vaapi/libva/tree/va/drm/va_drm.c#n90 |
BrandonSchaefer
commented
Nov 10, 2016
|
I made some changes in 21b89b2 Soo I dont need to create a EGL Mir type. Pretty much ignore the windowing egl system if mir is enabled! |
BrandonSchaefer
commented
Nov 11, 2016
|
Also looking at cores/VideoPlayer/DVDCodecs/Video/VAAPI.h seems to depend on X11. |
|
I know about the DRM backend but I doubt that it would work when the final goal is to display the surface. |
BrandonSchaefer
commented
Nov 12, 2016
•
|
Soo messing around with the VAAPI, im pretty sure its working using DRM/EGL render nodes. (Was running into issues with our kms backend since it opens up the same dri device which work buuut render nodes seems to work) A very hacked proof of concept: From there its just manually checking the /dev/dri/renderD* for the correct number depending on the machine. (as long as you've a kernel >= 3.15) Which brings me to wondering if we can replace the VAAPI DVDCodec bits with drm only? Or does the x11 specific bring better support for x11? I dont really understand everything thats going on there :). |
needs to be tested with wayland too. there is nothing that keeps us sticking to x11 because x11 will die anyway. did you get a picture with drm? |
BrandonSchaefer
commented
Nov 12, 2016
|
Yeah testing for sure. I did get picture and tested with print statements in the vaapi renderer + break point on vaRenderPicture which were all going off (which makes me think its working!). Let me screen shot though! |
|
Great! Just great! |
|
For the record, still works fine with X11 Display (what was to be expected). Btw. if we are at it - there are some additional options for "transfering" * the surfaces via DRM insteand of using EGL, but still being able to render them afterwards.
Code used, directly basing on your cleaned up "hack": http://sprunge.us/cDgS - node, that is opened needs to be closed, which is also missing here. |
|
fritsch/xbmc@372a3ff should do :-) |
BrandonSchaefer
commented
Nov 12, 2016
|
O sweet, yeah i double checked with X11 as well which was working but didnt know about that player process info. That helps secure the fact its vaapi. Also note it doesnt work for *.divx (which im not very familiar with codecs in general I just assume vaapi doesnt support that codec.) Just needs cleaning up on an RAII class to hold the FD as well as selecting the render node (since I assume mir/wayland will hold onto the device so you cannot drmOpen on it) |
|
For DIVX: Player Settings (Expert Hierarchy) -> Enable Mpeg4 |
BrandonSchaefer
referenced this pull request
Nov 12, 2016
Merged
Use DRM as a fallback if not on X11 for VAAPI #10922
BrandonSchaefer
commented
Nov 13, 2016
•
|
Comparison on this pull request (#10922) with mir using VAAPI vs X11 and vs mir with no hardware accel (ie. this branch currently) |
| @@ -135,8 +135,10 @@ endif | ||
| ifeq (@USE_OPENGLES@,1) | ||
| DIRECTORY_ARCHIVES += xbmc/rendering/gles/rendering_gles.a | ||
| +ifneq (@USE_MIR@,1) |
| @@ -0,0 +1,39 @@ | ||
| +#pragma once | ||
| + | ||
| +#ifndef WINDOW_SYSTEM_MIR_GLES_CONTEXT_H_ |
FernetMenta
Dec 1, 2016
Member
we require it in many places. a compiler that does not support pragma won't ever be able to build kodi
| @@ -0,0 +1,40 @@ | ||
| +#pragma once |
FernetMenta
merged commit 374da77
into
xbmc:master
Dec 2, 2016
BrandonSchaefer
referenced this pull request
Dec 2, 2016
Merged
Enable VAAPI support for Mir using DRM #11040
MartijnKaijser
modified the milestone:
L 18.0-alpha1
Dec 3, 2016
|
this inverted logic is kind of ugly. I don't think we want to extend this with NOT Mir Wayland, blaba |
BrandonSchaefer
replied
Jan 8, 2017
|
I agree 100%. I can try to get a new patch up soon! |
|
I had a discussion with @fetzerch. He is working on something better already. |

BrandonSchaefer commentedNov 8, 2016
•
Edited 1 time
-
BrandonSchaefer
Nov 8, 2016
Mir windowing system for Kodi.
Description
Implements a mir windowing system. Supports both OpenGL/ES for rendering. Keyboard/Pointer events but I need to test out touch events. Supports both cmake/autotools. I also need to test out arm/64.
cmake -DENABLE_MIR=ON or for autotools --enable-mir
Motivation and Context
The motivation for this change is to support a mir windowing system. Allow a Kodi media center to run on mir.
How Has This Been Tested?
Tested on ubuntu 16.10 using mir 0.24 and 0.25. There is some mir 0.25 code that is commented out but can be re-enabled once 0.25 has been released.
To test you'll need a mir server + kodi built with mir enabled
On ubuntu 16.10:
Getting a mir server running:
apt-get install miral-examples (gives you miral-shell the mir server)
Running on X11 you can simply run: ./miral-shell
You'll see a window pop up saying Mir-on-X which is the mir server running on the X11 platform.
Getting kodi compiled/working.
apt-get install libmirclient-dev
From this branch you can either use autotools (--enable-mir) or cmake (-DENABLE_MIR=ON)
Once configured make annnd wait.
Once you have kodi.bin and the miral-shell (server) running:
./kodi.bin
This will start kodi.bin on the mir server.
From there tested video/pictures/add-ons/skins/music etc. I could have missed somethings to manually test that I was unsure about.
This code change is very low impact, as its turned off by default and the code it self is stuffed into a directory.
I also think I need to write a README.mir
Screenshots (if appropriate):
https://www.youtube.com/watch?v=26A6qK7vNGo
Types of change
Checklist: