This patch adds support for testing YUV formats.
Jira: None.
Test: Build passes on Linux and Android. Test apps using
NV12 buffers is about to show content on screen.
Signed-off-by: johnson.lin <johnson.lin@intel.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
#Include tests only if eng build
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
# Commenting for now include when ld issue is resolved
-#include $(LOCAL_PATH)/tests/third_party/json-c/Android.mk
+#include $(HWC_PATH)/tests/third_party/json-c/Android.mk
endif
endif
bool NativeSurface::Init(NativeBufferHandler *buffer_handler,
bool cursor_layer) {
buffer_handler_ = buffer_handler;
- buffer_handler_->CreateBuffer(width_, height_, 0, &native_handle_,
- cursor_layer);
+ uint32_t usage = hwcomposer::kLayerNormal;
+ if (cursor_layer) {
+ usage = hwcomposer::kLayerCursor;
+ }
+
+ buffer_handler_->CreateBuffer(width_, height_, 0, &native_handle_, usage);
if (!native_handle_) {
ETRACE("NativeSurface: Failed to create buffer.");
return false;
bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
HWCNativeHandle *handle,
- bool cursor_usage) {
- return CreateGraphicsBuffer(w, h, format, handle, cursor_usage);
+ uint32_t layer_type) {
+ return CreateGraphicsBuffer(w, h, format, handle, layer_type);
}
bool Gralloc1BufferHandler::ReleaseBuffer(HWCNativeHandle handle) {
bool Init();
bool CreateBuffer(uint32_t w, uint32_t h, int format, HWCNativeHandle *handle,
- bool cursor_usage = false) override;
+ uint32_t layer_type) override;
bool ReleaseBuffer(HWCNativeHandle handle) override;
void DestroyHandle(HWCNativeHandle handle) override;
bool ImportBuffer(HWCNativeHandle handle, HwcBuffer *bo) override;
bool GrallocBufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
HWCNativeHandle *handle,
- bool cursor_usage) {
- return CreateGraphicsBuffer(w, h, format, handle, cursor_usage);
+ uint32_t layer_type) {
+ return CreateGraphicsBuffer(w, h, format, handle, layer_type);
}
bool GrallocBufferHandler::ReleaseBuffer(HWCNativeHandle handle) {
bool Init();
bool CreateBuffer(uint32_t w, uint32_t h, int format, HWCNativeHandle *handle,
- bool cursor_usage = false) override;
+ bool cursor_usage = false, uint32_t layer_type) override;
bool ReleaseBuffer(HWCNativeHandle handle) override;
void DestroyHandle(HWCNativeHandle handle) override;
bool ImportBuffer(HWCNativeHandle handle, HwcBuffer *bo) override;
#include "platformdefines.h"
#ifdef USE_MINIGBM
+#define DRV_I915 1
#include <cros_gralloc_handle.h>
#include <cros_gralloc_helpers.h>
+#include <i915_private_android_types.h>
#endif
#include <hwcdefs.h>
extern "C" {
#endif
-#define DRM_FORMAT_NONE fourcc_code('0', '0', '0', '0')
-
-// minigbm specific DRM_FORMAT_YVU420_ANDROID enum
-#define DRM_FORMAT_YVU420_ANDROID fourcc_code('9', '9', '9', '7')
-
#define DRV_MAX_PLANES 4
// Conversion from HAL to fourcc-based DRM formats
return DRM_FORMAT_NONE;
}
+static uint32_t DrmFormatToHALFormat(int format) {
+ switch (format) {
+ case DRM_FORMAT_BGRA8888:
+ return HAL_PIXEL_FORMAT_RGBA_8888;
+ case DRM_FORMAT_BGRX8888:
+ return HAL_PIXEL_FORMAT_RGBX_8888;
+ case DRM_FORMAT_BGR888:
+ return HAL_PIXEL_FORMAT_RGB_888;
+ case DRM_FORMAT_BGR565:
+ return HAL_PIXEL_FORMAT_RGB_565;
+ case DRM_FORMAT_ARGB8888:
+ return HAL_PIXEL_FORMAT_BGRA_8888;
+ case DRM_FORMAT_YVU420:
+ return HAL_PIXEL_FORMAT_YV12;
+ case DRM_FORMAT_R8:
+ return HAL_PIXEL_FORMAT_Y8;
+ case DRM_FORMAT_GR88:
+ case DRM_FORMAT_R16:
+ return HAL_PIXEL_FORMAT_Y16;
+ case DRM_FORMAT_RGB332: //('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
+ return 0;
+ case DRM_FORMAT_BGR233: //('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
+ return 0;
+
+ case DRM_FORMAT_XRGB4444:
+ case DRM_FORMAT_XBGR4444:
+ case DRM_FORMAT_RGBX4444:
+ case DRM_FORMAT_BGRX4444:
+ case DRM_FORMAT_ARGB4444:
+ case DRM_FORMAT_ABGR4444:
+ case DRM_FORMAT_RGBA4444:
+ case DRM_FORMAT_BGRA4444:
+ return 0;
+ case DRM_FORMAT_XRGB1555:
+ case DRM_FORMAT_XBGR1555:
+ case DRM_FORMAT_RGBX5551:
+ case DRM_FORMAT_BGRX5551:
+ case DRM_FORMAT_ARGB1555:
+ case DRM_FORMAT_ABGR1555:
+ case DRM_FORMAT_RGBA5551:
+ case DRM_FORMAT_BGRA5551:
+ return 0;
+ case DRM_FORMAT_RGB565:
+ return HAL_PIXEL_FORMAT_RGB_565;
+ case DRM_FORMAT_RGB888:
+ return HAL_PIXEL_FORMAT_RGB_888;
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_RGBX8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_RGBA8888:
+ return 0;
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XBGR2101010:
+ case DRM_FORMAT_RGBX1010102:
+ case DRM_FORMAT_BGRX1010102:
+ case DRM_FORMAT_ARGB2101010:
+ case DRM_FORMAT_ABGR2101010:
+ case DRM_FORMAT_RGBA1010102:
+ case DRM_FORMAT_BGRA1010102:
+ return 0;
+ case DRM_FORMAT_YUYV:
+ return HAL_PIXEL_FORMAT_YCbCr_422_I;
+ case DRM_FORMAT_YVYU:
+ case DRM_FORMAT_UYVY:
+ case DRM_FORMAT_VYUY:
+ case DRM_FORMAT_AYUV:
+ return 0;
+#ifdef USE_MINIGBM
+ case DRM_FORMAT_NV12:
+ return HAL_PIXEL_FORMAT_NV12;
+#endif
+ case DRM_FORMAT_NV21:
+ return HAL_PIXEL_FORMAT_YCrCb_420_SP;
+ case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV61:
+ case DRM_FORMAT_YUV410:
+ case DRM_FORMAT_YVU410:
+ case DRM_FORMAT_YUV411:
+ case DRM_FORMAT_YVU411:
+ return 0;
+ case DRM_FORMAT_YUV420:
+ return HAL_PIXEL_FORMAT_YCbCr_420_888;
+ case DRM_FORMAT_YVU420_ANDROID:
+ return HAL_PIXEL_FORMAT_YV12;
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
+ return 0;
+ case DRM_FORMAT_YUV444:
+ return HAL_PIXEL_FORMAT_YCbCr_444_888;
+ case DRM_FORMAT_YVU444:
+ return 0;
+#ifdef USE_MINIGBM
+ case DRM_FORMAT_NV12_Y_TILED_INTEL:
+ return HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL;
+#endif
+ default:
+ return 0;
+ break;
+ }
+
+ return DRM_FORMAT_NONE;
+}
+
static native_handle_t *dup_buffer_handle(buffer_handle_t handle) {
native_handle_t *new_handle =
native_handle_create(handle->numFds, handle->numInts);
handle = NULL;
}
#ifdef USE_MINIGBM
-static bool CreateGraphicsBuffer(uint32_t w, uint32_t h, int /*format*/,
- HWCNativeHandle *handle, bool cursor_usage) {
+static bool CreateGraphicsBuffer(uint32_t w, uint32_t h, int format,
+ HWCNativeHandle *handle, uint32_t layer_type) {
struct gralloc_handle *temp = new struct gralloc_handle();
- uint32_t usage =
- GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
- if (cursor_usage) {
+ uint32_t usage = 0;
+ uint32_t pixel_format = 0;
+ if (format != 0) {
+ pixel_format = DrmFormatToHALFormat(format);
+ }
+
+ if (pixel_format == 0) {
+ pixel_format = android::PIXEL_FORMAT_RGBA_8888;
+ }
+
+ if (layer_type == hwcomposer::kLayerNormal) {
+ usage |= GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_HW_RENDER |
+ GRALLOC_USAGE_HW_COMPOSER;
+ } else if (layer_type == hwcomposer::kLayerVideo) {
+ if (pixel_format == DRM_FORMAT_YUYV) {
+ usage |= GRALLOC_USAGE_HW_TEXTURE;
+ } else {
+ usage |= GRALLOC_USAGE_HW_CAMERA_WRITE | GRALLOC_USAGE_HW_CAMERA_READ |
+ GRALLOC_USAGE_HW_TEXTURE;
+ }
+ } else if (layer_type == hwcomposer::kLayerCursor) {
usage |= GRALLOC_USAGE_CURSOR;
}
- temp->buffer_ =
- new android::GraphicBuffer(w, h, android::PIXEL_FORMAT_RGBA_8888, usage);
+ temp->buffer_ = new android::GraphicBuffer(w, h, pixel_format, usage);
temp->handle_ = temp->buffer_->handle;
temp->hwc_buffer_ = true;
*handle = temp;
bool GbmBufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,
HWCNativeHandle *handle,
- bool cursor_usage) {
+ uint32_t layer_type) {
uint32_t gbm_format = format;
if (gbm_format == 0)
gbm_format = GBM_FORMAT_XRGB8888;
- struct gbm_bo *bo = gbm_bo_create(device_, w, h, gbm_format,
- GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ uint32_t flags = 0;
+
+ if (layer_type == kLayerNormal) {
+ flags |= (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ } else if (layer_type == kLayerVideo) {
+ flags |= (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING |
+ GBM_BO_USE_CAMERA_WRITE | GBM_BO_USE_CAMERA_READ);
+ }
+
+ struct gbm_bo *bo = gbm_bo_create(device_, w, h, gbm_format, flags);
if (!bo) {
- bo = gbm_bo_create(device_, w, h, gbm_format, GBM_BO_USE_RENDERING);
- if (!bo) {
- ETRACE("GbmBufferHandler: failed to create gbm_bo");
- return false;
- }
+ flags &= ~GBM_BO_USE_SCANOUT;
+ bo = gbm_bo_create(device_, w, h, gbm_format, flags);
+ }
+
+ if (!bo) {
+ ETRACE("GbmBufferHandler: failed to create gbm_bo");
+ return false;
}
struct gbm_handle *temp = new struct gbm_handle();
bool Init();
bool CreateBuffer(uint32_t w, uint32_t h, int format, HWCNativeHandle *handle,
- bool cursor_usage = false) override;
+ uint32_t layer_type) override;
bool ReleaseBuffer(HWCNativeHandle handle) override;
void DestroyHandle(HWCNativeHandle handle) override;
void CopyHandle(HWCNativeHandle source, HWCNativeHandle *target) override;
VkFormat NativeToVkFormat(int native_format);
#endif
+#define DRM_FORMAT_NONE fourcc_code('0', '0', '0', '0')
+
+#define DRM_FORMAT_NV12_Y_TILED_INTEL fourcc_code('9', '9', '9', '6')
+// minigbm specific DRM_FORMAT_YVU420_ANDROID enum
+#define DRM_FORMAT_YVU420_ANDROID fourcc_code('9', '9', '9', '7')
+
#endif // OS_LINUX_PLATFORMCOMMONDEFINES_H_
};
enum HWCLayerType {
- kLayerNormal = 1 << 0,
- kLayerCursor = 1 << 1,
- kLayerProtected = 1 << 2,
- kLayerVideo = 1 << 3
+ kLayerNormal = 0,
+ kLayerCursor = 1,
+ kLayerProtected = 2,
+ kLayerVideo = 3
};
enum class HWCDisplayAttribute : int32_t {
#include <hwcbuffer.h>
#include <platformdefines.h>
+#include <hwcdefs.h>
namespace hwcomposer {
}
virtual bool CreateBuffer(uint32_t w, uint32_t h, int format,
- HWCNativeHandle *handle,
- bool cursor_usage = false) = 0;
+ HWCNativeHandle *handle = NULL,
+ uint32_t layer_type = kLayerNormal) = 0;
virtual bool ReleaseBuffer(HWCNativeHandle handle) = 0;
LOCAL_REQUIRED_MODULES := libjson-c \
- gralloc.$(TARGET_BOARD_PLATFORM) \
hwcomposer.$(TARGET_BOARD_PLATFORM)
#LOCAL_LDLIBS += -L$(PRODUCT_OUT)/vendor/lib/hw/ -l:gralloc.android_ia.so -l:hwcomposer.android_ia.so
libui \
libutils \
libjson-c \
- gralloc.$(TARGET_BOARD_PLATFORM) \
- hwcomposer.$(TARGET_BOARD_PLATFORM)
+ libhwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_C_INCLUDES := \
system/core/include/utils \
system/core/libsync \
system/core/libsync/include \
- $(LOCAL_PATH)/third_party/json-c \
- $(LOCAL_PATH)/common \
+ $(LOCAL_PATH)/third_party/json-c \
+ $(LOCAL_PATH)/common \
$(LOCAL_PATH)/../os/android \
+ $(LOCAL_PATH)/../os \
+ $(LOCAL_PATH)/../wsi \
$(LOCAL_PATH)/../public \
$(LOCAL_PATH)/../common/core \
$(LOCAL_PATH)/../common/compositor \
common/glcubelayerrenderer.cpp \
common/videolayerrenderer.cpp \
common/imagelayerrenderer.cpp \
+ common/cclayerrenderer.cpp \
common/esTransform.cpp \
common/jsonhandlers.cpp \
apps/jsonlayerstest.cpp
#include "jsonhandlers.h"
#include <nativebufferhandler.h>
+#include "platformcommondefines.h"
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
TEST_PARAMETERS test_parameters;
hwcomposer::NativeBufferHandler *buffer_handler;
-static uint32_t layerformat2gbmformat(LAYER_FORMAT format) {
+static uint32_t layerformat2gbmformat(LAYER_FORMAT format,
+ uint32_t *usage_format, uint32_t *usage) {
+ *usage = 0;
+
switch (format) {
case LAYER_FORMAT_C8:
return DRM_FORMAT_C8;
return DRM_FORMAT_YUV444;
case LAYER_FORMAT_YVU444:
return DRM_FORMAT_YVU444;
+ case LAYER_HAL_PIXEL_FORMAT_YV12:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YV12;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_YVU420;
+ case LAYER_HAL_PIXEL_FORMAT_Y8:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_Y8;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R8;
+ case LAYER_HAL_PIXEL_FORMAT_Y16:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_Y16;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R16;
+ case LAYER_HAL_PIXEL_FORMAT_YCbCr_444_888:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YCbCr_444_888;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_YUV444;
+ case LAYER_HAL_PIXEL_FORMAT_YCbCr_422_I:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YCbCr_422_I;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_YUYV;
+ case LAYER_HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YCbCr_422_SP;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_NV16;
+ case LAYER_HAL_PIXEL_FORMAT_YCbCr_420_888:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YCbCr_420_888;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_NV12;
+ case LAYER_HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_YCrCb_420_SP;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_NV21;
+ case LAYER_HAL_PIXEL_FORMAT_RAW16:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_RAW16;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R16;
+ case LAYER_HAL_PIXEL_FORMAT_RAW_OPAQUE:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_RAW_OPAQUE;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R16;
+ case LAYER_HAL_PIXEL_FORMAT_BLOB:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_BLOB;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R8;
+ case LAYER_ANDROID_SCALER_AVAILABLE_FORMATS_RAW16:
+ *usage_format = LAYER_ANDROID_SCALER_AVAILABLE_FORMATS_RAW16;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_R16;
+ case LAYER_HAL_PIXEL_FORMAT_NV12_LINEAR_CAMERA_INTEL:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_NV12_LINEAR_CAMERA_INTEL;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_NV12;
+ case LAYER_HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL:
+ *usage_format = LAYER_HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL;
+ *usage = hwcomposer::kLayerVideo;
+ return DRM_FORMAT_NV12_Y_TILED_INTEL;
case LAYER_FORMAT_UNDEFINED:
return (uint32_t)-1;
}
LayerRenderer *renderer = NULL;
hwcomposer::HwcLayer *hwc_layer = NULL;
- uint32_t gbm_format = layerformat2gbmformat(layer_parameter.format);
+ uint32_t usage_format, usage;
+ uint64_t modificators[4];
+ uint32_t gbm_format =
+ layerformat2gbmformat(layer_parameter.format, &usage_format, &usage);
switch (layer_parameter.type) {
// todo: more GL layer categories intead of only one CubeLayer
}
if (!renderer->Init(layer_parameter.source_width,
- layer_parameter.source_height, gbm_format, &gl,
+ layer_parameter.source_height, gbm_format,
+ usage_format, usage, &gl,
layer_parameter.resource_path.c_str())) {
printf("\nrender init not successful\n");
exit(-1);
}
bool CCLayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
- glContext* gl, const char* resource_path) {
- if (format != GBM_FORMAT_XRGB8888)
+ uint32_t usage_format, uint32_t usage, glContext* gl,
+ const char* resource_path) {
+ if (format != DRM_FORMAT_XRGB8888)
return false;
- if (!LayerRenderer::Init(width, height, format, gl, resource_path))
+ if (!LayerRenderer::Init(width, height, format, usage_format, usage, gl,
+ resource_path))
return false;
return true;
~CCLayerRenderer() override;
bool Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format = -1, uint32_t usage = 0,
glContext* gl = NULL, const char* resource_path = NULL) override;
void Draw(int64_t* pfence) override;
};
}
bool GLCubeLayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format, uint32_t usage,
glContext *gl, const char *resource_path) {
if (format != DRM_FORMAT_XRGB8888)
return false;
- if (!GLLayerRenderer::Init(width, height, format, gl))
+ if (!GLLayerRenderer::Init(width, height, format, usage_format, usage, gl))
return false;
GLuint vertex_shader, fragment_shader;
~GLCubeLayerRenderer() override;
bool Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format = -1, uint32_t usage = 0,
glContext *gl = NULL, const char *resource_path = NULL) override;
void glDrawFrame() override;
void UpdateStreamTexture(unsigned long usec);
}
bool GLLayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
- glContext* gl, const char* resource_path) {
+ uint32_t usage_format, uint32_t usage, glContext* gl,
+ const char* resource_path) {
if (format != DRM_FORMAT_XRGB8888)
return false;
- if (!LayerRenderer::Init(width, height, format, gl))
+ if (!LayerRenderer::Init(width, height, format, usage_format, usage, gl))
return false;
if (!Init_GL(gl)) {
~GLLayerRenderer() override;
bool Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format = -1, uint32_t usage = 0,
glContext* gl = NULL, const char* resource_path = NULL) override;
void Draw(int64_t* pfence) override;
virtual void glDrawFrame() = 0;
}
bool ImageLayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format, uint32_t usage,
glContext* gl, const char* resource_path) {
return true;
}
~ImageLayerRenderer();
bool Init(uint32_t width, uint32_t height, uint32_t format,
- glContext* gl = NULL, const char* resoruce_path = NULL) override;
+ uint32_t usage_format = -1, uint32_t usage = 0,
+ glContext* gl = NULL, const char* resourePath = NULL) override;
void Draw(int64_t* pfence) override;
private:
LAYER_FORMAT_YVU444 =
60, // ('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
- LAYER_FORMAT_UNDEFINED
+ /*Anadroid formats */
+
+ LAYER_HAL_PIXEL_FORMAT_YV12 = 61,
+ LAYER_HAL_PIXEL_FORMAT_Y8 = 62,
+ LAYER_HAL_PIXEL_FORMAT_Y16 = 63,
+ LAYER_HAL_PIXEL_FORMAT_YCbCr_444_888 = 64,
+ LAYER_HAL_PIXEL_FORMAT_YCbCr_422_I = 65,
+ LAYER_HAL_PIXEL_FORMAT_YCbCr_422_SP = 66,
+ LAYER_HAL_PIXEL_FORMAT_YCbCr_422_888 = 67,
+ LAYER_HAL_PIXEL_FORMAT_YCbCr_420_888 = 68,
+ LAYER_HAL_PIXEL_FORMAT_YCrCb_420_SP = 69,
+ LAYER_HAL_PIXEL_FORMAT_RAW16 = 70,
+ LAYER_HAL_PIXEL_FORMAT_RAW10 = 71,
+ LAYER_HAL_PIXEL_FORMAT_RAW12 = 72,
+ LAYER_HAL_PIXEL_FORMAT_RAW_OPAQUE = 73,
+ LAYER_HAL_PIXEL_FORMAT_BLOB = 74,
+ LAYER_ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 75,
+ LAYER_HAL_PIXEL_FORMAT_NV12_LINEAR_CAMERA_INTEL = 76,
+ LAYER_HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL = 77,
+ LAYER_FORMAT_UNDEFINED
} LAYER_FORMAT;
typedef enum {
}
bool LayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
- glContext* gl, const char* resource_path) {
- if (!buffer_handler_->CreateBuffer(width, height, format, &handle_)) {
+ uint32_t usage_format, uint32_t usage, glContext* gl,
+ const char* resource_path) {
+ if (!buffer_handler_->CreateBuffer(width, height, format, &handle_, usage)) {
ETRACE("LayerRenderer: CreateBuffer failed");
return false;
}
+ buffer_handler_->CopyHandle(handle_, &handle_);
+
if (!buffer_handler_->ImportBuffer(handle_, &bo_)) {
ETRACE("LayerRenderer: ImportBuffer failed");
return false;
virtual ~LayerRenderer();
virtual bool Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format = -1, uint32_t usage = 0,
glContext* gl = NULL, const char* resourePath = NULL) = 0;
virtual void Draw(int64_t* pfence) = 0;
HWCNativeHandle GetNativeBoHandle() {
}
bool VideoLayerRenderer::Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format, uint32_t usage,
glContext* gl, const char* resource_path) {
- if (!LayerRenderer::Init(width, height, format, gl, resource_path))
+ if (!LayerRenderer::Init(width, height, format, usage_format, usage, gl,
+ resource_path))
return false;
if (!resource_path) {
ETRACE("resource file no provided");
case DRM_FORMAT_YVU420:
return 8;
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_Y_TILED_INTEL:
return (plane == 0) ? 8 : 16;
case DRM_FORMAT_ABGR1555:
if (plane != 0) {
switch (format) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_Y_TILED_INTEL:
case DRM_FORMAT_YVU420:
stride = stride / 2;
break;
return height;
case DRM_FORMAT_YVU420:
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_Y_TILED_INTEL:
return (plane == 0) ? height : height / 2;
}
ETRACE("UNKNOWN FORMAT %d", format);
pReadLoc += bo_.pitches[i];
readHeight++;
}
+
+ if (readHeight < planeHeight)
+ break;
}
buffer_handler_->UnMap(handle_, pOpaque);
~VideoLayerRenderer() override;
bool Init(uint32_t width, uint32_t height, uint32_t format,
+ uint32_t usage_format = -1, uint32_t usage = 0,
glContext* gl = NULL, const char* resource_path = NULL) override;
void Draw(int64_t* pfence) override;
*
*/
-#include "config.h"
-
#include <limits.h>
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif /* STDC_HEADERS */
-
-#if defined(HAVE_STRINGS_H) && !defined(_STRING_H) && !defined(__USE_BSD)
-# include <strings.h>
-#endif /* HAVE_STRINGS_H */
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
#if SIZEOF_SIZE_T == SIZEOF_INT
#define SIZE_T_MAX UINT_MAX
#endif
#define ARRAY_LIST_DEFAULT_SIZE 32
+#include <stdlib.h>
+#include <stddef.h>
-typedef void (array_list_free_fn) (void *data);
+typedef void(array_list_free_fn)(void *data);
-struct array_list
-{
+struct array_list {
void **array;
size_t length;
size_t size;
*
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* This library is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See COPYING for details.
*/
-#include "config.h"
#include "json_c_version.h"
*
*/
-#include "config.h"
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "math_compat.h"
#include "strdup_compat.h"
-#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
- /* MSC has the version as _snprintf */
-# define snprintf _snprintf
-#elif !defined(HAVE_SNPRINTF)
-# error You do not have snprintf on your system.
-#endif /* HAVE_SNPRINTF */
-
// Don't define this. It's not thread-safe.
/* #define REFCOUNT_DEBUG 1 */
*
*/
-#include "config.h"
-
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
*
*
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
- * The copyrights to the contents of this file are licensed under the MIT License
+ * The copyrights to the contents of this file are licensed under the MIT
+ *License
* (http://www.opensource.org/licenses/mit-license.php)
*/
-#include "config.h"
-
#include <math.h>
#include "math_compat.h"
#include <stdio.h>
#include <xlocale.h>
#endif
-#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
-
-#if !HAVE_STRNCASECMP && defined(_MSC_VER)
- /* MSC has the version as _strnicmp */
-# define strncasecmp _strnicmp
-#elif !HAVE_STRNCASECMP
-# error You do not have strncasecmp on your system.
-#endif /* HAVE_STRNCASECMP */
+#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x)&7) + 9)
/* Use C99 NAN by default; if not available, nan("") should work too. */
#ifndef NAN
*
*/
-#include "config.h"
#undef realloc
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
-
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif /* HAVE_SYS_STAT_H */
-
-#ifdef HAVE_FCNTL_H
#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#ifdef WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# include <io.h>
-#endif /* defined(WIN32) */
-
-#if !defined(HAVE_OPEN) && defined(WIN32)
-# define open _open
-#endif
-
-#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
- /* MSC has the version as _snprintf */
-# define snprintf _snprintf
-#elif !defined(HAVE_SNPRINTF)
-# error You do not have snprintf on your system.
-#endif /* HAVE_SNPRINTF */
-
+#include <unistd.h>
#include "debug.h"
#include "printbuf.h"
#include "json_inttypes.h"
extern "C" {
#endif
+#include <fcntl.h>
+
#define JSON_FILE_BUF_SIZE 4096
/* utility functions */
#include <stdio.h>
-#include "config.h"
#include "json_inttypes.h"
#include "json_object.h"
#include "json_visit.h"
*
*/
-#include "config.h"
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
*
*
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
- * The copyrights to the contents of this file are licensed under the MIT License
+ * The copyrights to the contents of this file are licensed under the MIT
+ *License
* (http://www.opensource.org/licenses/mit-license.php)
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#else /* !HAVE_STDARG_H */
-# error Not enough var arg support!
-#endif /* HAVE_STDARG_H */
+#include <stdarg.h>
#include "debug.h"
#include "printbuf.h"
*/
#include <stdio.h>
-#include "config.h"
#include "random_seed.h"
#define DEBUG_SEED(s)
-
#if defined ENABLE_RDRAND
/* cpuid */
#ifndef __strdup_compat_h
#define __strdup_compat_h
-#if !defined(HAVE_STRDUP) && defined(_MSC_VER)
- /* MSC has the version as _strdup */
-# define strdup _strdup
-#elif !defined(HAVE_STRDUP)
-# error You do not have strdup on your system.
-#endif /* HAVE_STRDUP */
-
#endif
#ifndef __vasprintf_compat_h
#define __vasprintf_compat_h
-#if !defined(HAVE_VSNPRINTF) && defined(_MSC_VER)
-# define vsnprintf _vsnprintf
-#elif !defined(HAVE_VSNPRINTF) /* !HAVE_VSNPRINTF */
-# error Need vsnprintf!
-#endif /* !HAVE_VSNPRINTF && defined(WIN32) */
-
-#if !defined(HAVE_VASPRINTF)
-/* CAW: compliant version of vasprintf */
-static int vasprintf(char **buf, const char *fmt, va_list ap)
-{
-#ifndef WIN32
- static char _T_emptybuffer = '\0';
-#endif /* !defined(WIN32) */
- int chars;
- char *b;
-
- if(!buf) { return -1; }
-
-#ifdef WIN32
- chars = _vscprintf(fmt, ap)+1;
-#else /* !defined(WIN32) */
- /* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite
- our buffer like on some 64bit sun systems.... but hey, its time to move on */
- chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap)+1;
- if(chars < 0) { chars *= -1; } /* CAW: old glibc versions have this problem */
-#endif /* defined(WIN32) */
-
- b = (char*)malloc(sizeof(char)*chars);
- if(!b) { return -1; }
-
- if((chars = vsprintf(b, fmt, ap)) < 0)
- {
- free(b);
- } else {
- *buf = b;
- }
-
- return chars;
-}
-#endif /* !HAVE_VASPRINTF */
+#include <stdarg.h>
#endif /* __vasprintf_compat_h */
case DRM_FORMAT_YVYU:
return 1;
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_Y_TILED_INTEL:
return 2;
case DRM_FORMAT_YVU420:
return 3;
}
format_ = bo.format;
+ if (format_ == DRM_FORMAT_NV12_Y_TILED_INTEL)
+ format_ = DRM_FORMAT_NV12;
+
prime_fd_ = bo.prime_fd;
usage_ = bo.usage;
if (usage_ & hwcomposer::kLayerCursor) {