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_ |
(...skipping 13 matching lines...) Expand all Loading... | |
24 class NativePixmap; | 24 class NativePixmap; |
25 } | 25 } |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 class VaapiWrapper; | 29 class VaapiWrapper; |
30 | 30 |
31 // Implementation of VaapiPicture for the ozone/drm backed chromium. | 31 // Implementation of VaapiPicture for the ozone/drm backed chromium. |
32 class VaapiDrmPicture : public VaapiPicture { | 32 class VaapiDrmPicture : public VaapiPicture { |
33 public: | 33 public: |
34 VaapiDrmPicture(VaapiWrapper* vaapi_wrapper, | 34 VaapiDrmPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
35 const base::Callback<bool(void)>& make_context_current, | 35 const base::Callback<bool(void)>& make_context_current, |
36 int32 picture_buffer_id, | 36 int32 picture_buffer_id, |
37 uint32 texture_id, | 37 uint32 texture_id, |
38 const gfx::Size& size); | 38 const gfx::Size& size); |
39 | 39 |
40 ~VaapiDrmPicture() override; | 40 ~VaapiDrmPicture() override; |
41 | 41 |
42 bool Initialize() override; | 42 bool Initialize() override; |
43 | 43 |
44 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; | 44 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; |
45 | 45 |
46 scoped_refptr<gl::GLImage> GetImageToBind() override; | 46 scoped_refptr<gl::GLImage> GetImageToBind() override; |
47 | 47 |
48 bool AllowOverlay() const override; | 48 bool AllowOverlay() const override; |
49 | 49 |
50 private: | 50 private: |
51 // Calls ProcessPixmap() if weak_ptr is not NULL. | 51 // Use VPP to process underlying pixmap_, scaling to |target_size| and |
52 static scoped_refptr<ui::NativePixmap> CallProcessPixmap( | 52 // converting to |target_format|. |
53 base::WeakPtr<VaapiDrmPicture> weak_ptr, | 53 static scoped_refptr<ui::NativePixmap> ProcessPixmap( |
Pawel Osciak
2015/11/20 10:09:18
Please document return value and |pixmap|.
william.xie1
2015/11/23 03:33:58
Done.
| |
54 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | |
55 const scoped_refptr<ui::NativePixmap>& pixmap, | |
54 gfx::Size target_size, | 56 gfx::Size target_size, |
55 gfx::BufferFormat target_format); | 57 gfx::BufferFormat target_format); |
56 // Use VPP to process underlying pixmap_, scaling to |target_size| and | 58 static scoped_refptr<ui::NativePixmap> CreateNativePixmap( |
57 // converting to |target_format|. | 59 gfx::Size size, |
58 scoped_refptr<ui::NativePixmap> ProcessPixmap( | 60 gfx::BufferFormat format); |
59 gfx::Size target_size, | |
60 gfx::BufferFormat target_format); | |
61 scoped_refptr<VASurface> CreateVASurfaceForPixmap( | |
62 scoped_refptr<ui::NativePixmap> pixmap, | |
63 gfx::Size pixmap_size); | |
64 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size, | |
65 gfx::BufferFormat format); | |
66 | 61 |
67 VaapiWrapper* vaapi_wrapper_; // Not owned. | 62 scoped_refptr<VaapiWrapper> vaapi_wrapper_; |
68 base::Callback<bool(void)> make_context_current_; | 63 base::Callback<bool(void)> make_context_current_; |
69 | 64 |
70 // Ozone buffer, the storage of the EGLImage and the VASurface. | 65 // Ozone buffer, the storage of the EGLImage and the VASurface. |
71 scoped_refptr<ui::NativePixmap> pixmap_; | 66 scoped_refptr<ui::NativePixmap> pixmap_; |
72 | 67 |
73 // Ozone buffer, the storage of the processed buffer for overlay. | |
74 scoped_refptr<ui::NativePixmap> processed_pixmap_; | |
75 | |
76 // EGLImage bound to the GL textures used by the VDA client. | 68 // EGLImage bound to the GL textures used by the VDA client. |
77 scoped_refptr<gl::GLImage> gl_image_; | 69 scoped_refptr<gl::GLImage> gl_image_; |
78 | 70 |
79 // VASurface used to transfer from the decoder's pixel format. | 71 // VASurface used to transfer from the decoder's pixel format. |
80 scoped_refptr<VASurface> va_surface_; | 72 scoped_refptr<VASurface> va_surface_; |
81 | 73 |
82 // VaSurface used to apply processing. | |
83 scoped_refptr<VASurface> processed_va_surface_; | |
84 | |
85 // The WeakPtrFactory for VaapiDrmPicture. | |
86 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); | 74 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
89 }; | 75 }; |
90 | 76 |
91 } // namespace content | 77 } // namespace content |
92 | 78 |
93 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 79 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |