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.
5 // This file contains an implementation of picture allocation for the
6 // Ozone window system used by VaapiVideoDecodeAccelerator to produce
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "content/common/gpu/media/vaapi_picture.h"
15 #include "ui/gfx/geometry/size.h"
29 // Implementation of VaapiPicture for the ozone/drm backed chromium.
30 class VaapiDrmPicture
: public VaapiPicture
{
32 VaapiDrmPicture(VaapiWrapper
* vaapi_wrapper
,
33 const base::Callback
<bool(void)>& make_context_current
,
34 int32 picture_buffer_id
,
36 const gfx::Size
& size
);
38 ~VaapiDrmPicture() override
;
40 bool Initialize() override
;
42 bool DownloadFromSurface(const scoped_refptr
<VASurface
>& va_surface
) override
;
44 scoped_refptr
<gfx::GLImage
> GetImageToBind() override
;
46 bool AllowOverlay() const override
;
49 VaapiWrapper
* vaapi_wrapper_
; // Not owned.
50 base::Callback
<bool(void)> make_context_current_
;
52 // Ozone buffer, the storage of the EGLImage and the VASurface.
53 scoped_refptr
<ui::NativePixmap
> pixmap_
;
55 // EGLImage bound to the GL textures used by the VDA client.
56 scoped_refptr
<gfx::GLImage
> gl_image_
;
58 // VASurface used to transfer from the decoder's pixel format.
59 scoped_refptr
<VASurface
> va_surface_
;
61 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture
);
64 } // namespace content
66 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_