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

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

Issue 1209033018: Create VA surface with correct VA RT format for MJPEG decode acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (va_display_state) { 488 if (va_display_state) {
489 VAStatus va_res = VA_STATUS_SUCCESS; 489 VAStatus va_res = VA_STATUS_SUCCESS;
490 va_display_state->Deinitialize(&va_res); 490 va_display_state->Deinitialize(&va_res);
491 VA_LOG_ON_ERROR(va_res, "vaTerminate failed"); 491 VA_LOG_ON_ERROR(va_res, "vaTerminate failed");
492 } 492 }
493 493
494 va_config_id_ = VA_INVALID_ID; 494 va_config_id_ = VA_INVALID_ID;
495 va_display_ = NULL; 495 va_display_ = NULL;
496 } 496 }
497 497
498 bool VaapiWrapper::CreateSurfaces(const gfx::Size& size, 498 bool VaapiWrapper::CreateSurfaces(unsigned int va_format,
499 const gfx::Size& size,
499 size_t num_surfaces, 500 size_t num_surfaces,
500 std::vector<VASurfaceID>* va_surfaces) { 501 std::vector<VASurfaceID>* va_surfaces) {
501 base::AutoLock auto_lock(*va_lock_); 502 base::AutoLock auto_lock(*va_lock_);
502 DVLOG(2) << "Creating " << num_surfaces << " surfaces"; 503 DVLOG(2) << "Creating " << num_surfaces << " surfaces";
503 504
504 DCHECK(va_surfaces->empty()); 505 DCHECK(va_surfaces->empty());
505 DCHECK(va_surface_ids_.empty()); 506 DCHECK(va_surface_ids_.empty());
506 va_surface_ids_.resize(num_surfaces); 507 va_surface_ids_.resize(num_surfaces);
507 508
508 // Allocate surfaces in driver. 509 // Allocate surfaces in driver.
509 VAStatus va_res = vaCreateSurfaces(va_display_, 510 VAStatus va_res =
510 VA_RT_FORMAT_YUV420, 511 vaCreateSurfaces(va_display_, va_format, size.width(), size.height(),
511 size.width(), size.height(), 512 &va_surface_ids_[0], va_surface_ids_.size(), NULL, 0);
512 &va_surface_ids_[0],
513 va_surface_ids_.size(),
514 NULL, 0);
515 513
516 VA_LOG_ON_ERROR(va_res, "vaCreateSurfaces failed"); 514 VA_LOG_ON_ERROR(va_res, "vaCreateSurfaces failed");
517 if (va_res != VA_STATUS_SUCCESS) { 515 if (va_res != VA_STATUS_SUCCESS) {
518 va_surface_ids_.clear(); 516 va_surface_ids_.clear();
519 return false; 517 return false;
520 } 518 }
521 519
522 // And create a context associated with them. 520 // And create a context associated with them.
523 va_res = vaCreateContext(va_display_, va_config_id_, 521 va_res = vaCreateContext(va_display_, va_config_id_,
524 size.width(), size.height(), VA_PROGRESSIVE, 522 size.width(), size.height(), VA_PROGRESSIVE,
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 drm_fd_.reset(HANDLE_EINTR(dup(fd))); 1140 drm_fd_.reset(HANDLE_EINTR(dup(fd)));
1143 } 1141 }
1144 #endif // USE_OZONE 1142 #endif // USE_OZONE
1145 1143
1146 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { 1144 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) {
1147 return (major_version_ < major) || 1145 return (major_version_ < major) ||
1148 (major_version_ == major && minor_version_ < minor); 1146 (major_version_ == major && minor_version_ < minor);
1149 } 1147 }
1150 1148
1151 } // namespace content 1149 } // namespace content
OLDNEW
« content/common/gpu/media/vaapi_wrapper.h ('K') | « content/common/gpu/media/vaapi_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698