Ubuntu Pastebin

Paste from bschaefer at Sat, 12 Nov 2016 19:34:12 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt
index 414397e..f35526d 100644
--- a/project/cmake/CMakeLists.txt
+++ b/project/cmake/CMakeLists.txt
@@ -205,8 +205,8 @@ if(NOT WIN32)
     else()
       core_optional_dep(X ENABLE_X11)
       core_optional_dep(XRandR ENABLE_X11)
-      core_optional_dep(LibDRM ENABLE_X11)
     endif()
+    core_optional_dep(LibDRM ENABLE_X11)
   else()
     core_optional_dep(OpenGLES)
     if(OPENGLES_FOUND)
@@ -214,8 +214,8 @@ if(NOT WIN32)
         core_require_dep(Mir ENABLE_MIR)
       else()
         core_optional_dep(X ENABLE_X11)
-        core_optional_dep(LibDRM ENABLE_X11)
       endif()
+      core_optional_dep(LibDRM ENABLE_X11)
     endif()
   endif()
   if(NOT APPLE)
@@ -475,6 +475,7 @@ foreach(msg ${final_message})
   message(STATUS ${msg})
 endforeach()
 
+
 if(VERBOSE)
   message(STATUS "\n#--------------- Internal Variables -------------#")
   message(STATUS "DEPLIBS: ${DEPLIBS}")
