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

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

Issue 804353003: Revert of Refactor Vaapi video decoder/encoder in preparation of Freon support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/common/gpu/media/va.sigs ('k') | content/common/gpu/media/va_x11.sigs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 the definition of VASurface class, used for decoding by 5 // This file contains the definition of VASurface class, used for decoding by
6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder. 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder.
7 7
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_
9 #define CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 9 #define CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_
10 10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "content/common/content_export.h"
14 #include "third_party/libva/va/va.h" 11 #include "third_party/libva/va/va.h"
15 #include "ui/gfx/size.h"
16 12
17 namespace content { 13 namespace content {
18 14
19 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into 15 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into
20 // and use as reference for decoding other surfaces. It is also handed by the 16 // and use as reference for decoding other surfaces. It is also handed by the
21 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are 17 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are
22 // ready and should be displayed. VAVDA converts the surface contents into an 18 // ready and should be displayed. VAVDA converts the surface contents into an
23 // X/Drm Pixmap bound to a texture for display and releases its reference to it. 19 // X Pixmap bound to a texture for display and releases its reference to it.
24 // Decoder releases its references to the surface when it's done decoding and 20 // Decoder releases its references to the surface when it's done decoding and
25 // using it as reference. Note that a surface may still be used for reference 21 // using it as reference. Note that a surface may still be used for reference
26 // after it's been sent to output and also after it is no longer used by VAVDA. 22 // after it's been sent to output and also after it is no longer used by VAVDA.
27 // Thus, the surface can be in use by both VAVDA and the Decoder at the same 23 // Thus, the surface can be in use by both VAVDA and the Decoder at the same
28 // time, or by either of them, with the restriction that VAVDA will never get 24 // time, or by either of them, with the restriction that VAVDA will never get
29 // the surface until the contents are ready, and it is guaranteed that the 25 // the surface until the contents are ready, and it is guaranteed that the
30 // contents will not change after that. 26 // contents will not change after that.
31 // When both the decoder and VAVDA release their references to the surface, 27 // When both the decoder and VAVDA release their references to the surface,
32 // it is freed and the release callback is executed to put the surface back 28 // it is freed and the release callback is executed to put the surface back
33 // into available surfaces pool, which is managed externally. 29 // into available surfaces pool, which is managed externally.
(...skipping 19 matching lines...) Expand all
53 // | DecodeSurface is used for decoding, putting data into associated VASurface. 49 // | DecodeSurface is used for decoding, putting data into associated VASurface.
54 // | | 50 // | |
55 // | |--------------------------------------------------+ 51 // | |--------------------------------------------------+
56 // | | | 52 // | | |
57 // | v v 53 // | v v
58 // | DecodeSurface is to be output. VaapiH264Decoder uses the 54 // | DecodeSurface is to be output. VaapiH264Decoder uses the
59 // | VaapiH264Decoder passes the associated DecodeSurface and associated 55 // | VaapiH264Decoder passes the associated DecodeSurface and associated
60 // | VASurface to VaapiVideoDecodeAccelerator, VASurface as reference for 56 // | VASurface to VaapiVideoDecodeAccelerator, VASurface as reference for
61 // | which stores it (taking a ref) on decoding more frames. 57 // | which stores it (taking a ref) on decoding more frames.
62 // | pending_output_cbs_ queue until an output | 58 // | pending_output_cbs_ queue until an output |
63 // | VaapiPicture becomes available. v 59 // | TFPPicture becomes available. v
64 // | | Once the DecodeSurface is not 60 // | | Once the DecodeSurface is not
65 // | | needed as reference anymore, 61 // | | needed as reference anymore,
66 // | v it is released, releasing the 62 // | v it is released, releasing the
67 // | A VaapiPicture becomes available after associated VASurface reference. 63 // | A TFPPicture becomes available after associated VASurface reference.
68 // | the client of VVDA returns | 64 // | the client of VVDA returns |
69 // | a PictureBuffer associated with it. VVDA | 65 // | a PictureBuffer associated with it. VVDA |
70 // | puts the contents of the VASurface into | 66 // | puts the contents of the VASurface into |
71 // | it and releases the reference to VASurface. | 67 // | it and releases the reference to VASurface. |
72 // | | | 68 // | | |
73 // | '---------------------------------------' 69 // | '---------------------------------------'
74 // | | 70 // | |
75 // | v 71 // | v
76 // | Neither VVDA nor VHD hold a reference to VASurface. VASurface is released, 72 // | Neither VVDA nor VHD hold a reference to VASurface. VASurface is released,
77 // | ReleaseCB gets called in its destructor, which puts the associated 73 // | ReleaseCB gets called in its destructor, which puts the associated
78 // | VASurfaceID back onto VVDA::available_va_surfaces_. 74 // | VASurfaceID back onto VVDA::available_va_surfaces_.
79 // | | 75 // | |
80 // '-------------------------------------| 76 // '-------------------------------------|
81 // | 77 // |
82 // v 78 // v
83 // VaapiWrapper frees VASurfaceID. 79 // VaapiWrapper frees VASurfaceID.
84 // 80 //
85 class CONTENT_EXPORT VASurface : public base::RefCountedThreadSafe<VASurface> { 81 class CONTENT_EXPORT VASurface : public base::RefCountedThreadSafe<VASurface> {
86 public: 82 public:
87 // Provided by user, will be called when all references to the surface 83 // Provided by user, will be called when all references to the surface
88 // are released. 84 // are released.
89 typedef base::Callback<void(VASurfaceID)> ReleaseCB; 85 typedef base::Callback<void(VASurfaceID)> ReleaseCB;
90 86
91 VASurface(VASurfaceID va_surface_id, 87 VASurface(VASurfaceID va_surface_id, const ReleaseCB& release_cb);
92 const gfx::Size& size,
93 const ReleaseCB& release_cb);
94 88
95 VASurfaceID id() { 89 VASurfaceID id() {
96 return va_surface_id_; 90 return va_surface_id_;
97 } 91 }
98 92
99 const gfx::Size& size() const { return size_; }
100
101 private: 93 private:
102 friend class base::RefCountedThreadSafe<VASurface>; 94 friend class base::RefCountedThreadSafe<VASurface>;
103 ~VASurface(); 95 ~VASurface();
104 96
105 const VASurfaceID va_surface_id_; 97 const VASurfaceID va_surface_id_;
106 gfx::Size size_;
107 ReleaseCB release_cb_; 98 ReleaseCB release_cb_;
108 99
109 DISALLOW_COPY_AND_ASSIGN(VASurface); 100 DISALLOW_COPY_AND_ASSIGN(VASurface);
110 }; 101 };
111 102
112 } // namespace content 103 } // namespace content
113 104
114 #endif // CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 105 #endif // CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/va.sigs ('k') | content/common/gpu/media/va_x11.sigs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698