Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: content/common/gpu/media/vaapi_drm_picture.h

Issue 1432963003: [Ozone] Extends the lifetime of VaapiWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT for upstream Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 class NativePixmap; 23 class NativePixmap;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 27
28 class VaapiWrapper; 28 class VaapiWrapper;
29 29
30 // Implementation of VaapiPicture for the ozone/drm backed chromium. 30 // Implementation of VaapiPicture for the ozone/drm backed chromium.
31 class VaapiDrmPicture : public VaapiPicture { 31 class VaapiDrmPicture : public VaapiPicture {
32 public: 32 public:
33 VaapiDrmPicture(VaapiWrapper* vaapi_wrapper, 33 VaapiDrmPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
Pawel Osciak 2015/11/16 04:24:35 const&
william.xie1 2015/11/16 08:07:25 Done.
34 const base::Callback<bool(void)>& make_context_current, 34 const base::Callback<bool(void)>& make_context_current,
35 int32 picture_buffer_id, 35 int32 picture_buffer_id,
36 uint32 texture_id, 36 uint32 texture_id,
37 const gfx::Size& size); 37 const gfx::Size& size);
38 38
39 ~VaapiDrmPicture() override; 39 ~VaapiDrmPicture() override;
40 40
41 bool Initialize() override; 41 bool Initialize() override;
42 42
43 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; 43 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override;
44 44
45 scoped_refptr<gl::GLImage> GetImageToBind() override; 45 scoped_refptr<gl::GLImage> GetImageToBind() override;
46 46
47 bool AllowOverlay() const override; 47 bool AllowOverlay() const override;
48 48
49 private: 49 private:
50 // Calls ScalePixmap() if weak_ptr is not NULL.
51 static scoped_refptr<ui::NativePixmap> CallScalePixmap(
52 base::WeakPtr<VaapiDrmPicture> weak_ptr,
53 gfx::Size new_size);
54 // Use VPP to scale underlying pixmap_ to |new_size| and return the 50 // Use VPP to scale underlying pixmap_ to |new_size| and return the
55 // scaling result with a new pixmap. 51 // scaling result with a new pixmap.
56 scoped_refptr<ui::NativePixmap> ScalePixmap(gfx::Size new_size); 52 scoped_refptr<ui::NativePixmap> ScalePixmap(gfx::Size new_size);
57 scoped_refptr<VASurface> CreateVASurfaceForPixmap( 53 scoped_refptr<VASurface> CreateVASurfaceForPixmap(
58 scoped_refptr<ui::NativePixmap> pixmap, 54 scoped_refptr<ui::NativePixmap> pixmap,
59 gfx::Size pixmap_size); 55 gfx::Size pixmap_size);
60 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size); 56 scoped_refptr<ui::NativePixmap> CreateNativePixmap(gfx::Size size);
61 57
62 VaapiWrapper* vaapi_wrapper_; // Not owned. 58 scoped_refptr<VaapiWrapper> vaapi_wrapper_;
63 base::Callback<bool(void)> make_context_current_; 59 base::Callback<bool(void)> make_context_current_;
64 60
65 // Ozone buffer, the storage of the EGLImage and the VASurface. 61 // Ozone buffer, the storage of the EGLImage and the VASurface.
66 scoped_refptr<ui::NativePixmap> pixmap_; 62 scoped_refptr<ui::NativePixmap> pixmap_;
67 63
68 // Ozone buffer, the storage of the scaled buffer for overlay. 64 // Ozone buffer, the storage of the scaled buffer for overlay.
69 scoped_refptr<ui::NativePixmap> scaled_pixmap_; 65 scoped_refptr<ui::NativePixmap> scaled_pixmap_;
70 66
71 // EGLImage bound to the GL textures used by the VDA client. 67 // EGLImage bound to the GL textures used by the VDA client.
72 scoped_refptr<gl::GLImage> gl_image_; 68 scoped_refptr<gl::GLImage> gl_image_;
73 69
74 // VASurface used to transfer from the decoder's pixel format. 70 // VASurface used to transfer from the decoder's pixel format.
75 scoped_refptr<VASurface> va_surface_; 71 scoped_refptr<VASurface> va_surface_;
76 72
77 // VaSurface used to apply scaling. 73 // VaSurface used to apply scaling.
78 scoped_refptr<VASurface> scaled_va_surface_; 74 scoped_refptr<VASurface> scaled_va_surface_;
79 75
80 // The WeakPtrFactory for VaapiDrmPicture.
81 base::WeakPtrFactory<VaapiDrmPicture> weak_this_factory_;
82
83 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); 76 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture);
84 }; 77 };
85 78
86 } // namespace content 79 } // namespace content
87 80
88 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ 81 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/vaapi_drm_picture.cc » ('j') | content/common/gpu/media/vaapi_drm_picture.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698