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

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

Issue 490233002: VaapiVideoAccelerator: make Vaapi accelerator work with ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable vaapi_h264_decoder_unittest on Ozone Created 6 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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // This file contains an implementation of picture allocation for
6 // different window system (X11/Ozone) used by
7 // VaapiVideoDecodeAccelerator to produce output pictures.
8
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_
11
12 #include "base/callback.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/threading/non_thread_safe.h"
15 #include "third_party/libva/va/va.h"
16 #include "ui/gfx/size.h"
17
18 namespace gfx {
19 class GLContext;
20 } // namespace gfx
21
22 namespace content {
23
24 class VaapiWrapper;
25
26 // VaapiPictureProvider is in charge of allocating pictures for the
27 // window system and binding them to gl textures.
28 class VaapiPictureProvider : public base::NonThreadSafe {
Pawel Osciak 2014/11/03 01:36:51 Both VaapiWrapper and MakeContextCurrent are now o
llandwerlin-old 2014/11/03 09:30:11 The creation of pictures is fairly different betwe
29 public:
30 // Picture is native pixmap abstraction (X11/Ozone)
Pawel Osciak 2014/11/03 01:36:51 Please full stop at the end of sentences.
llandwerlin-old 2014/11/03 09:30:11 Acknowledged.
31 class Picture : public base::NonThreadSafe {
32 public:
33 virtual ~Picture() {}
34
35 // Try to allocate the underlying resources for the picture.
36 virtual bool Initialize() = 0;
37
38 int32 picture_buffer_id() const { return picture_buffer_id_; }
39 uint32 texture_id() const { return texture_id_; }
40 const gfx::Size& size() const { return size_; }
41
42 // Downloads the |va_surface_id| of size |surface_size| into the
43 // picture, potentially scaling it if needed.
44 virtual bool DownloadFromSurface(VASurfaceID va_surface_id,
Pawel Osciak 2014/11/03 01:36:51 Could we use VASurface? We wounldn't need size the
llandwerlin-old 2014/11/03 09:30:11 Acknowledged.
45 const gfx::Size& surface_size) = 0;
46
47 protected:
48 Picture(int32 picture_buffer_id, uint32 texture_id, const gfx::Size& size)
49 : picture_buffer_id_(picture_buffer_id),
50 texture_id_(texture_id),
51 size_(size) {}
52
53 private:
54 int32 picture_buffer_id_;
55 uint32 texture_id_;
56 gfx::Size size_;
57
58 DISALLOW_COPY_AND_ASSIGN(Picture);
59 };
60
61 virtual ~VaapiPictureProvider();
62
63 // Create an RGBA picture of |size| and allocate all necessary
64 // underlying buffers and associate it to the given gl |texture_id|
65 // and |picture_buffer_id|.
66 linked_ptr<Picture> CreatePicture(int32 picture_buffer_id,
67 uint32 texture_id,
68 const gfx::Size& size);
69
70 // Create a platform specific picture provider. |vaapi_wrapper| will
71 // be used to make libVA calls and |gl_context| and
72 // |make_context_current| will be used to bind/unbind picture to gl
73 // textures.
74 static scoped_ptr<VaapiPictureProvider> Create(
75 scoped_refptr<VaapiWrapper> vaapi_wrapper,
76 gfx::GLContext* gl_context,
77 const base::Callback<bool(void)> make_context_current);
78
79 protected:
80 VaapiPictureProvider();
81
82 // Allocates a picture of |size| without actually creating the
83 // underlying buffer and associate it to the given gl |texture_id|
84 // and |picture_buffer_id|.
85 virtual linked_ptr<Picture> AllocatePicture(int32 picture_buffer_id,
86 uint32 texture_id,
87 const gfx::Size& size) = 0;
88
89 private:
90 // Initialize the picture provider.
91 virtual bool Initialize() = 0;
92
93 DISALLOW_COPY_AND_ASSIGN(VaapiPictureProvider);
94 };
95
96 } // namespace content
97
98 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698