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

Commit ee7cb1b5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Convert the pose buffer into a more generic named buffer" into oc-dev

parents 24880bb5 eaa5522f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ LOCAL_SRC_FILES := \
	vrscreencap.cpp

LOCAL_STATIC_LIBRARIES := \
	libbufferhub \
	libdisplay \
	libimageio \
	libpdx_default_transport \
@@ -14,7 +15,8 @@ LOCAL_SHARED_LIBRARIES := \
	libcutils \
	liblog \
	libpng \
	libsync
	libsync \
	libui \

LOCAL_MODULE := vrscreencap

+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ using android::pdx::Status;

namespace {

// TODO(hendrikw): These flags can not be hard coded.
constexpr int kUncachedBlobUsageFlags = GRALLOC_USAGE_SW_READ_RARELY |
                                        GRALLOC_USAGE_SW_WRITE_RARELY |
                                        GRALLOC_USAGE_PRIVATE_UNCACHED;
@@ -110,6 +111,7 @@ int BufferHubBuffer::Unlock(size_t index) { return slices_[index].Unlock(); }
int BufferHubBuffer::GetBlobReadWritePointer(size_t size, void** addr) {
  int width = static_cast<int>(size);
  int height = 1;
  // TODO(hendrikw): These flags can not be hard coded.
  constexpr int usage = GRALLOC_USAGE_SW_READ_RARELY |
                        GRALLOC_USAGE_SW_WRITE_RARELY |
                        GRALLOC_USAGE_PRIVATE_UNCACHED;
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ class NativeBufferHandle {
    }
  }
  NativeBufferHandle(NativeBufferHandle&& other) = default;
  NativeBufferHandle& operator=(NativeBufferHandle&& other) = default;

  // Imports the native handle into the given IonBuffer instance.
  int Import(IonBuffer* buffer) {
@@ -93,6 +94,9 @@ class NativeBufferHandle {
  void operator=(const NativeBufferHandle&) = delete;
};

using BorrowedNativeBufferHandle = NativeBufferHandle<pdx::BorrowedHandle>;
using LocalNativeBufferHandle = NativeBufferHandle<pdx::LocalHandle>;

template <typename FileHandleType>
class FenceHandle {
 public:
+11 −6
Original line number Diff line number Diff line
@@ -216,7 +216,8 @@ int DisplayClient::GetDisplayMetrics(SystemDisplayMetrics* metrics) {
  return 0;
}

pdx::Status<void> DisplayClient::SetViewerParams(const ViewerParams& viewer_params) {
pdx::Status<void> DisplayClient::SetViewerParams(
    const ViewerParams& viewer_params) {
  auto status = InvokeRemoteMethod<DisplayRPC::SetViewerParams>(viewer_params);
  if (!status) {
    ALOGE("DisplayClient::SetViewerParams: Failed to set viewer params: %s",
@@ -252,16 +253,20 @@ std::unique_ptr<DisplaySurfaceClient> DisplayClient::CreateDisplaySurface(
  return DisplaySurfaceClient::Create(width, height, format, usage, flags);
}

std::unique_ptr<BufferConsumer> DisplayClient::GetPoseBuffer() {
  auto status = InvokeRemoteMethod<DisplayRPC::GetPoseBuffer>();
std::unique_ptr<IonBuffer> DisplayClient::GetNamedBuffer(
    const std::string& name) {
  auto status = InvokeRemoteMethod<DisplayRPC::GetNamedBuffer>(name);
  if (!status) {
    ALOGE(
        "DisplayClient::GetPoseBuffer: Failed to get pose buffer %s",
        status.GetErrorMessage().c_str());
        "DisplayClient::GetNamedBuffer: Failed to get pose buffer. name=%s, "
        "error=%s",
        name.c_str(), status.GetErrorMessage().c_str());
    return nullptr;
  }

  return BufferConsumer::Import(std::move(status));
  auto ion_buffer = std::make_unique<IonBuffer>();
  status.take().Import(ion_buffer.get());
  return ion_buffer;
}

bool DisplayClient::IsVrAppRunning() {
+11 −8
Original line number Diff line number Diff line
@@ -31,19 +31,22 @@ int DisplayManagerClient::GetSurfaceList(
  return 0;
}

std::unique_ptr<BufferProducer> DisplayManagerClient::SetupPoseBuffer(
    size_t extended_region_size, int usage) {
  auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupPoseBuffer>(
      extended_region_size, usage);
std::unique_ptr<IonBuffer> DisplayManagerClient::SetupNamedBuffer(
    const std::string& name, size_t size, uint64_t producer_usage,
    uint64_t consumer_usage) {
  auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupNamedBuffer>(
      name, size, producer_usage, consumer_usage);
  if (!status) {
    ALOGE(
        "DisplayManagerClient::SetupPoseBuffer: Failed to create the pose "
        "buffer %s",
        status.GetErrorMessage().c_str());
        "DisplayManagerClient::SetupNamedBuffer: Failed to create the named "
        "buffer: name=%s, error=%s",
        name.c_str(), status.GetErrorMessage().c_str());
    return {};
  }

  return BufferProducer::Import(std::move(status));
  auto ion_buffer = std::make_unique<IonBuffer>();
  status.take().Import(ion_buffer.get());
  return ion_buffer;
}

}  // namespace dvr
Loading