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

Side by Side Diff: content/common/gpu/media/v4l2_video_decode_accelerator.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #include <dlfcn.h> 5 #include <dlfcn.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { 355 for (size_t i = 0; i < output_buffer_map_.size(); ++i) {
356 DCHECK(buffers[i].size() == coded_size_); 356 DCHECK(buffers[i].size() == coded_size_);
357 357
358 OutputRecord& output_record = output_buffer_map_[i]; 358 OutputRecord& output_record = output_buffer_map_[i];
359 DCHECK(!output_record.at_device); 359 DCHECK(!output_record.at_device);
360 DCHECK(!output_record.at_client); 360 DCHECK(!output_record.at_client);
361 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); 361 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR);
362 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); 362 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR);
363 DCHECK_EQ(output_record.picture_id, -1); 363 DCHECK_EQ(output_record.picture_id, -1);
364 DCHECK_EQ(output_record.cleared, false); 364 DCHECK_EQ(output_record.cleared, false);
365 DCHECK_LE(1u, buffers[i].texture_ids().size());
365 366
366 EGLImageKHR egl_image = device_->CreateEGLImage(egl_display_, 367 EGLImageKHR egl_image = device_->CreateEGLImage(
367 egl_context_, 368 egl_display_, egl_context_, buffers[i].texture_ids()[0], coded_size_, i,
368 buffers[i].texture_id(), 369 output_format_fourcc_, output_planes_count_);
369 coded_size_,
370 i,
371 output_format_fourcc_,
372 output_planes_count_);
373 if (egl_image == EGL_NO_IMAGE_KHR) { 370 if (egl_image == EGL_NO_IMAGE_KHR) {
374 LOG(ERROR) << "AssignPictureBuffers(): could not create EGLImageKHR"; 371 LOG(ERROR) << "AssignPictureBuffers(): could not create EGLImageKHR";
375 // Ownership of EGLImages allocated in previous iterations of this loop 372 // Ownership of EGLImages allocated in previous iterations of this loop
376 // has been transferred to output_buffer_map_. After we error-out here 373 // has been transferred to output_buffer_map_. After we error-out here
377 // the destructor will handle their cleanup. 374 // the destructor will handle their cleanup.
378 NOTIFY_ERROR(PLATFORM_FAILURE); 375 NOTIFY_ERROR(PLATFORM_FAILURE);
379 return; 376 return;
380 } 377 }
381 378
382 output_record.egl_image = egl_image; 379 output_record.egl_image = egl_image;
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_G_CTRL, &ctrl); 1864 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_G_CTRL, &ctrl);
1868 output_dpb_size_ = ctrl.value; 1865 output_dpb_size_ = ctrl.value;
1869 1866
1870 // Output format setup in Initialize(). 1867 // Output format setup in Initialize().
1871 1868
1872 const uint32_t buffer_count = output_dpb_size_ + kDpbOutputBufferExtraCount; 1869 const uint32_t buffer_count = output_dpb_size_ + kDpbOutputBufferExtraCount;
1873 DVLOG(3) << "CreateOutputBuffers(): ProvidePictureBuffers(): " 1870 DVLOG(3) << "CreateOutputBuffers(): ProvidePictureBuffers(): "
1874 << "buffer_count=" << buffer_count 1871 << "buffer_count=" << buffer_count
1875 << ", coded_size=" << coded_size_.ToString(); 1872 << ", coded_size=" << coded_size_.ToString();
1876 child_task_runner_->PostTask( 1873 child_task_runner_->PostTask(
1877 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, 1874 FROM_HERE,
1878 buffer_count, coded_size_, 1875 base::Bind(&Client::ProvidePictureBuffers, client_, buffer_count, 1,
1879 device_->GetTextureTarget())); 1876 coded_size_, device_->GetTextureTarget()));
1880 1877
1881 // Wait for the client to call AssignPictureBuffers() on the Child thread. 1878 // Wait for the client to call AssignPictureBuffers() on the Child thread.
1882 // We do this, because if we continue decoding without finishing buffer 1879 // We do this, because if we continue decoding without finishing buffer
1883 // allocation, we may end up Resetting before AssignPictureBuffers arrives, 1880 // allocation, we may end up Resetting before AssignPictureBuffers arrives,
1884 // resulting in unnecessary complications and subtle bugs. 1881 // resulting in unnecessary complications and subtle bugs.
1885 // For example, if the client calls Decode(Input1), Reset(), Decode(Input2) 1882 // For example, if the client calls Decode(Input1), Reset(), Decode(Input2)
1886 // in a sequence, and Decode(Input1) results in us getting here and exiting 1883 // in a sequence, and Decode(Input1) results in us getting here and exiting
1887 // without waiting, we might end up running Reset{,Done}Task() before 1884 // without waiting, we might end up running Reset{,Done}Task() before
1888 // AssignPictureBuffers is scheduled, thus cleaning up and pushing buffers 1885 // AssignPictureBuffers is scheduled, thus cleaning up and pushing buffers
1889 // to the free_output_buffers_ map twice. If we somehow marked buffers as 1886 // to the free_output_buffers_ map twice. If we somehow marked buffers as
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 2024
2028 void V4L2VideoDecodeAccelerator::PictureCleared() { 2025 void V4L2VideoDecodeAccelerator::PictureCleared() {
2029 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; 2026 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_;
2030 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); 2027 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
2031 DCHECK_GT(picture_clearing_count_, 0); 2028 DCHECK_GT(picture_clearing_count_, 0);
2032 picture_clearing_count_--; 2029 picture_clearing_count_--;
2033 SendPictureReady(); 2030 SendPictureReady();
2034 } 2031 }
2035 2032
2036 } // namespace content 2033 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698