summaryrefslogtreecommitdiffstats
path: root/exynos3
diff options
context:
space:
mode:
authorPetr Havlena <havlenapetr@gmail.com>2012-10-26 17:52:00 +0530
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-11-16 05:12:27 -0800
commit1386f44a87281ecfb0309fc7b6ba00209cd7c05f (patch)
treebaf257ad0a77d6c10b73032f686a47918fb350bf /exynos3
parent41b00c3b143ef1dfdd4704fa2154ad5fd0385fbf (diff)
downloadandroid_hardware_samsung-1386f44a87281ecfb0309fc7b6ba00209cd7c05f.tar.gz
android_hardware_samsung-1386f44a87281ecfb0309fc7b6ba00209cd7c05f.tar.bz2
android_hardware_samsung-1386f44a87281ecfb0309fc7b6ba00209cd7c05f.zip
exynos3: hwc: add hdmi support
Change-Id: I9def46f17fc2b3042af776b253ac3441fd6d3405
Diffstat (limited to 'exynos3')
-rw-r--r--exynos3/s5pc110/include/hardware/hdmi.h58
-rw-r--r--exynos3/s5pc110/libhwcomposer/Android.mk6
-rw-r--r--exynos3/s5pc110/libhwcomposer/SecHWC.cpp57
-rw-r--r--exynos3/s5pc110/libhwcomposer/SecHWCUtils.h6
4 files changed, 124 insertions, 3 deletions
diff --git a/exynos3/s5pc110/include/hardware/hdmi.h b/exynos3/s5pc110/include/hardware/hdmi.h
new file mode 100644
index 0000000..c8e3209
--- /dev/null
+++ b/exynos3/s5pc110/include/hardware/hdmi.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HDMI_INTERFACE_H
+#define ANDROID_HDMI_INTERFACE_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <hardware/hardware.h>
+
+__BEGIN_DECLS
+
+/**
+ * The id of this module
+ */
+#define HDMI_HARDWARE_MODULE_ID "hdmi"
+
+enum {
+ HDMI_MODE_NONE = 0,
+ HDMI_MODE_UI,
+ HDMI_MODE_VIDEO,
+};
+
+struct hdmi_device_t {
+ struct hw_device_t common;
+
+ int (*connect)(struct hdmi_device_t* dev);
+
+ int (*disconnect)(struct hdmi_device_t* dev);
+
+ int (*clear) (struct hdmi_device_t* dev, int hdmiLayer);
+
+ int (*blit)(struct hdmi_device_t* dev, int srcW, int srcH, int srcColorFormat,
+ uint32_t srcYAddr, uint32_t srcCbAddr, uint32_t srcCrAddr,
+ int dstX, int dstY,
+ int layer,
+ int num_of_hwc_layer);
+};
+
+
+__END_DECLS
+
+#endif // ANDROID_HDMI_INTERFACE_H
diff --git a/exynos3/s5pc110/libhwcomposer/Android.mk b/exynos3/s5pc110/libhwcomposer/Android.mk
index a058145..88dced3 100644
--- a/exynos3/s5pc110/libhwcomposer/Android.mk
+++ b/exynos3/s5pc110/libhwcomposer/Android.mk
@@ -20,7 +20,11 @@ include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libGLESv1_CM libhardware libhardware_legacy
-LOCAL_CFLAGS += -DLOG_TAG=\"hwcomposer\"
+
+LOCAL_CFLAGS := -DLOG_TAG=\"hwcomposer\"
+ifeq ($(BOARD_USES_HDMI),true)
+ LOCAL_CFLAGS += -DBOARD_USES_HDMI
+endif
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../include
diff --git a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
index 31d25f4..f8a3d1a 100644
--- a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
+++ b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
@@ -79,9 +79,9 @@ static int set_src_dst_info(hwc_layer_t *cur,
src_img->w = prev_handle->iWidth;
src_img->h = prev_handle->iHeight;
src_img->format = prev_handle->iFormat;
- src_img->base = NULL;
+ src_img->base = 0;
src_img->offset = 0;
- src_img->mem_id =0;
+ src_img->mem_id = 0;
src_img->mem_type = HWC_PHYS_MEM_TYPE;
src_img->w = (src_img->w + 15) & (~15);
@@ -422,6 +422,42 @@ static int hwc_set(hwc_composer_device_t *dev,
}
}
+#if defined(BOARD_USES_HDMI)
+ hdmi_device_t* hdmi = ctx->hdmi;
+ if (ctx->num_of_hwc_layer == 1 && hdmi) {
+ if ((src_img.format == HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED)||
+ (src_img.format == HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP)) {
+ ADDRS * addr = (ADDRS *)(src_img.base);
+ hdmi->blit(hdmi,
+ src_img.w,
+ src_img.h,
+ src_img.format,
+ (unsigned int)addr->addr_y,
+ (unsigned int)addr->addr_cbcr,
+ (unsigned int)addr->addr_cbcr,
+ 0, 0,
+ HDMI_MODE_VIDEO,
+ ctx->num_of_hwc_layer);
+ } else if ((src_img.format == HAL_PIXEL_FORMAT_YCbCr_420_SP) ||
+ (src_img.format == HAL_PIXEL_FORMAT_YCrCb_420_SP) ||
+ (src_img.format == HAL_PIXEL_FORMAT_YCbCr_420_P) ||
+ (src_img.format == HAL_PIXEL_FORMAT_YV12)) {
+ hdmi->blit(hdmi,
+ src_img.w,
+ src_img.h,
+ src_img.format,
+ (unsigned int)ctx->fimc.params.src.buf_addr_phy_rgb_y,
+ (unsigned int)ctx->fimc.params.src.buf_addr_phy_cb,
+ (unsigned int)ctx->fimc.params.src.buf_addr_phy_cr,
+ 0, 0,
+ HDMI_MODE_VIDEO,
+ ctx->num_of_hwc_layer);
+ } else {
+ ALOGE("%s: Unsupported format = %d for hdmi", __func__, src_img.format);
+ }
+ }
+#endif
+
return 0;
}
@@ -606,6 +642,9 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
int status = 0;
int err;
struct hwc_win_info_t *win;
+#if defined(BOARD_USES_HDMI)
+ struct hw_module_t *hdmi_module;
+#endif
if(hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
(const hw_module_t**)&gpsGrallocModule))
@@ -637,6 +676,20 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
*device = &dev->device.common;
+#if defined(BOARD_USES_HDMI)
+ dev->hdmi = NULL;
+ if(hw_get_module(HDMI_HARDWARE_MODULE_ID,
+ (const hw_module_t**)&hdmi_module)) {
+ ALOGE("%s:: HDMI device not present", __func__);
+ } else {
+ int ret = module->methods->open(hdmi_module, "hdmi-composer",
+ (hw_device_t **)&dev->hdmi);
+ if(ret < 0) {
+ ALOGE("%s:: Failed to open hdmi device : %s", __func__, strerror(ret));
+ }
+ }
+#endif
+
/* initializing */
memset(&(dev->fimc), 0, sizeof(s5p_fimc_t));
dev->fimc.dev_fd = -1;
diff --git a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
index d59c120..ac81c0b 100644
--- a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
+++ b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
@@ -37,6 +37,9 @@
#include <hardware/gralloc.h>
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
+#if defined(BOARD_USES_HDMI)
+#include "hardware/hdmi.h"
+#endif
#include "s5p_fimc.h"
#include "sec_lcd.h"
@@ -121,6 +124,9 @@ struct hwc_context_t {
unsigned int num_of_fb_layer;
unsigned int num_of_hwc_layer;
unsigned int num_of_fb_layer_prev;
+#if defined(BOARD_USES_HDMI)
+ hdmi_device_t* hdmi;
+#endif
};
int window_open(struct hwc_win_info_t *win, int id);