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

Unified Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2836933003: DXVA; choose pbuffers with the right number of bits when possible (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/dxva_video_decode_accelerator_win.cc
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index 42951071961a4d05ba40b715a0a87efc5d96008b..e65f1e857c878fe4b0c712a73cbff69b40184c1d 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -1549,17 +1549,34 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(VideoCodecProfile profile) {
EGL_ALPHA_SIZE, 0,
EGL_NONE};
- EGLint num_configs;
-
- if (!eglChooseConfig(egl_display, config_attribs, &egl_config_, 1,
- &num_configs) ||
- num_configs == 0) {
- if (use_fp16_) {
- // Try again, but without use_fp16_
- use_fp16_ = false;
- continue;
+ EGLint num_configs = 0;
+
+ if (eglChooseConfig(egl_display, config_attribs, NULL, 0, &num_configs) &&
+ num_configs > 0) {
+ std::vector<EGLConfig> configs(num_configs);
+ if (eglChooseConfig(egl_display, config_attribs, configs.data(),
+ num_configs, &num_configs)) {
+ egl_config_ = configs[0];
+ for (int i = 0; i < num_configs; i++) {
+ EGLint red_bits;
+ eglGetConfigAttrib(egl_display, configs[i], EGL_RED_SIZE, &red_bits);
+ // Try to pick a configuration with the right number of bits rather
+ // than one that just has enough bits.
+ if (red_bits == (use_fp16_ ? 16 : 8)) {
+ egl_config_ = configs[i];
+ break;
+ }
+ }
+ }
+
+ if (!num_configs) {
+ if (use_fp16_) {
+ // Try again, but without use_fp16_
+ use_fp16_ = false;
+ continue;
+ }
+ return false;
}
- return false;
}
break;
« 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