Chromium Code Reviews| 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 CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // |report_error_to_uma_cb| will be called independently from reporting | 45 // |report_error_to_uma_cb| will be called independently from reporting |
| 46 // errors to clients via method return values. | 46 // errors to clients via method return values. |
| 47 static scoped_ptr<VaapiWrapper> Create( | 47 static scoped_ptr<VaapiWrapper> Create( |
| 48 CodecMode mode, | 48 CodecMode mode, |
| 49 media::VideoCodecProfile profile, | 49 media::VideoCodecProfile profile, |
| 50 Display* x_display, | 50 Display* x_display, |
| 51 const base::Closure& report_error_to_uma_cb); | 51 const base::Closure& report_error_to_uma_cb); |
| 52 | 52 |
| 53 // Return the supported profiles. | |
| 54 static std::vector<media::VideoCodecProfile> GetSupportedProfiles( | |
|
Pawel Osciak
2014/09/26 07:15:12
GetSupportedEncodeProfiles
wuchengli
2014/09/26 09:02:28
Done.
| |
| 55 Display* x_display, | |
| 56 const base::Closure& report_error_to_uma_cb); | |
| 57 | |
| 53 ~VaapiWrapper(); | 58 ~VaapiWrapper(); |
| 54 | 59 |
| 55 // Create |num_surfaces| backing surfaces in driver for VASurfaces, each | 60 // Create |num_surfaces| backing surfaces in driver for VASurfaces, each |
| 56 // of size |size|. Returns true when successful, with the created IDs in | 61 // of size |size|. Returns true when successful, with the created IDs in |
| 57 // |va_surfaces| to be managed and later wrapped in VASurfaces. | 62 // |va_surfaces| to be managed and later wrapped in VASurfaces. |
| 58 // The client must DestroySurfaces() each time before calling this method | 63 // The client must DestroySurfaces() each time before calling this method |
| 59 // again to free the allocated surfaces first, but is not required to do so | 64 // again to free the allocated surfaces first, but is not required to do so |
| 60 // at destruction time, as this will be done automatically from | 65 // at destruction time, as this will be done automatically from |
| 61 // the destructor. | 66 // the destructor. |
| 62 bool CreateSurfaces(gfx::Size size, | 67 bool CreateSurfaces(gfx::Size size, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 | 138 |
| 134 // Destroy all previously-allocated (and not yet destroyed) coded buffers. | 139 // Destroy all previously-allocated (and not yet destroyed) coded buffers. |
| 135 void DestroyCodedBuffers(); | 140 void DestroyCodedBuffers(); |
| 136 | 141 |
| 137 private: | 142 private: |
| 138 VaapiWrapper(); | 143 VaapiWrapper(); |
| 139 | 144 |
| 140 bool Initialize(CodecMode mode, | 145 bool Initialize(CodecMode mode, |
| 141 media::VideoCodecProfile profile, | 146 media::VideoCodecProfile profile, |
| 142 Display* x_display, | 147 Display* x_display, |
| 143 const base::Closure& report_error__to_uma_cb); | 148 const base::Closure& report_error_to_uma_cb); |
| 144 void Deinitialize(); | 149 void Deinitialize(); |
| 150 bool VaInitialize(Display* x_display, | |
| 151 const base::Closure& report_error_to_uma_cb); | |
| 152 bool GetSupportedVaProfiles(std::vector<VAProfile>* profiles); | |
| 153 bool IsEntrypointSupported(VAProfile va_profile, VAEntrypoint entrypoint); | |
| 154 bool IsAttribSupported(VAProfile va_profile, | |
| 155 VAEntrypoint entrypoint, | |
| 156 const std::vector<VAConfigAttrib>& required_attribs); | |
| 145 | 157 |
| 146 // Execute pending job in hardware and destroy pending buffers. Return false | 158 // Execute pending job in hardware and destroy pending buffers. Return false |
| 147 // if vaapi driver refuses to accept parameter or slice buffers submitted | 159 // if vaapi driver refuses to accept parameter or slice buffers submitted |
| 148 // by client, or if execution fails in hardware. | 160 // by client, or if execution fails in hardware. |
| 149 bool Execute(VASurfaceID va_surface_id); | 161 bool Execute(VASurfaceID va_surface_id); |
| 150 | 162 |
| 151 // Attempt to set render mode to "render to texture.". Failure is non-fatal. | 163 // Attempt to set render mode to "render to texture.". Failure is non-fatal. |
| 152 void TryToSetVADisplayAttributeToLocalGPU(); | 164 void TryToSetVADisplayAttributeToLocalGPU(); |
| 153 | 165 |
| 154 // Lazily initialize static data after sandbox is enabled. Return false on | 166 // Lazily initialize static data after sandbox is enabled. Return false on |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 184 // Called to report codec errors to UMA. Errors to clients are reported via | 196 // Called to report codec errors to UMA. Errors to clients are reported via |
| 185 // return values from public methods. | 197 // return values from public methods. |
| 186 base::Closure report_error_to_uma_cb_; | 198 base::Closure report_error_to_uma_cb_; |
| 187 | 199 |
| 188 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); | 200 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); |
| 189 }; | 201 }; |
| 190 | 202 |
| 191 } // namespace content | 203 } // namespace content |
| 192 | 204 |
| 193 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 205 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
| OLD | NEW |