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

Unified Diff: content/common/gpu/media/vaapi_wrapper.h

Issue 490233002: VaapiVideoAccelerator: make Vaapi accelerator work with ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/vaapi_wrapper.h
diff --git a/content/common/gpu/media/vaapi_wrapper.h b/content/common/gpu/media/vaapi_wrapper.h
index f600cdfa1d17198d00f4fd67b4b59767ea60795e..b905636d961c6b66cf8ce4d61a5744c80d67893f 100644
--- a/content/common/gpu/media/vaapi_wrapper.h
+++ b/content/common/gpu/media/vaapi_wrapper.h
@@ -14,15 +14,21 @@
#include <vector>
#include "base/callback.h"
+#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
+#include "base/threading/non_thread_safe.h"
#include "content/common/content_export.h"
#include "content/common/gpu/media/va_surface.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h"
-#include "third_party/libva/va/va_x11.h"
+#include "third_party/libva/va/va.h"
#include "ui/gfx/size.h"
+namespace gfx {
+class GLContext;
+}; // namespace gfx
+
namespace content {
// This class handles VA-API calls and ensures proper locking of VA-API calls
@@ -42,12 +48,35 @@ class CONTENT_EXPORT VaapiWrapper {
kEncode,
};
+ class Picture : public base::NonThreadSafe {
Pawel Osciak 2014/08/25 01:13:24 We should keep Picture as an interface in VaapiVid
+ public:
+ virtual ~Picture() {}
+
+ int32 picture_buffer_id() const {
+ return picture_buffer_id_;
+ };
+ uint32 texture_id() const { return texture_id_; }
+ const gfx::Size& size() const { return size_; }
+
+ protected:
+ Picture(int32 picture_buffer_id, uint32 texture_id, gfx::Size size)
+ : picture_buffer_id_(picture_buffer_id),
+ texture_id_(texture_id),
+ size_(size) {}
+
+ private:
+ int32 picture_buffer_id_;
+ uint32 texture_id_;
+ gfx::Size size_;
+ };
+
// |report_error_to_uma_cb| will be called independently from reporting
// errors to clients via method return values.
static scoped_ptr<VaapiWrapper> Create(
CodecMode mode,
media::VideoCodecProfile profile,
- Display* x_display,
+ gfx::GLContext* gl_context,
+ const base::Callback<bool(void)>& make_context_current,
const base::Closure& report_error_to_uma_cb);
~VaapiWrapper();
@@ -59,10 +88,14 @@ class CONTENT_EXPORT VaapiWrapper {
// again to free the allocated surfaces first, but is not required to do so
// at destruction time, as this will be done automatically from
// the destructor.
- bool CreateSurfaces(gfx::Size size,
+ bool CreateSurfaces(const gfx::Size& size,
size_t num_surfaces,
std::vector<VASurfaceID>* va_surfaces);
+ linked_ptr<Picture> CreatePicture(int32 picture_buffer_id,
+ uint32 texture_id,
+ gfx::Size size);
+
// Free all memory allocated in CreateSurfaces.
void DestroySurfaces();
@@ -92,11 +125,8 @@ class CONTENT_EXPORT VaapiWrapper {
// buffers. Return false if Execute() fails.
bool ExecuteAndDestroyPendingBuffers(VASurfaceID va_surface_id);
- // Put data from |va_surface_id| into |x_pixmap| of size |size|,
- // converting/scaling to it.
- bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id,
- Pixmap x_pixmap,
- gfx::Size dest_size);
+ // Put data from |va_surface_id| into |picture|, converting/scaling to it.
+ bool PutSurfaceIntoPicture(VASurfaceID va_surface_id, Picture* picture);
// Returns true if the VAAPI version is less than the specified version.
bool VAAPIVersionLessThan(int major, int minor);
@@ -135,11 +165,20 @@ class CONTENT_EXPORT VaapiWrapper {
void DestroyCodedBuffers();
private:
+ class Backend;
+ class X11Backend;
Pawel Osciak 2014/08/25 01:13:24 All four declarations are unused here.
+ class GbmBackend;
+ class TFPPicture;
+ class GbmPicture;
+ // friend class X11Backend;
+ // friend class GbmBackend;
+
VaapiWrapper();
bool Initialize(CodecMode mode,
media::VideoCodecProfile profile,
- Display* x_display,
+ gfx::GLContext* gl_context,
+ const base::Callback<bool(void)>& make_context_current,
const base::Closure& report_error__to_uma_cb);
void Deinitialize();
@@ -168,7 +207,6 @@ class CONTENT_EXPORT VaapiWrapper {
// VA handles.
// Both valid after successful Initialize() and until Deinitialize().
- VADisplay va_display_;
VAConfigID va_config_id_;
// Created for the current set of va_surface_ids_ in CreateSurfaces() and
// valid until DestroySurfaces().
@@ -185,6 +223,9 @@ class CONTENT_EXPORT VaapiWrapper {
// return values from public methods.
base::Closure report_error_to_uma_cb_;
+ // Backend for initialization/surface allocation on X11/DRM
+ scoped_refptr<Backend> backend_;
+
DISALLOW_COPY_AND_ASSIGN(VaapiWrapper);
};

Powered by Google App Engine
This is Rietveld 408576698