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

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

Issue 1822983002: Support external buffer import in VDA interface and add a V4L2SVDA impl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 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 defines the V4L2Device interface which is used by the 5 // This file defines the V4L2Device interface which is used by the
6 // V4L2DecodeAccelerator class to delegate/pass the device specific 6 // V4L2DecodeAccelerator class to delegate/pass the device specific
7 // handling of any of the functionalities. 7 // handling of any of the functionalities.
8 8
9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_
11 11
12 #include <stddef.h> 12 #include <stddef.h>
13 #include <stdint.h> 13 #include <stdint.h>
14 14
15 #include <linux/videodev2.h>
16
17 #include "base/files/scoped_file.h"
15 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
16 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
17 #include "media/base/video_decoder_config.h" 20 #include "media/base/video_decoder_config.h"
18 #include "media/base/video_frame.h" 21 #include "media/base/video_frame.h"
19 #include "media/video/video_decode_accelerator.h" 22 #include "media/video/video_decode_accelerator.h"
20 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
21 #include "ui/gl/gl_bindings.h" 24 #include "ui/gl/gl_bindings.h"
22 25
23 // TODO(posciak): remove this once V4L2 headers are updated. 26 // TODO(posciak): remove this once V4L2 headers are updated.
24 #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') 27 #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 unsigned int len, 82 unsigned int len,
80 int prot, 83 int prot,
81 int flags, 84 int flags,
82 unsigned int offset) = 0; 85 unsigned int offset) = 0;
83 virtual void Munmap(void* addr, unsigned int len) = 0; 86 virtual void Munmap(void* addr, unsigned int len) = 0;
84 87
85 // Initializes the V4L2Device to operate as a device of |type|. 88 // Initializes the V4L2Device to operate as a device of |type|.
86 // Returns true on success. 89 // Returns true on success.
87 virtual bool Initialize() = 0; 90 virtual bool Initialize() = 0;
88 91
92 // Return a vector of dmabuf file descriptors, exported for V4L2 buffer with
93 // |index|, assuming the buffer contains |num_planes| V4L2 planes and is of
94 // |type|. Return an empty vector on failure.
95 // The caller is responsible for closing the file descriptors after use.
96 virtual std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer(
97 int index,
98 size_t num_planes,
99 enum v4l2_buf_type type) = 0;
100
89 // Return true if the given V4L2 pixfmt can be used in CreateEGLImage() 101 // Return true if the given V4L2 pixfmt can be used in CreateEGLImage()
90 // for the current platform. 102 // for the current platform.
91 virtual bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) = 0; 103 virtual bool CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) = 0;
92 104
93 // Creates an EGLImageKHR since each V4L2Device may use a different method of 105 // Create an EGLImage from provided |dmabuf_fds| and bind |texture_id| to it.
94 // acquiring one and associating it to the given texture. The texture_id is 106 // Some implementations may also require the V4L2 |buffer_index| of the buffer
95 // used to bind the texture to the returned EGLImageKHR. buffer_index can be 107 // for which |dmabuf_fds| have been exported.
kcwu 2016/03/22 07:47:01 Do we need to keep |dmabuf_fds| open after CreateE
Owen Lin 2016/03/23 06:32:49 How about using std::vector<base::ScopedFD> as the
Pawel Osciak 2016/03/28 01:31:28 I intended to keep the option of retaining referen
Pawel Osciak 2016/03/28 01:31:28 No. Adding to the doc.
96 // used to associate the returned EGLImageKHR by the underlying V4L2Device 108 // Return EGL_NO_IMAGE_KHR on failure.
97 // implementation. 109 virtual EGLImageKHR CreateEGLImage(
98 virtual EGLImageKHR CreateEGLImage(EGLDisplay egl_display, 110 EGLDisplay egl_display,
99 EGLContext egl_context, 111 EGLContext /* egl_context */,
kcwu 2016/03/22 07:47:02 remove /* */
Pawel Osciak 2016/03/28 01:31:28 Done.
100 GLuint texture_id, 112 GLuint texture_id,
101 gfx::Size frame_buffer_size, 113 const gfx::Size& size,
102 unsigned int buffer_index, 114 unsigned int buffer_index,
103 uint32_t v4l2_pixfmt, 115 uint32_t v4l2_pixfmt,
104 size_t num_v4l2_planes) = 0; 116 const std::vector<base::ScopedFD>& dmabuf_fds) = 0;
105 117
106 // Destroys the EGLImageKHR. 118 // Destroys the EGLImageKHR.
107 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display, 119 virtual EGLBoolean DestroyEGLImage(EGLDisplay egl_display,
108 EGLImageKHR egl_image) = 0; 120 EGLImageKHR egl_image) = 0;
109 121
110 // Returns the supported texture target for the V4L2Device. 122 // Returns the supported texture target for the V4L2Device.
111 virtual GLenum GetTextureTarget() = 0; 123 virtual GLenum GetTextureTarget() = 0;
112 124
113 // Returns the preferred V4L2 input format or 0 if don't care. 125 // Returns the preferred V4L2 input format or 0 if don't care.
114 virtual uint32_t PreferredInputFormat() = 0; 126 virtual uint32_t PreferredInputFormat() = 0;
(...skipping 19 matching lines...) Expand all
134 friend class base::RefCountedThreadSafe<V4L2Device>; 146 friend class base::RefCountedThreadSafe<V4L2Device>;
135 explicit V4L2Device(Type type); 147 explicit V4L2Device(Type type);
136 virtual ~V4L2Device(); 148 virtual ~V4L2Device();
137 149
138 const Type type_; 150 const Type type_;
139 }; 151 };
140 152
141 } // namespace content 153 } // namespace content
142 154
143 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ 155 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698