Skip to content
This repository
Browse code

muahaha, it's working

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29053 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
commit eab1526bd8b1ddaed27412ad7e90f921cff95b4c 1 parent b71ebe3
authored April 06, 2010
46  xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -2241,26 +2241,22 @@ void CLinuxRendererGL::DeleteVAAPITexture(int index)
2241 2241
   YUVBUFFER::VA &va    = m_buffers[index].vaapi;
2242 2242
   VAStatus status;
2243 2243
 
2244  
-  glDeleteTextures(1, &plane.id);
2245  
-  plane.id = 0;
2246  
-
2247  
-  if(va.object == NULL)
2248  
-  {
2249  
-    if(va.surfacegl)
2250  
-      CLog::Log(LOGERROR, "CLinuxRendererGL::DeleteVAAPITexture - unable to delete texture due to lacking display");
2251  
-    return;
2252  
-  }
2253  
-
2254 2244
   if(va.surfacegl)
2255 2245
   {
2256  
-    status = vaDestroySurfaceGLX(va.object->GetDisplay(), va.surfacegl);
2257  
-    if(status != VA_STATUS_SUCCESS)
  2246
+    if(va.object)
2258 2247
     {
2259  
-      CLog::Log(LOGERROR, "CLinuxRendererGL::DeleteVAAPITexture - failed delete surface (%d)", status);
2260  
-      return;
  2248
+      status = vaDestroySurfaceGLX(va.object->GetDisplay(), va.surfacegl);
  2249
+      if(status != VA_STATUS_SUCCESS)
  2250
+        CLog::Log(LOGERROR, "CLinuxRendererGL::DeleteVAAPITexture - failed delete surface (%d)", status);
2261 2251
     }
  2252
+    else
  2253
+      CLog::Log(LOGERROR, "CLinuxRendererGL::DeleteVAAPITexture - unable to delete texture due to lacking display");    
  2254
+
2262 2255
     va.surfacegl = NULL;
2263 2256
   }
  2257
+  if(plane.id && glIsTexture(plane.id))
  2258
+    glDeleteTextures(1, &plane.id);
  2259
+  plane.id = 0;
2264 2260
 
2265 2261
   SAFE_RELEASE(va.object);
2266 2262
 #endif
@@ -2317,10 +2313,9 @@ void CLinuxRendererGL::UploadVAAPITexture(int index)
2317 2313
   if(va.object == NULL)
2318 2314
     return;
2319 2315
 
2320  
-  //vaAssociateSurfaceGLX
2321  
-
2322 2316
   if(va.surfacegl == NULL)
2323 2317
   {
  2318
+    CLog::Log(LOGDEBUG, "CLinuxRendererGL::UploadVAAPITexture - creating vaapi surface for texture %d", index);
2324 2319
     status = vaCreateSurfaceGLX(va.object->GetDisplay()
2325 2320
                               , m_textureTarget
2326 2321
                               , plane.id
@@ -2331,16 +2326,31 @@ void CLinuxRendererGL::UploadVAAPITexture(int index)
2331 2326
       return;
2332 2327
     }
2333 2328
   }
  2329
+  int colorspace;
  2330
+  if(CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_BT709)
  2331
+    colorspace = VA_SRC_BT709;
  2332
+  else
  2333
+    colorspace = VA_SRC_BT601;
  2334
+
  2335
+  int field;
  2336
+  if      (m_currentField == FIELD_ODD)
  2337
+    field = VA_TOP_FIELD;
  2338
+  else if (m_currentField == FIELD_EVEN)
  2339
+    field = VA_BOTTOM_FIELD;
  2340
+  else
  2341
+    field = VA_FRAME_PICTURE;
  2342
+
2334 2343
 #if USE_VAAPI_GLX_BIND
2335 2344
   status = vaAssociateSurfaceGLX(va.object->GetDisplay()
2336 2345
                                , va.surfacegl
2337 2346
                                , va.surface
2338  
-                               , VA_FRAME_PICTURE | VA_SRC_BT709);
  2347
+                               , field | colorspace);
2339 2348
 #else
  2349
+  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
2340 2350
   status = vaCopySurfaceGLX(va.object->GetDisplay()
2341 2351
                           , va.surfacegl
2342 2352
                           , va.surface
2343  
-                          , VA_FRAME_PICTURE | VA_SRC_BT709);
  2353
+                          , field | colorspace);
2344 2354
 #endif
2345 2355
 
2346 2356
   if(status != VA_STATUS_SUCCESS)
8  xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
@@ -31,7 +31,7 @@ do { \
31 31
   VAStatus res = a; \
32 32
   if(res != VA_STATUS_SUCCESS) \
33 33
   { \
34  
-    CLog::Log(LOGERROR, "VAAPI - failed executing "#a" at line %d with error %x", __LINE__, res); \
  34
+    CLog::Log(LOGERROR, "VAAPI - failed executing "#a" at line %d with error %x:%s", __LINE__, res, vaErrorStr(res)); \
35 35
     return false; \
36 36
   } \
37 37
 } while(0);
@@ -40,7 +40,7 @@ do { \
40 40
 do { \
41 41
   VAStatus res = a; \
42 42
   if(res != VA_STATUS_SUCCESS) \
43  
-    CLog::Log(LOGWARNING, "VAAPI - failed executing "#a" at line %d with error %x", __LINE__, res); \
  43
+    CLog::Log(LOGWARNING, "VAAPI - failed executing "#a" at line %d with error %x:%s", __LINE__, res, vaErrorStr(res)); \
44 44
 } while(0);
45 45
 
46 46
 
@@ -179,6 +179,10 @@ void CDecoder::Close()
179 179
   for(std::list<VASurfaceID>::iterator it = m_surfaces_used.begin(); it != m_surfaces_used.end(); it++)
180 180
     WARN(vaDestroySurfaces(m_display, &(*it), 1))
181 181
   m_surfaces_used.clear();
  182
+  
  183
+  if(m_display)
  184
+    WARN(vaTerminate(m_display))
  185
+  m_display = NULL;
182 186
 }
183 187
 
184 188
 bool CDecoder::Open(AVCodecContext *avctx, enum PixelFormat fmt)

0 notes on commit eab1526

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