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

Side by Side Diff: media/gpu/ipc/service/gpu_video_decode_accelerator.cc

Issue 2711903002: Set the type of hardware decoded texture to UNSIGNED_BYTE (Closed)
Patch Set: add DCHECK Created 3 years, 9 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/ipc/service/gpu_video_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return; 443 return;
444 } 444 }
445 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || 445 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES ||
446 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { 446 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) {
447 // These textures have their dimensions defined by the underlying 447 // These textures have their dimensions defined by the underlying
448 // storage. 448 // storage.
449 // Use |texture_dimensions_| for this size. 449 // Use |texture_dimensions_| for this size.
450 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, GL_RGBA, 450 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, GL_RGBA,
451 texture_dimensions_.width(), 451 texture_dimensions_.width(),
452 texture_dimensions_.height(), 1, 0, 452 texture_dimensions_.height(), 1, 0,
453 GL_RGBA, 0, gfx::Rect()); 453 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
454 } else { 454 } else {
455 // For other targets, texture dimensions should already be defined. 455 // For other targets, texture dimensions should already be defined.
456 GLsizei width = 0, height = 0; 456 GLsizei width = 0, height = 0;
457 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); 457 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr);
458 if (width != texture_dimensions_.width() || 458 if (width != texture_dimensions_.width() ||
459 height != texture_dimensions_.height()) { 459 height != texture_dimensions_.height()) {
460 DLOG(ERROR) << "Size mismatch for texture id " 460 DLOG(ERROR) << "Size mismatch for texture id "
461 << buffer_texture_ids[j]; 461 << buffer_texture_ids[j];
462 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); 462 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT);
463 return; 463 return;
464 } 464 }
465 465
466 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 466 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691
467 GLenum format = 467 GLenum format =
468 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); 468 video_decode_accelerator_.get()->GetSurfaceInternalFormat();
469 if (format != GL_RGBA) { 469 if (format != GL_RGBA) {
470 DCHECK(format == GL_BGRA_EXT);
qiankun 2017/03/14 16:13:27 Add a DCHECK to make sure GL_UNSIGNED_BYTE is corr
470 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, 471 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format,
471 width, height, 1, 0, format, 0, 472 width, height, 1, 0, format,
472 gfx::Rect()); 473 GL_UNSIGNED_BYTE, gfx::Rect());
473 } 474 }
474 } 475 }
475 service_ids.push_back(texture_ref->service_id()); 476 service_ids.push_back(texture_ref->service_id());
476 current_textures.push_back(texture_ref); 477 current_textures.push_back(texture_ref);
477 } 478 }
478 textures.push_back(current_textures); 479 textures.push_back(current_textures);
479 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_, 480 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_,
480 buffer_texture_ids, service_ids)); 481 buffer_texture_ids, service_ids));
481 } 482 }
482 { 483 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 for (auto texture_ref : it->second) { 530 for (auto texture_ref : it->second) {
530 GLenum target = texture_ref->texture()->target(); 531 GLenum target = texture_ref->texture()->target();
531 gpu::gles2::TextureManager* texture_manager = 532 gpu::gles2::TextureManager* texture_manager =
532 stub_->decoder()->GetContextGroup()->texture_manager(); 533 stub_->decoder()->GetContextGroup()->texture_manager();
533 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); 534 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true);
534 } 535 }
535 uncleared_textures_.erase(it); 536 uncleared_textures_.erase(it);
536 } 537 }
537 538
538 } // namespace media 539 } // 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