diff --git a/project/cmake/scripts/linux/ArchSetup.cmake b/project/cmake/scripts/linux/ArchSetup.cmake
index 51a7152..cae0bb8 100644
--- a/project/cmake/scripts/linux/ArchSetup.cmake
+++ b/project/cmake/scripts/linux/ArchSetup.cmake
@@ -39,10 +39,3 @@ if(CMAKE_BUILD_TYPE STREQUAL Coverage)
   set(COVERAGE_DEPENDS "\${APP_NAME_LC}" "\${APP_NAME_LC}-test")
   set(COVERAGE_EXCLUDES */test/* lib/* */lib/*)
 endif()
-
-# 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)
-  message(STATUS "Hardware video acceleration disabled due to no support in Mir")
-endif()
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
index ed27cbb..4d47b65 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
@@ -32,7 +32,7 @@
 #include "guilib/GraphicContext.h"
 #include "settings/MediaSettings.h"
 #include "settings/AdvancedSettings.h"
-#include <va/va_x11.h>
+#include <va/va_drm.h>
 #include <va/va_drmcommon.h>
 #include <drm_fourcc.h>
 #include "linux/XTimeUtils.h"
@@ -46,16 +46,41 @@ extern "C" {
 }
 
 #include <va/va_vpp.h>
+#include <xf86drm.h>
 
 using namespace VAAPI;
 #define NUM_RENDER_PICS 7
 
+Fd::Fd(int fd) :
+  fd(fd)
+{
+}
+
+Fd& Fd::operator=(Fd&& other)
+{
+  fd = std::move(other.fd);
+  other.fd = invalid;
+  return *this;
+}
+
+Fd::operator int() const
+{
+  return fd;
+}
+
+Fd::~Fd()
+{
+  if (fd > invalid)
+  {
+    close(fd);
+  }
+}
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 CVAAPIContext *CVAAPIContext::m_context = 0;
 CCriticalSection CVAAPIContext::m_section;
-Display *CVAAPIContext::m_X11dpy = 0;
 
 CVAAPIContext::CVAAPIContext()
 {
@@ -125,12 +150,15 @@ bool CVAAPIContext::EnsureContext(CVAAPIContext **ctx, CDecoder *decoder)
 
 bool CVAAPIContext::CreateContext()
 {
-  { CSingleLock lock(g_graphicsContext);
-    if (!m_X11dpy)
-      m_X11dpy = XOpenDisplay(NULL);
+  // FIXME Talk with the OS to figure out the correct render node
+  drm_fd = Fd(open("/dev/dri/renderD128", O_RDWR));
+  if (drm_fd < 0)
+  {
+    m_display = NULL;
+    return false;
   }
 
-  m_display = vaGetDisplay(m_X11dpy);
+  m_display = vaGetDisplayDRM(drm_fd);
 
   int major_version, minor_version;
   if (!CheckSuccess(vaInitialize(m_display, &major_version, &minor_version)))
@@ -250,11 +278,6 @@ VADisplay CVAAPIContext::GetDisplay()
   return m_display;
 }
 
-Display *CVAAPIContext::GetX11Display()
-{
-  return m_X11dpy;
-}
-
 bool CVAAPIContext::IsValidDecoder(CDecoder *decoder)
 {
   auto it = find(m_decoders.begin(), m_decoders.end(), decoder);
@@ -1011,7 +1034,6 @@ bool CDecoder::ConfigVAAPI()
   memset(&m_hwContext, 0, sizeof(vaapi_context));
 
   m_vaapiConfig.dpy = m_vaapiConfig.context->GetDisplay();
-  m_vaapiConfig.x11dsp = m_vaapiConfig.context->GetX11Display();
   m_vaapiConfig.attrib = m_vaapiConfig.context->GetAttrib(m_vaapiConfig.profile);
   if ((m_vaapiConfig.attrib.value & VA_RT_FORMAT_YUV420) == 0)
   {
@@ -2397,7 +2419,6 @@ bool COutput::CheckSuccess(VAStatus status)
 
 bool COutput::CreateEGLContext()
 {
-  m_Display = g_Windowing.GetDisplay();
   EGLDisplay eglDisplay = g_Windowing.GetEGLDisplay();
   EGLContext eglMainContext = g_Windowing.GetEGLContext();
   EGLConfig eglMainConfig = g_Windowing.GetEGLConfig();
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.h
index cbaf4a6..56210ba 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.h
@@ -125,7 +125,6 @@ struct CVaapiConfig
   VADisplay dpy;
   VAProfile profile;
   VAConfigAttrib attrib;
-  Display *x11dsp;
   CProcessInfo *processInfo;
 };
 
@@ -368,6 +367,22 @@ protected:
   CCriticalSection m_section;
 };
 
+// Takes ownership of an FD
+class Fd
+{
+public:
+  Fd() = default;
+  explicit Fd(int fd);
+  Fd& operator=(Fd&& other);
+  ~Fd();
+
+  operator int() const;
+
+private:
+  static const int invalid{-1};
+  int fd{invalid};
+};
+
 //-----------------------------------------------------------------------------
 // VAAPI decoder
 //-----------------------------------------------------------------------------
@@ -378,7 +393,6 @@ public:
   static bool EnsureContext(CVAAPIContext **ctx, CDecoder *decoder);
   void Release(CDecoder *decoder);
   VADisplay GetDisplay();
-  Display* GetX11Display();
   bool SupportsProfile(VAProfile profile);
   VAConfigAttrib GetAttrib(VAProfile profile);
   VAConfigID CreateConfig(VAProfile profile, VAConfigAttrib attrib);
@@ -401,6 +415,7 @@ private:
   int m_profileCount;
   VAProfile *m_profiles;
   std::vector<CDecoder*> m_decoders;
+  Fd drm_fd;
 };
 
 /**
diff --git a/xbmc/windowing/mir/WinSystemMirGLContext.cpp b/xbmc/windowing/mir/WinSystemMirGLContext.cpp
index d157eb8..9d83e5c 100644
--- a/xbmc/windowing/mir/WinSystemMirGLContext.cpp
+++ b/xbmc/windowing/mir/WinSystemMirGLContext.cpp
@@ -84,4 +84,20 @@ bool CWinSystemMirGLContext::IsExtSupported(const char* extension)
   return false;
 }
 
+
+EGLDisplay CWinSystemMirGLContext::GetEGLDisplay() const
+{
+    return m_pGLContext.m_eglDisplay;
+}
+
+EGLContext CWinSystemMirGLContext::GetEGLContext() const
+{
+    return m_pGLContext.m_eglContext;
+}
+
+EGLConfig CWinSystemMirGLContext::GetEGLConfig() const
+{
+    return m_pGLContext.m_eglConfig;
+}
+
 #endif
diff --git a/xbmc/windowing/mir/WinSystemMirGLContext.h b/xbmc/windowing/mir/WinSystemMirGLContext.h
index d65bcd6..4e27406 100644
--- a/xbmc/windowing/mir/WinSystemMirGLContext.h
+++ b/xbmc/windowing/mir/WinSystemMirGLContext.h
@@ -42,6 +42,9 @@ public:
 
   bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
   bool IsExtSupported(const char* extension) override;
+  EGLDisplay GetEGLDisplay() const;
+  EGLContext GetEGLContext() const;
+  EGLConfig GetEGLConfig() const;
 
 protected:
   void SetVSyncImpl(bool enable) override;
diff --git a/xbmc/windowing/mir/WinSystemMirGLESContext.cpp b/xbmc/windowing/mir/WinSystemMirGLESContext.cpp
index 29cd3ea..2d40cb6 100644
--- a/xbmc/windowing/mir/WinSystemMirGLESContext.cpp
+++ b/xbmc/windowing/mir/WinSystemMirGLESContext.cpp
@@ -85,4 +85,19 @@ bool CWinSystemMirGLESContext::IsExtSupported(const char* extension)
   return false;
 }
 
+EGLDisplay CWinSystemMirGLESContext::GetEGLDisplay() const
+{
+    return m_pGLContext.m_eglDisplay;
+}
+
+EGLContext CWinSystemMirGLESContext::GetEGLContext() const
+{
+    return m_pGLContext.m_eglContext;
+}
+
+EGLConfig CWinSystemMirGLESContext::GetEGLConfig() const
+{
+    return m_pGLContext.m_eglConfig;
+}
+
 #endif
diff --git a/xbmc/windowing/mir/WinSystemMirGLESContext.h b/xbmc/windowing/mir/WinSystemMirGLESContext.h
index 5f07ce0..a345253 100644
--- a/xbmc/windowing/mir/WinSystemMirGLESContext.h
+++ b/xbmc/windowing/mir/WinSystemMirGLESContext.h
@@ -21,6 +21,9 @@ public:
 
   bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
   bool IsExtSupported(const char* extension) override;
+  EGLDisplay GetEGLDisplay() const;
+  EGLContext GetEGLContext() const;
+  EGLConfig GetEGLConfig() const;
 
 protected:
   void SetVSyncImpl(bool enable) override;
Download as text