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 "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "content/common/gpu/media/vaapi_picture.h" | 15 #include "content/common/gpu/media/vaapi_picture.h" |
16 #include "ui/gfx/buffer_types.h" | |
16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
17 | 18 |
18 namespace gl { | 19 namespace gl { |
19 class GLImage; | 20 class GLImage; |
20 } | 21 } |
21 | 22 |
22 namespace ui { | 23 namespace ui { |
23 class NativePixmap; | 24 class NativePixmap; |
24 } | 25 } |
25 | 26 |
(...skipping 14 matching lines...) Expand all Loading... | |
40 | 41 |
41 bool Initialize() override; | 42 bool Initialize() override; |
42 | 43 |
43 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; | 44 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; |
44 | 45 |
45 scoped_refptr<gl::GLImage> GetImageToBind() override; | 46 scoped_refptr<gl::GLImage> GetImageToBind() override; |
46 | 47 |
47 bool AllowOverlay() const override; | 48 bool AllowOverlay() const override; |
48 | 49 |
49 private: | 50 private: |
50 // Calls ScalePixmap() if weak_ptr is not NULL. | 51 // Calls ProcessPixmap() if weak_ptr is not NULL. |
51 static scoped_refptr<ui::NativePixmap> CallScalePixmap( | 52 static scoped_refptr<ui::NativePixmap> CallProcessPixmap( |
52 base::WeakPtr<VaapiDrmPicture> weak_ptr, | 53 base::WeakPtr<VaapiDrmPicture> weak_ptr, |
53 gfx::Size new_size); | 54 gfx::Size target_size, |
54 // Use VPP to scale underlying pixmap_ to |new_size| and return the | 55 gfx::BufferFormat target_format); |
55 // scaling result with a new pixmap. | 56 // Use VPP to process underlying pixmap_, scaling to |target_size| and |
56 scoped_refptr<ui::NativePixmap> ScalePixmap(gfx::Size new_size); | 57 // converting to |target_format| |
58 scoped_refptr<ui::NativePixmap> ProcessPixmap( | |
Pawel Osciak
2015/11/10 06:09:24
Nit: dot at the end of sentences please.
william.xie1
2015/11/10 06:25:54
Done.
| |
59 gfx::Size target_size, | |
60 gfx::BufferFormat target_format); | |
57 scoped_refptr<VASurface> CreateVASurfaceForPixmap( | 61 scoped_refptr<VASurface> CreateVASurfaceForPixmap( |
58 scoped_refptr<ui::NativePixmap> pixmap, | 62 scoped_refptr<ui::NativePixmap> pixmap, |
59 gfx::Size pixmap_size); | 63 gfx::Size pixmap_size); |
60 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size); | 64 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size, |
65 gfx::BufferFormat format); | |
61 | 66 |
62 VaapiWrapper* vaapi_wrapper_; // Not owned. | 67 VaapiWrapper* vaapi_wrapper_; // Not owned. |
63 base::Callback<bool(void)> make_context_current_; | 68 base::Callback<bool(void)> make_context_current_; |
64 | 69 |
65 // Ozone buffer, the storage of the EGLImage and the VASurface. | 70 // Ozone buffer, the storage of the EGLImage and the VASurface. |
66 scoped_refptr<ui::NativePixmap> pixmap_; | 71 scoped_refptr<ui::NativePixmap> pixmap_; |
67 | 72 |
68 // Ozone buffer, the storage of the scaled buffer for overlay. | 73 // Ozone buffer, the storage of the processed buffer for overlay. |
69 scoped_refptr<ui::NativePixmap> scaled_pixmap_; | 74 scoped_refptr<ui::NativePixmap> processed_pixmap_; |
70 | 75 |
71 // EGLImage bound to the GL textures used by the VDA client. | 76 // EGLImage bound to the GL textures used by the VDA client. |
72 scoped_refptr<gl::GLImage> gl_image_; | 77 scoped_refptr<gl::GLImage> gl_image_; |
73 | 78 |
74 // VASurface used to transfer from the decoder's pixel format. | 79 // VASurface used to transfer from the decoder's pixel format. |
75 scoped_refptr<VASurface> va_surface_; | 80 scoped_refptr<VASurface> va_surface_; |
76 | 81 |
77 // VaSurface used to apply scaling. | 82 // VaSurface used to apply processing. |
78 scoped_refptr<VASurface> scaled_va_surface_; | 83 scoped_refptr<VASurface> processed_va_surface_; |
79 | 84 |
80 // The WeakPtrFactory for VaapiDrmPicture. | 85 // The WeakPtrFactory for VaapiDrmPicture. |
81 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_; | 86 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_; |
82 | 87 |
83 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); | 88 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
84 }; | 89 }; |
85 | 90 |
86 } // namespace content | 91 } // namespace content |
87 | 92 |
88 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 93 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |