Skip to content
This repository
Browse code

VAAPI: Check supported libva-driver-intel to see if 4K decoding is po…

…ssible
  • Loading branch information...
commit ac7fea4b976441984f55c252a6b99cc9c8a2a801 1 parent 5fb932d
Peter Frühberger authored September 09, 2013
21  xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
@@ -106,6 +106,7 @@ static CDisplayPtr GetGlobalDisplay()
106 106
 
107 107
   bool deinterlace = true;
108 108
   int major, minor, micro;
  109
+  bool support_4k = true;
109 110
   if(sscanf(vendor,  "Intel i965 driver - %d.%d.%d", &major, &minor, &micro) == 3)
110 111
   {
111 112
     /* older version will crash and burn */
@@ -114,9 +115,16 @@ static CDisplayPtr GetGlobalDisplay()
114 115
       CLog::Log(LOGDEBUG, "VAAPI - deinterlace not support on this intel driver version");
115 116
       deinterlace = false;
116 117
     }
  118
+    // do the same check for 4K decoding: version < 1.2.0 (stable) and 1.0.21 (staging)
  119
+    // cannot decode 4K and will crash the GPU
  120
+    if((compare_version(major, minor, micro, 1, 2, 0) < 0) && (compare_version(major, minor, micro, 1, 0, 21) < 0))
  121
+    {
  122
+      support_4k = false;
  123
+    }
117 124
   }
118 125
 
119 126
   display = CDisplayPtr(new CDisplay(disp, deinterlace));
  127
+  display->support_4k(support_4k);
120 128
   display_global = display;
121 129
   return display;
122 130
 }
@@ -266,13 +274,6 @@ bool CDecoder::Open(AVCodecContext *avctx, enum PixelFormat fmt, unsigned int su
266 274
 
267 275
   CLog::Log(LOGDEBUG, "VAAPI - attempting to open codec %d with profile %d at level %d with %d reference frames", avctx->codec_id, avctx->profile, avctx->level, avctx->refs);
268 276
 
269  
-  if(avctx->width  > 1920
270  
-  || avctx->height > 1088)
271  
-  {
272  
-    CLog::Log(LOGDEBUG, "VAAPI - frame size (%dx%d) too large - disallowing", avctx->width, avctx->height);
273  
-    return false;
274  
-  }
275  
-
276 277
   vector<VAProfile> accepted;
277 278
   switch (avctx->codec_id) {
278 279
     case AV_CODEC_ID_MPEG2VIDEO:
@@ -315,6 +316,12 @@ bool CDecoder::Open(AVCodecContext *avctx, enum PixelFormat fmt, unsigned int su
315 316
   if(!m_display)
316 317
     return false;
317 318
 
  319
+  if(!m_display->support_4k() && (avctx->width > 1920 || avctx->height > 1088))
  320
+  {
  321
+    CLog::Log(LOGDEBUG, "VAAPI - frame size (%dx%d) too large - disallowing", avctx->width, avctx->height);
  322
+    return false;
  323
+  }
  324
+
318 325
   int num_display_attrs = 0;
319 326
   scoped_array<VADisplayAttribute> display_attrs(new VADisplayAttribute[vaMaxNumDisplayAttributes(m_display->get())]);
320 327
 
4  xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h
@@ -42,6 +42,7 @@ struct CDisplay
42 42
     : m_display(display)
43 43
     , m_lost(false)
44 44
     , m_deinterlace(deinterlace)
  45
+    , m_support_4k(true)
45 46
   {}
46 47
  ~CDisplay();
47 48
 
@@ -49,10 +50,13 @@ struct CDisplay
49 50
   bool      lost()          { return m_lost; }
50 51
   void      lost(bool lost) { m_lost = lost; }
51 52
   bool      support_deinterlace() { return m_deinterlace; };
  53
+  bool      support_4k() { return m_support_4k; };
  54
+  void      support_4k(bool support_4k) { m_support_4k = support_4k; };
52 55
 private:
53 56
   VADisplay m_display;
54 57
   bool      m_lost;
55 58
   bool      m_deinterlace;
  59
+  bool      m_support_4k;
56 60
 };
57 61
 
58 62
 typedef boost::shared_ptr<CDisplay> CDisplayPtr;

0 notes on commit ac7fea4

Please sign in to comment.
Something went wrong with that request. Please try again.