| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file contains an implementation of VaapiWrapper, used by | 5 // This file contains an implementation of VaapiWrapper, used by |
| 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, | 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, |
| 7 // and VaapiVideoEncodeAccelerator for encode, to interface | 7 // and VaapiVideoEncodeAccelerator for encode, to interface |
| 8 // with libva (VA-API library for hardware video codec). | 8 // with libva (VA-API library for hardware video codec). |
| 9 | 9 |
| 10 #ifndef MEDIA_GPU_VAAPI_WRAPPER_H_ | 10 #ifndef MEDIA_GPU_VAAPI_WRAPPER_H_ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "media/video/video_encode_accelerator.h" | 29 #include "media/video/video_encode_accelerator.h" |
| 30 #include "third_party/libva/va/va.h" | 30 #include "third_party/libva/va/va.h" |
| 31 #include "third_party/libva/va/va_vpp.h" | 31 #include "third_party/libva/va/va_vpp.h" |
| 32 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
| 33 | 33 |
| 34 #if defined(USE_X11) | 34 #if defined(USE_X11) |
| 35 #include "third_party/libva/va/va_x11.h" | 35 #include "third_party/libva/va/va_x11.h" |
| 36 #endif // USE_X11 | 36 #endif // USE_X11 |
| 37 | 37 |
| 38 #if defined(USE_OZONE) | 38 #if defined(USE_OZONE) |
| 39 namespace ui { | 39 namespace gfx { |
| 40 class NativePixmap; | 40 class NativePixmap; |
| 41 } | 41 } |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 namespace media { | 44 namespace media { |
| 45 | 45 |
| 46 // This class handles VA-API calls and ensures proper locking of VA-API calls | 46 // This class handles VA-API calls and ensures proper locking of VA-API calls |
| 47 // to libva, the userspace shim to the HW codec driver. libva is not | 47 // to libva, the userspace shim to the HW codec driver. libva is not |
| 48 // thread-safe, so we have to perform locking ourselves. This class is fully | 48 // thread-safe, so we have to perform locking ourselves. This class is fully |
| 49 // synchronous and its methods can be called from any thread and may wait on | 49 // synchronous and its methods can be called from any thread and may wait on |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 scoped_refptr<VASurface> CreateUnownedSurface( | 111 scoped_refptr<VASurface> CreateUnownedSurface( |
| 112 unsigned int va_format, | 112 unsigned int va_format, |
| 113 const gfx::Size& size, | 113 const gfx::Size& size, |
| 114 const std::vector<VASurfaceAttrib>& va_attribs); | 114 const std::vector<VASurfaceAttrib>& va_attribs); |
| 115 | 115 |
| 116 #if defined(USE_OZONE) | 116 #if defined(USE_OZONE) |
| 117 // Create a VASurface for |pixmap|. The ownership of the surface is | 117 // Create a VASurface for |pixmap|. The ownership of the surface is |
| 118 // transferred to the caller. It differs from surfaces created using | 118 // transferred to the caller. It differs from surfaces created using |
| 119 // CreateSurfaces(), where VaapiWrapper is the owner of the surfaces. | 119 // CreateSurfaces(), where VaapiWrapper is the owner of the surfaces. |
| 120 scoped_refptr<VASurface> CreateVASurfaceForPixmap( | 120 scoped_refptr<VASurface> CreateVASurfaceForPixmap( |
| 121 const scoped_refptr<ui::NativePixmap>& pixmap); | 121 const scoped_refptr<gfx::NativePixmap>& pixmap); |
| 122 | 122 |
| 123 // Use VPP to process |source_pixmap| to |target_pixmap| with scaling and | 123 // Use VPP to process |source_pixmap| to |target_pixmap| with scaling and |
| 124 // color space conversion. | 124 // color space conversion. |
| 125 bool ProcessPixmap(const scoped_refptr<ui::NativePixmap>& source_pixmap, | 125 bool ProcessPixmap(const scoped_refptr<gfx::NativePixmap>& source_pixmap, |
| 126 scoped_refptr<ui::NativePixmap> target_pixmap); | 126 scoped_refptr<gfx::NativePixmap> target_pixmap); |
| 127 | 127 |
| 128 #endif | 128 #endif |
| 129 | 129 |
| 130 // Submit parameters or slice data of |va_buffer_type|, copying them from | 130 // Submit parameters or slice data of |va_buffer_type|, copying them from |
| 131 // |buffer| of size |size|, into HW codec. The data in |buffer| is no | 131 // |buffer| of size |size|, into HW codec. The data in |buffer| is no |
| 132 // longer needed and can be freed after this method returns. | 132 // longer needed and can be freed after this method returns. |
| 133 // Data submitted via this method awaits in the HW codec until | 133 // Data submitted via this method awaits in the HW codec until |
| 134 // ExecuteAndDestroyPendingBuffers() is called to execute or | 134 // ExecuteAndDestroyPendingBuffers() is called to execute or |
| 135 // DestroyPendingBuffers() is used to cancel a pending job. | 135 // DestroyPendingBuffers() is used to cancel a pending job. |
| 136 bool SubmitBuffer(VABufferType va_buffer_type, size_t size, void* buffer); | 136 bool SubmitBuffer(VABufferType va_buffer_type, size_t size, void* buffer); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 VAConfigID va_vpp_config_id_; | 381 VAConfigID va_vpp_config_id_; |
| 382 VAContextID va_vpp_context_id_; | 382 VAContextID va_vpp_context_id_; |
| 383 VABufferID va_vpp_buffer_id_; | 383 VABufferID va_vpp_buffer_id_; |
| 384 | 384 |
| 385 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); | 385 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); |
| 386 }; | 386 }; |
| 387 | 387 |
| 388 } // namespace media | 388 } // namespace media |
| 389 | 389 |
| 390 #endif // MEDIA_GPU_VAAPI_WRAPPER_H_ | 390 #endif // MEDIA_GPU_VAAPI_WRAPPER_H_ |
| OLD | NEW |