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