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

Commit dc82be74 authored by Jiwen 'Steve' Cai's avatar Jiwen 'Steve' Cai
Browse files

Move clang warnings override out of libgui

These clang warnings overrides were introduced to mute warnings brought
in from bufferhub and its dependencies. A better way to handle this is
to mute those warnings in BufferHub headers and keep libgui free from
those overrides.

Bug: 72172820
Test: Build system
Change-Id: I7d8aa233ceeef353a7db2c43431ae64360c668b1
parent c90a77f1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ cc_library_shared {
        // Allow implicit instantiation for templated class function
        "-Wno-undefined-func-template",

        // Allow explicitly marking struct as packed even when unnecessary
        "-Wno-packed",

        "-DDEBUG_ONLY_CODE=0",
    ],

+0 −13
Original line number Diff line number Diff line
@@ -14,21 +14,8 @@
 * limitations under the License.
 */

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#endif

// The following headers are included without checking every warning.
// TODO(b/72172820): Remove the workaround once we have enforced -Weverything
// in these headers and their dependencies.
#include <dvr/dvr_api.h>
#include <gui/BufferHubProducer.h>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

#include <inttypes.h>
#include <log/log.h>
#include <system/window.h>
+0 −13
Original line number Diff line number Diff line
@@ -19,22 +19,9 @@

#include <gui/BufferSlot.h>
#include <gui/IGraphicBufferProducer.h>

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#endif

// The following headers are included without checking every warning.
// TODO(b/72172820): Remove the workaround once we have enforced -Weverything
// in these headers and their dependencies.
#include <private/dvr/buffer_hub_queue_client.h>
#include <private/dvr/buffer_hub_queue_parcelable.h>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

namespace android {

class BufferHubProducer : public IGraphicBufferProducer {
+27 −15
Original line number Diff line number Diff line
@@ -3,6 +3,14 @@

#include <ui/BufferQueueDefs.h>

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#endif

// The following headers are included without checking every warning.
// TODO(b/72172820): Remove the workaround once we have enforced -Weverything
// in these headers and their dependencies.
#include <pdx/client.h>
#include <pdx/status.h>
#include <private/dvr/buffer_hub_client.h>
@@ -10,6 +18,10 @@
#include <private/dvr/bufferhub_rpc.h>
#include <private/dvr/epoll_file_descriptor.h>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

#include <memory>
#include <queue>
#include <vector>
@@ -45,10 +57,10 @@ class BufferHubQueue : public pdx::Client {
  uint32_t default_width() const { return default_width_; }

  // Returns the default buffer height of this buffer queue.
  uint32_t default_height() const { return default_height_; }
  uint32_t default_height() const { return static_cast<uint32_t>(default_height_); }

  // Returns the default buffer format of this buffer queue.
  uint32_t default_format() const { return default_format_; }
  uint32_t default_format() const { return static_cast<uint32_t>(default_format_); }

  // Creates a new consumer in handle form for immediate transport over RPC.
  pdx::Status<pdx::LocalChannelHandle> CreateConsumerQueueHandle(
@@ -160,16 +172,16 @@ class BufferHubQueue : public pdx::Client {
  // per-buffer data.
  struct Entry {
    Entry() : slot(0) {}
    Entry(const std::shared_ptr<BufferHubBuffer>& buffer, size_t slot,
          uint64_t index)
        : buffer(buffer), slot(slot), index(index) {}
    Entry(const std::shared_ptr<BufferHubBuffer>& buffer,
          std::unique_ptr<uint8_t[]> metadata, pdx::LocalHandle fence,
          size_t slot)
        : buffer(buffer),
          metadata(std::move(metadata)),
          fence(std::move(fence)),
          slot(slot) {}
    Entry(const std::shared_ptr<BufferHubBuffer>& in_buffer, size_t in_slot,
          uint64_t in_index)
        : buffer(in_buffer), slot(in_slot), index(in_index) {}
    Entry(const std::shared_ptr<BufferHubBuffer>& in_buffer,
          std::unique_ptr<uint8_t[]> in_metadata, pdx::LocalHandle in_fence,
          size_t in_slot)
        : buffer(in_buffer),
          metadata(std::move(in_metadata)),
          fence(std::move(in_fence)),
          slot(in_slot) {}
    Entry(Entry&&) = default;
    Entry& operator=(Entry&&) = default;

@@ -227,13 +239,13 @@ class BufferHubQueue : public pdx::Client {
  bool is_async_{false};

  // Default buffer width that is set during ProducerQueue's creation.
  size_t default_width_{1};
  uint32_t default_width_{1};

  // Default buffer height that is set during ProducerQueue's creation.
  size_t default_height_{1};
  uint32_t default_height_{1};

  // Default buffer format that is set during ProducerQueue's creation.
  int32_t default_format_{1};  // PIXEL_FORMAT_RGBA_8888
  uint32_t default_format_{1};  // PIXEL_FORMAT_RGBA_8888

  // Tracks the buffers belonging to this queue. Buffers are stored according to
  // "slot" in this vector. Each slot is a logical id of the buffer within this
+16 −2
Original line number Diff line number Diff line
#ifndef ANDROID_DVR_BUFFER_HUB_QUEUE_PARCELABLE_H_
#define ANDROID_DVR_BUFFER_HUB_QUEUE_PARCELABLE_H_

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#endif

// The following headers are included without checking every warning.
// TODO(b/72172820): Remove the workaround once we have enforced -Weverything
// in these headers and their dependencies.
#include <pdx/channel_parcelable.h>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

namespace android {
namespace dvr {

@@ -17,8 +29,10 @@ class BufferHubQueueParcelable : public Parcelable {
  BufferHubQueueParcelable() = default;

  BufferHubQueueParcelable(BufferHubQueueParcelable&& other) = default;
  BufferHubQueueParcelable& operator=(BufferHubQueueParcelable&& other) =
      default;
  BufferHubQueueParcelable& operator=(BufferHubQueueParcelable&& other) {
    channel_parcelable_ = std::move(other.channel_parcelable_);
    return *this;
  }

  // Constructs an parcelable contains the channel parcelable.
  BufferHubQueueParcelable(