Skip to content

Commit

Permalink
exynos3: hwc: add hdmi support
Browse files Browse the repository at this point in the history
Change-Id: I9def46f17fc2b3042af776b253ac3441fd6d3405
  • Loading branch information
havlenapetr authored and Gerrit Code Review committed Nov 16, 2012
1 parent 41b00c3 commit 1386f44
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 3 deletions.
58 changes: 58 additions & 0 deletions exynos3/s5pc110/include/hardware/hdmi.h
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion exynos3/s5pc110/libhwcomposer/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 55 additions & 2 deletions exynos3/s5pc110/libhwcomposer/SecHWC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

This comment has been minimized.

Copy link
@trajano

trajano Nov 17, 2012

would this pointer change? should it not have a "const"

};

int window_open(struct hwc_win_info_t *win, int id);
Expand Down

1 comment on commit 1386f44

@wypiki
Copy link

@wypiki wypiki commented on 1386f44 Nov 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Video decoding still falls back to software mode, when HDMI is connected. Isn't it possible to get the source of the hdmi-hwcomposer from TeamOvercome or from anywhere else?

Please sign in to comment.