Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: content/common/gpu/media/vaapi_h264_decoder.cc

Issue 10824051: VAVDA: Go back to using vaTerminate now that the bug in the driver is fixed. (Closed) Base URL: https://git.chromium.org/git/chromium/src@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <dlfcn.h> 5 #include <dlfcn.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 16 matching lines...) Expand all
27 DVLOG(1) << err_msg \ 27 DVLOG(1) << err_msg \
28 << " VA error: " << VAAPI_ErrorStr(va_res); \ 28 << " VA error: " << VAAPI_ErrorStr(va_res); \
29 return (ret); \ 29 return (ret); \
30 } \ 30 } \
31 } while (0) 31 } while (0)
32 32
33 namespace content { 33 namespace content {
34 34
35 void *vaapi_handle = dlopen("libva.so", RTLD_NOW); 35 void *vaapi_handle = dlopen("libva.so", RTLD_NOW);
36 void *vaapi_x11_handle = dlopen("libva-x11.so", RTLD_NOW); 36 void *vaapi_x11_handle = dlopen("libva-x11.so", RTLD_NOW);
37 void *vaapi_glx_handle = dlopen("libva-glx.so", RTLD_NOW);
38 37
39 typedef VADisplay (*VaapiGetDisplayGLX)(Display *dpy); 38 typedef VADisplay (*VaapiGetDisplay)(Display *dpy);
40 typedef int (*VaapiDisplayIsValid)(VADisplay dpy); 39 typedef int (*VaapiDisplayIsValid)(VADisplay dpy);
41 typedef VAStatus (*VaapiInitialize)(VADisplay dpy, 40 typedef VAStatus (*VaapiInitialize)(VADisplay dpy,
42 int *major_version, 41 int *major_version,
43 int *minor_version); 42 int *minor_version);
44 typedef VAStatus (*VaapiTerminate)(VADisplay dpy); 43 typedef VAStatus (*VaapiTerminate)(VADisplay dpy);
45 typedef VAStatus (*VaapiGetConfigAttributes)(VADisplay dpy, 44 typedef VAStatus (*VaapiGetConfigAttributes)(VADisplay dpy,
46 VAProfile profile, 45 VAProfile profile,
47 VAEntrypoint entrypoint, 46 VAEntrypoint entrypoint,
48 VAConfigAttrib *attrib_list, 47 VAConfigAttrib *attrib_list,
49 int num_attribs); 48 int num_attribs);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 unsigned int num_elements, 101 unsigned int num_elements,
103 void *data, 102 void *data,
104 VABufferID *buf_id); 103 VABufferID *buf_id);
105 typedef VAStatus (*VaapiDestroyBuffer)(VADisplay dpy, VABufferID buffer_id); 104 typedef VAStatus (*VaapiDestroyBuffer)(VADisplay dpy, VABufferID buffer_id);
106 typedef const char* (*VaapiErrorStr)(VAStatus error_status); 105 typedef const char* (*VaapiErrorStr)(VAStatus error_status);
107 106
108 #define VAAPI_DLSYM(name, handle) \ 107 #define VAAPI_DLSYM(name, handle) \
109 Vaapi##name VAAPI_##name = \ 108 Vaapi##name VAAPI_##name = \
110 reinterpret_cast<Vaapi##name>(dlsym((handle), "va"#name)) 109 reinterpret_cast<Vaapi##name>(dlsym((handle), "va"#name))
111 110
112 VAAPI_DLSYM(GetDisplayGLX, vaapi_glx_handle); 111 VAAPI_DLSYM(GetDisplay, vaapi_x11_handle);
113 VAAPI_DLSYM(DisplayIsValid, vaapi_handle); 112 VAAPI_DLSYM(DisplayIsValid, vaapi_handle);
114 VAAPI_DLSYM(Initialize, vaapi_handle); 113 VAAPI_DLSYM(Initialize, vaapi_handle);
115 VAAPI_DLSYM(Terminate, vaapi_handle); 114 VAAPI_DLSYM(Terminate, vaapi_handle);
116 VAAPI_DLSYM(GetConfigAttributes, vaapi_handle); 115 VAAPI_DLSYM(GetConfigAttributes, vaapi_handle);
117 VAAPI_DLSYM(CreateConfig, vaapi_handle); 116 VAAPI_DLSYM(CreateConfig, vaapi_handle);
118 VAAPI_DLSYM(DestroyConfig, vaapi_handle); 117 VAAPI_DLSYM(DestroyConfig, vaapi_handle);
119 VAAPI_DLSYM(CreateSurfaces, vaapi_handle); 118 VAAPI_DLSYM(CreateSurfaces, vaapi_handle);
120 VAAPI_DLSYM(DestroySurfaces, vaapi_handle); 119 VAAPI_DLSYM(DestroySurfaces, vaapi_handle);
121 VAAPI_DLSYM(CreateContext, vaapi_handle); 120 VAAPI_DLSYM(CreateContext, vaapi_handle);
122 VAAPI_DLSYM(DestroyContext, vaapi_handle); 121 VAAPI_DLSYM(DestroyContext, vaapi_handle);
123 VAAPI_DLSYM(PutSurface, vaapi_x11_handle); 122 VAAPI_DLSYM(PutSurface, vaapi_x11_handle);
124 VAAPI_DLSYM(SyncSurface, vaapi_x11_handle); 123 VAAPI_DLSYM(SyncSurface, vaapi_x11_handle);
125 VAAPI_DLSYM(BeginPicture, vaapi_handle); 124 VAAPI_DLSYM(BeginPicture, vaapi_handle);
126 VAAPI_DLSYM(RenderPicture, vaapi_handle); 125 VAAPI_DLSYM(RenderPicture, vaapi_handle);
127 VAAPI_DLSYM(EndPicture, vaapi_handle); 126 VAAPI_DLSYM(EndPicture, vaapi_handle);
128 VAAPI_DLSYM(CreateBuffer, vaapi_handle); 127 VAAPI_DLSYM(CreateBuffer, vaapi_handle);
129 VAAPI_DLSYM(DestroyBuffer, vaapi_handle); 128 VAAPI_DLSYM(DestroyBuffer, vaapi_handle);
130 VAAPI_DLSYM(ErrorStr, vaapi_handle); 129 VAAPI_DLSYM(ErrorStr, vaapi_handle);
131 130
132 static bool AreVaapiFunctionPointersInitialized() { 131 static bool AreVaapiFunctionPointersInitialized() {
133 return VAAPI_GetDisplayGLX && 132 return VAAPI_GetDisplay &&
134 VAAPI_DisplayIsValid && 133 VAAPI_DisplayIsValid &&
135 VAAPI_Initialize && 134 VAAPI_Initialize &&
136 VAAPI_Terminate && 135 VAAPI_Terminate &&
137 VAAPI_GetConfigAttributes && 136 VAAPI_GetConfigAttributes &&
138 VAAPI_CreateConfig && 137 VAAPI_CreateConfig &&
139 VAAPI_DestroyConfig && 138 VAAPI_DestroyConfig &&
140 VAAPI_CreateSurfaces && 139 VAAPI_CreateSurfaces &&
141 VAAPI_DestroySurfaces && 140 VAAPI_DestroySurfaces &&
142 VAAPI_CreateContext && 141 VAAPI_CreateContext &&
143 VAAPI_DestroyContext && 142 VAAPI_DestroyContext &&
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 case kError: 411 case kError:
413 destroy_surfaces = true; 412 destroy_surfaces = true;
414 // fallthrough 413 // fallthrough
415 case kInitialized: 414 case kInitialized:
416 if (!make_context_current_.Run()) 415 if (!make_context_current_.Run())
417 break; 416 break;
418 if (destroy_surfaces) 417 if (destroy_surfaces)
419 DestroyVASurfaces(); 418 DestroyVASurfaces();
420 va_res = VAAPI_DestroyConfig(va_display_, va_config_id_); 419 va_res = VAAPI_DestroyConfig(va_display_, va_config_id_);
421 VA_LOG_ON_ERROR(va_res, "vaDestroyConfig failed"); 420 VA_LOG_ON_ERROR(va_res, "vaDestroyConfig failed");
422 // TODO(fischman,posciak): call vaTerminate when we figure out why it 421 va_res = VAAPI_Terminate(va_display_);
423 // crashes. 422 VA_LOG_ON_ERROR(va_res, "vaTerminate failed");
424 // va_res = VAAPI_Terminate(va_display_);
425 // VA_LOG_ON_ERROR(va_res, "vaTerminate failed");
426 // fallthrough 423 // fallthrough
427 case kUninitialized: 424 case kUninitialized:
428 break; 425 break;
429 } 426 }
430 427
431 state_ = kUninitialized; 428 state_ = kUninitialized;
432 } 429 }
433 430
434 // Maps Profile enum values to VaProfile values. 431 // Maps Profile enum values to VaProfile values.
435 bool VaapiH264Decoder::SetProfile(media::VideoCodecProfile profile) { 432 bool VaapiH264Decoder::SetProfile(media::VideoCodecProfile profile) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 if (!AreVaapiFunctionPointersInitialized()) { 499 if (!AreVaapiFunctionPointersInitialized()) {
503 DVLOG(1) << "Could not load libva"; 500 DVLOG(1) << "Could not load libva";
504 return false; 501 return false;
505 } 502 }
506 503
507 if (!InitializeFBConfig()) { 504 if (!InitializeFBConfig()) {
508 DVLOG(1) << "Could not get a usable FBConfig"; 505 DVLOG(1) << "Could not get a usable FBConfig";
509 return false; 506 return false;
510 } 507 }
511 508
512 va_display_ = VAAPI_GetDisplayGLX(x_display_); 509 va_display_ = VAAPI_GetDisplay(x_display_);
513 if (!VAAPI_DisplayIsValid(va_display_)) { 510 if (!VAAPI_DisplayIsValid(va_display_)) {
514 DVLOG(1) << "Could not get a valid VA display"; 511 DVLOG(1) << "Could not get a valid VA display";
515 return false; 512 return false;
516 } 513 }
517 514
518 int major_version, minor_version; 515 int major_version, minor_version;
519 VAStatus va_res; 516 VAStatus va_res;
520 va_res = VAAPI_Initialize(va_display_, &major_version, &minor_version); 517 va_res = VAAPI_Initialize(va_display_, &major_version, &minor_version);
521 VA_SUCCESS_OR_RETURN(va_res, "vaInitialize failed", false); 518 VA_SUCCESS_OR_RETURN(va_res, "vaInitialize failed", false);
522 DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version; 519 DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version;
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 } 2092 }
2096 } 2093 }
2097 } 2094 }
2098 2095
2099 // static 2096 // static
2100 size_t VaapiH264Decoder::GetRequiredNumOfPictures() { 2097 size_t VaapiH264Decoder::GetRequiredNumOfPictures() {
2101 return kNumReqPictures; 2098 return kNumReqPictures;
2102 } 2099 }
2103 2100
2104 } // namespace content 2101 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698