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

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

Issue 1422563002: [Ozone] Enables overlay render format setting path and by default use UYVY (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/common/gpu/media/vaapi_wrapper.h" 5 #include "content/common/gpu/media/vaapi_wrapper.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 932
933 va_res = vaDestroyBuffer(va_display_, buffer_id); 933 va_res = vaDestroyBuffer(va_display_, buffer_id);
934 VA_LOG_ON_ERROR(va_res, "vaDestroyBuffer failed"); 934 VA_LOG_ON_ERROR(va_res, "vaDestroyBuffer failed");
935 935
936 const auto was_found = coded_buffers_.erase(buffer_id); 936 const auto was_found = coded_buffers_.erase(buffer_id);
937 DCHECK(was_found); 937 DCHECK(was_found);
938 938
939 return buffer_segment == NULL; 939 return buffer_segment == NULL;
940 } 940 }
941 941
942 bool VaapiWrapper::BlitSurface(VASurfaceID va_surface_id_src, 942 bool VaapiWrapper::BlitSurface(
943 const gfx::Size& src_size, 943 const scoped_refptr<VASurface>& va_surface_src,
kalyank 2015/10/21 19:48:41 These changes seem unrelated, can you separate the
william.xie1 2015/10/22 07:35:41 Done.
944 VASurfaceID va_surface_id_dest, 944 const scoped_refptr<VASurface>& va_surface_dest) {
945 const gfx::Size& dest_size) {
946 base::AutoLock auto_lock(*va_lock_); 945 base::AutoLock auto_lock(*va_lock_);
947 946
948 // Initialize the post processing engine if not already done. 947 // Initialize the post processing engine if not already done.
949 if (va_vpp_buffer_id_ == VA_INVALID_ID) { 948 if (va_vpp_buffer_id_ == VA_INVALID_ID) {
950 if (!InitializeVpp_Locked()) 949 if (!InitializeVpp_Locked())
951 return false; 950 return false;
952 } 951 }
953 952
954 VAProcPipelineParameterBuffer* pipeline_param; 953 VAProcPipelineParameterBuffer* pipeline_param;
955 VA_SUCCESS_OR_RETURN(vaMapBuffer(va_display_, va_vpp_buffer_id_, 954 VA_SUCCESS_OR_RETURN(vaMapBuffer(va_display_, va_vpp_buffer_id_,
956 reinterpret_cast<void**>(&pipeline_param)), 955 reinterpret_cast<void**>(&pipeline_param)),
957 "Couldn't map vpp buffer", false); 956 "Couldn't map vpp buffer", false);
958 957
959 memset(pipeline_param, 0, sizeof *pipeline_param); 958 memset(pipeline_param, 0, sizeof *pipeline_param);
959 const gfx::Size src_size = va_surface_src->size();
960 const gfx::Size dest_size = va_surface_dest->size();
960 961
961 VARectangle input_region; 962 VARectangle input_region;
962 input_region.x = input_region.y = 0; 963 input_region.x = input_region.y = 0;
963 input_region.width = src_size.width(); 964 input_region.width = src_size.width();
964 input_region.height = src_size.height(); 965 input_region.height = src_size.height();
965 pipeline_param->surface_region = &input_region; 966 pipeline_param->surface_region = &input_region;
966 pipeline_param->surface = va_surface_id_src; 967 pipeline_param->surface = va_surface_src->id();
967 pipeline_param->surface_color_standard = VAProcColorStandardNone; 968 pipeline_param->surface_color_standard = VAProcColorStandardNone;
968 969
969 VARectangle output_region; 970 VARectangle output_region;
970 output_region.x = output_region.y = 0; 971 output_region.x = output_region.y = 0;
971 output_region.width = dest_size.width(); 972 output_region.width = dest_size.width();
972 output_region.height = dest_size.height(); 973 output_region.height = dest_size.height();
973 pipeline_param->output_region = &output_region; 974 pipeline_param->output_region = &output_region;
974 pipeline_param->output_background_color = 0xff000000; 975 pipeline_param->output_background_color = 0xff000000;
975 pipeline_param->output_color_standard = VAProcColorStandardNone; 976 pipeline_param->surface_color_standard = VAProcColorStandardNone;
976 977
977 VA_SUCCESS_OR_RETURN(vaUnmapBuffer(va_display_, va_vpp_buffer_id_), 978 VA_SUCCESS_OR_RETURN(vaUnmapBuffer(va_display_, va_vpp_buffer_id_),
978 "Couldn't unmap vpp buffer", false); 979 "Couldn't unmap vpp buffer", false);
979 980
980 VA_SUCCESS_OR_RETURN( 981 VA_SUCCESS_OR_RETURN(
981 vaBeginPicture(va_display_, va_vpp_context_id_, va_surface_id_dest), 982 vaBeginPicture(va_display_, va_vpp_context_id_, va_surface_dest->id()),
982 "Couldn't begin picture", false); 983 "Couldn't begin picture", false);
983 984
984 VA_SUCCESS_OR_RETURN( 985 VA_SUCCESS_OR_RETURN(
985 vaRenderPicture(va_display_, va_vpp_context_id_, &va_vpp_buffer_id_, 1), 986 vaRenderPicture(va_display_, va_vpp_context_id_, &va_vpp_buffer_id_, 1),
986 "Couldn't render picture", false); 987 "Couldn't render picture", false);
987 988
988 VA_SUCCESS_OR_RETURN(vaEndPicture(va_display_, va_vpp_context_id_), 989 VA_SUCCESS_OR_RETURN(vaEndPicture(va_display_, va_vpp_context_id_),
989 "Couldn't end picture", false); 990 "Couldn't end picture", false);
990 991
991 return true; 992 return true;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 drm_fd_.reset(HANDLE_EINTR(dup(fd))); 1150 drm_fd_.reset(HANDLE_EINTR(dup(fd)));
1150 } 1151 }
1151 #endif // USE_OZONE 1152 #endif // USE_OZONE
1152 1153
1153 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { 1154 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) {
1154 return (major_version_ < major) || 1155 return (major_version_ < major) ||
1155 (major_version_ == major && minor_version_ < minor); 1156 (major_version_ == major && minor_version_ < minor);
1156 } 1157 }
1157 1158
1158 } // namespace content 1159 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698