| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
| 6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
| 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
| 8 // Win/EGL. | 8 // Win/EGL. |
| 9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
| 10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 bool decoder_deleted() { return !decoder_.get(); } | 291 bool decoder_deleted() { return !decoder_.get(); } |
| 292 | 292 |
| 293 private: | 293 private: |
| 294 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; | 294 typedef std::map<int32, scoped_refptr<TextureRef>> TextureRefMap; |
| 295 | 295 |
| 296 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); | 296 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); |
| 297 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); | 297 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); |
| 298 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); | 298 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); |
| 299 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); | 299 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); |
| 300 | 300 |
| 301 void BindImage(uint32 client_texture_id, |
| 302 uint32 texture_target, |
| 303 scoped_refptr<gfx::GLImage> image); |
| 304 |
| 301 void SetState(ClientState new_state); | 305 void SetState(ClientState new_state); |
| 302 void FinishInitialization(); | 306 void FinishInitialization(); |
| 303 void ReturnPicture(int32 picture_buffer_id); | 307 void ReturnPicture(int32 picture_buffer_id); |
| 304 | 308 |
| 305 // Delete the associated decoder helper. | 309 // Delete the associated decoder helper. |
| 306 void DeleteDecoder(); | 310 void DeleteDecoder(); |
| 307 | 311 |
| 308 // Compute & return the first encoded bytes (including a start frame) to send | 312 // Compute & return the first encoded bytes (including a start frame) to send |
| 309 // to the decoder, starting at |start_pos| and returning one fragment. Skips | 313 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
| 310 // to the first decodable position. | 314 // to the first decodable position. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 device, | 476 device, |
| 473 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 477 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
| 474 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), | 478 static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()), |
| 475 weak_client, | 479 weak_client, |
| 476 base::Bind(&DoNothingReturnTrue), | 480 base::Bind(&DoNothingReturnTrue), |
| 477 base::MessageLoopProxy::current())); | 481 base::MessageLoopProxy::current())); |
| 478 } | 482 } |
| 479 #endif | 483 #endif |
| 480 return decoder.Pass(); | 484 return decoder.Pass(); |
| 481 } | 485 } |
| 486 |
| 482 scoped_ptr<media::VideoDecodeAccelerator> | 487 scoped_ptr<media::VideoDecodeAccelerator> |
| 483 GLRenderingVDAClient::CreateVaapiVDA() { | 488 GLRenderingVDAClient::CreateVaapiVDA() { |
| 484 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 489 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
| 485 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 490 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 486 decoder.reset( | 491 decoder.reset(new VaapiVideoDecodeAccelerator( |
| 487 new VaapiVideoDecodeAccelerator(base::Bind(&DoNothingReturnTrue))); | 492 base::Bind(&DoNothingReturnTrue), |
| 493 base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this)))); |
| 488 #endif | 494 #endif |
| 489 return decoder.Pass(); | 495 return decoder.Pass(); |
| 490 } | 496 } |
| 491 | 497 |
| 498 void GLRenderingVDAClient::BindImage(uint32 client_texture_id, |
| 499 uint32 texture_target, |
| 500 scoped_refptr<gfx::GLImage> image) { |
| 501 } |
| 502 |
| 492 void GLRenderingVDAClient::CreateAndStartDecoder() { | 503 void GLRenderingVDAClient::CreateAndStartDecoder() { |
| 493 CHECK(decoder_deleted()); | 504 CHECK(decoder_deleted()); |
| 494 CHECK(!decoder_.get()); | 505 CHECK(!decoder_.get()); |
| 495 | 506 |
| 496 VideoDecodeAccelerator::Client* client = this; | 507 VideoDecodeAccelerator::Client* client = this; |
| 497 | 508 |
| 498 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { | 509 scoped_ptr<media::VideoDecodeAccelerator> decoders[] = { |
| 499 CreateDXVAVDA(), | 510 CreateDXVAVDA(), |
| 500 CreateV4L2VDA(), | 511 CreateV4L2VDA(), |
| 501 CreateV4L2SliceVDA(), | 512 CreateV4L2SliceVDA(), |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") | 1556 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") |
| 1546 continue; | 1557 continue; |
| 1547 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1558 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1548 } | 1559 } |
| 1549 | 1560 |
| 1550 base::ShadowingAtExitManager at_exit_manager; | 1561 base::ShadowingAtExitManager at_exit_manager; |
| 1551 content::RenderingHelper::InitializeOneOff(); | 1562 content::RenderingHelper::InitializeOneOff(); |
| 1552 | 1563 |
| 1553 return RUN_ALL_TESTS(); | 1564 return RUN_ALL_TESTS(); |
| 1554 } | 1565 } |
| OLD | NEW |