| OLD | NEW |
| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 bool PbufferPictureBuffer::CopySurfaceComplete( | 268 bool PbufferPictureBuffer::CopySurfaceComplete( |
| 269 IDirect3DSurface9* src_surface, | 269 IDirect3DSurface9* src_surface, |
| 270 IDirect3DSurface9* dest_surface) { | 270 IDirect3DSurface9* dest_surface) { |
| 271 DCHECK_EQ(COPYING, state_); | 271 DCHECK_EQ(COPYING, state_); |
| 272 state_ = IN_CLIENT; | 272 state_ = IN_CLIENT; |
| 273 | 273 |
| 274 GLint current_texture = 0; | 274 GLint current_texture = 0; |
| 275 glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); | 275 glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); |
| 276 | 276 |
| 277 glBindTexture(GL_TEXTURE_2D, picture_buffer_.texture_ids()[0]); | 277 glBindTexture(GL_TEXTURE_2D, picture_buffer_.service_texture_ids()[0]); |
| 278 | 278 |
| 279 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 279 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 280 | 280 |
| 281 if (src_surface && dest_surface) { | 281 if (src_surface && dest_surface) { |
| 282 DCHECK_EQ(src_surface, decoder_surface_.get()); | 282 DCHECK_EQ(src_surface, decoder_surface_.get()); |
| 283 DCHECK_EQ(dest_surface, target_surface_.get()); | 283 DCHECK_EQ(dest_surface, target_surface_.get()); |
| 284 decoder_surface_.Release(); | 284 decoder_surface_.Release(); |
| 285 target_surface_.Release(); | 285 target_surface_.Release(); |
| 286 } else { | 286 } else { |
| 287 DCHECK(decoder_dx11_texture_.get()); | 287 DCHECK(decoder_dx11_texture_.get()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 const EGLint stream_attributes[] = { | 353 const EGLint stream_attributes[] = { |
| 354 EGL_CONSUMER_LATENCY_USEC_KHR, | 354 EGL_CONSUMER_LATENCY_USEC_KHR, |
| 355 0, | 355 0, |
| 356 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, | 356 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, |
| 357 0, | 357 0, |
| 358 EGL_NONE, | 358 EGL_NONE, |
| 359 }; | 359 }; |
| 360 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); | 360 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); |
| 361 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); | 361 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); |
| 362 gl::ScopedActiveTexture texture0(GL_TEXTURE0); | 362 gl::ScopedActiveTexture texture0(GL_TEXTURE0); |
| 363 gl::ScopedTextureBinder texture0_binder(GL_TEXTURE_EXTERNAL_OES, | 363 gl::ScopedTextureBinder texture0_binder( |
| 364 picture_buffer_.texture_ids()[0]); | 364 GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]); |
| 365 gl::ScopedActiveTexture texture1(GL_TEXTURE1); | 365 gl::ScopedActiveTexture texture1(GL_TEXTURE1); |
| 366 gl::ScopedTextureBinder texture1_binder(GL_TEXTURE_EXTERNAL_OES, | 366 gl::ScopedTextureBinder texture1_binder( |
| 367 picture_buffer_.texture_ids()[1]); | 367 GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[1]); |
| 368 | 368 |
| 369 EGLAttrib consumer_attributes[] = { | 369 EGLAttrib consumer_attributes[] = { |
| 370 EGL_COLOR_BUFFER_TYPE, | 370 EGL_COLOR_BUFFER_TYPE, |
| 371 EGL_YUV_BUFFER_EXT, | 371 EGL_YUV_BUFFER_EXT, |
| 372 EGL_YUV_NUMBER_OF_PLANES_EXT, | 372 EGL_YUV_NUMBER_OF_PLANES_EXT, |
| 373 2, | 373 2, |
| 374 EGL_YUV_PLANE0_TEXTURE_UNIT_NV, | 374 EGL_YUV_PLANE0_TEXTURE_UNIT_NV, |
| 375 0, | 375 0, |
| 376 EGL_YUV_PLANE1_TEXTURE_UNIT_NV, | 376 EGL_YUV_PLANE1_TEXTURE_UNIT_NV, |
| 377 1, | 377 1, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 const EGLint stream_attributes[] = { | 460 const EGLint stream_attributes[] = { |
| 461 EGL_CONSUMER_LATENCY_USEC_KHR, | 461 EGL_CONSUMER_LATENCY_USEC_KHR, |
| 462 0, | 462 0, |
| 463 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, | 463 EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, |
| 464 0, | 464 0, |
| 465 EGL_NONE, | 465 EGL_NONE, |
| 466 }; | 466 }; |
| 467 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); | 467 stream_ = eglCreateStreamKHR(egl_display, stream_attributes); |
| 468 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); | 468 RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); |
| 469 gl::ScopedActiveTexture texture0(GL_TEXTURE0); | 469 gl::ScopedActiveTexture texture0(GL_TEXTURE0); |
| 470 gl::ScopedTextureBinder texture0_binder(GL_TEXTURE_EXTERNAL_OES, | 470 gl::ScopedTextureBinder texture0_binder( |
| 471 picture_buffer_.texture_ids()[0]); | 471 GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]); |
| 472 gl::ScopedActiveTexture texture1(GL_TEXTURE1); | 472 gl::ScopedActiveTexture texture1(GL_TEXTURE1); |
| 473 gl::ScopedTextureBinder texture1_binder(GL_TEXTURE_EXTERNAL_OES, | 473 gl::ScopedTextureBinder texture1_binder( |
| 474 picture_buffer_.texture_ids()[1]); | 474 GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[1]); |
| 475 | 475 |
| 476 EGLAttrib consumer_attributes[] = { | 476 EGLAttrib consumer_attributes[] = { |
| 477 EGL_COLOR_BUFFER_TYPE, | 477 EGL_COLOR_BUFFER_TYPE, |
| 478 EGL_YUV_BUFFER_EXT, | 478 EGL_YUV_BUFFER_EXT, |
| 479 EGL_YUV_NUMBER_OF_PLANES_EXT, | 479 EGL_YUV_NUMBER_OF_PLANES_EXT, |
| 480 2, | 480 2, |
| 481 EGL_YUV_PLANE0_TEXTURE_UNIT_NV, | 481 EGL_YUV_PLANE0_TEXTURE_UNIT_NV, |
| 482 0, | 482 0, |
| 483 EGL_YUV_PLANE1_TEXTURE_UNIT_NV, | 483 EGL_YUV_PLANE1_TEXTURE_UNIT_NV, |
| 484 1, | 484 1, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 state_ = UNUSED; | 594 state_ = UNUSED; |
| 595 | 595 |
| 596 if (stream_) { | 596 if (stream_) { |
| 597 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); | 597 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); |
| 598 RETURN_ON_FAILURE(result, "Could not release stream", false); | 598 RETURN_ON_FAILURE(result, "Could not release stream", false); |
| 599 } | 599 } |
| 600 return true; | 600 return true; |
| 601 } | 601 } |
| 602 | 602 |
| 603 } // namespace media | 603 } // namespace media |
| OLD | NEW |