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

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, 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 #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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 365
366 EGLImageKHR egl_image = device_->CreateEGLImage(egl_display_, 366 EGLImageKHR egl_image = device_->CreateEGLImage(
367 egl_context_, 367 egl_display_, egl_context_, buffers[i].texture_ids().ids[0],
368 buffers[i].texture_id(), 368 coded_size_, i, 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) { 369 if (egl_image == EGL_NO_IMAGE_KHR) {
374 LOG(ERROR) << "AssignPictureBuffers(): could not create EGLImageKHR"; 370 LOG(ERROR) << "AssignPictureBuffers(): could not create EGLImageKHR";
375 // Ownership of EGLImages allocated in previous iterations of this loop 371 // Ownership of EGLImages allocated in previous iterations of this loop
376 // has been transferred to output_buffer_map_. After we error-out here 372 // has been transferred to output_buffer_map_. After we error-out here
377 // the destructor will handle their cleanup. 373 // the destructor will handle their cleanup.
378 NOTIFY_ERROR(PLATFORM_FAILURE); 374 NOTIFY_ERROR(PLATFORM_FAILURE);
379 return; 375 return;
380 } 376 }
381 377
382 output_record.egl_image = egl_image; 378 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); 1863 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_G_CTRL, &ctrl);
1868 output_dpb_size_ = ctrl.value; 1864 output_dpb_size_ = ctrl.value;
1869 1865
1870 // Output format setup in Initialize(). 1866 // Output format setup in Initialize().
1871 1867
1872 const uint32_t buffer_count = output_dpb_size_ + kDpbOutputBufferExtraCount; 1868 const uint32_t buffer_count = output_dpb_size_ + kDpbOutputBufferExtraCount;
1873 DVLOG(3) << "CreateOutputBuffers(): ProvidePictureBuffers(): " 1869 DVLOG(3) << "CreateOutputBuffers(): ProvidePictureBuffers(): "
1874 << "buffer_count=" << buffer_count 1870 << "buffer_count=" << buffer_count
1875 << ", coded_size=" << coded_size_.ToString(); 1871 << ", coded_size=" << coded_size_.ToString();
1876 child_task_runner_->PostTask( 1872 child_task_runner_->PostTask(
1877 FROM_HERE, base::Bind(&Client::ProvidePictureBuffers, client_, 1873 FROM_HERE,
1878 buffer_count, coded_size_, 1874 base::Bind(&Client::ProvidePictureBuffers, client_, buffer_count, 1,
1879 device_->GetTextureTarget())); 1875 coded_size_, device_->GetTextureTarget()));
1880 1876
1881 // Wait for the client to call AssignPictureBuffers() on the Child thread. 1877 // Wait for the client to call AssignPictureBuffers() on the Child thread.
1882 // We do this, because if we continue decoding without finishing buffer 1878 // We do this, because if we continue decoding without finishing buffer
1883 // allocation, we may end up Resetting before AssignPictureBuffers arrives, 1879 // allocation, we may end up Resetting before AssignPictureBuffers arrives,
1884 // resulting in unnecessary complications and subtle bugs. 1880 // resulting in unnecessary complications and subtle bugs.
1885 // For example, if the client calls Decode(Input1), Reset(), Decode(Input2) 1881 // 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 1882 // 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 1883 // without waiting, we might end up running Reset{,Done}Task() before
1888 // AssignPictureBuffers is scheduled, thus cleaning up and pushing buffers 1884 // AssignPictureBuffers is scheduled, thus cleaning up and pushing buffers
1889 // to the free_output_buffers_ map twice. If we somehow marked buffers as 1885 // 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 2023
2028 void V4L2VideoDecodeAccelerator::PictureCleared() { 2024 void V4L2VideoDecodeAccelerator::PictureCleared() {
2029 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; 2025 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_;
2030 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); 2026 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
2031 DCHECK_GT(picture_clearing_count_, 0); 2027 DCHECK_GT(picture_clearing_count_, 0);
2032 picture_clearing_count_--; 2028 picture_clearing_count_--;
2033 SendPictureReady(); 2029 SendPictureReady();
2034 } 2030 }
2035 2031
2036 } // namespace content 2032 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698