| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 an implementation of VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
| 6 // that utilizes the hardware video decoder present on the Exynos SoC. | 6 // that utilizes the hardware video decoder present on the Exynos SoC. |
| 7 | 7 |
| 8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
| 10 | 10 |
| 11 #include <queue> | 11 #include <list> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" | 19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" |
| 20 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
| 21 #include "media/base/video_decoder_config.h" | 21 #include "media/base/video_decoder_config.h" |
| 22 #include "media/video/picture.h" | 22 #include "media/video/picture.h" |
| 23 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 24 #include "ui/gl/gl_bindings.h" | 24 #include "ui/gl/gl_bindings.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class MessageLoopProxy; | 27 class MessageLoopProxy; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 class H264Parser; | 31 class H264Parser; |
| 32 | 32 |
| 33 // This class handles Exynos video acceleration directly through the V4L2 | 33 // This class handles Exynos video acceleration directly through the V4L2 |
| 34 // device exported by the Multi Format Codec hardware block. | 34 // devices exported by the Multi Format Codec and GScaler hardware blocks. |
| 35 // | 35 // |
| 36 // The threading model of this class is driven by the fact that it needs to | 36 // The threading model of this class is driven by the fact that it needs to |
| 37 // interface two fundamentally different event queues -- the one Chromium | 37 // interface two fundamentally different event queues -- the one Chromium |
| 38 // provides through MessageLoop, and the one driven by the V4L2 devices which | 38 // provides through MessageLoop, and the one driven by the V4L2 devices which |
| 39 // is waited on with epoll(). There are three threads involved in this class: | 39 // is waited on with epoll(). There are three threads involved in this class: |
| 40 // | 40 // |
| 41 // * The child thread, which is the main GPU process thread which calls the | 41 // * The child thread, which is the main GPU process thread which calls the |
| 42 // media::VideoDecodeAccelerator entry points. Calls from this thread | 42 // media::VideoDecodeAccelerator entry points. Calls from this thread |
| 43 // generally do not block (with the exception of Initialize() and Destroy()). | 43 // generally do not block (with the exception of Initialize() and Destroy()). |
| 44 // They post tasks to the decoder_thread_, which actually services the task | 44 // They post tasks to the decoder_thread_, which actually services the task |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 virtual void AssignPictureBuffers( | 75 virtual void AssignPictureBuffers( |
| 76 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 76 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
| 77 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 77 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
| 78 virtual void Flush() OVERRIDE; | 78 virtual void Flush() OVERRIDE; |
| 79 virtual void Reset() OVERRIDE; | 79 virtual void Reset() OVERRIDE; |
| 80 virtual void Destroy() OVERRIDE; | 80 virtual void Destroy() OVERRIDE; |
| 81 | 81 |
| 82 // VideoDecodeAcceleratorImpl implementation. | 82 // VideoDecodeAcceleratorImpl implementation. |
| 83 virtual bool CanDecodeOnIOThread() OVERRIDE; | 83 virtual bool CanDecodeOnIOThread() OVERRIDE; |
| 84 | 84 |
| 85 // Do any necessary initialization before the sandbox is enabled. |
| 86 static void PreSandboxInitialization(); |
| 87 |
| 88 // Lazily initialize static data after sandbox is enabled. Return false on |
| 89 // init failure. |
| 90 static bool PostSandboxInitialization(); |
| 91 |
| 85 private: | 92 private: |
| 86 // These are rather subjectively tuned. | 93 // These are rather subjectively tuned. |
| 87 enum { | 94 enum { |
| 88 kMfcInputBufferCount = 8, | 95 kMfcInputBufferCount = 8, |
| 89 // TODO(posciak): determine MFC input buffer size based on level limits. | 96 // TODO(posciak): determine MFC input buffer size based on level limits. |
| 90 // See http://crbug.com/255116. | 97 // See http://crbug.com/255116. |
| 91 kMfcInputBufferMaxSize = 1024 * 1024, | 98 kMfcInputBufferMaxSize = 1024 * 1024, |
| 99 kGscInputBufferCount = 4, |
| 92 // Number of output buffers to use for each VDA stage above what's required | 100 // Number of output buffers to use for each VDA stage above what's required |
| 93 // by the decoder (e.g. DPB size, in H264). We need | 101 // by the decoder (e.g. DPB size, in H264). We need |
| 94 // media::limits::kMaxVideoFrames to fill up the GpuVideoDecode pipeline, | 102 // media::limits::kMaxVideoFrames to fill up the GpuVideoDecode pipeline, |
| 95 // and +1 for a frame in transit. | 103 // and +1 for a frame in transit. |
| 96 kDpbOutputBufferExtraCount = media::limits::kMaxVideoFrames + 1, | 104 kDpbOutputBufferExtraCount = media::limits::kMaxVideoFrames + 1, |
| 97 }; | 105 }; |
| 98 | 106 |
| 99 // Internal state of the decoder. | 107 // Internal state of the decoder. |
| 100 enum State { | 108 enum State { |
| 101 kUninitialized, // Initialize() not yet called. | 109 kUninitialized, // Initialize() not yet called. |
| 102 kInitialized, // Initialize() returned true; ready to start decoding. | 110 kInitialized, // Initialize() returned true; ready to start decoding. |
| 103 kDecoding, // DecodeBufferInitial() successful; decoding frames. | 111 kDecoding, // DecodeBufferInitial() successful; decoding frames. |
| 104 kResetting, // Presently resetting. | 112 kResetting, // Presently resetting. |
| 105 kAfterReset, // After Reset(), ready to start decoding again. | 113 kAfterReset, // After Reset(), ready to start decoding again. |
| 106 kChangingResolution, // Performing resolution change, all remaining | 114 kChangingResolution, // Performing resolution change, all remaining |
| 107 // pre-change frames decoded and processed. | 115 // pre-change frames decoded and processed. |
| 108 kError, // Error in kDecoding state. | 116 kError, // Error in kDecoding state. |
| 109 }; | 117 }; |
| 110 | 118 |
| 111 enum BufferId { | 119 enum BufferId { |
| 112 kFlushBufferId = -2 // Buffer id for flush buffer, queued by FlushTask(). | 120 kFlushBufferId = -2 // Buffer id for flush buffer, queued by FlushTask(). |
| 113 }; | 121 }; |
| 114 | 122 |
| 115 // File descriptors we need to poll. | 123 // File descriptors we need to poll. |
| 116 enum PollFds { | 124 enum PollFds { |
| 117 kPollMfc = (1 << 0), | 125 kPollMfc = (1 << 0), |
| 126 kPollGsc = (1 << 1), |
| 118 }; | 127 }; |
| 119 | 128 |
| 120 // Auto-destruction reference for BitstreamBuffer, for message-passing from | 129 // Auto-destruction reference for BitstreamBuffer, for message-passing from |
| 121 // Decode() to DecodeTask(). | 130 // Decode() to DecodeTask(). |
| 122 struct BitstreamBufferRef; | 131 struct BitstreamBufferRef; |
| 123 | 132 |
| 124 // Auto-destruction reference for an array of PictureBuffer, for | 133 // Auto-destruction reference for an array of PictureBuffer, for |
| 125 // message-passing from AssignPictureBuffers() to AssignPictureBuffersTask(). | 134 // message-passing from AssignPictureBuffers() to AssignPictureBuffersTask(). |
| 126 struct PictureBufferArrayRef; | 135 struct PictureBufferArrayRef; |
| 127 | 136 |
| 128 // Auto-destruction reference for EGLSync (for message-passing). | 137 // Auto-destruction reference for EGLSync (for message-passing). |
| 129 struct EGLSyncKHRRef; | 138 struct EGLSyncKHRRef; |
| 130 | 139 |
| 131 // Record for decoded pictures that can be sent to PictureReady. | 140 // Record for decoded pictures that can be sent to PictureReady. |
| 132 struct PictureRecord; | 141 struct PictureRecord; |
| 133 | 142 |
| 134 // Record for MFC input buffers. | 143 // Record for MFC input buffers. |
| 135 struct MfcInputRecord { | 144 struct MfcInputRecord { |
| 136 MfcInputRecord(); | 145 MfcInputRecord(); |
| 137 ~MfcInputRecord(); | 146 ~MfcInputRecord(); |
| 138 bool at_device; // held by device. | 147 bool at_device; // held by device. |
| 139 void* address; // mmap() address. | 148 void* address; // mmap() address. |
| 140 size_t length; // mmap() length. | 149 size_t length; // mmap() length. |
| 141 off_t bytes_used; // bytes filled in the mmap() segment. | 150 off_t bytes_used; // bytes filled in the mmap() segment. |
| 142 int32 input_id; // triggering input_id as given to Decode(). | 151 int32 input_id; // triggering input_id as given to Decode(). |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 // Record for MFC output buffers. | 154 // Record for MFC output buffers. |
| 146 struct MfcOutputRecord { | 155 struct MfcOutputRecord { |
| 147 MfcOutputRecord(); | 156 MfcOutputRecord(); |
| 148 ~MfcOutputRecord(); | 157 ~MfcOutputRecord(); |
| 149 bool at_device; // held by device. | 158 bool at_device; // held by device. |
| 150 bool at_client; // held by client. | 159 size_t bytes_used[2]; // bytes used in each dmabuf. |
| 151 int fds[2]; // file descriptors for each plane. | 160 void* address[2]; // mmap() address for each plane. |
| 152 EGLImageKHR egl_image; // EGLImageKHR for the output buffer. | 161 size_t length[2]; // mmap() length for each plane. |
| 153 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. | 162 int32 input_id; // triggering input_id as given to Decode(). |
| 154 int32 picture_id; // picture buffer id as returned to PictureReady(). | 163 }; |
| 155 bool cleared; // Whether the texture is cleared and safe to render | 164 |
| 156 // from. See TextureManager for details. | 165 // Record for GSC input buffers. |
| 166 struct GscInputRecord { |
| 167 GscInputRecord(); |
| 168 ~GscInputRecord(); |
| 169 bool at_device; // held by device. |
| 170 int mfc_output; // MFC output buffer index to recycle when this input |
| 171 // is complete. |
| 172 }; |
| 173 |
| 174 // Record for GSC output buffers. |
| 175 struct GscOutputRecord { |
| 176 GscOutputRecord(); |
| 177 ~GscOutputRecord(); |
| 178 bool at_device; // held by device. |
| 179 bool at_client; // held by client. |
| 180 int fd; // file descriptor from backing EGLImage. |
| 181 EGLImageKHR egl_image; // backing EGLImage. |
| 182 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. |
| 183 int32 picture_id; // picture buffer id as returned to PictureReady(). |
| 184 bool cleared; // Whether the texture is cleared and safe to render |
| 185 // from. See TextureManager for details. |
| 157 }; | 186 }; |
| 158 | 187 |
| 159 // | 188 // |
| 160 // Decoding tasks, to be run on decode_thread_. | 189 // Decoding tasks, to be run on decode_thread_. |
| 161 // | 190 // |
| 162 | 191 |
| 163 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the | 192 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the |
| 164 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode | 193 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode |
| 165 // the buffer. | 194 // the buffer. |
| 166 void DecodeTask(const media::BitstreamBuffer& bitstream_buffer); | 195 void DecodeTask(const media::BitstreamBuffer& bitstream_buffer); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 190 // buffers. | 219 // buffers. |
| 191 void AssignPictureBuffersTask(scoped_ptr<PictureBufferArrayRef> pic_buffers); | 220 void AssignPictureBuffersTask(scoped_ptr<PictureBufferArrayRef> pic_buffers); |
| 192 | 221 |
| 193 // Service I/O on the V4L2 devices. This task should only be scheduled from | 222 // Service I/O on the V4L2 devices. This task should only be scheduled from |
| 194 // DevicePollTask(). If |mfc_event_pending| is true, one or more events | 223 // DevicePollTask(). If |mfc_event_pending| is true, one or more events |
| 195 // on MFC file descriptor are pending. | 224 // on MFC file descriptor are pending. |
| 196 void ServiceDeviceTask(bool mfc_event_pending); | 225 void ServiceDeviceTask(bool mfc_event_pending); |
| 197 // Handle the various device queues. | 226 // Handle the various device queues. |
| 198 void EnqueueMfc(); | 227 void EnqueueMfc(); |
| 199 void DequeueMfc(); | 228 void DequeueMfc(); |
| 229 void EnqueueGsc(); |
| 230 void DequeueGsc(); |
| 200 // Handle incoming MFC events. | 231 // Handle incoming MFC events. |
| 201 void DequeueMfcEvents(); | 232 void DequeueMfcEvents(); |
| 202 // Enqueue a buffer on the corresponding queue. | 233 // Enqueue a buffer on the corresponding queue. |
| 203 bool EnqueueMfcInputRecord(); | 234 bool EnqueueMfcInputRecord(); |
| 204 bool EnqueueMfcOutputRecord(); | 235 bool EnqueueMfcOutputRecord(); |
| 236 bool EnqueueGscInputRecord(); |
| 237 bool EnqueueGscOutputRecord(); |
| 205 | 238 |
| 206 // Process a ReusePictureBuffer() API call. The API call create an EGLSync | 239 // Process a ReusePictureBuffer() API call. The API call create an EGLSync |
| 207 // object on the main (GPU process) thread; we will record this object so we | 240 // object on the main (GPU process) thread; we will record this object so we |
| 208 // can wait on it before reusing the buffer. | 241 // can wait on it before reusing the buffer. |
| 209 void ReusePictureBufferTask(int32 picture_buffer_id, | 242 void ReusePictureBufferTask(int32 picture_buffer_id, |
| 210 scoped_ptr<EGLSyncKHRRef> egl_sync_ref); | 243 scoped_ptr<EGLSyncKHRRef> egl_sync_ref); |
| 211 | 244 |
| 212 // Flush() task. Child thread should not submit any more buffers until it | 245 // Flush() task. Child thread should not submit any more buffers until it |
| 213 // receives the NotifyFlushDone callback. This task will schedule an empty | 246 // receives the NotifyFlushDone callback. This task will schedule an empty |
| 214 // BitstreamBufferRef (with input_id == kFlushBufferId) to perform the flush. | 247 // BitstreamBufferRef (with input_id == kFlushBufferId) to perform the flush. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 238 bool SetDevicePollInterrupt(); | 271 bool SetDevicePollInterrupt(); |
| 239 bool ClearDevicePollInterrupt(); | 272 bool ClearDevicePollInterrupt(); |
| 240 | 273 |
| 241 void StartResolutionChangeIfNeeded(); | 274 void StartResolutionChangeIfNeeded(); |
| 242 void FinishResolutionChange(); | 275 void FinishResolutionChange(); |
| 243 void ResumeAfterResolutionChange(); | 276 void ResumeAfterResolutionChange(); |
| 244 | 277 |
| 245 // Try to get output format from MFC, detected after parsing the beginning | 278 // Try to get output format from MFC, detected after parsing the beginning |
| 246 // of the stream. Sets |again| to true if more parsing is needed. | 279 // of the stream. Sets |again| to true if more parsing is needed. |
| 247 bool GetFormatInfo(struct v4l2_format* format, bool* again); | 280 bool GetFormatInfo(struct v4l2_format* format, bool* again); |
| 248 // Create MFC output buffers for the given |format|. | 281 // Create MFC output and GSC input and output buffers for the given |format|. |
| 249 bool CreateBuffersForFormat(const struct v4l2_format& format); | 282 bool CreateBuffersForFormat(const struct v4l2_format& format); |
| 250 | 283 |
| 251 // | 284 // |
| 252 // Device tasks, to be run on device_poll_thread_. | 285 // Device tasks, to be run on device_poll_thread_. |
| 253 // | 286 // |
| 254 | 287 |
| 255 // The device task. | 288 // The device task. |
| 256 void DevicePollTask(unsigned int poll_fds); | 289 void DevicePollTask(unsigned int poll_fds); |
| 257 | 290 |
| 258 // | 291 // |
| 259 // Safe from any thread. | 292 // Safe from any thread. |
| 260 // | 293 // |
| 261 | 294 |
| 262 // Error notification (using PostTask() to child thread, if necessary). | 295 // Error notification (using PostTask() to child thread, if necessary). |
| 263 void NotifyError(Error error); | 296 void NotifyError(Error error); |
| 264 | 297 |
| 265 // Set the decoder_thread_ state (using PostTask to decoder thread, if | 298 // Set the decoder_thread_ state (using PostTask to decoder thread, if |
| 266 // necessary). | 299 // necessary). |
| 267 void SetDecoderState(State state); | 300 void SetDecoderState(State state); |
| 268 | 301 |
| 269 // | 302 // |
| 270 // Other utility functions. Called on decoder_thread_, unless | 303 // Other utility functions. Called on decoder_thread_, unless |
| 271 // decoder_thread_ is not yet started, in which case the child thread can call | 304 // decoder_thread_ is not yet started, in which case the child thread can call |
| 272 // these (e.g. in Initialize() or Destroy()). | 305 // these (e.g. in Initialize() or Destroy()). |
| 273 // | 306 // |
| 274 | 307 |
| 275 // Create the buffers we need. | 308 // Create the buffers we need. |
| 276 bool CreateMfcInputBuffers(); | 309 bool CreateMfcInputBuffers(); |
| 277 bool CreateMfcOutputBuffers(); | 310 bool CreateMfcOutputBuffers(); |
| 311 bool CreateGscInputBuffers(); |
| 312 bool CreateGscOutputBuffers(); |
| 278 | 313 |
| 279 // | 314 // |
| 280 // Methods run on child thread. | 315 // Methods run on child thread. |
| 281 // | 316 // |
| 282 | 317 |
| 283 // Destroy buffers. | 318 // Destroy buffers. |
| 284 void DestroyMfcInputBuffers(); | 319 void DestroyMfcInputBuffers(); |
| 285 void DestroyMfcOutputBuffers(); | 320 void DestroyMfcOutputBuffers(); |
| 321 void DestroyGscInputBuffers(); |
| 322 void DestroyGscOutputBuffers(); |
| 286 void ResolutionChangeDestroyBuffers(); | 323 void ResolutionChangeDestroyBuffers(); |
| 287 | 324 |
| 288 // Send decoded pictures to PictureReady. | 325 // Send decoded pictures to PictureReady. |
| 289 void SendPictureReady(); | 326 void SendPictureReady(); |
| 290 | 327 |
| 291 // Callback that indicates a picture has been cleared. | 328 // Callback that indicates a picture has been cleared. |
| 292 void PictureCleared(); | 329 void PictureCleared(); |
| 293 | 330 |
| 294 // Our original calling message loop for the child thread. | 331 // Our original calling message loop for the child thread. |
| 295 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 332 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Picture buffers held by the client. | 377 // Picture buffers held by the client. |
| 341 int decoder_frames_at_client_; | 378 int decoder_frames_at_client_; |
| 342 // Are we flushing? | 379 // Are we flushing? |
| 343 bool decoder_flushing_; | 380 bool decoder_flushing_; |
| 344 // Got a notification from driver that it reached resolution change point | 381 // Got a notification from driver that it reached resolution change point |
| 345 // in the stream. | 382 // in the stream. |
| 346 bool resolution_change_pending_; | 383 bool resolution_change_pending_; |
| 347 // Got a reset request while we were performing resolution change. | 384 // Got a reset request while we were performing resolution change. |
| 348 bool resolution_change_reset_pending_; | 385 bool resolution_change_reset_pending_; |
| 349 // Input queue for decoder_thread_: BitstreamBuffers in. | 386 // Input queue for decoder_thread_: BitstreamBuffers in. |
| 350 std::queue<linked_ptr<BitstreamBufferRef> > decoder_input_queue_; | 387 std::list<linked_ptr<BitstreamBufferRef> > decoder_input_queue_; |
| 351 // For H264 decode, hardware requires that we send it frame-sized chunks. | 388 // For H264 decode, hardware requires that we send it frame-sized chunks. |
| 352 // We'll need to parse the stream. | 389 // We'll need to parse the stream. |
| 353 scoped_ptr<content::H264Parser> decoder_h264_parser_; | 390 scoped_ptr<content::H264Parser> decoder_h264_parser_; |
| 354 // Set if the decoder has a pending incomplete frame in an input buffer. | 391 // Set if the decoder has a pending incomplete frame in an input buffer. |
| 355 bool decoder_partial_frame_pending_; | 392 bool decoder_partial_frame_pending_; |
| 356 | 393 |
| 357 // | 394 // |
| 358 // Hardware state and associated queues. Since decoder_thread_ services | 395 // Hardware state and associated queues. Since decoder_thread_ services |
| 359 // the hardware, decoder_thread_ owns these too. | 396 // the hardware, decoder_thread_ owns these too. |
| 360 // | 397 // |
| 361 | 398 |
| 362 // Completed decode buffers, waiting for MFC. | 399 // Completed decode buffers, waiting for MFC. |
| 363 std::queue<int> mfc_input_ready_queue_; | 400 std::list<int> mfc_input_ready_queue_; |
| 364 | 401 |
| 365 // MFC decode device. | 402 // MFC decode device. |
| 366 int mfc_fd_; | 403 int mfc_fd_; |
| 367 | 404 |
| 368 // MFC input buffer state. | 405 // MFC input buffer state. |
| 369 bool mfc_input_streamon_; | 406 bool mfc_input_streamon_; |
| 370 // MFC input buffers enqueued to device. | 407 // MFC input buffers enqueued to device. |
| 371 int mfc_input_buffer_queued_count_; | 408 int mfc_input_buffer_queued_count_; |
| 372 // Input buffers ready to use, as a LIFO since we don't care about ordering. | 409 // Input buffers ready to use, as a LIFO since we don't care about ordering. |
| 373 std::vector<int> mfc_free_input_buffers_; | 410 std::vector<int> mfc_free_input_buffers_; |
| 374 // Mapping of int index to MFC input buffer record. | 411 // Mapping of int index to MFC input buffer record. |
| 375 std::vector<MfcInputRecord> mfc_input_buffer_map_; | 412 std::vector<MfcInputRecord> mfc_input_buffer_map_; |
| 376 | 413 |
| 377 // MFC output buffer state. | 414 // MFC output buffer state. |
| 378 bool mfc_output_streamon_; | 415 bool mfc_output_streamon_; |
| 379 // MFC output buffers enqueued to device. | 416 // MFC output buffers enqueued to device. |
| 380 int mfc_output_buffer_queued_count_; | 417 int mfc_output_buffer_queued_count_; |
| 381 // Output buffers ready to use, as a FIFO since we want oldest-first to hide | 418 // Output buffers ready to use, as a LIFO since we don't care about ordering. |
| 382 // synchronization latency with GL. | 419 std::vector<int> mfc_free_output_buffers_; |
| 383 std::queue<int> mfc_free_output_buffers_; | |
| 384 // Mapping of int index to MFC output buffer record. | 420 // Mapping of int index to MFC output buffer record. |
| 385 std::vector<MfcOutputRecord> mfc_output_buffer_map_; | 421 std::vector<MfcOutputRecord> mfc_output_buffer_map_; |
| 386 // MFC output pixel format. | 422 // Required size of MFC output buffers. Two sizes for two planes. |
| 423 size_t mfc_output_buffer_size_[2]; |
| 387 uint32 mfc_output_buffer_pixelformat_; | 424 uint32 mfc_output_buffer_pixelformat_; |
| 388 // Required size of DPB for decoding. | 425 // Required size of DPB for decoding. |
| 389 int mfc_output_dpb_size_; | 426 int mfc_output_dpb_size_; |
| 390 | 427 |
| 428 // Completed MFC outputs, waiting for GSC. |
| 429 std::list<int> mfc_output_gsc_input_queue_; |
| 430 |
| 431 // GSC decode device. |
| 432 int gsc_fd_; |
| 433 |
| 434 // GSC input buffer state. |
| 435 bool gsc_input_streamon_; |
| 436 // GSC input buffers enqueued to device. |
| 437 int gsc_input_buffer_queued_count_; |
| 438 // Input buffers ready to use, as a LIFO since we don't care about ordering. |
| 439 std::vector<int> gsc_free_input_buffers_; |
| 440 // Mapping of int index to GSC input buffer record. |
| 441 std::vector<GscInputRecord> gsc_input_buffer_map_; |
| 442 |
| 443 // GSC output buffer state. |
| 444 bool gsc_output_streamon_; |
| 445 // GSC output buffers enqueued to device. |
| 446 int gsc_output_buffer_queued_count_; |
| 447 // Output buffers ready to use. We need a FIFO here. |
| 448 std::list<int> gsc_free_output_buffers_; |
| 449 // Mapping of int index to GSC output buffer record. |
| 450 std::vector<GscOutputRecord> gsc_output_buffer_map_; |
| 451 |
| 391 // Pictures that are ready but not sent to PictureReady yet. | 452 // Pictures that are ready but not sent to PictureReady yet. |
| 392 std::queue<PictureRecord> pending_picture_ready_; | 453 std::queue<PictureRecord> pending_picture_ready_; |
| 393 | 454 |
| 394 // The number of pictures that are sent to PictureReady and will be cleared. | 455 // The number of pictures that are sent to PictureReady and will be cleared. |
| 395 int picture_clearing_count_; | 456 int picture_clearing_count_; |
| 396 | 457 |
| 397 // Output picture size. | 458 // Output picture size. |
| 398 gfx::Size frame_buffer_size_; | 459 gfx::Size frame_buffer_size_; |
| 399 | 460 |
| 400 // | 461 // |
| (...skipping 19 matching lines...) Expand all Loading... |
| 420 | 481 |
| 421 // The codec we'll be decoding for. | 482 // The codec we'll be decoding for. |
| 422 media::VideoCodecProfile video_profile_; | 483 media::VideoCodecProfile video_profile_; |
| 423 | 484 |
| 424 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); | 485 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); |
| 425 }; | 486 }; |
| 426 | 487 |
| 427 } // namespace content | 488 } // namespace content |
| 428 | 489 |
| 429 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 490 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |