Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1386f44a authored by Petr Havlena's avatar Petr Havlena Committed by Gerrit Code Review
Browse files

exynos3: hwc: add hdmi support

Change-Id: I9def46f17fc2b3042af776b253ac3441fd6d3405
parent 41b00c3b
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
/*
 * 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
+5 −1
Original line number Diff line number Diff line
@@ -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
+55 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ 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;

@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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);