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

Side by Side Diff: media/gpu/vaapi_video_decode_accelerator.cc

Issue 2636433003: [NotForReview] Enable YUV video overlay on Skylake ChromeOS.
Patch Set: Created 3 years, 11 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 | « media/gpu/vaapi_drm_picture.cc ('k') | media/gpu/vaapi_wrapper.cc » ('j') | 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/vaapi_video_decode_accelerator.h" 5 #include "media/gpu/vaapi_video_decode_accelerator.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 namespace { 35 namespace {
36 // UMA errors that the VaapiVideoDecodeAccelerator class reports. 36 // UMA errors that the VaapiVideoDecodeAccelerator class reports.
37 enum VAVDADecoderFailure { 37 enum VAVDADecoderFailure {
38 VAAPI_ERROR = 0, 38 VAAPI_ERROR = 0,
39 VAVDA_DECODER_FAILURES_MAX, 39 VAVDA_DECODER_FAILURES_MAX,
40 }; 40 };
41 41
42 // Buffer format to use for output buffers backing PictureBuffers. This is the 42 // Buffer format to use for output buffers backing PictureBuffers. This is the
43 // format decoded frames in VASurfaces are converted into. 43 // format decoded frames in VASurfaces are converted into.
44 const gfx::BufferFormat kAllocatePictureFormat = gfx::BufferFormat::BGRA_8888; 44 // gfx::BufferFormat::UYVY_422;
45 // gfx::BufferFormat::BGRA_8888;
46 const gfx::BufferFormat kAllocatePictureFormat = gfx::BufferFormat::YUYV_422;
47
45 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420; 48 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420;
46 } 49 }
47 50
48 static void ReportToUMA(VAVDADecoderFailure failure) { 51 static void ReportToUMA(VAVDADecoderFailure failure) {
49 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure, 52 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure,
50 VAVDA_DECODER_FAILURES_MAX + 1); 53 VAVDA_DECODER_FAILURES_MAX + 1);
51 } 54 }
52 55
53 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ 56 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \
54 do { \ 57 do { \
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 429
427 // Notify the client a picture is ready to be displayed. 430 // Notify the client a picture is ready to be displayed.
428 ++num_frames_at_client_; 431 ++num_frames_at_client_;
429 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); 432 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_);
430 DVLOG(4) << "Notifying output picture id " << output_id 433 DVLOG(4) << "Notifying output picture id " << output_id
431 << " for input " << input_id << " is ready"; 434 << " for input " << input_id << " is ready";
432 // TODO(posciak): Use visible size from decoder here instead 435 // TODO(posciak): Use visible size from decoder here instead
433 // (crbug.com/402760). Passing (0, 0) results in the client using the 436 // (crbug.com/402760). Passing (0, 0) results in the client using the
434 // visible size extracted from the container instead. 437 // visible size extracted from the container instead.
435 // TODO(hubbe): Use the correct color space. http://crbug.com/647725 438 // TODO(hubbe): Use the correct color space. http://crbug.com/647725
439 PLOG(ERROR) << "Video decoder ready with format ";
436 if (client_) 440 if (client_)
437 client_->PictureReady(Picture(output_id, input_id, gfx::Rect(0, 0), 441 client_->PictureReady(Picture(output_id, input_id, gfx::Rect(0, 0),
438 gfx::ColorSpace(), picture->AllowOverlay())); 442 gfx::ColorSpace(), picture->AllowOverlay()));
439 } 443 }
440 444
441 void VaapiVideoDecodeAccelerator::TryOutputSurface() { 445 void VaapiVideoDecodeAccelerator::TryOutputSurface() {
442 DCHECK(task_runner_->BelongsToCurrentThread()); 446 DCHECK(task_runner_->BelongsToCurrentThread());
443 447
444 // Handle Destroy() arriving while pictures are queued for output. 448 // Handle Destroy() arriving while pictures are queued for output.
445 if (!client_) 449 if (!client_)
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 665
662 static VideoPixelFormat BufferFormatToVideoPixelFormat( 666 static VideoPixelFormat BufferFormatToVideoPixelFormat(
663 gfx::BufferFormat format) { 667 gfx::BufferFormat format) {
664 switch (format) { 668 switch (format) {
665 case gfx::BufferFormat::BGRA_8888: 669 case gfx::BufferFormat::BGRA_8888:
666 return PIXEL_FORMAT_ARGB; 670 return PIXEL_FORMAT_ARGB;
667 671
668 case gfx::BufferFormat::YVU_420: 672 case gfx::BufferFormat::YVU_420:
669 return PIXEL_FORMAT_YV12; 673 return PIXEL_FORMAT_YV12;
670 674
675 case gfx::BufferFormat::UYVY_422:
676 return PIXEL_FORMAT_UYVY;
677
678 case gfx::BufferFormat::YUYV_422:
679 return PIXEL_FORMAT_YUY2;
680
671 default: 681 default:
672 LOG(FATAL) << "Add more cases as needed"; 682 LOG(FATAL) << "Add more cases as needed";
673 return PIXEL_FORMAT_UNKNOWN; 683 return PIXEL_FORMAT_UNKNOWN;
674 } 684 }
675 } 685 }
676 686
677 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { 687 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() {
678 DCHECK(task_runner_->BelongsToCurrentThread()); 688 DCHECK(task_runner_->BelongsToCurrentThread());
679 689
680 if (!awaiting_va_surfaces_recycle_) 690 if (!awaiting_va_surfaces_recycle_)
(...skipping 26 matching lines...) Expand all
707 if (client_) 717 if (client_)
708 client_->DismissPictureBuffer(iter->first); 718 client_->DismissPictureBuffer(iter->first);
709 } 719 }
710 pictures_.clear(); 720 pictures_.clear();
711 721
712 // And ask for a new set as requested. 722 // And ask for a new set as requested.
713 DVLOG(1) << "Requesting " << requested_num_pics_ 723 DVLOG(1) << "Requesting " << requested_num_pics_
714 << " pictures of size: " << requested_pic_size_.ToString(); 724 << " pictures of size: " << requested_pic_size_.ToString();
715 725
716 VideoPixelFormat format = BufferFormatToVideoPixelFormat(output_format_); 726 VideoPixelFormat format = BufferFormatToVideoPixelFormat(output_format_);
727 PLOG(ERROR) << "Request video pixel buffer " << format;
717 task_runner_->PostTask( 728 task_runner_->PostTask(
718 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, 729 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_,
719 requested_num_pics_, format, 1, requested_pic_size_, 730 requested_num_pics_, format, 1, requested_pic_size_,
720 VaapiPicture::GetGLTextureTarget())); 731 VaapiPicture::GetGLTextureTarget()));
721 } 732 }
722 733
723 void VaapiVideoDecodeAccelerator::Decode( 734 void VaapiVideoDecodeAccelerator::Decode(
724 const BitstreamBuffer& bitstream_buffer) { 735 const BitstreamBuffer& bitstream_buffer) {
725 DCHECK(task_runner_->BelongsToCurrentThread()); 736 DCHECK(task_runner_->BelongsToCurrentThread());
726 737
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 return vaapi_pic->dec_surface(); 1891 return vaapi_pic->dec_surface();
1881 } 1892 }
1882 1893
1883 // static 1894 // static
1884 VideoDecodeAccelerator::SupportedProfiles 1895 VideoDecodeAccelerator::SupportedProfiles
1885 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { 1896 VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
1886 return VaapiWrapper::GetSupportedDecodeProfiles(); 1897 return VaapiWrapper::GetSupportedDecodeProfiles();
1887 } 1898 }
1888 1899
1889 } // namespace media 1900 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/vaapi_drm_picture.cc ('k') | media/gpu/vaapi_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698