From 3be1c6b60a188dc10025e2ce156c11fac050625d Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Tue, 18 Nov 2014 10:24:03 -0800 Subject: libgui: Enable -Weverything and -Werror Enables -Weverything and -Werror, with just a few exceptions for warnings we can't (or shouldn't need to) work around. Cherry pick of I034abec27bf4020d84af60d7acc1939c59986dd6 plus a couple of minor changes to CpuConsumer.cpp to make it work with a prior change: Uncomment CC_LOGV on line 46 Change C-style cast to static_cast on line 71 Change-Id: Iaec610477ea0122317b0578fb74caf2383d4cf08 --- include/gui/BufferItemConsumer.h | 2 +- include/gui/BufferQueueConsumer.h | 5 ++--- include/gui/BufferQueueCore.h | 6 +++--- include/gui/BufferQueueProducer.h | 11 +++++----- include/gui/CpuConsumer.h | 15 +++++++------- include/gui/GLConsumer.h | 8 ++++---- include/gui/GraphicBufferAlloc.h | 5 +++-- include/gui/IGraphicBufferAlloc.h | 8 ++++---- include/gui/IGraphicBufferConsumer.h | 7 ++++--- include/gui/IGraphicBufferProducer.h | 8 +++----- include/gui/ISurfaceComposer.h | 1 - include/gui/Sensor.h | 10 ++++----- include/gui/Surface.h | 40 ++++++++++++++++++------------------ include/gui/SurfaceComposerClient.h | 2 +- include/gui/SurfaceControl.h | 4 ++-- 15 files changed, 64 insertions(+), 68 deletions(-) (limited to 'include/gui') diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h index 5494ff1..869b470 100644 --- a/include/gui/BufferItemConsumer.h +++ b/include/gui/BufferItemConsumer.h @@ -95,7 +95,7 @@ class BufferItemConsumer: public ConsumerBase // setDefaultBufferFormat allows the BufferQueue to create // GraphicBuffers of a defaultFormat if no format is specified // in dequeueBuffer - status_t setDefaultBufferFormat(uint32_t defaultFormat); + status_t setDefaultBufferFormat(PixelFormat defaultFormat); }; } // namespace android diff --git a/include/gui/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h index 1912ed0..898c451 100644 --- a/include/gui/BufferQueueConsumer.h +++ b/include/gui/BufferQueueConsumer.h @@ -125,9 +125,8 @@ public: // setDefaultBufferFormat allows the BufferQueue to create // GraphicBuffers of a defaultFormat if no format is specified - // in dequeueBuffer. Formats are enumerated in graphics.h; the - // initial default is HAL_PIXEL_FORMAT_RGBA_8888. - virtual status_t setDefaultBufferFormat(uint32_t defaultFormat); + // in dequeueBuffer. The initial default is HAL_PIXEL_FORMAT_RGBA_8888. + virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat); // setConsumerUsageBits will turn on additional usage bits for dequeueBuffer. // These are merged with the bits passed to dequeueBuffer. The values are diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h index 1d975c0..b23cb08 100644 --- a/include/gui/BufferQueueCore.h +++ b/include/gui/BufferQueueCore.h @@ -199,15 +199,15 @@ private: // mDefaultBufferFormat can be set so it will override the buffer format // when it isn't specified in dequeueBuffer. - uint32_t mDefaultBufferFormat; + PixelFormat mDefaultBufferFormat; // mDefaultWidth holds the default width of allocated buffers. It is used // in dequeueBuffer if a width and height of 0 are specified. - int mDefaultWidth; + uint32_t mDefaultWidth; // mDefaultHeight holds the default height of allocated buffers. It is used // in dequeueBuffer if a width and height of 0 are specified. - int mDefaultHeight; + uint32_t mDefaultHeight; // mDefaultMaxBufferCount is the default limit on the number of buffers that // will be allocated at one time. This default limit is set by the consumer. diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h index ed1056a..f794ea3 100644 --- a/include/gui/BufferQueueProducer.h +++ b/include/gui/BufferQueueProducer.h @@ -73,9 +73,7 @@ public: // updateTexImage() is called. If width and height are both zero, the // default values specified by setDefaultBufferSize() are used instead. // - // The pixel formats are enumerated in graphics.h, e.g. - // HAL_PIXEL_FORMAT_RGBA_8888. If the format is 0, the default format - // will be used. + // If the format is 0, the default format will be used. // // The usage argument specifies gralloc buffer usage flags. The values // are enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER. These @@ -93,8 +91,9 @@ public: // // In both cases, the producer will need to call requestBuffer to get a // GraphicBuffer handle for the returned slot. - virtual status_t dequeueBuffer(int *outSlot, sp* outFence, bool async, - uint32_t width, uint32_t height, uint32_t format, uint32_t usage); + virtual status_t dequeueBuffer(int *outSlot, sp* outFence, + bool async, uint32_t width, uint32_t height, PixelFormat format, + uint32_t usage); // See IGraphicBufferProducer::detachBuffer virtual status_t detachBuffer(int slot); @@ -171,7 +170,7 @@ public: // See IGraphicBufferProducer::allocateBuffers virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - uint32_t format, uint32_t usage); + PixelFormat format, uint32_t usage); private: // This is required by the IBinder::DeathRecipient interface diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h index 4c6822a..faf6852 100644 --- a/include/gui/CpuConsumer.h +++ b/include/gui/CpuConsumer.h @@ -71,7 +71,7 @@ class CpuConsumer : public ConsumerBase // Create a new CPU consumer. The maxLockedBuffers parameter specifies // how many buffers can be locked for user access at the same time. CpuConsumer(const sp& bq, - uint32_t maxLockedBuffers, bool controlledByApp = false); + size_t maxLockedBuffers, bool controlledByApp = false); virtual ~CpuConsumer(); @@ -86,10 +86,9 @@ class CpuConsumer : public ConsumerBase status_t setDefaultBufferSize(uint32_t width, uint32_t height); // setDefaultBufferFormat allows CpuConsumer's BufferQueue to create buffers - // of a defaultFormat if no format is specified by producer. Formats are - // enumerated in graphics.h; the initial default is - // HAL_PIXEL_FORMAT_RGBA_8888. - status_t setDefaultBufferFormat(uint32_t defaultFormat); + // of a defaultFormat if no format is specified by producer. + // The initial default is PIXEL_FORMAT_RGBA_8888. + status_t setDefaultBufferFormat(PixelFormat defaultFormat); // Gets the next graphics buffer from the producer and locks it for CPU use, // filling out the passed-in locked buffer structure with the native pointer @@ -110,9 +109,9 @@ class CpuConsumer : public ConsumerBase private: // Maximum number of buffers that can be locked at a time - uint32_t mMaxLockedBuffers; + size_t mMaxLockedBuffers; - status_t releaseAcquiredBufferLocked(int lockedIdx); + status_t releaseAcquiredBufferLocked(size_t lockedIdx); virtual void freeBufferLocked(int slotIndex); @@ -133,7 +132,7 @@ class CpuConsumer : public ConsumerBase Vector mAcquiredBuffers; // Count of currently locked buffers - uint32_t mCurrentLockedBuffers; + size_t mCurrentLockedBuffers; }; diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h index f91fe46..053d1ed 100644 --- a/include/gui/GLConsumer.h +++ b/include/gui/GLConsumer.h @@ -150,7 +150,7 @@ public: // // The frame number is an incrementing counter set to 0 at the creation of // the BufferQueue associated with this consumer. - int64_t getFrameNumber(); + uint64_t getFrameNumber(); // setDefaultBufferSize is used to set the size of buffers returned by // requestBuffers when a with and height of zero is requested. @@ -197,7 +197,7 @@ public: // These functions call the corresponding BufferQueue implementation // so the refactoring can proceed smoothly - status_t setDefaultBufferFormat(uint32_t defaultFormat); + status_t setDefaultBufferFormat(PixelFormat defaultFormat); status_t setConsumerUsageBits(uint32_t usage); status_t setTransformHint(uint32_t hint); @@ -254,7 +254,7 @@ protected: return releaseBufferLocked(slot, graphicBuffer, mEglDisplay, eglFence); } - static bool isExternalFormat(uint32_t format); + static bool isExternalFormat(PixelFormat format); // This releases the buffer in the slot referenced by mCurrentTexture, // then updates state to refer to the BufferItem, which must be a @@ -391,7 +391,7 @@ private: // mCurrentFrameNumber is the frame counter for the current texture. // It gets set each time updateTexImage is called. - int64_t mCurrentFrameNumber; + uint64_t mCurrentFrameNumber; uint32_t mDefaultWidth, mDefaultHeight; diff --git a/include/gui/GraphicBufferAlloc.h b/include/gui/GraphicBufferAlloc.h index b08750c..69fe51e 100644 --- a/include/gui/GraphicBufferAlloc.h +++ b/include/gui/GraphicBufferAlloc.h @@ -33,8 +33,9 @@ class GraphicBufferAlloc : public BnGraphicBufferAlloc { public: GraphicBufferAlloc(); virtual ~GraphicBufferAlloc(); - virtual sp createGraphicBuffer(uint32_t w, uint32_t h, - PixelFormat format, uint32_t usage, status_t* error); + virtual sp createGraphicBuffer(uint32_t width, + uint32_t height, PixelFormat format, uint32_t usage, + status_t* error); }; diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h index cee41d9..f3c46ec 100644 --- a/include/gui/IGraphicBufferAlloc.h +++ b/include/gui/IGraphicBufferAlloc.h @@ -45,10 +45,10 @@ public: class BnGraphicBufferAlloc : public BnInterface { public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); + virtual status_t onTransact(uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); }; // ---------------------------------------------------------------------------- diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h index 15f51fe..9ac23c2 100644 --- a/include/gui/IGraphicBufferConsumer.h +++ b/include/gui/IGraphicBufferConsumer.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -280,11 +281,11 @@ public: // setDefaultBufferFormat allows the BufferQueue to create // GraphicBuffers of a defaultFormat if no format is specified - // in dequeueBuffer. Formats are enumerated in graphics.h; the - // initial default is HAL_PIXEL_FORMAT_RGBA_8888. + // in dequeueBuffer. + // The initial default is PIXEL_FORMAT_RGBA_8888. // // Return of a value other than NO_ERROR means an unknown error has occurred. - virtual status_t setDefaultBufferFormat(uint32_t defaultFormat) = 0; + virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat) = 0; // setConsumerUsageBits will turn on additional usage bits for dequeueBuffer. // These are merged with the bits passed to dequeueBuffer. The values are diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h index 4e9e810..4d3cd9a 100644 --- a/include/gui/IGraphicBufferProducer.h +++ b/include/gui/IGraphicBufferProducer.h @@ -134,9 +134,7 @@ public: // updateTexImage() is called. If width and height are both zero, the // default values specified by setDefaultBufferSize() are used instead. // - // The pixel formats are enumerated in , e.g. - // HAL_PIXEL_FORMAT_RGBA_8888. If the format is 0, the default format - // will be used. + // If the format is 0, the default format will be used. // // The usage argument specifies gralloc buffer usage flags. The values // are enumerated in , e.g. GRALLOC_USAGE_HW_RENDER. These @@ -167,7 +165,7 @@ public: // All other negative values are an unknown error returned downstream // from the graphics allocator (typically errno). virtual status_t dequeueBuffer(int* slot, sp* fence, bool async, - uint32_t w, uint32_t h, uint32_t format, uint32_t usage) = 0; + uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; // detachBuffer attempts to remove all ownership of the buffer in the given // slot from the buffer queue. If this call succeeds, the slot will be @@ -448,7 +446,7 @@ public: // dequeueBuffer. If there are already the maximum number of buffers // allocated, this function has no effect. virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - uint32_t format, uint32_t usage) = 0; + PixelFormat format, uint32_t usage) = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h index f04a848..8c3d49e 100644 --- a/include/gui/ISurfaceComposer.h +++ b/include/gui/ISurfaceComposer.h @@ -28,7 +28,6 @@ #include #include -#include #include #include diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h index 59b4d4d..27a215e 100644 --- a/include/gui/Sensor.h +++ b/include/gui/Sensor.h @@ -67,12 +67,12 @@ public: int32_t getMinDelay() const; nsecs_t getMinDelayNs() const; int32_t getVersion() const; - int32_t getFifoReservedEventCount() const; - int32_t getFifoMaxEventCount() const; + uint32_t getFifoReservedEventCount() const; + uint32_t getFifoMaxEventCount() const; const String8& getStringType() const; const String8& getRequiredPermission() const; int32_t getMaxDelay() const; - int32_t getFlags() const; + uint32_t getFlags() const; bool isWakeUpSensor() const; int32_t getReportingMode() const; @@ -93,8 +93,8 @@ private: float mPower; int32_t mMinDelay; int32_t mVersion; - int32_t mFifoReservedEventCount; - int32_t mFifoMaxEventCount; + uint32_t mFifoReservedEventCount; + uint32_t mFifoMaxEventCount; String8 mStringType; String8 mRequiredPermission; int32_t mMaxDelay; diff --git a/include/gui/Surface.h b/include/gui/Surface.h index f2cf018..98f4f4f 100644 --- a/include/gui/Surface.h +++ b/include/gui/Surface.h @@ -160,12 +160,12 @@ protected: virtual int connect(int api); virtual int disconnect(int api); virtual int setBufferCount(int bufferCount); - virtual int setBuffersDimensions(int w, int h); - virtual int setBuffersUserDimensions(int w, int h); - virtual int setBuffersFormat(int format); + virtual int setBuffersDimensions(uint32_t width, uint32_t height); + virtual int setBuffersUserDimensions(uint32_t width, uint32_t height); + virtual int setBuffersFormat(PixelFormat format); virtual int setScalingMode(int mode); - virtual int setBuffersTransform(int transform); - virtual int setBuffersStickyTransform(int transform); + virtual int setBuffersTransform(uint32_t transform); + virtual int setBuffersStickyTransform(uint32_t transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); virtual int setUsage(uint32_t reqUsage); @@ -211,7 +211,7 @@ private: // mReqFormat is the buffer pixel format that will be requested at the next // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888. - uint32_t mReqFormat; + PixelFormat mReqFormat; // mReqUsage is the set of buffer usage flags that will be requested // at the next deuque operation. It is initialized to 0. @@ -240,23 +240,23 @@ private: // from being set by the compositor. uint32_t mStickyTransform; - // mDefaultWidth is default width of the buffers, regardless of the - // native_window_set_buffers_dimensions call. - uint32_t mDefaultWidth; + // mDefaultWidth is default width of the buffers, regardless of the + // native_window_set_buffers_dimensions call. + uint32_t mDefaultWidth; - // mDefaultHeight is default height of the buffers, regardless of the - // native_window_set_buffers_dimensions call. - uint32_t mDefaultHeight; + // mDefaultHeight is default height of the buffers, regardless of the + // native_window_set_buffers_dimensions call. + uint32_t mDefaultHeight; - // mUserWidth, if non-zero, is an application-specified override - // of mDefaultWidth. This is lower priority than the width set by - // native_window_set_buffers_dimensions. - uint32_t mUserWidth; + // mUserWidth, if non-zero, is an application-specified override + // of mDefaultWidth. This is lower priority than the width set by + // native_window_set_buffers_dimensions. + uint32_t mUserWidth; - // mUserHeight, if non-zero, is an application-specified override - // of mDefaultHeight. This is lower priority than the height set - // by native_window_set_buffers_dimensions. - uint32_t mUserHeight; + // mUserHeight, if non-zero, is an application-specified override + // of mDefaultHeight. This is lower priority than the height set + // by native_window_set_buffers_dimensions. + uint32_t mUserHeight; // mTransformHint is the transform probably applied to buffers of this // window. this is only a hint, actual transform may differ. diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h index 4cbfc09..37d953e 100644 --- a/include/gui/SurfaceComposerClient.h +++ b/include/gui/SurfaceComposerClient.h @@ -127,7 +127,7 @@ public: status_t show(const sp& id); status_t setFlags(const sp& id, uint32_t flags, uint32_t mask); status_t setTransparentRegionHint(const sp& id, const Region& transparent); - status_t setLayer(const sp& id, int32_t layer); + status_t setLayer(const sp& id, uint32_t layer); status_t setAlpha(const sp& id, float alpha=1.0f); status_t setMatrix(const sp& id, float dsdx, float dtdx, float dsdy, float dtdy); status_t setPosition(const sp& id, float x, float y); diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h index 84fb9f9..9f62f7c 100644 --- a/include/gui/SurfaceControl.h +++ b/include/gui/SurfaceControl.h @@ -57,8 +57,8 @@ public: // release surface data from java void clear(); - status_t setLayerStack(int32_t layerStack); - status_t setLayer(int32_t layer); + status_t setLayerStack(uint32_t layerStack); + status_t setLayer(uint32_t layer); status_t setPosition(float x, float y); status_t setSize(uint32_t w, uint32_t h); status_t hide(); -- cgit v1.1