Merge "hwc: Add MetaData support in overlay path."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
f77af57636
@@ -12,10 +12,13 @@ ifeq ($(TARGET_USES_POST_PROCESSING),true)
|
||||
common_includes += $(TARGET_OUT_HEADERS)/pp/inc
|
||||
endif
|
||||
|
||||
|
||||
#Common libraries external to display HAL
|
||||
common_libs := liblog libutils libcutils libhardware
|
||||
|
||||
ifeq ($(TARGET_USES_POST_PROCESSING),true)
|
||||
common_libs += libmm-abl
|
||||
endif
|
||||
|
||||
#Common C flags
|
||||
common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
|
||||
common_flags += -Werror
|
||||
|
||||
@@ -605,6 +605,13 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
||||
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_FLIP_V);
|
||||
}
|
||||
}
|
||||
|
||||
if(metadata &&
|
||||
((metadata->operation & PP_PARAM_HSIC)
|
||||
|| (metadata->operation & PP_PARAM_IGC)
|
||||
|| (metadata->operation & PP_PARAM_SHARP2))) {
|
||||
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_PP_EN);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int configRotator(Rotator *rot, const Whf& whf,
|
||||
@@ -620,7 +627,8 @@ static inline int configRotator(Rotator *rot, const Whf& whf,
|
||||
|
||||
static inline int configMdp(Overlay *ov, const PipeArgs& parg,
|
||||
const eTransform& orient, const hwc_rect_t& crop,
|
||||
const hwc_rect_t& pos, const eDest& dest) {
|
||||
const hwc_rect_t& pos, const MetaData_t *metadata,
|
||||
const eDest& dest) {
|
||||
ov->setSource(parg, dest);
|
||||
ov->setTransform(orient, dest);
|
||||
|
||||
@@ -634,6 +642,9 @@ static inline int configMdp(Overlay *ov, const PipeArgs& parg,
|
||||
Dim position(pos.left, pos.top, posW, posH);
|
||||
ov->setPosition(position, dest);
|
||||
|
||||
if (metadata)
|
||||
ov->setVisualParams(*metadata, dest);
|
||||
|
||||
if (!ov->commit(dest)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -665,6 +676,8 @@ int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
return -1;
|
||||
}
|
||||
|
||||
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
|
||||
|
||||
hwc_rect_t crop = layer->sourceCrop;
|
||||
hwc_rect_t dst = layer->displayFrame;
|
||||
int transform = layer->transform;
|
||||
@@ -706,7 +719,7 @@ int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
transform = 0;
|
||||
|
||||
PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(rotFlags));
|
||||
if(configMdp(ctx->mOverlay, parg, orient, crop, dst, dest) < 0) {
|
||||
if(configMdp(ctx->mOverlay, parg, orient, crop, dst, metadata, dest) < 0) {
|
||||
ALOGE("%s: commit failed for low res panel", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
@@ -723,6 +736,8 @@ int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
return -1;
|
||||
}
|
||||
|
||||
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
|
||||
|
||||
int hw_w = ctx->dpyAttr[dpy].xres;
|
||||
int hw_h = ctx->dpyAttr[dpy].yres;
|
||||
hwc_rect_t crop = layer->sourceCrop;
|
||||
@@ -798,7 +813,7 @@ int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
PipeArgs pargL(mdpFlagsL, whf, z, isFg,
|
||||
static_cast<eRotFlags>(rotFlags));
|
||||
if(configMdp(ctx->mOverlay, pargL, orient,
|
||||
tmp_cropL, tmp_dstL, lDest) < 0) {
|
||||
tmp_cropL, tmp_dstL, metadata, lDest) < 0) {
|
||||
ALOGE("%s: commit failed for left mixer config", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
@@ -811,7 +826,7 @@ int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
tmp_dstR.right = tmp_dstR.right - tmp_dstR.left;
|
||||
tmp_dstR.left = 0;
|
||||
if(configMdp(ctx->mOverlay, pargR, orient,
|
||||
tmp_cropR, tmp_dstR, rDest) < 0) {
|
||||
tmp_cropR, tmp_dstR, metadata, rDest) < 0) {
|
||||
ALOGE("%s: commit failed for right mixer config", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "overlay.h"
|
||||
#include "pipes/overlayGenPipe.h"
|
||||
#include "mdp_version.h"
|
||||
#include "qdMetaData.h"
|
||||
|
||||
#define PIPE_DEBUG 0
|
||||
|
||||
@@ -194,6 +195,12 @@ void Overlay::setSource(const utils::PipeArgs args,
|
||||
mPipeBook[index].mPipe->setSource(newArgs);
|
||||
}
|
||||
|
||||
void Overlay::setVisualParams(const MetaData_t& metadata, utils::eDest dest) {
|
||||
int index = (int)dest;
|
||||
validate(index);
|
||||
mPipeBook[index].mPipe->setVisualParams(metadata);
|
||||
}
|
||||
|
||||
Overlay* Overlay::getInstance() {
|
||||
if(sInstance == NULL) {
|
||||
sInstance = new Overlay();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "overlayUtils.h"
|
||||
#include "utils/threads.h"
|
||||
|
||||
struct MetaData_t;
|
||||
|
||||
namespace overlay {
|
||||
class GenericPipe;
|
||||
|
||||
@@ -64,6 +66,7 @@ public:
|
||||
void setCrop(const utils::Dim& d, utils::eDest dest);
|
||||
void setTransform(const int orientation, utils::eDest dest);
|
||||
void setPosition(const utils::Dim& dim, utils::eDest dest);
|
||||
void setVisualParams(const MetaData_t& data, utils::eDest dest);
|
||||
bool commit(utils::eDest dest);
|
||||
bool queueBuffer(int fd, uint32_t offset, utils::eDest dest);
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
void setTransform(const utils::eTransform& p);
|
||||
/* set mdp position using dim */
|
||||
void setPosition(const utils::Dim& dim);
|
||||
/* set mdp visual params using metadata */
|
||||
bool setVisualParams(const MetaData_t &metadata);
|
||||
/* mdp set overlay/commit changes */
|
||||
bool commit();
|
||||
|
||||
@@ -171,6 +173,15 @@ inline void Ctrl::setCrop(const utils::Dim& d)
|
||||
mMdp.setCrop(d);
|
||||
}
|
||||
|
||||
inline bool Ctrl::setVisualParams(const MetaData_t &metadata)
|
||||
{
|
||||
if (!mMdp.setVisualParams(metadata)) {
|
||||
ALOGE("Ctrl setVisualParams failed in MDP setVisualParams");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void Ctrl::dump() const {
|
||||
ALOGE("== Dump Ctrl start ==");
|
||||
mMdp.dump();
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
#include <mdp_version.h>
|
||||
#include "overlayUtils.h"
|
||||
#include "overlayMdp.h"
|
||||
#include "mdp_version.h"
|
||||
|
||||
#define HSIC_SETTINGS_DEBUG 0
|
||||
|
||||
static inline bool isEqual(float f1, float f2) {
|
||||
return ((int)(f1*100) == (int)(f2*100)) ? true : false;
|
||||
}
|
||||
|
||||
namespace ovutils = overlay::utils;
|
||||
namespace overlay {
|
||||
@@ -53,6 +60,15 @@ void MdpCtrl::reset() {
|
||||
mLkgo.id = MSMFB_NEW_REQUEST;
|
||||
mOrientation = utils::OVERLAY_TRANSFORM_0;
|
||||
mDownscale = 0;
|
||||
#ifdef USES_POST_PROCESSING
|
||||
mPPChanged = false;
|
||||
memset(&mParams, 0, sizeof(struct compute_params));
|
||||
mParams.params.conv_params.order = hsic_order_hsc_i;
|
||||
mParams.params.conv_params.interface = interface_rec601;
|
||||
mParams.params.conv_params.cc_matrix[0][0] = 1;
|
||||
mParams.params.conv_params.cc_matrix[1][1] = 1;
|
||||
mParams.params.conv_params.cc_matrix[2][2] = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MdpCtrl::close() {
|
||||
@@ -63,7 +79,11 @@ bool MdpCtrl::close() {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USES_POST_PROCESSING
|
||||
/* free allocated memory in PP */
|
||||
if (mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data)
|
||||
free(mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data);
|
||||
#endif
|
||||
reset();
|
||||
|
||||
if(!mFd.close()) {
|
||||
@@ -191,4 +211,120 @@ void MdpCtrl3D::dump() const {
|
||||
ALOGE("== Dump MdpCtrl end ==");
|
||||
}
|
||||
|
||||
bool MdpCtrl::setVisualParams(const MetaData_t& data) {
|
||||
bool needUpdate = false;
|
||||
#ifdef USES_POST_PROCESSING
|
||||
/* calculate the data */
|
||||
if (data.operation & PP_PARAM_HSIC) {
|
||||
if (mParams.params.pa_params.hue != data.hsicData.hue) {
|
||||
ALOGD_IF(HSIC_SETTINGS_DEBUG,
|
||||
"Hue has changed from %d to %d",
|
||||
mParams.params.pa_params.hue,data.hsicData.hue);
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (!isEqual(mParams.params.pa_params.sat,
|
||||
data.hsicData.saturation)) {
|
||||
ALOGD_IF(HSIC_SETTINGS_DEBUG,
|
||||
"Saturation has changed from %f to %f",
|
||||
mParams.params.pa_params.sat,
|
||||
data.hsicData.saturation);
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (mParams.params.pa_params.intensity != data.hsicData.intensity) {
|
||||
ALOGD_IF(HSIC_SETTINGS_DEBUG,
|
||||
"Intensity has changed from %d to %d",
|
||||
mParams.params.pa_params.intensity,
|
||||
data.hsicData.intensity);
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (!isEqual(mParams.params.pa_params.contrast,
|
||||
data.hsicData.contrast)) {
|
||||
ALOGD_IF(HSIC_SETTINGS_DEBUG,
|
||||
"Contrast has changed from %f to %f",
|
||||
mParams.params.pa_params.contrast,
|
||||
data.hsicData.contrast);
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (needUpdate) {
|
||||
mParams.params.pa_params.hue = data.hsicData.hue;
|
||||
mParams.params.pa_params.sat = data.hsicData.saturation;
|
||||
mParams.params.pa_params.intensity = data.hsicData.intensity;
|
||||
mParams.params.pa_params.contrast = data.hsicData.contrast;
|
||||
mParams.params.pa_params.ops = MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
|
||||
mParams.operation |= PP_OP_PA;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.operation & PP_PARAM_SHARP2) {
|
||||
if (mParams.params.sharp_params.strength != data.Sharp2Data.strength) {
|
||||
needUpdate = true;
|
||||
}
|
||||
if (mParams.params.sharp_params.edge_thr != data.Sharp2Data.edge_thr) {
|
||||
needUpdate = true;
|
||||
}
|
||||
if (mParams.params.sharp_params.smooth_thr !=
|
||||
data.Sharp2Data.smooth_thr) {
|
||||
needUpdate = true;
|
||||
}
|
||||
if (mParams.params.sharp_params.noise_thr !=
|
||||
data.Sharp2Data.noise_thr) {
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (needUpdate) {
|
||||
mParams.params.sharp_params.strength = data.Sharp2Data.strength;
|
||||
mParams.params.sharp_params.edge_thr = data.Sharp2Data.edge_thr;
|
||||
mParams.params.sharp_params.smooth_thr =
|
||||
data.Sharp2Data.smooth_thr;
|
||||
mParams.params.sharp_params.noise_thr = data.Sharp2Data.noise_thr;
|
||||
mParams.params.sharp_params.ops =
|
||||
MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
|
||||
mParams.operation |= PP_OP_SHARP;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.operation & PP_PARAM_IGC) {
|
||||
if (mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data == NULL){
|
||||
uint32_t *igcData
|
||||
= (uint32_t *)malloc(2 * MAX_IGC_LUT_ENTRIES * sizeof(uint32_t));
|
||||
if (!igcData) {
|
||||
ALOGE("IGC storage allocated failed");
|
||||
return false;
|
||||
}
|
||||
mOVInfo.overlay_pp_cfg.igc_cfg.c0_c1_data = igcData;
|
||||
mOVInfo.overlay_pp_cfg.igc_cfg.c2_data
|
||||
= igcData + MAX_IGC_LUT_ENTRIES;
|
||||
}
|
||||
|
||||
memcpy(mParams.params.igc_lut_params.c0,
|
||||
data.igcData.c0, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
|
||||
memcpy(mParams.params.igc_lut_params.c1,
|
||||
data.igcData.c1, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
|
||||
memcpy(mParams.params.igc_lut_params.c2,
|
||||
data.igcData.c2, sizeof(uint16_t) * MAX_IGC_LUT_ENTRIES);
|
||||
|
||||
mParams.params.igc_lut_params.ops
|
||||
= MDP_PP_OPS_WRITE | MDP_PP_OPS_ENABLE;
|
||||
mParams.operation |= PP_OP_IGC;
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (data.operation & PP_PARAM_VID_INTFC) {
|
||||
mParams.params.conv_params.interface =
|
||||
(interface_type) data.video_interface;
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if (needUpdate) {
|
||||
display_pp_compute_params(&mParams, &mOVInfo.overlay_pp_cfg);
|
||||
mPPChanged = true;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // overlay
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include "overlayUtils.h"
|
||||
#include "mdpWrapper.h"
|
||||
#include "qdMetaData.h"
|
||||
#ifdef USES_POST_PROCESSING
|
||||
#include "lib-postproc.h"
|
||||
#endif
|
||||
|
||||
namespace overlay{
|
||||
|
||||
@@ -75,6 +79,8 @@ public:
|
||||
utils::Dim getDstRectDim() const;
|
||||
/* returns a copy to src rect dim */
|
||||
utils::Dim getSrcRectDim() const;
|
||||
/* setVisualParam */
|
||||
bool setVisualParams(const MetaData_t& data);
|
||||
|
||||
private:
|
||||
/* Perform transformation calculations */
|
||||
@@ -119,6 +125,12 @@ private:
|
||||
/* FD for the mdp fbnum */
|
||||
OvFD mFd;
|
||||
int mDownscale;
|
||||
#ifdef USES_POST_PROCESSING
|
||||
/* PP Compute Params */
|
||||
struct compute_params mParams;
|
||||
/* indicate if PP params have been changed */
|
||||
bool mPPChanged;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -227,6 +239,13 @@ inline void MdpCtrl::setDownscale(int dscale) {
|
||||
}
|
||||
|
||||
inline bool MdpCtrl::ovChanged() const {
|
||||
#ifdef USES_POST_PROCESSING
|
||||
// Some pp params are stored as pointer address,
|
||||
// so can't compare their content directly.
|
||||
if (mPPChanged) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// 0 means same
|
||||
if(0 == ::memcmp(&mOVInfo, &mLkgo, sizeof (mdp_overlay))) {
|
||||
return false;
|
||||
|
||||
@@ -261,6 +261,7 @@ enum eMdpFlags {
|
||||
OV_MDP_FLIP_H = MDP_FLIP_LR,
|
||||
OV_MDP_FLIP_V = MDP_FLIP_UD,
|
||||
OV_MDSS_MDP_RIGHT_MIXER = MDSS_MDP_RIGHT_MIXER,
|
||||
OV_MDP_PP_EN = MDP_OVERLAY_PP_CFG_EN,
|
||||
};
|
||||
|
||||
enum eZorder {
|
||||
|
||||
@@ -115,6 +115,11 @@ void GenericPipe::setPosition(const utils::Dim& d) {
|
||||
mCtrlData.ctrl.setPosition(d);
|
||||
}
|
||||
|
||||
bool GenericPipe::setVisualParams(const MetaData_t &metadata)
|
||||
{
|
||||
return mCtrlData.ctrl.setVisualParams(metadata);
|
||||
}
|
||||
|
||||
bool GenericPipe::commit() {
|
||||
bool ret = false;
|
||||
int downscale_factor = utils::ROT_DS_NONE;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
namespace overlay {
|
||||
|
||||
|
||||
class GenericPipe : utils::NoCopy {
|
||||
public:
|
||||
/* ctor */
|
||||
@@ -54,6 +53,8 @@ public:
|
||||
void setTransform(const utils::eTransform& param);
|
||||
/* set mdp posision using dim */
|
||||
void setPosition(const utils::Dim& dim);
|
||||
/* set visual param */
|
||||
bool setVisualParams(const MetaData_t &metadata);
|
||||
/* commit changes to the overlay "set"*/
|
||||
bool commit();
|
||||
/* Data APIs */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
@@ -43,6 +43,10 @@ int setMetaData(private_handle_t *handle, DispParamType paramType,
|
||||
ALOGE("%s: Bad fd for extra data!", __func__);
|
||||
return -1;
|
||||
}
|
||||
if (!param) {
|
||||
ALOGE("%s: input param is null!", __func__);
|
||||
return -1;
|
||||
}
|
||||
unsigned long size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
|
||||
void *base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||
handle->fd_metadata, 0);
|
||||
@@ -65,6 +69,12 @@ int setMetaData(private_handle_t *handle, DispParamType paramType,
|
||||
case PP_PARAM_INTERLACED:
|
||||
data->interlaced = *((int32_t *)param);
|
||||
break;
|
||||
case PP_PARAM_IGC:
|
||||
memcpy((void *)&data->igcData, param, sizeof(IGCData_t));
|
||||
break;
|
||||
case PP_PARAM_SHARP2:
|
||||
memcpy((void *)&data->Sharp2Data, param, sizeof(Sharp2Data_t));
|
||||
break;
|
||||
default:
|
||||
ALOGE("Unknown paramType %d", paramType);
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
@@ -30,27 +30,45 @@
|
||||
#ifndef _QDMETADATA_H
|
||||
#define _QDMETADATA_H
|
||||
|
||||
#define MAX_IGC_LUT_ENTRIES 256
|
||||
|
||||
typedef struct {
|
||||
struct HSICData_t {
|
||||
int32_t hue;
|
||||
float saturation;
|
||||
int32_t intensity;
|
||||
float contrast;
|
||||
} HSICData_t;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct Sharp2Data_t {
|
||||
int32_t strength;
|
||||
uint32_t edge_thr;
|
||||
uint32_t smooth_thr;
|
||||
uint32_t noise_thr;
|
||||
};
|
||||
|
||||
struct IGCData_t{
|
||||
uint16_t c0[MAX_IGC_LUT_ENTRIES];
|
||||
uint16_t c1[MAX_IGC_LUT_ENTRIES];
|
||||
uint16_t c2[MAX_IGC_LUT_ENTRIES];
|
||||
};
|
||||
|
||||
struct MetaData_t {
|
||||
int32_t operation;
|
||||
int32_t interlaced;
|
||||
HSICData_t hsicData;
|
||||
int32_t sharpness;
|
||||
int32_t video_interface;
|
||||
} MetaData_t;
|
||||
IGCData_t igcData;
|
||||
Sharp2Data_t Sharp2Data;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
PP_PARAM_HSIC = 0x0001,
|
||||
PP_PARAM_SHARPNESS = 0x0002,
|
||||
PP_PARAM_INTERLACED = 0x0004,
|
||||
PP_PARAM_VID_INTFC = 0x0008
|
||||
PP_PARAM_VID_INTFC = 0x0008,
|
||||
PP_PARAM_IGC = 0x0010,
|
||||
PP_PARAM_SHARP2 = 0x0020,
|
||||
} DispParamType;
|
||||
|
||||
int setMetaData(private_handle_t *handle, DispParamType paramType, void *param);
|
||||
|
||||
Reference in New Issue
Block a user