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 #include "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
6 | 6 |
7 #include "base/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/common/gpu/gpu_command_buffer_stub.h" | 9 #include "content/common/gpu/gpu_command_buffer_stub.h" |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 surface_handle.transport_type == gfx::NATIVE_TRANSPORT); | 519 surface_handle.transport_type == gfx::NATIVE_TRANSPORT); |
520 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); | 520 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); |
521 | 521 |
522 switch (gfx::GetGLImplementation()) { | 522 switch (gfx::GetGLImplementation()) { |
523 case gfx::kGLImplementationDesktopGL: | 523 case gfx::kGLImplementationDesktopGL: |
524 case gfx::kGLImplementationAppleGL: | 524 case gfx::kGLImplementationAppleGL: |
525 if (!io_surface_support) { | 525 if (!io_surface_support) { |
526 DLOG(WARNING) << "No IOSurface support"; | 526 DLOG(WARNING) << "No IOSurface support"; |
527 return scoped_refptr<gfx::GLSurface>(); | 527 return scoped_refptr<gfx::GLSurface>(); |
528 } | 528 } |
| 529 |
| 530 if (surface_handle.transport_type == gfx::NATIVE_DIRECT) { |
| 531 DLOG(INFO) << "Want a NATIVE_DIRECT transport: client_id=" << surface_ha
ndle.parent_client_id; |
| 532 #if 0 |
| 533 DCHECK(surface_handle.handle); |
| 534 scoped_refptr<gfx::GLSurface> surface = |
| 535 gfx::GLSurface::CreateViewGLSurface(surface_handle.handle); |
| 536 if (!surface.get()) |
| 537 return surface; |
| 538 |
| 539 return scoped_refptr<gfx::GLSurface>( |
| 540 new PassThroughImageTransportSurface(manager, stub, surface.get())); |
| 541 #endif |
| 542 } |
| 543 |
529 return scoped_refptr<gfx::GLSurface>(new IOSurfaceImageTransportSurface( | 544 return scoped_refptr<gfx::GLSurface>(new IOSurfaceImageTransportSurface( |
530 manager, stub, surface_handle.handle)); | 545 manager, stub, surface_handle.handle)); |
531 | 546 |
532 default: | 547 default: |
533 // Content shell in DRT mode spins up a gpu process which needs an | 548 // Content shell in DRT mode spins up a gpu process which needs an |
534 // image transport surface, but that surface isn't used to read pixel | 549 // image transport surface, but that surface isn't used to read pixel |
535 // baselines. So this is mostly a dummy surface. | 550 // baselines. So this is mostly a dummy surface. |
536 if (!g_allow_os_mesa) { | 551 if (!g_allow_os_mesa) { |
537 NOTREACHED(); | 552 NOTREACHED(); |
538 return scoped_refptr<gfx::GLSurface>(); | 553 return scoped_refptr<gfx::GLSurface>(); |
539 } | 554 } |
540 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); | 555 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); |
541 if (!surface.get() || !surface->Initialize()) | 556 if (!surface.get() || !surface->Initialize()) |
542 return surface; | 557 return surface; |
543 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 558 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
544 manager, stub, surface.get())); | 559 manager, stub, surface.get())); |
545 } | 560 } |
546 } | 561 } |
547 | 562 |
548 // static | 563 // static |
549 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 564 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
550 g_allow_os_mesa = allow; | 565 g_allow_os_mesa = allow; |
551 } | 566 } |
552 | 567 |
553 } // namespace content | 568 } // namespace content |
OLD | NEW |