sf: This is a combination of following changes.

Author: Prabhanjan Kandula<pkandula@codeaurora.org>
SF: Add support for inverse mounted panels.

Add 180 rotation in SF to account for inverse mounted panels.
The framework will be unaffected and use policies for a 0 mounted
panel. SF changes the global transform and silently induces the H,V
flips. Similar flips are added to screenshots as well.

CRs-Fixed: 894147

Change-Id: I6e9576ee734ee85097491eaa1e8e94cfb3731e0f

Author: Ramkumar Radhakrishnan<ramkumar@codeaurora.org>
SF: Clear visible region of layer appropriately.

Clear visible region of layer having layer stack id different than
the display layer stack id to ensure that the layer won't be present
on the wrong display layer list.

Change-Id: I59289fea63ec7a2451d4715cfe7926ba34fdb8e3

Change-Id: I5ad08a6013aa173d621ee80c766a6e19e1086a35
This commit is contained in:
Ramkumar Radhakrishnan 2015-08-20 18:18:30 -07:00 committed by Linux Build Service Account
parent 3652b23865
commit cfd539bf4a
3 changed files with 33 additions and 2 deletions

View File

@ -90,6 +90,7 @@ DisplayDevice::DisplayDevice(
{
mNativeWindow = new Surface(producer, false);
ANativeWindow* const window = mNativeWindow.get();
char property[PROPERTY_VALUE_MAX];
/*
* Create our display's surface
@ -140,6 +141,11 @@ DisplayDevice::DisplayDevice(
break;
}
mPanelInverseMounted = false;
// Check if panel is inverse mounted (contents show up HV flipped)
property_get("persist.panel.inversemounted", property, "0");
mPanelInverseMounted = !!atoi(property);
// initialize the display orientation transform.
setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
}
@ -402,6 +408,11 @@ status_t DisplayDevice::orientationToTransfrom(
default:
return BAD_VALUE;
}
if (DISPLAY_PRIMARY == mHwcDisplayId && isPanelInverseMounted()) {
flags = flags ^ Transform::ROT_180;
}
tr->set(flags, w, h);
return NO_ERROR;
}

View File

@ -126,6 +126,10 @@ public:
int32_t getHwcDisplayId() const { return mHwcDisplayId; }
const wp<IBinder>& getDisplayToken() const { return mDisplayToken; }
bool isPanelInverseMounted() const {
return mPanelInverseMounted;
}
// We pass in mustRecompose so we can keep VirtualDisplaySurface's state
// machine happy without actually queueing a buffer if nothing has changed
status_t beginFrame(bool mustRecompose) const;
@ -209,7 +213,7 @@ private:
/*
* Transaction state
*/
static status_t orientationToTransfrom(int orientation,
status_t orientationToTransfrom(int orientation,
int w, int h, Transform* tr);
uint32_t mLayerStack;
@ -226,6 +230,8 @@ private:
int mPowerMode;
// Current active config
int mActiveConfig;
// Panel is inverse mounted
int mPanelInverseMounted;
};
}; // namespace android

View File

@ -3306,6 +3306,12 @@ void SurfaceFlinger::renderScreenImplLocked(
// make sure to clear all GL error flags
engine.checkErrors();
if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType() &&
hw->isPanelInverseMounted()) {
rotation = (Transform::orientation_flags)
(rotation ^ Transform::ROT_180);
}
// set-up our viewport
engine.setViewportAndProjection(
reqWidth, reqHeight, sourceCrop, hw_h, yswap, rotation);
@ -3508,8 +3514,16 @@ bool SurfaceFlinger::updateLayerVisibleNonTransparentRegion(const int& /*dpy*/,
const Layer::State& s(layer->getDrawingState());
// only consider the layers on the given layer stack
if (s.layerStack != layerStack)
if (s.layerStack != layerStack) {
/* set the visible region as empty since we have removed the
* layerstack check in rebuildLayerStack() function
*/
Region visibleNonTransRegion;
visibleNonTransRegion.set(Rect(0,0));
layer->setVisibleNonTransparentRegion(visibleNonTransRegion);
return true;
}
return false;
}