summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 21:05:39 +0000
committerposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 21:05:39 +0000
commit432714c273e5aedbf6980392fcefcac0cade7d5a (patch)
tree122a27362eac06f5abc32a477bba9e92165df005
parent4f052883e187b34d47d6ffad7a9227517a02bd3c (diff)
downloadchromium_src-432714c273e5aedbf6980392fcefcac0cade7d5a.zip
chromium_src-432714c273e5aedbf6980392fcefcac0cade7d5a.tar.gz
chromium_src-432714c273e5aedbf6980392fcefcac0cade7d5a.tar.bz2
EVEA: Fix buffer deallocation sequence
EVEA should first free GSC and then MFC input buffers, as MFC buffers are exported to GSC, so GSC needs to release them before they are destroyed via REQBUFS(0). Moreover, the file descriptors exported via VIDIOC_EXPBUF should be closed before the buffers are freed. BUG=274454 TEST=veaunittest Review URL: https://chromiumcodereview.appspot.com/23116009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218086 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/gpu/media/exynos_video_encode_accelerator.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/content/common/gpu/media/exynos_video_encode_accelerator.cc b/content/common/gpu/media/exynos_video_encode_accelerator.cc
index 572b831..66d34e3 100644
--- a/content/common/gpu/media/exynos_video_encode_accelerator.cc
+++ b/content/common/gpu/media/exynos_video_encode_accelerator.cc
@@ -115,18 +115,18 @@ ExynosVideoEncodeAccelerator::~ExynosVideoEncodeAccelerator() {
HANDLE_EINTR(close(device_poll_interrupt_fd_));
device_poll_interrupt_fd_ = -1;
}
- if (mfc_fd_ != -1) {
- DestroyMfcInputBuffers();
- DestroyMfcOutputBuffers();
- HANDLE_EINTR(close(mfc_fd_));
- mfc_fd_ = -1;
- }
if (gsc_fd_ != -1) {
DestroyGscInputBuffers();
DestroyGscOutputBuffers();
HANDLE_EINTR(close(gsc_fd_));
gsc_fd_ = -1;
}
+ if (mfc_fd_ != -1) {
+ DestroyMfcInputBuffers();
+ DestroyMfcOutputBuffers();
+ HANDLE_EINTR(close(mfc_fd_));
+ mfc_fd_ = -1;
+ }
}
void ExynosVideoEncodeAccelerator::Initialize(
@@ -1444,6 +1444,13 @@ void ExynosVideoEncodeAccelerator::DestroyMfcInputBuffers() {
DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
DCHECK(!mfc_input_streamon_);
+ for (size_t buf = 0; buf < mfc_input_buffer_map_.size(); ++buf) {
+ MfcInputRecord& input_record = mfc_input_buffer_map_[buf];
+
+ for (size_t plane = 0; plane < arraysize(input_record.fd); ++plane)
+ HANDLE_EINTR(close(mfc_input_buffer_map_[buf].fd[plane]));
+ }
+
struct v4l2_requestbuffers reqbufs;
memset(&reqbufs, 0, sizeof(reqbufs));
reqbufs.count = 0;