mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
d699f69c9a
Backed out changeset e7278af0a484 (bug 1200595) Backed out changeset c13228f84d85 (bug 1200595) Backed out changeset 4b88e8a3d8af (bug 1200595) Backed out changeset e55376bd2cf8 (bug 1200595) Backed out changeset 9c27c8e2c021 (bug 1200595) Backed out changeset a369a2983ceb (bug 1200595) Backed out changeset 09e71ba15ea8 (bug 1200595) Backed out changeset b555b130d439 (bug 1200595) Backed out changeset 6819f6d82287 (bug 1200595) Backed out changeset a8cdfbf443d8 (bug 1200595) Backed out changeset 0092c9d7a86b (bug 1200595) Backed out changeset 6dc38a1e6073 (bug 1200595) Backed out changeset fe2164aa1468 (bug 1200595)
136 lines
3.5 KiB
C++
136 lines
3.5 KiB
C++
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef GRALLOCIMAGES_H
|
|
#define GRALLOCIMAGES_H
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#include "ImageLayers.h"
|
|
#include "ImageContainer.h"
|
|
#include "mozilla/gfx/Point.h"
|
|
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
|
|
#include "mozilla/layers/FenceUtils.h"
|
|
#include "mozilla/layers/LayersSurfaces.h"
|
|
|
|
#include <ui/GraphicBuffer.h>
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class GrallocTextureClientOGL;
|
|
|
|
already_AddRefed<gfx::DataSourceSurface>
|
|
GetDataSourceSurfaceFrom(android::sp<android::GraphicBuffer>& aGraphicBuffer,
|
|
gfx::IntSize aSize,
|
|
const layers::PlanarYCbCrData& aYcbcrData);
|
|
|
|
/**
|
|
* The YUV format supported by Android HAL
|
|
*
|
|
* 4:2:0 - CbCr width and height is half that of Y.
|
|
*
|
|
* This format assumes
|
|
* - an even width
|
|
* - an even height
|
|
* - a horizontal stride multiple of 16 pixels
|
|
* - a vertical stride equal to the height
|
|
*
|
|
* y_size = stride * height
|
|
* c_size = ALIGN(stride/2, 16) * height/2
|
|
* size = y_size + c_size * 2
|
|
* cr_offset = y_size
|
|
* cb_offset = y_size + c_size
|
|
*
|
|
* The Image that is rendered is the picture region defined by
|
|
* mPicX, mPicY and mPicSize. The size of the rendered image is
|
|
* mPicSize, not mYSize or mCbCrSize.
|
|
*/
|
|
class GrallocImage : public RecyclingPlanarYCbCrImage
|
|
{
|
|
typedef PlanarYCbCrData Data;
|
|
static int32_t sColorIdMap[];
|
|
public:
|
|
GrallocImage();
|
|
|
|
virtual ~GrallocImage();
|
|
|
|
/**
|
|
* This makes a copy of the data buffers, in order to support functioning
|
|
* in all different layer managers.
|
|
*/
|
|
virtual bool SetData(const Data& aData);
|
|
|
|
/**
|
|
* Share the SurfaceDescriptor without making the copy, in order
|
|
* to support functioning in all different layer managers.
|
|
*/
|
|
void SetData(TextureClient* aGraphicBuffer, const gfx::IntSize& aSize);
|
|
|
|
// From [android 4.0.4]/hardware/msm7k/libgralloc-qsd8k/gralloc_priv.h
|
|
enum {
|
|
/* OEM specific HAL formats */
|
|
HAL_PIXEL_FORMAT_YCbCr_422_P = 0x102,
|
|
HAL_PIXEL_FORMAT_YCbCr_420_P = 0x103,
|
|
HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x109,
|
|
HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO = 0x10A,
|
|
HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x7FA30C03,
|
|
HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS = 0x7FA30C04,
|
|
};
|
|
|
|
enum {
|
|
GRALLOC_SW_UAGE = android::GraphicBuffer::USAGE_SOFTWARE_MASK,
|
|
};
|
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
|
|
|
|
android::sp<android::GraphicBuffer> GetGraphicBuffer() const;
|
|
|
|
void* GetNativeBuffer();
|
|
|
|
virtual bool IsValid() { return !!mTextureClient; }
|
|
|
|
virtual TextureClient* GetTextureClient(CompositableClient* aClient) override;
|
|
|
|
virtual GrallocImage* AsGrallocImage() override
|
|
{
|
|
return this;
|
|
}
|
|
|
|
virtual uint8_t* GetBuffer()
|
|
{
|
|
return static_cast<uint8_t*>(GetNativeBuffer());
|
|
}
|
|
|
|
int GetUsage()
|
|
{
|
|
return (static_cast<ANativeWindowBuffer*>(GetNativeBuffer()))->usage;
|
|
}
|
|
|
|
static int GetOmxFormat(int aFormat)
|
|
{
|
|
uint32_t omxFormat = 0;
|
|
|
|
for (int i = 0; sColorIdMap[i]; i += 2) {
|
|
if (sColorIdMap[i] == aFormat) {
|
|
omxFormat = sColorIdMap[i + 1];
|
|
break;
|
|
}
|
|
}
|
|
|
|
return omxFormat;
|
|
}
|
|
|
|
private:
|
|
RefPtr<GrallocTextureClientOGL> mTextureClient;
|
|
};
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|
|
|
|
#endif
|
|
|
|
#endif /* GRALLOCIMAGES_H */
|