OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 picture allocation for the | 5 // This file contains an implementation of picture allocation for the |
6 // Ozone window system used by VaapiVideoDecodeAccelerator to produce | 6 // Ozone window system used by VaapiVideoDecodeAccelerator to produce |
7 // output pictures. | 7 // output pictures. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
11 | 11 |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include "base/callback.h" | |
15 #include "base/macros.h" | 14 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
18 #include "content/common/gpu/media/vaapi_picture.h" | 17 #include "content/common/gpu/media/vaapi_picture.h" |
19 #include "ui/gfx/buffer_types.h" | 18 #include "ui/gfx/buffer_types.h" |
20 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
21 | 20 |
22 namespace gl { | 21 namespace gl { |
23 class GLImage; | 22 class GLImage; |
24 } | 23 } |
25 | 24 |
26 namespace ui { | 25 namespace ui { |
27 class NativePixmap; | 26 class NativePixmap; |
28 } | 27 } |
29 | 28 |
30 namespace content { | 29 namespace content { |
31 | 30 |
32 class VaapiWrapper; | 31 class VaapiWrapper; |
33 | 32 |
34 // Implementation of VaapiPicture for the ozone/drm backed chromium. | 33 // Implementation of VaapiPicture for the ozone/drm backed chromium. |
35 class VaapiDrmPicture : public VaapiPicture { | 34 class VaapiDrmPicture : public VaapiPicture { |
36 public: | 35 public: |
37 VaapiDrmPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 36 VaapiDrmPicture( |
38 const base::Callback<bool(void)>& make_context_current, | 37 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
39 int32_t picture_buffer_id, | 38 const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb, |
40 uint32_t texture_id, | 39 int32_t picture_buffer_id, |
41 const gfx::Size& size); | 40 uint32_t texture_id, |
| 41 const gfx::Size& size); |
42 | 42 |
43 ~VaapiDrmPicture() override; | 43 ~VaapiDrmPicture() override; |
44 | 44 |
45 bool Initialize() override; | 45 bool Initialize() override; |
46 | 46 |
47 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; | 47 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; |
48 | 48 |
49 scoped_refptr<gl::GLImage> GetImageToBind() override; | 49 scoped_refptr<gl::GLImage> GetImageToBind() override; |
50 | 50 |
51 bool AllowOverlay() const override; | 51 bool AllowOverlay() const override; |
52 | 52 |
53 private: | 53 private: |
54 scoped_refptr<VaapiWrapper> vaapi_wrapper_; | 54 scoped_refptr<VaapiWrapper> vaapi_wrapper_; |
55 base::Callback<bool(void)> make_context_current_; | 55 gpu_vda_helpers::MakeGLContextCurrentCb make_context_current_cb_; |
56 | 56 |
57 // Ozone buffer, the storage of the EGLImage and the VASurface. | 57 // Ozone buffer, the storage of the EGLImage and the VASurface. |
58 scoped_refptr<ui::NativePixmap> pixmap_; | 58 scoped_refptr<ui::NativePixmap> pixmap_; |
59 | 59 |
60 // EGLImage bound to the GL textures used by the VDA client. | 60 // EGLImage bound to the GL textures used by the VDA client. |
61 scoped_refptr<gl::GLImage> gl_image_; | 61 scoped_refptr<gl::GLImage> gl_image_; |
62 | 62 |
63 // VASurface used to transfer from the decoder's pixel format. | 63 // VASurface used to transfer from the decoder's pixel format. |
64 scoped_refptr<VASurface> va_surface_; | 64 scoped_refptr<VASurface> va_surface_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); | 66 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace content | 69 } // namespace content |
70 | 70 |
71 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 71 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |