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

Side by Side 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, 7 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 "media/gpu/dxva_video_decode_accelerator_win.h" 5 #include "media/gpu/dxva_video_decode_accelerator_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #if !defined(OS_WIN) 9 #if !defined(OS_WIN)
10 #error This file should only be built on Windows. 10 #error This file should only be built on Windows.
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 1542
1543 while (true) { 1543 while (true) {
1544 EGLint config_attribs[] = {EGL_BUFFER_SIZE, 32, 1544 EGLint config_attribs[] = {EGL_BUFFER_SIZE, 32,
1545 EGL_RED_SIZE, use_fp16_ ? 16 : 8, 1545 EGL_RED_SIZE, use_fp16_ ? 16 : 8,
1546 EGL_GREEN_SIZE, use_fp16_ ? 16 : 8, 1546 EGL_GREEN_SIZE, use_fp16_ ? 16 : 8,
1547 EGL_BLUE_SIZE, use_fp16_ ? 16 : 8, 1547 EGL_BLUE_SIZE, use_fp16_ ? 16 : 8,
1548 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, 1548 EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
1549 EGL_ALPHA_SIZE, 0, 1549 EGL_ALPHA_SIZE, 0,
1550 EGL_NONE}; 1550 EGL_NONE};
1551 1551
1552 EGLint num_configs; 1552 EGLint num_configs = 0;
1553 1553
1554 if (!eglChooseConfig(egl_display, config_attribs, &egl_config_, 1, 1554 if (eglChooseConfig(egl_display, config_attribs, NULL, 0, &num_configs) &&
1555 &num_configs) || 1555 num_configs > 0) {
1556 num_configs == 0) { 1556 std::vector<EGLConfig> configs(num_configs);
1557 if (use_fp16_) { 1557 if (eglChooseConfig(egl_display, config_attribs, configs.data(),
1558 // Try again, but without use_fp16_ 1558 num_configs, &num_configs)) {
1559 use_fp16_ = false; 1559 egl_config_ = configs[0];
1560 continue; 1560 for (int i = 0; i < num_configs; i++) {
1561 EGLint red_bits;
1562 eglGetConfigAttrib(egl_display, configs[i], EGL_RED_SIZE, &red_bits);
1563 // Try to pick a configuration with the right number of bits rather
1564 // than one that just has enough bits.
1565 if (red_bits == (use_fp16_ ? 16 : 8)) {
1566 egl_config_ = configs[i];
1567 break;
1568 }
1569 }
1561 } 1570 }
1562 return false; 1571
1572 if (!num_configs) {
1573 if (use_fp16_) {
1574 // Try again, but without use_fp16_
1575 use_fp16_ = false;
1576 continue;
1577 }
1578 return false;
1579 }
1563 } 1580 }
1564 1581
1565 break; 1582 break;
1566 } 1583 }
1567 1584
1568 if (use_fp16_) { 1585 if (use_fp16_) {
1569 // TODO(hubbe): Share/copy P010/P016 textures. 1586 // TODO(hubbe): Share/copy P010/P016 textures.
1570 share_nv12_textures_ = false; 1587 share_nv12_textures_ = false;
1571 copy_nv12_textures_ = false; 1588 copy_nv12_textures_ = false;
1572 } 1589 }
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { 3006 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const {
2990 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; 3007 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_;
2991 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; 3008 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
2992 } 3009 }
2993 3010
2994 ID3D11Device* DXVAVideoDecodeAccelerator::D3D11Device() const { 3011 ID3D11Device* DXVAVideoDecodeAccelerator::D3D11Device() const {
2995 return share_nv12_textures_ ? angle_device_.Get() : d3d11_device_.Get(); 3012 return share_nv12_textures_ ? angle_device_.Get() : d3d11_device_.Get();
2996 } 3013 }
2997 3014
2998 } // namespace media 3015 } // namespace media
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