Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85fcaa23 authored by Mark Urbanus's avatar Mark Urbanus
Browse files

vr_hwc: Address ion buffer leakage

Problem:
system is running out of memory while switching between apps back and forth.

Root-cause:
vr_hwc is leaking ion buffers by holding an unreleased reference.

Solution:
No need to register the buffer when getting buffer info. This removes the
additional (unreleased) reference on the buffer.

Test: Validated vr_hwc is no longer leaking ion buffers when switching
      apps.
Bug: 36449218

Change-Id: I1c1c5d2cca35c50a4bcbcf7b879d37914b8d835f
parent 42b54696
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -49,12 +49,6 @@ sp<GraphicBuffer> GetBufferFromHandle(const native_handle_t* handle) {
  int32_t format = 0;
  int32_t format = 0;


  GraphicBufferMapper& mapper = GraphicBufferMapper::get();
  GraphicBufferMapper& mapper = GraphicBufferMapper::get();
  // Need to register |handle| otherwise we can't read its properties.
  if (mapper.registerBuffer(handle) != OK) {
    ALOGE("Failed to register buffer");
    return nullptr;
  }

  if (mapper.getDimensions(handle, &width, &height) ||
  if (mapper.getDimensions(handle, &width, &height) ||
      mapper.getStride(handle, &stride) ||
      mapper.getStride(handle, &stride) ||
      mapper.getFormat(handle, &format) ||
      mapper.getFormat(handle, &format) ||