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 <gbm.h> |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "content/common/gpu/media/vaapi_picture.h" | 16 #include "content/common/gpu/media/vaapi_picture.h" |
| 17 #include "ui/gfx/buffer_types.h" |
16 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
17 | 19 |
18 namespace gfx { | 20 namespace gfx { |
19 class GLImage; | 21 class GLImage; |
20 } | 22 } |
21 | 23 |
22 namespace ui { | 24 namespace ui { |
23 class NativePixmap; | 25 class NativePixmap; |
24 } | 26 } |
25 | 27 |
(...skipping 24 matching lines...) Expand all Loading... |
50 // Calls ScalePixmap() if weak_ptr is not NULL. | 52 // Calls ScalePixmap() if weak_ptr is not NULL. |
51 static scoped_refptr<ui::NativePixmap> CallScalePixmap( | 53 static scoped_refptr<ui::NativePixmap> CallScalePixmap( |
52 base::WeakPtr<VaapiDrmPicture> weak_ptr, | 54 base::WeakPtr<VaapiDrmPicture> weak_ptr, |
53 gfx::Size new_size); | 55 gfx::Size new_size); |
54 // Use VPP to scale underlying pixmap_ to |new_size| and return the | 56 // Use VPP to scale underlying pixmap_ to |new_size| and return the |
55 // scaling result with a new pixmap. | 57 // scaling result with a new pixmap. |
56 scoped_refptr<ui::NativePixmap> ScalePixmap(gfx::Size new_size); | 58 scoped_refptr<ui::NativePixmap> ScalePixmap(gfx::Size new_size); |
57 scoped_refptr<VASurface> CreateVASurfaceForPixmap( | 59 scoped_refptr<VASurface> CreateVASurfaceForPixmap( |
58 scoped_refptr<ui::NativePixmap> pixmap, | 60 scoped_refptr<ui::NativePixmap> pixmap, |
59 gfx::Size pixmap_size); | 61 gfx::Size pixmap_size); |
60 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size); | 62 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size, |
| 63 gfx::BufferFormat format); |
61 | 64 |
62 VaapiWrapper* vaapi_wrapper_; // Not owned. | 65 VaapiWrapper* vaapi_wrapper_; // Not owned. |
63 base::Callback<bool(void)> make_context_current_; | 66 base::Callback<bool(void)> make_context_current_; |
64 | 67 |
65 // Ozone buffer, the storage of the EGLImage and the VASurface. | 68 // Ozone buffer, the storage of the EGLImage and the VASurface. |
66 scoped_refptr<ui::NativePixmap> pixmap_; | 69 scoped_refptr<ui::NativePixmap> pixmap_; |
67 | 70 |
68 // Ozone buffer, the storage of the scaled buffer for overlay. | 71 // Ozone buffer, the storage of the scaled buffer for overlay. |
69 scoped_refptr<ui::NativePixmap> scaled_pixmap_; | 72 scoped_refptr<ui::NativePixmap> scaled_pixmap_; |
70 | 73 |
71 // EGLImage bound to the GL textures used by the VDA client. | 74 // EGLImage bound to the GL textures used by the VDA client. |
72 scoped_refptr<gfx::GLImage> gl_image_; | 75 scoped_refptr<gfx::GLImage> gl_image_; |
73 | 76 |
74 // VASurface used to transfer from the decoder's pixel format. | 77 // VASurface used to transfer from the decoder's pixel format. |
75 scoped_refptr<VASurface> va_surface_; | 78 scoped_refptr<VASurface> va_surface_; |
76 | 79 |
77 // VaSurface used to apply scaling. | 80 // VaSurface used to apply scaling. |
78 scoped_refptr<VASurface> scaled_va_surface_; | 81 scoped_refptr<VASurface> scaled_va_surface_; |
79 | 82 |
80 // The WeakPtrFactory for VaapiDrmPicture. | 83 // The WeakPtrFactory for VaapiDrmPicture. |
81 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_; | 84 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_; |
82 | 85 |
83 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); | 86 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
84 }; | 87 }; |
85 | 88 |
86 } // namespace content | 89 } // namespace content |
87 | 90 |
88 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 91 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |