Merge "hwc: Support for reading FB format from driver"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
2ce22c9b76
@@ -13,11 +13,14 @@ LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay \
|
||||
libdl libmemalloc libqservice libsync \
|
||||
libbinder libmedia
|
||||
|
||||
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdhwcomposer\"
|
||||
ifeq ($(TARGET_USES_QCOM_BSP),true)
|
||||
LOCAL_SHARED_LIBRARIES += libskia
|
||||
ifeq ($(GET_FRAMEBUFFER_FORMAT_FROM_HWC),true)
|
||||
LOCAL_CFLAGS += -DGET_FRAMEBUFFER_FORMAT_FROM_HWC
|
||||
endif
|
||||
endif #TARGET_USES_QCOM_BSP
|
||||
|
||||
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdhwcomposer\"
|
||||
#Enable Dynamic FPS if PHASE_OFFSET is not set
|
||||
ifeq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
|
||||
LOCAL_CFLAGS += -DDYNAMIC_FPS
|
||||
|
||||
@@ -836,6 +836,9 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
|
||||
HWC_DISPLAY_DPI_X,
|
||||
HWC_DISPLAY_DPI_Y,
|
||||
HWC_DISPLAY_SECURE,
|
||||
#ifdef GET_FRAMEBUFFER_FORMAT_FROM_HWC
|
||||
HWC_DISPLAY_FBFORMAT,
|
||||
#endif
|
||||
HWC_DISPLAY_NO_ATTRIBUTE,
|
||||
};
|
||||
|
||||
@@ -886,6 +889,11 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
|
||||
case HWC_DISPLAY_SECURE:
|
||||
values[i] = (int32_t) (ctx->dpyAttr[disp].secure);
|
||||
break;
|
||||
#ifdef GET_FRAMEBUFFER_FORMAT_FROM_HWC
|
||||
case HWC_DISPLAY_FBFORMAT:
|
||||
values[i] = ctx->dpyAttr[disp].fbformat;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ALOGE("Unknown display attribute %d",
|
||||
attributes[i]);
|
||||
|
||||
@@ -54,7 +54,7 @@ IFBUpdate::IFBUpdate(hwc_context_t *ctx, const int& dpy) : mDpy(dpy) {
|
||||
yres = ctx->dpyAttr[mDpy].yresFB;
|
||||
}
|
||||
getBufferAttributes((int)xres, (int)yres,
|
||||
HAL_PIXEL_FORMAT_RGBA_8888,
|
||||
ctx->dpyAttr[mDpy].fbformat,
|
||||
0,
|
||||
mAlignedFBWidth,
|
||||
mAlignedFBHeight,
|
||||
@@ -134,7 +134,7 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis
|
||||
int flags = mTileEnabled ?
|
||||
private_handle_t::PRIV_FLAGS_TILE_RENDERED : 0;
|
||||
ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight,
|
||||
ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888, flags));
|
||||
ovutils::getMdpFormat(ctx->dpyAttr[mDpy].fbformat, flags));
|
||||
|
||||
Overlay::PipeSpecs pipeSpecs;
|
||||
pipeSpecs.formatClass = Overlay::FORMAT_RGB;
|
||||
|
||||
@@ -1123,8 +1123,8 @@ bool MDPComp::fullMDPCompWithPTOR(hwc_context_t *ctx,
|
||||
|
||||
bool MDPComp::partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list)
|
||||
{
|
||||
if(!sEnableMixedMode) {
|
||||
//Mixed mode is disabled. No need to even try caching.
|
||||
if(!sEnableMixedMode || !isAlphaPresentinFB(ctx, mDpy)) {
|
||||
//Mixed mode is disabled/can't be used. No need to even try caching.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,32 @@ namespace qhwc {
|
||||
// Std refresh rates for digital videos- 24p, 30p, 48p and 60p
|
||||
uint32_t stdRefreshRates[] = { 30, 24, 48, 60 };
|
||||
|
||||
static uint32_t getFBformat(fb_var_screeninfo vinfo) {
|
||||
uint32_t fbformat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
|
||||
#ifdef GET_FRAMEBUFFER_FORMAT_FROM_HWC
|
||||
// Here, we are adding the formats that are supported by both GPU and MDP.
|
||||
// The formats that fall in this category are RGBA_8888, RGB_565, RGB_888
|
||||
switch(vinfo.bits_per_pixel) {
|
||||
case 16:
|
||||
fbformat = HAL_PIXEL_FORMAT_RGB_565;
|
||||
break;
|
||||
case 24:
|
||||
if ((vinfo.transp.offset == 0) && (vinfo.transp.length == 0))
|
||||
fbformat = HAL_PIXEL_FORMAT_RGB_888;
|
||||
break;
|
||||
case 32:
|
||||
if ((vinfo.red.offset == 0) && (vinfo.green.offset == 8) &&
|
||||
(vinfo.blue.offset == 16) && (vinfo.transp.offset == 24))
|
||||
fbformat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
break;
|
||||
default:
|
||||
fbformat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
}
|
||||
#endif
|
||||
return fbformat;
|
||||
}
|
||||
|
||||
bool isValidResolution(hwc_context_t *ctx, uint32_t xres, uint32_t yres)
|
||||
{
|
||||
return !((xres > qdutils::MDPVersion::getInstance().getMaxPipeWidth() &&
|
||||
@@ -130,6 +156,14 @@ static void handleFbScaling(hwc_context_t *ctx, int xresPanel, int yresPanel,
|
||||
// Initialize hdmi display attributes based on
|
||||
// hdmi display class state
|
||||
void updateDisplayInfo(hwc_context_t* ctx, int dpy) {
|
||||
struct fb_var_screeninfo info;
|
||||
|
||||
if (ioctl(ctx->mHDMIDisplay->getFd(), FBIOGET_VSCREENINFO, &info) == -1) {
|
||||
ALOGE("%s:Error in ioctl FBIOGET_VSCREENINFO: %s",
|
||||
__FUNCTION__, strerror(errno));
|
||||
}
|
||||
|
||||
ctx->dpyAttr[dpy].fbformat = getFBformat(info);
|
||||
ctx->dpyAttr[dpy].fd = ctx->mHDMIDisplay->getFd();
|
||||
ctx->dpyAttr[dpy].xres = ctx->mHDMIDisplay->getWidth();
|
||||
ctx->dpyAttr[dpy].yres = ctx->mHDMIDisplay->getHeight();
|
||||
@@ -238,6 +272,7 @@ static int openFramebufferDevice(hwc_context_t *ctx)
|
||||
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].secure = true;
|
||||
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period =
|
||||
(uint32_t)(1000000000l / fps);
|
||||
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fbformat = getFBformat(info);
|
||||
|
||||
handleFbScaling(ctx, info.xres, info.yres, info.width, info.height);
|
||||
|
||||
@@ -992,6 +1027,16 @@ bool isAlphaPresent(hwc_layer_1_t const* layer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isAlphaPresentinFB(hwc_context_t *ctx, int dpy) {
|
||||
switch(ctx->dpyAttr[dpy].fbformat) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
return true;
|
||||
default : return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void trimLayer(hwc_context_t *ctx, const int& dpy, const int& transform,
|
||||
hwc_rect_t& crop, hwc_rect_t& dst) {
|
||||
int hw_w = ctx->dpyAttr[dpy].xres;
|
||||
|
||||
@@ -91,6 +91,7 @@ struct DisplayAttributes {
|
||||
float xdpi;
|
||||
float ydpi;
|
||||
bool secure;
|
||||
uint32_t fbformat;
|
||||
int fd;
|
||||
bool connected; //Applies only to pluggable disp.
|
||||
//Connected does not mean it ready to use.
|
||||
@@ -307,6 +308,7 @@ bool needsScalingWithSplit(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
||||
void sanitizeSourceCrop(hwc_rect_t& cropL, hwc_rect_t& cropR,
|
||||
private_handle_t *hnd);
|
||||
bool isAlphaPresent(hwc_layer_1_t const* layer);
|
||||
bool isAlphaPresentinFB(hwc_context_t* ctx, int dpy);
|
||||
int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable);
|
||||
int getBlending(int blending);
|
||||
bool isGLESOnlyComp(hwc_context_t *ctx, const int& dpy);
|
||||
|
||||
@@ -90,6 +90,7 @@ int HWCVirtualVDS::prepare(hwc_composer_device_1 *dev,
|
||||
// it up to the consumer to decide how fast to consume frames.
|
||||
ctx->dpyAttr[dpy].vsync_period
|
||||
= ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period;
|
||||
ctx->dpyAttr[dpy].fbformat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
init(ctx);
|
||||
// Do one padding round for cases where primary has all pipes
|
||||
// The virtual composition falls back to GPU in such cases.
|
||||
|
||||
Reference in New Issue
Block a user