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

Commit 73feb067 authored by Chris Forbes's avatar Chris Forbes
Browse files

vr: Adjust for libui gralloc flags change

Change-Id: I24dbe407ad9139ba1d206b9074c7c507537d198c
Bug: b/33350696
Test: Bullhead: booted to launcher, take photo, watch youtube
parent f3ef3eab
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ localIncludeFiles = [
staticLibraries = [
staticLibraries = [
    "libdvrcommon",
    "libdvrcommon",
    "libpdx_default_transport",
    "libpdx_default_transport",
    "libgrallocusage",
]
]


sharedLibraries = [
sharedLibraries = [
+11 −6
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@


#include <log/log.h>
#include <log/log.h>
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#include <grallocusage/GrallocUsageConversion.h>
#include <utils/Trace.h>
#include <utils/Trace.h>


#include <mutex>
#include <mutex>
@@ -99,9 +100,10 @@ int IonBuffer::Alloc(uint32_t width, uint32_t height, uint32_t format,
      " consumer_usage=%" PRIx64,
      " consumer_usage=%" PRIx64,
      width, height, format, producer_usage, consumer_usage);
      width, height, format, producer_usage, consumer_usage);


  sp<GraphicBuffer> buffer =
  // TODO: forget about split producer/consumer usage
      new GraphicBuffer(width, height, format, kDefaultGraphicBufferLayerCount,
  sp<GraphicBuffer> buffer = new GraphicBuffer(
                        producer_usage, consumer_usage);
      width, height, format, kDefaultGraphicBufferLayerCount,
      android_convertGralloc1To0Usage(producer_usage, consumer_usage));
  if (buffer->initCheck() != OK) {
  if (buffer->initCheck() != OK) {
    ALOGE("IonBuffer::Aloc: Failed to allocate buffer");
    ALOGE("IonBuffer::Aloc: Failed to allocate buffer");
    return -EINVAL;
    return -EINVAL;
@@ -144,9 +146,12 @@ int IonBuffer::Import(buffer_handle_t handle, uint32_t width, uint32_t height,
      "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64,
      "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64,
      handle, width, height, stride, format, producer_usage, consumer_usage);
      handle, width, height, stride, format, producer_usage, consumer_usage);
  FreeHandle();
  FreeHandle();
  sp<GraphicBuffer> buffer = new GraphicBuffer(
  sp<GraphicBuffer> buffer =
      handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width, height, format,
      new GraphicBuffer(handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width,
      kDefaultGraphicBufferLayerCount, producer_usage, consumer_usage, stride);
                        height, format, kDefaultGraphicBufferLayerCount,
                        static_cast<uint64_t>(android_convertGralloc1To0Usage(
                            producer_usage, consumer_usage)),
                        stride);
  if (buffer->initCheck() != OK) {
  if (buffer->initCheck() != OK) {
    ALOGE("IonBuffer::Import: Failed to import buffer");
    ALOGE("IonBuffer::Import: Failed to import buffer");
    return -EINVAL;
    return -EINVAL;
+1 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ sp<GraphicBuffer> CreateGraphicBuffer(
   sp<GraphicBuffer> buffer = new GraphicBuffer(
   sp<GraphicBuffer> buffer = new GraphicBuffer(
      handle, GraphicBuffer::CLONE_HANDLE, metadata.width, metadata.height,
      handle, GraphicBuffer::CLONE_HANDLE, metadata.width, metadata.height,
      static_cast<int32_t>(metadata.format), metadata.layerCount,
      static_cast<int32_t>(metadata.format), metadata.layerCount,
      metadata.usage, metadata.usage, metadata.stride);
      metadata.usage, metadata.stride);
   if (buffer->initCheck() != OK) {
   if (buffer->initCheck() != OK) {
     ALOGE("Failed to create graphic buffer");
     ALOGE("Failed to create graphic buffer");
     return nullptr;
     return nullptr;