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