#include "DisplayHardware/FramebufferSurface.h"
#include "DisplayHardware/HWComposer.h"
+#include "ExSurfaceFlinger/ExHWComposer.h"
#include "DisplayHardware/VirtualDisplaySurface.h"
#include "Effects/Daltonizer.h"
mHWVsyncAvailable(false),
mDaltonize(false),
mHasColorMatrix(false),
+ mHasSecondaryColorMatrix(false),
mHasPoweredOff(false),
mFrameBuckets(),
mTotalTime(0),
public:
static int getEmuDensity() {
return getDensityFromProperty("qemu.sf.lcd_density"); }
- static int getBuildDensity() {
- return getDensityFromProperty("ro.sf.lcd_density"); }
+ static int getBuildDensity(const DisplayInfo& info) {
+ static int density = getDensityFromProperty("ro.sf.lcd_density");
+#if defined(__i386__) || defined(__x86_64__)
+ if (density == 0) {
+ uint32_t area = info.w * info.h;
+ if (area <= 800 * 480) {
+ density = 120;
+ } else if (area <= 1024 * 600) {
+ density = 130;
+ } else if (area < 1024 * 768) {
+ density = 140;
+ } else if (area < 1920 * 1080) {
+ density = 160;
+ } else if (area < 2160 * 1440) {
+ density = 240;
+ } else if (area < 2736 * 1824) {
+ density = 280;
+ } else {
+ density = 320;
+ }
+ ALOGI("auto set density to %d", density);
+ }
+#endif
+ return density;
+ }
};
configs->clear();
float xdpi = hwConfig.xdpi;
float ydpi = hwConfig.ydpi;
+ info.w = hwConfig.width;
+ info.h = hwConfig.height;
if (type == DisplayDevice::DISPLAY_PRIMARY) {
// The density of the device is provided by a build property
- float density = Density::getBuildDensity() / 160.0f;
+ float density = Density::getBuildDensity(info) / 160.0f;
if (density == 0) {
// the build doesn't provide a density -- this is wrong!
// use xdpi instead
mEventQueue.waitMessage();
}
+#ifdef CONSOLE_MANAGER
+void SurfaceFlinger::screenReleased(const sp<IBinder>& display) {
+ // this may be called by a signal handler, we can't do too much in here
+ setPowerMode(display, HWC_POWER_MODE_OFF);
+ signalLayerUpdate();
+}
+
+void SurfaceFlinger::screenAcquired(const sp<IBinder>& display) {
+ // this may be called by a signal handler, we can't do too much in here
+ setPowerMode(display, HWC_POWER_MODE_NORMAL);
+ signalLayerUpdate();
+}
+#endif
+
void SurfaceFlinger::signalTransaction() {
mEventQueue.invalidate();
}
mAnimFrameTracker.advanceFrame();
}
+ dumpDrawCycle(false);
+
if (hw->getPowerMode() == HWC_POWER_MODE_OFF) {
return;
}
for (size_t i=0 ; cur!=end && i<count ; ++i, ++cur) {
const sp<Layer>& layer(currentLayers[i]);
layer->setGeometry(hw, *cur);
- if (mDebugDisableHWC || mDebugRegion || mDaltonize || mHasColorMatrix) {
+ if (mDebugDisableHWC || mDebugRegion || mDaltonize || mHasColorMatrix || mHasSecondaryColorMatrix) {
cur->setSkip(true);
}
}
}
}
+ dumpDrawCycle(true);
+
status_t err = hwc.prepare();
ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
}
}
- if (CC_LIKELY(!mDaltonize && !mHasColorMatrix)) {
+ if (CC_LIKELY(!mDaltonize && !mHasColorMatrix && !mHasSecondaryColorMatrix)) {
if (!doComposeSurfaces(hw, dirtyRegion)) return;
} else {
RenderEngine& engine(getRenderEngine());
mat4 colorMatrix = mColorMatrix;
+ if (mHasSecondaryColorMatrix) {
+ colorMatrix = mHasColorMatrix ? (colorMatrix * mSecondaryColorMatrix) : mSecondaryColorMatrix;
+ }
if (mDaltonize) {
colorMatrix = colorMatrix * mDaltonizer();
}
}
// Never touch the framebuffer if we don't have any framebuffer layers
+#if defined(QTI_BSP) && defined(SDM_TARGET)
+ const bool hasHwcComposition = hwc.hasHwcComposition(id) |
+ (reinterpret_cast<ExHWComposer*>(&hwc))->getS3DFlag(id);
+#else
const bool hasHwcComposition = hwc.hasHwcComposition(id);
+#endif
if (hasHwcComposition) {
// when using overlays, we assume a fully transparent framebuffer
// NOTE: we could reduce how much we need to clear, for instance
result.appendFormat(" h/w composer %s and %s\n",
hwc.initCheck()==NO_ERROR ? "present" : "not present",
(mDebugDisableHWC || mDebugRegion || mDaltonize
- || mHasColorMatrix) ? "disabled" : "enabled");
+ || mHasColorMatrix
+ || mHasSecondaryColorMatrix) ? "disabled" : "enabled");
hwc.dump(result);
/*
mSFEventThread->setPhaseOffset(static_cast<nsecs_t>(n));
return NO_ERROR;
}
+ case 1030: {
+ // apply a secondary color matrix
+ // this will be combined with any other transformations
+ n = data.readInt32();
+ mHasSecondaryColorMatrix = n ? 1 : 0;
+ if (n) {
+ // color matrix is sent as mat3 matrix followed by vec3
+ // offset, then packed into a mat4 where the last row is
+ // the offset and extra values are 0
+ for (size_t i = 0 ; i < 4; i++) {
+ for (size_t j = 0; j < 4; j++) {
+ mSecondaryColorMatrix[i][j] = data.readFloat();
+ }
+ }
+ } else {
+ mSecondaryColorMatrix = mat4();
+ }
+ invalidateHwcGeometry();
+ repaintEverything();
+ return NO_ERROR;
+ }
+
}
}
return err;
// make sure to clear all GL error flags
engine.checkErrors();
- if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType() &&
- hw->isPanelInverseMounted()) {
+ if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType()) {
rotation = (Transform::orientation_flags)
- (rotation ^ Transform::ROT_180);
+ (rotation ^ hw->getPanelMountFlip());
}
// set-up our viewport