Skip to content

Commit

Permalink
drm: close prime fd on destruction of DrmBoData
Browse files Browse the repository at this point in the history
 * on cl path, DrmBoData will be created for every incoming v4l2
   buffer, and a prime fd will be requested for each; close the
   fd on destruction is necessary to prevent fd exhaustion.

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
  • Loading branch information
dspmeng authored and windyuan committed Nov 4, 2015
1 parent e965dff commit 72d03bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xcore/drm_bo_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ DrmBoData::~DrmBoData ()
unmap ();
if (_bo)
drm_intel_bo_unreference (_bo);
if (_prime_fd != -1)
close (_prime_fd);
}

uint8_t *
Expand Down Expand Up @@ -95,7 +97,7 @@ DrmBoData::get_fd ()
if (_prime_fd == -1) {
if (drm_intel_bo_gem_export_to_prime (_bo, &_prime_fd) < 0) {
_prime_fd = -1;
XCAM_LOG_DEBUG ("DrmBoData: failed to obtain prime fd");
XCAM_LOG_ERROR ("DrmBoData: failed to obtain prime fd: %s", strerror(errno));
}
}

Expand Down

0 comments on commit 72d03bc

Please sign in to comment.