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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 DCHECK_EQ(BOUND, state_); | 217 DCHECK_EQ(BOUND, state_); |
218 state_ = COPYING; | 218 state_ = COPYING; |
219 DCHECK(dest_surface || dx11_texture); | 219 DCHECK(dest_surface || dx11_texture); |
220 if (dx11_texture) { | 220 if (dx11_texture) { |
221 // Grab a reference on the decoder texture. This reference will be released | 221 // Grab a reference on the decoder texture. This reference will be released |
222 // when we receive a notification that the copy was completed or when the | 222 // when we receive a notification that the copy was completed or when the |
223 // DXVAPictureBuffer instance is destroyed. | 223 // DXVAPictureBuffer instance is destroyed. |
224 decoder_dx11_texture_ = dx11_texture; | 224 decoder_dx11_texture_ = dx11_texture; |
225 decoder->CopyTexture(dx11_texture, dx11_decoding_texture_.get(), | 225 decoder->CopyTexture(dx11_texture, dx11_decoding_texture_.get(), |
226 dx11_keyed_mutex_, keyed_mutex_value_, id(), | 226 dx11_keyed_mutex_, keyed_mutex_value_, id(), |
227 input_buffer_id); | 227 input_buffer_id, color_space_); |
228 return true; | 228 return true; |
229 } | 229 } |
230 D3DSURFACE_DESC surface_desc; | 230 D3DSURFACE_DESC surface_desc; |
231 HRESULT hr = dest_surface->GetDesc(&surface_desc); | 231 HRESULT hr = dest_surface->GetDesc(&surface_desc); |
232 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 232 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
233 | 233 |
234 D3DSURFACE_DESC texture_desc; | 234 D3DSURFACE_DESC texture_desc; |
235 decoding_texture_->GetLevelDesc(0, &texture_desc); | 235 decoding_texture_->GetLevelDesc(0, &texture_desc); |
236 | 236 |
237 if (texture_desc.Width != surface_desc.Width || | 237 if (texture_desc.Width != surface_desc.Width || |
(...skipping 15 matching lines...) Expand all Loading... |
253 // Grab a reference on the decoder surface and the target surface. These | 253 // Grab a reference on the decoder surface and the target surface. These |
254 // references will be released when we receive a notification that the | 254 // references will be released when we receive a notification that the |
255 // copy was completed or when the DXVAPictureBuffer instance is destroyed. | 255 // copy was completed or when the DXVAPictureBuffer instance is destroyed. |
256 // We hold references here as it is easier to manage their lifetimes. | 256 // We hold references here as it is easier to manage their lifetimes. |
257 hr = decoding_texture_->GetSurfaceLevel(0, target_surface_.Receive()); | 257 hr = decoding_texture_->GetSurfaceLevel(0, target_surface_.Receive()); |
258 RETURN_ON_HR_FAILURE(hr, "Failed to get surface from texture", false); | 258 RETURN_ON_HR_FAILURE(hr, "Failed to get surface from texture", false); |
259 | 259 |
260 decoder_surface_ = dest_surface; | 260 decoder_surface_ = dest_surface; |
261 | 261 |
262 decoder->CopySurface(decoder_surface_.get(), target_surface_.get(), id(), | 262 decoder->CopySurface(decoder_surface_.get(), target_surface_.get(), id(), |
263 input_buffer_id); | 263 input_buffer_id, color_space_); |
| 264 color_space_ = gfx::ColorSpace(); |
264 return true; | 265 return true; |
265 } | 266 } |
266 | 267 |
267 gl::GLFence* PbufferPictureBuffer::reuse_fence() { | 268 gl::GLFence* PbufferPictureBuffer::reuse_fence() { |
268 return reuse_fence_.get(); | 269 return reuse_fence_.get(); |
269 } | 270 } |
270 | 271 |
271 bool PbufferPictureBuffer::CopySurfaceComplete( | 272 bool PbufferPictureBuffer::CopySurfaceComplete( |
272 IDirect3DSurface9* src_surface, | 273 IDirect3DSurface9* src_surface, |
273 IDirect3DSurface9* dest_surface) { | 274 IDirect3DSurface9* dest_surface) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 int input_buffer_id) { | 549 int input_buffer_id) { |
549 DCHECK_EQ(BOUND, state_); | 550 DCHECK_EQ(BOUND, state_); |
550 state_ = COPYING; | 551 state_ = COPYING; |
551 DCHECK(dx11_texture); | 552 DCHECK(dx11_texture); |
552 // Grab a reference on the decoder texture. This reference will be released | 553 // Grab a reference on the decoder texture. This reference will be released |
553 // when we receive a notification that the copy was completed or when the | 554 // when we receive a notification that the copy was completed or when the |
554 // DXVAPictureBuffer instance is destroyed. | 555 // DXVAPictureBuffer instance is destroyed. |
555 dx11_decoding_texture_ = dx11_texture; | 556 dx11_decoding_texture_ = dx11_texture; |
556 decoder->CopyTexture(dx11_texture, decoder_copy_texture_.get(), | 557 decoder->CopyTexture(dx11_texture, decoder_copy_texture_.get(), |
557 dx11_keyed_mutex_, keyed_mutex_value_, id(), | 558 dx11_keyed_mutex_, keyed_mutex_value_, id(), |
558 input_buffer_id); | 559 input_buffer_id, color_space_); |
559 // The texture copy will acquire the current keyed mutex value and release | 560 // The texture copy will acquire the current keyed mutex value and release |
560 // with the value + 1. | 561 // with the value + 1. |
561 keyed_mutex_value_++; | 562 keyed_mutex_value_++; |
562 return true; | 563 return true; |
563 } | 564 } |
564 | 565 |
565 bool EGLStreamCopyPictureBuffer::CopySurfaceComplete( | 566 bool EGLStreamCopyPictureBuffer::CopySurfaceComplete( |
566 IDirect3DSurface9* src_surface, | 567 IDirect3DSurface9* src_surface, |
567 IDirect3DSurface9* dest_surface) { | 568 IDirect3DSurface9* dest_surface) { |
568 DCHECK(!src_surface); | 569 DCHECK(!src_surface); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 state_ = UNUSED; | 604 state_ = UNUSED; |
604 | 605 |
605 if (stream_) { | 606 if (stream_) { |
606 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); | 607 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); |
607 RETURN_ON_FAILURE(result, "Could not release stream", false); | 608 RETURN_ON_FAILURE(result, "Could not release stream", false); |
608 } | 609 } |
609 return true; | 610 return true; |
610 } | 611 } |
611 | 612 |
612 } // namespace media | 613 } // namespace media |
OLD | NEW |