When closing gem handles in ReleaseBufferImpl, do not try to close
the same one more than once.
BUG=chrome-os-partner:46443
TEST=Play youtube video, minimize. Observe no "Failed to close
gem handle" messages in logcat.
Change-Id: I06598f304e3bd167a77f105eb2be86595ada8f4d
Signed-off-by: Isaac Simha <isimha@nvidia.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
gem_close.handle = bo->gem_handles[i];
int ret = drmIoctl(drm_->fd(), DRM_IOCTL_GEM_CLOSE, &gem_close);
- if (ret)
+ if (ret) {
ALOGE("Failed to close gem handle %d %d", i, ret);
- else
+ } else {
+ /* Clear any duplicate gem handle as well but don't close again */
+ for(int j = i + 1; j < num_gem_handles; j++)
+ if(bo->gem_handles[j] == bo->gem_handles[i])
+ bo->gem_handles[j] = 0;
bo->gem_handles[i] = 0;
+ }
}
}