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 scoped_refptr<VaapiWrapper> vaapi_wrapper_; |
52 static scoped_refptr<ui::NativePixmap> CallProcessPixmap( | |
53 base::WeakPtr<VaapiDrmPicture> weak_ptr, | |
54 gfx::Size target_size, | |
55 gfx::BufferFormat target_format); | |
56 // Use VPP to process underlying pixmap_, scaling to |target_size| and | |
57 // converting to |target_format|. | |
58 scoped_refptr<ui::NativePixmap> ProcessPixmap( | |
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 | |
67 VaapiWrapper* vaapi_wrapper_; // Not owned. | |
68 base::Callback<bool(void)> make_context_current_; | 52 base::Callback<bool(void)> make_context_current_; |
69 | 53 |
70 // Ozone buffer, the storage of the EGLImage and the VASurface. | 54 // Ozone buffer, the storage of the EGLImage and the VASurface. |
71 scoped_refptr<ui::NativePixmap> pixmap_; | 55 scoped_refptr<ui::NativePixmap> pixmap_; |
72 | 56 |
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. | 57 // EGLImage bound to the GL textures used by the VDA client. |
77 scoped_refptr<gl::GLImage> gl_image_; | 58 scoped_refptr<gl::GLImage> gl_image_; |
78 | 59 |
79 // VASurface used to transfer from the decoder's pixel format. | 60 // VASurface used to transfer from the decoder's pixel format. |
80 scoped_refptr<VASurface> va_surface_; | 61 scoped_refptr<VASurface> va_surface_; |
81 | 62 |
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); | 63 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
89 }; | 64 }; |
90 | 65 |
91 } // namespace content | 66 } // namespace content |
92 | 67 |
93 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 68 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |