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

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

Issue 2462393002: Use texture ids passed from ARC as service ids in ArcGVDA (Closed)
Patch Set: Fixup DXVA Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_picture_buffer_win.h" 5 #include "media/gpu/dxva_picture_buffer_win.h"
6 6
7 #include "media/gpu/dxva_video_decode_accelerator_win.h" 7 #include "media/gpu/dxva_video_decode_accelerator_win.h"
8 #include "third_party/angle/include/EGL/egl.h" 8 #include "third_party/angle/include/EGL/egl.h"
9 #include "third_party/angle/include/EGL/eglext.h" 9 #include "third_party/angle/include/EGL/eglext.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 : picture_buffer_(buffer) {} 106 : picture_buffer_(buffer) {}
107 107
108 bool DXVAPictureBuffer::BindSampleToTexture( 108 bool DXVAPictureBuffer::BindSampleToTexture(
109 base::win::ScopedComPtr<IMFSample> sample) { 109 base::win::ScopedComPtr<IMFSample> sample) {
110 NOTREACHED(); 110 NOTREACHED();
111 return false; 111 return false;
112 } 112 }
113 113
114 bool PbufferPictureBuffer::Initialize(const DXVAVideoDecodeAccelerator& decoder, 114 bool PbufferPictureBuffer::Initialize(const DXVAVideoDecodeAccelerator& decoder,
115 EGLConfig egl_config) { 115 EGLConfig egl_config) {
116 RETURN_ON_FAILURE(!picture_buffer_.service_texture_ids().empty(),
117 "No service texture ids provided", false);
118
116 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 119 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
117 EGLint use_rgb = 1; 120 EGLint use_rgb = 1;
118 eglGetConfigAttrib(egl_display, egl_config, EGL_BIND_TO_TEXTURE_RGB, 121 eglGetConfigAttrib(egl_display, egl_config, EGL_BIND_TO_TEXTURE_RGB,
119 &use_rgb); 122 &use_rgb);
120 123
121 if (!InitializeTexture(decoder, !!use_rgb)) 124 if (!InitializeTexture(decoder, !!use_rgb))
122 return false; 125 return false;
123 126
124 EGLint attrib_list[] = {EGL_WIDTH, 127 EGLint attrib_list[] = {EGL_WIDTH,
125 size().width(), 128 size().width(),
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 345
343 EGLStreamPictureBuffer::~EGLStreamPictureBuffer() { 346 EGLStreamPictureBuffer::~EGLStreamPictureBuffer() {
344 if (stream_) { 347 if (stream_) {
345 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 348 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
346 eglDestroyStreamKHR(egl_display, stream_); 349 eglDestroyStreamKHR(egl_display, stream_);
347 stream_ = nullptr; 350 stream_ = nullptr;
348 } 351 }
349 } 352 }
350 353
351 bool EGLStreamPictureBuffer::Initialize() { 354 bool EGLStreamPictureBuffer::Initialize() {
355 RETURN_ON_FAILURE(picture_buffer_.service_texture_ids().size() >= 2,
356 "Not enough texture ids provided", false);
357
352 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 358 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
353 const EGLint stream_attributes[] = { 359 const EGLint stream_attributes[] = {
354 EGL_CONSUMER_LATENCY_USEC_KHR, 360 EGL_CONSUMER_LATENCY_USEC_KHR,
355 0, 361 0,
356 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, 362 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR,
357 0, 363 0,
358 EGL_NONE, 364 EGL_NONE,
359 }; 365 };
360 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); 366 stream_ = eglCreateStreamKHR(egl_display, stream_attributes);
361 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); 367 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 EGLStreamCopyPictureBuffer::~EGLStreamCopyPictureBuffer() { 455 EGLStreamCopyPictureBuffer::~EGLStreamCopyPictureBuffer() {
450 if (stream_) { 456 if (stream_) {
451 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 457 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
452 eglDestroyStreamKHR(egl_display, stream_); 458 eglDestroyStreamKHR(egl_display, stream_);
453 stream_ = nullptr; 459 stream_ = nullptr;
454 } 460 }
455 } 461 }
456 462
457 bool EGLStreamCopyPictureBuffer::Initialize( 463 bool EGLStreamCopyPictureBuffer::Initialize(
458 const DXVAVideoDecodeAccelerator& decoder) { 464 const DXVAVideoDecodeAccelerator& decoder) {
465 RETURN_ON_FAILURE(picture_buffer_.service_texture_ids().size() >= 2,
466 "Not enough texture ids provided", false);
467
459 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 468 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
460 const EGLint stream_attributes[] = { 469 const EGLint stream_attributes[] = {
461 EGL_CONSUMER_LATENCY_USEC_KHR, 470 EGL_CONSUMER_LATENCY_USEC_KHR,
462 0, 471 0,
463 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, 472 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR,
464 0, 473 0,
465 EGL_NONE, 474 EGL_NONE,
466 }; 475 };
467 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); 476 stream_ = eglCreateStreamKHR(egl_display, stream_attributes);
468 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); 477 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 state_ = UNUSED; 603 state_ = UNUSED;
595 604
596 if (stream_) { 605 if (stream_) {
597 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); 606 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_);
598 RETURN_ON_FAILURE(result, "Could not release stream", false); 607 RETURN_ON_FAILURE(result, "Could not release stream", false);
599 } 608 }
600 return true; 609 return true;
601 } 610 }
602 611
603 } // namespace media 612 } // namespace media
OLDNEW
« no previous file with comments | « chrome/gpu/arc_gpu_video_decode_accelerator.cc ('k') | media/gpu/dxva_video_decode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698