Merge m-c to m-i

This commit is contained in:
Phil Ringnalda 2013-10-05 17:42:10 -07:00
commit 2edd784e1d
20 changed files with 382 additions and 42 deletions

View File

@ -1,4 +1,4 @@
{ {
"revision": "51dc7b3879435541f8ee00fa903a6dbc44726da4", "revision": "cf34567487555df98987144f9acda7eb58f51c4b",
"repo_path": "/integration/gaia-central" "repo_path": "/integration/gaia-central"
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1380130116000"> <blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1380576907000">
<emItems> <emItems>
<emItem blockID="i454" id="sqlmoz@facebook.com"> <emItem blockID="i454" id="sqlmoz@facebook.com">
<versionRange minVersion="0" maxVersion="*" severity="3"> <versionRange minVersion="0" maxVersion="*" severity="3">
@ -1159,6 +1159,9 @@
<pluginItem blockID="p428"> <pluginItem blockID="p428">
<match name="filename" exp="np[dD]eployJava1\.dll" /> <versionRange severity="0" vulnerabilitystatus="2"></versionRange> <match name="filename" exp="np[dD]eployJava1\.dll" /> <versionRange severity="0" vulnerabilitystatus="2"></versionRange>
</pluginItem> </pluginItem>
<pluginItem blockID="p456">
<match name="filename" exp="npvlc\.dll" /> <versionRange minVersion="0" maxVersion="2.0.5" severity="0" vulnerabilitystatus="1"></versionRange>
</pluginItem>
</pluginItems> </pluginItems>
<gfxItems> <gfxItems>

View File

@ -8,9 +8,6 @@ const {Connection} = require("devtools/client/connection-manager");
const {Cu} = require("chrome"); const {Cu} = require("chrome");
const dbgClient = Cu.import("resource://gre/modules/devtools/dbg-client.jsm"); const dbgClient = Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
dbgClient.UnsolicitedNotifications.appOpen = "appOpen";
dbgClient.UnsolicitedNotifications.appClose = "appClose"
const _knownWebappsStores = new WeakMap(); const _knownWebappsStores = new WeakMap();
let WebappsStore; let WebappsStore;
@ -103,6 +100,14 @@ WebappsStore.prototype = {
this._onAppClose(manifestURL); this._onAppClose(manifestURL);
}); });
client.addListener("appInstall", (type, { manifestURL }) => {
this._onAppInstall(manifestURL);
});
client.addListener("appUninstall", (type, { manifestURL }) => {
this._onAppUninstall(manifestURL);
});
return deferred.resolve(); return deferred.resolve();
}) })
return deferred.promise; return deferred.promise;
@ -177,6 +182,10 @@ WebappsStore.prototype = {
let a = allApps[idx++]; let a = allApps[idx++];
request.manifestURL = a.manifestURL; request.manifestURL = a.manifestURL;
return client.request(request, (res) => { return client.request(request, (res) => {
if (res.error) {
Cu.reportError(res.message || res.error);
}
if (res.url) { if (res.url) {
a.iconURL = res.url; a.iconURL = res.url;
} }
@ -204,4 +213,57 @@ WebappsStore.prototype = {
return m != manifest; return m != manifest;
}); });
}, },
_onAppInstall: function(manifest) {
let client = this._connection.client;
let request = {
to: this._webAppsActor,
type: "getApp",
manifestURL: manifest
};
client.request(request, (res) => {
if (res.error) {
if (res.error == "forbidden") {
// We got a notification for an app we don't have access to.
// Ignore.
return;
}
Cu.reportError(res.message || res.error);
return;
}
let app = res.app;
app.running = false;
let notFound = true;
let proxifiedApp;
for (let i = 0; i < this.object.all.length; i++) {
let storedApp = this.object.all[i];
if (storedApp.manifestURL == app.manifestURL) {
this.object.all[i] = app;
proxifiedApp = this.object.all[i];
notFound = false;
break;
}
}
if (notFound) {
this.object.all.push(app);
proxifiedApp = this.object.all[this.object.all.length - 1];
}
request.type = "getIconAsDataURL";
client.request(request, (res) => {
if (res.url) {
proxifiedApp.iconURL = res.url;
}
});
});
},
_onAppUninstall: function(manifest) {
this.object.all = this.object.all.filter((app) => {
return (app.manifestURL != manifest);
});
},
} }

View File

@ -1552,6 +1552,13 @@ EventListenersView.prototype = Heritage.extend(WidgetMethods, {
*/ */
addListener: function(aListener, aOptions = {}) { addListener: function(aListener, aOptions = {}) {
let { node: { selector }, function: { url }, type } = aListener; let { node: { selector }, function: { url }, type } = aListener;
if (!type) return;
// Some listener objects may be added from plugins, thus getting
// translated to native code.
if (!url) {
url = this._inNativeCodeString;
}
// If an event item for this listener's url and type was already added, // If an event item for this listener's url and type was already added,
// avoid polluting the view and simply increase the "targets" count. // avoid polluting the view and simply increase the "targets" count.
@ -1627,12 +1634,6 @@ EventListenersView.prototype = Heritage.extend(WidgetMethods, {
group = L10N.getStr("otherEvents"); group = L10N.getStr("otherEvents");
} }
// Some listener objects may be added from plugins, thus getting
// translated to native code.
if (!url) {
url = this._inNativeCodeString;
}
// Create the element node for the event listener item. // Create the element node for the event listener item.
let itemView = this._createItemView(type, selector, url); let itemView = this._createItemView(type, selector, url);

View File

@ -74,6 +74,7 @@ support-files =
[browser_dbg_break-on-dom-04.js] [browser_dbg_break-on-dom-04.js]
[browser_dbg_break-on-dom-05.js] [browser_dbg_break-on-dom-05.js]
[browser_dbg_break-on-dom-06.js] [browser_dbg_break-on-dom-06.js]
[browser_dbg_break-on-dom-07.js]
[browser_dbg_breakpoints-actual-location.js] [browser_dbg_breakpoints-actual-location.js]
[browser_dbg_breakpoints-contextmenu.js] [browser_dbg_breakpoints-contextmenu.js]
[browser_dbg_breakpoints-disabled-reload.js] [browser_dbg_breakpoints-disabled-reload.js]

View File

@ -0,0 +1,104 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that system event listeners don't get duplicated in the view.
*/
function test() {
initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => {
let gDebugger = aPanel.panelWin;
let gView = gDebugger.DebuggerView;
let gEvents = gView.EventListeners;
let gL10N = gDebugger.L10N;
is(gEvents.itemCount, 0,
"There are no events displayed in the corresponding pane yet.");
gEvents.addListener({
type: "foo",
node: { selector: "#first" },
function: { url: null }
});
is(gEvents.itemCount, 1,
"There was a system event listener added in the view.");
is(gEvents.attachments[0].url, gL10N.getStr("eventNative"),
"The correct string is used as the event's url.");
is(gEvents.attachments[0].type, "foo",
"The correct string is used as the event's type.");
is(gEvents.attachments[0].selectors.toString(), "#first",
"The correct array of selectors is used as the event's target.");
gEvents.addListener({
type: "bar",
node: { selector: "#second" },
function: { url: null }
});
is(gEvents.itemCount, 2,
"There was another system event listener added in the view.");
is(gEvents.attachments[1].url, gL10N.getStr("eventNative"),
"The correct string is used as the event's url.");
is(gEvents.attachments[1].type, "bar",
"The correct string is used as the event's type.");
is(gEvents.attachments[1].selectors.toString(), "#second",
"The correct array of selectors is used as the event's target.");
gEvents.addListener({
type: "foo",
node: { selector: "#first" },
function: { url: null }
});
is(gEvents.itemCount, 2,
"There wasn't another system event listener added in the view.");
is(gEvents.attachments[0].url, gL10N.getStr("eventNative"),
"The correct string is used as the event's url.");
is(gEvents.attachments[0].type, "foo",
"The correct string is used as the event's type.");
is(gEvents.attachments[0].selectors.toString(), "#first",
"The correct array of selectors is used as the event's target.");
gEvents.addListener({
type: "foo",
node: { selector: "#second" },
function: { url: null }
});
is(gEvents.itemCount, 2,
"There still wasn't another system event listener added in the view.");
is(gEvents.attachments[0].url, gL10N.getStr("eventNative"),
"The correct string is used as the event's url.");
is(gEvents.attachments[0].type, "foo",
"The correct string is used as the event's type.");
is(gEvents.attachments[0].selectors.toString(), "#first,#second",
"The correct array of selectors is used as the event's target.");
gEvents.addListener({
type: null,
node: { selector: "#bogus" },
function: { url: null }
});
is(gEvents.itemCount, 2,
"No bogus system event listener was added in the view.");
is(gEvents.attachments[0].url, gL10N.getStr("eventNative"),
"The correct string is used as the first event's url.");
is(gEvents.attachments[0].type, "foo",
"The correct string is used as the first event's type.");
is(gEvents.attachments[0].selectors.toString(), "#first,#second",
"The correct array of selectors is used as the first event's target.");
is(gEvents.attachments[1].url, gL10N.getStr("eventNative"),
"The correct string is used as the second event's url.");
is(gEvents.attachments[1].type, "bar",
"The correct string is used as the second event's type.");
is(gEvents.attachments[1].selectors.toString(), "#second",
"The correct array of selectors is used as the second event's target.");
closeDebuggerAndFinish(aPanel);
});
}

View File

@ -596,9 +596,13 @@ public:
{ {
if (mSurface && !mPlatformContext) { if (mSurface && !mPlatformContext) {
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
if (!mIsOffscreen) if (!mIsOffscreen) {
return GetGonkDisplay()->SwapBuffers(EGL_DISPLAY(), mSurface); if (mHwc) {
else return mHwc->Render(EGL_DISPLAY(), mSurface);
} else {
return GetGonkDisplay()->SwapBuffers(EGL_DISPLAY(), mSurface);
}
} else
#endif #endif
return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface); return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface);
} else { } else {

View File

@ -441,7 +441,7 @@ bool RawDBusConnection::SendWithError(DBusMessage** aReply,
*aReply = t->GetReply(); *aReply = t->GetReply();
} }
return false; return true;
} }
bool RawDBusConnection::SendWithError(DBusMessage** aReply, bool RawDBusConnection::SendWithError(DBusMessage** aReply,

View File

@ -8,6 +8,7 @@ appengine.google.com: did not receive HSTS header
bcrook.com: max-age too low: 86400 bcrook.com: max-age too low: 86400
betnet.fr: could not connect to host betnet.fr: could not connect to host
bigshinylock.minazo.net: could not connect to host bigshinylock.minazo.net: could not connect to host
bitbucket.org: max-age too low: 2592000
blueseed.co: did not receive HSTS header blueseed.co: did not receive HSTS header
braintreegateway.com: did not receive HSTS header braintreegateway.com: did not receive HSTS header
braintreepayments.com: did not receive HSTS header braintreepayments.com: did not receive HSTS header
@ -22,6 +23,9 @@ codereview.chromium.org: did not receive HSTS header
crowdcurity.com: did not receive HSTS header crowdcurity.com: did not receive HSTS header
crypto.is: did not receive HSTS header crypto.is: did not receive HSTS header
csawctf.poly.edu: did not receive HSTS header csawctf.poly.edu: did not receive HSTS header
cupcake.io: max-age too low: 3153600
cupcake.is: max-age too low: 3153600
cybozu.com: did not receive HSTS header
dl.google.com: did not receive HSTS header dl.google.com: did not receive HSTS header
docs.google.com: did not receive HSTS header docs.google.com: did not receive HSTS header
drive.google.com: did not receive HSTS header drive.google.com: did not receive HSTS header
@ -41,6 +45,7 @@ grepular.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERR
groups.google.com: did not receive HSTS header groups.google.com: did not receive HSTS header
history.google.com: did not receive HSTS header history.google.com: did not receive HSTS header
hostedtalkgadget.google.com: did not receive HSTS header hostedtalkgadget.google.com: did not receive HSTS header
id.atlassian.com: did not receive HSTS header
iop.intuit.com: max-age too low: 86400 iop.intuit.com: max-age too low: 86400
irccloud.com: did not receive HSTS header irccloud.com: did not receive HSTS header
jitsi.org: did not receive HSTS header jitsi.org: did not receive HSTS header
@ -49,6 +54,7 @@ kiwiirc.com: max-age too low: 5256000
ledgerscope.net: max-age too low: 86400 ledgerscope.net: max-age too low: 86400
lists.mayfirst.org: did not receive HSTS header lists.mayfirst.org: did not receive HSTS header
logentries.com: did not receive HSTS header logentries.com: did not receive HSTS header
lumi.do: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-hsts-000000000000000/getHSTSPreloadList.js :: processStsHeader :: line 124" data: no]
mail.google.com: did not receive HSTS header mail.google.com: did not receive HSTS header
market.android.com: did not receive HSTS header market.android.com: did not receive HSTS header
my.alfresco.com: did not receive HSTS header my.alfresco.com: did not receive HSTS header
@ -82,18 +88,21 @@ sunshinepress.org: could not connect to host
surfeasy.com: did not receive HSTS header surfeasy.com: did not receive HSTS header
talk.google.com: did not receive HSTS header talk.google.com: did not receive HSTS header
talkgadget.google.com: did not receive HSTS header talkgadget.google.com: did not receive HSTS header
tent.io: max-age too low: 3153600
torproject.org: did not receive HSTS header torproject.org: did not receive HSTS header
translate.google.com: did not receive HSTS header translate.google.com: did not receive HSTS header
translate.googleapis.com: did not receive HSTS header translate.googleapis.com: did not receive HSTS header
uprotect.it: could not connect to host uprotect.it: could not connect to host
wallet.google.com: did not receive HSTS header wallet.google.com: did not receive HSTS header
whonix.org: did not receive HSTS header whonix.org: did not receive HSTS header
www.cueup.com: did not receive HSTS header
www.developer.mydigipass.com: could not connect to host www.developer.mydigipass.com: could not connect to host
www.dropcam.com: max-age too low: 2592000 www.dropcam.com: max-age too low: 2592000
www.elanex.biz: did not receive HSTS header www.elanex.biz: did not receive HSTS header
www.gmail.com: did not receive HSTS header www.gmail.com: did not receive HSTS header
www.googlemail.com: did not receive HSTS header www.googlemail.com: did not receive HSTS header
www.greplin.com: did not receive HSTS header www.gov.uk: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-hsts-000000000000000/getHSTSPreloadList.js :: processStsHeader :: line 124" data: no]
www.greplin.com: could not connect to host
www.jitsi.org: did not receive HSTS header www.jitsi.org: did not receive HSTS header
www.lastpass.com: did not receive HSTS header www.lastpass.com: did not receive HSTS header
www.ledgerscope.net: max-age too low: 86400 www.ledgerscope.net: max-age too low: 86400
@ -104,4 +113,4 @@ www.paycheckrecords.com: max-age too low: 86400
www.paypal.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-hsts-000000000000000/getHSTSPreloadList.js :: processStsHeader :: line 124" data: no] www.paypal.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-hsts-000000000000000/getHSTSPreloadList.js :: processStsHeader :: line 124" data: no]
www.sandbox.mydigipass.com: could not connect to host www.sandbox.mydigipass.com: could not connect to host
www.surfeasy.com: did not receive HSTS header www.surfeasy.com: did not receive HSTS header
zoo24.de: did not receive HSTS header zoo24.de: max-age too low: 2592000

View File

@ -8,7 +8,7 @@
/*****************************************************************************/ /*****************************************************************************/
#include <stdint.h> #include <stdint.h>
const PRTime gPreloadListExpirationTime = INT64_C(1391250031831000); const PRTime gPreloadListExpirationTime = INT64_C(1391854333088000);
class nsSTSPreload class nsSTSPreload
{ {
@ -44,12 +44,14 @@ static const nsSTSPreload kSTSPreloadList[] = {
{ "crm.onlime.ch", false }, { "crm.onlime.ch", false },
{ "crypto.cat", false }, { "crypto.cat", false },
{ "cyphertite.com", true }, { "cyphertite.com", true },
{ "davidlyness.com", true },
{ "developer.mydigipass.com", false }, { "developer.mydigipass.com", false },
{ "dist.torproject.org", false }, { "dist.torproject.org", false },
{ "dm.lookout.com", false }, { "dm.lookout.com", false },
{ "dm.mylookout.com", false }, { "dm.mylookout.com", false },
{ "download.jitsi.org", false }, { "download.jitsi.org", false },
{ "ebanking.indovinabank.com.vn", false }, { "ebanking.indovinabank.com.vn", false },
{ "ecosystem.atlassian.net", true },
{ "entropia.de", false }, { "entropia.de", false },
{ "espra.com", true }, { "espra.com", true },
{ "factor.cc", false }, { "factor.cc", false },
@ -122,7 +124,6 @@ static const nsSTSPreload kSTSPreloadList[] = {
{ "writeapp.me", false }, { "writeapp.me", false },
{ "www.apollo-auto.com", true }, { "www.apollo-auto.com", true },
{ "www.braintreepayments.com", false }, { "www.braintreepayments.com", false },
{ "www.cueup.com", false },
{ "www.cyveillance.com", true }, { "www.cyveillance.com", true },
{ "www.entropia.de", false }, { "www.entropia.de", false },
{ "www.gov.uk", false }, { "www.gov.uk", false },

View File

@ -98,7 +98,6 @@ function do_get_webappsdir() {
coreAppsDir.append("test_coreapps"); coreAppsDir.append("test_coreapps");
if (!coreAppsDir.exists()) if (!coreAppsDir.exists())
coreAppsDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("755", 8)); coreAppsDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("755", 8));
var tmpDir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
// Register our own provider for the profile directory. // Register our own provider for the profile directory.
// It will return our special docshell profile directory. // It will return our special docshell profile directory.
@ -111,7 +110,6 @@ function do_get_webappsdir() {
else if (prop == "coreAppsDir") { else if (prop == "coreAppsDir") {
return coreAppsDir.clone(); return coreAppsDir.clone();
} }
return tmpDir.clone();
throw Cr.NS_ERROR_FAILURE; throw Cr.NS_ERROR_FAILURE;
}, },
QueryInterface: function(iid) { QueryInterface: function(iid) {

View File

@ -57,6 +57,23 @@ add_test(function testGetAll() {
}); });
}); });
add_test(function testGetApp() {
let manifestURL = APP_ORIGIN + "/manifest.webapp";
let request = {type: "getApp", manifestURL: manifestURL};
webappActorRequest(request, function (aResponse) {
do_check_true("app" in aResponse);
let app = aResponse.app;
do_check_eq(app.id, gAppId);
do_check_eq(app.name, "Test app");
do_check_eq(app.manifest.description, "Testing webapps actor");
do_check_eq(app.manifest.launch_path, "/index.html");
do_check_eq(app.origin, APP_ORIGIN);
do_check_eq(app.installOrigin, app.origin);
do_check_eq(app.manifestURL, app.origin + "/manifest.webapp");
run_next_test();
});
});
add_test(function testLaunchApp() { add_test(function testLaunchApp() {
let manifestURL = APP_ORIGIN + "/manifest.webapp"; let manifestURL = APP_ORIGIN + "/manifest.webapp";
let startPoint = "/index.html"; let startPoint = "/index.html";

View File

@ -544,6 +544,32 @@ WebappsActor.prototype = {
return deferred.promise; return deferred.promise;
}, },
getApp: function wa_actorGetApp(aRequest) {
debug("getApp");
let manifestURL = aRequest.manifestURL;
if (!manifestURL) {
return { error: "missingParameter",
message: "missing parameter manifestURL" };
}
let reg = DOMApplicationRegistry;
let app = reg.getAppByManifestURL(manifestURL);
if (!app) {
return { error: "appNotFound" };
}
if (this._isAppAllowedForManifest(app.manifestURL)) {
let deferred = promise.defer();
reg.getManifestFor(manifestURL, function (manifest) {
app.manifest = manifest;
deferred.resolve({app: app});
});
return deferred.promise;
}
return { error: "forbidden" };
},
_areCertifiedAppsAllowed: function wa__areCertifiedAppsAllowed() { _areCertifiedAppsAllowed: function wa__areCertifiedAppsAllowed() {
let pref = "devtools.debugger.forbid-certified-apps"; let pref = "devtools.debugger.forbid-certified-apps";
return !Services.prefs.getBoolPref(pref); return !Services.prefs.getBoolPref(pref);
@ -955,6 +981,7 @@ if (Services.prefs.getBoolPref("devtools.debugger.enable-content-actors")) {
let requestTypes = WebappsActor.prototype.requestTypes; let requestTypes = WebappsActor.prototype.requestTypes;
requestTypes.uploadPackage = WebappsActor.prototype.uploadPackage; requestTypes.uploadPackage = WebappsActor.prototype.uploadPackage;
requestTypes.getAll = WebappsActor.prototype.getAll; requestTypes.getAll = WebappsActor.prototype.getAll;
requestTypes.getApp = WebappsActor.prototype.getApp;
requestTypes.launch = WebappsActor.prototype.launch; requestTypes.launch = WebappsActor.prototype.launch;
requestTypes.close = WebappsActor.prototype.close; requestTypes.close = WebappsActor.prototype.close;
requestTypes.uninstall = WebappsActor.prototype.uninstall; requestTypes.uninstall = WebappsActor.prototype.uninstall;

View File

@ -445,45 +445,114 @@ HwcComposer2D::TryHwComposition()
{ {
FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface()); FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());
if (!(fbsurface && fbsurface->lastHandle)) {
LOGD("H/W Composition failed. FBSurface not initialized.");
return false;
}
// Add FB layer
int idx = mList->numHwLayers++;
if (idx >= mMaxLayerCount) {
if (!ReallocLayerList() || idx >= mMaxLayerCount) {
LOGE("TryHwComposition failed! Could not add FB layer");
return false;
}
}
Prepare(fbsurface->lastHandle, -1);
for (int j = 0; j < idx; j++) {
if (mList->hwLayers[j].compositionType == HWC_FRAMEBUFFER) {
LOGD("GPU or Partial HWC Composition");
return false;
}
}
// Full HWC Composition
Commit();
// No composition on FB layer, so closing releaseFenceFd
close(mList->hwLayers[idx].releaseFenceFd);
mList->hwLayers[idx].releaseFenceFd = -1;
mList->numHwLayers = 0;
return true;
}
bool
HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
{
if (!mList) {
// After boot, HWC list hasn't been created yet
return GetGonkDisplay()->SwapBuffers(dpy, sur);
}
GetGonkDisplay()->UpdateFBSurface(dpy, sur);
FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());
if (!fbsurface) { if (!fbsurface) {
LOGE("H/W Composition failed. FBSurface not initialized."); LOGE("H/W Composition failed. FBSurface not initialized.");
return false; return false;
} }
hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = {NULL}; if (mList->numHwLayers != 0) {
// No mHwc prepare, if already prepared in current draw cycle
mList->hwLayers[mList->numHwLayers - 1].handle = fbsurface->lastHandle;
mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = fbsurface->lastFenceFD;
} else {
mList->numHwLayers = 2;
mList->hwLayers[0].hints = 0;
mList->hwLayers[0].compositionType = HWC_BACKGROUND;
mList->hwLayers[0].flags = HWC_SKIP_LAYER;
mList->hwLayers[0].backgroundColor = {0};
mList->hwLayers[0].displayFrame = {0, 0, mScreenRect.width, mScreenRect.height};
Prepare(fbsurface->lastHandle, fbsurface->lastFenceFD);
}
// GPU or partial HWC Composition
Commit();
GetGonkDisplay()->SetFBReleaseFd(mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd);
mList->numHwLayers = 0;
return true;
}
void
HwcComposer2D::Prepare(buffer_handle_t fbHandle, int fence)
{
int idx = mList->numHwLayers - 1;
const hwc_rect_t r = {0, 0, mScreenRect.width, mScreenRect.height}; const hwc_rect_t r = {0, 0, mScreenRect.width, mScreenRect.height};
int idx = mList->numHwLayers; hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr };
displays[HWC_DISPLAY_PRIMARY] = mList; displays[HWC_DISPLAY_PRIMARY] = mList;
mList->flags = HWC_GEOMETRY_CHANGED; mList->flags = HWC_GEOMETRY_CHANGED;
mList->outbufAcquireFenceFd = -1;
mList->outbuf = nullptr;
mList->retireFenceFd = -1; mList->retireFenceFd = -1;
mList->hwLayers[idx].hints = 0; mList->hwLayers[idx].hints = 0;
mList->hwLayers[idx].flags = 0; mList->hwLayers[idx].flags = 0;
mList->hwLayers[idx].transform = 0; mList->hwLayers[idx].transform = 0;
mList->hwLayers[idx].handle = fbsurface->lastHandle; mList->hwLayers[idx].handle = fbHandle;
mList->hwLayers[idx].blending = HWC_BLENDING_PREMULT; mList->hwLayers[idx].blending = HWC_BLENDING_PREMULT;
mList->hwLayers[idx].compositionType = HWC_FRAMEBUFFER_TARGET; mList->hwLayers[idx].compositionType = HWC_FRAMEBUFFER_TARGET;
mList->hwLayers[idx].sourceCrop = r; mList->hwLayers[idx].sourceCrop = r;
mList->hwLayers[idx].displayFrame = r; mList->hwLayers[idx].displayFrame = r;
mList->hwLayers[idx].visibleRegionScreen.numRects = 1; mList->hwLayers[idx].visibleRegionScreen.numRects = 1;
mList->hwLayers[idx].visibleRegionScreen.rects = &mList->hwLayers[idx].sourceCrop; mList->hwLayers[idx].visibleRegionScreen.rects = &mList->hwLayers[idx].sourceCrop;
mList->hwLayers[idx].acquireFenceFd = -1; mList->hwLayers[idx].acquireFenceFd = fence;
mList->hwLayers[idx].releaseFenceFd = -1; mList->hwLayers[idx].releaseFenceFd = -1;
mList->hwLayers[idx].planeAlpha = 0xFF; mList->hwLayers[idx].planeAlpha = 0xFF;
mList->numHwLayers++;
mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays); mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
}
for (int j = 0; j < idx; j++) { bool
if (mList->hwLayers[j].compositionType == HWC_FRAMEBUFFER) { HwcComposer2D::Commit()
LOGD("GPU or Partial MDP Composition"); {
return false; hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr };
} displays[HWC_DISPLAY_PRIMARY] = mList;
}
// Full MDP Composition int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
for (int i = 0; i <= MAX_HWC_LAYERS; i++) { for (int i = 0; i <= MAX_HWC_LAYERS; i++) {
if (mPrevRelFd[i] <= 0) { if (mPrevRelFd[i] <= 0) {
@ -504,18 +573,15 @@ HwcComposer2D::TryHwComposition()
} }
mPrevRelFd[0] = mList->retireFenceFd; mPrevRelFd[0] = mList->retireFenceFd;
for (uint32_t j = 0; j < idx; j++) { for (uint32_t j = 0; j < (mList->numHwLayers - 1); j++) {
if (mList->hwLayers[j].compositionType == HWC_OVERLAY) { if (mList->hwLayers[j].compositionType == HWC_OVERLAY) {
mPrevRelFd[j + 1] = mList->hwLayers[j].releaseFenceFd; mPrevRelFd[j + 1] = mList->hwLayers[j].releaseFenceFd;
mList->hwLayers[j].releaseFenceFd = -1; mList->hwLayers[j].releaseFenceFd = -1;
} }
} }
close(mList->hwLayers[idx].releaseFenceFd);
mList->hwLayers[idx].releaseFenceFd = -1;
mList->retireFenceFd = -1; mList->retireFenceFd = -1;
mList->numHwLayers = 0; return !err;
return true;
} }
#else #else
bool bool
@ -523,6 +589,12 @@ HwcComposer2D::TryHwComposition()
{ {
return !mHwc->set(mHwc, mDpy, mSur, mList); return !mHwc->set(mHwc, mDpy, mSur, mList);
} }
bool
HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
{
return GetGonkDisplay()->SwapBuffers(dpy, sur);
}
#endif #endif
bool bool
@ -549,13 +621,13 @@ HwcComposer2D::TryRender(Layer* aRoot,
aGLWorldTransform)) aGLWorldTransform))
{ {
LOGD("Render aborted. Nothing was drawn to the screen"); LOGD("Render aborted. Nothing was drawn to the screen");
mList->numHwLayers = 0;
return false; return false;
} }
if (!TryHwComposition()) { if (!TryHwComposition()) {
// Full MDP Composition LOGD("H/W Composition failed");
LOGE("H/W Composition failed"); return false;
return false;
} }
LOGD("Frame rendered"); LOGD("Frame rendered");

View File

@ -62,7 +62,11 @@ public:
// by this composer so nothing was rendered at all // by this composer so nothing was rendered at all
bool TryRender(layers::Layer* aRoot, const gfxMatrix& aGLWorldTransform) MOZ_OVERRIDE; bool TryRender(layers::Layer* aRoot, const gfxMatrix& aGLWorldTransform) MOZ_OVERRIDE;
bool Render(EGLDisplay dpy, EGLSurface sur);
private: private:
void Prepare(buffer_handle_t fbHandle, int fence);
bool Commit();
bool TryHwComposition(); bool TryHwComposition();
bool ReallocLayerList(); bool ReallocLayerList();
bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip, bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip,

View File

@ -43,6 +43,10 @@ public:
virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0; virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0;
virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur) = 0;
virtual void SetFBReleaseFd(int fd) = 0;
float xdpi; float xdpi;
uint32_t surfaceformat; uint32_t surfaceformat;
}; };

View File

@ -196,6 +196,17 @@ GonkDisplayICS::QueueBuffer(ANativeWindowBuffer *buf)
return !window->queueBuffer(window, buf); return !window->queueBuffer(window, buf);
} }
void
GonkDisplayICS::UpdateFBSurface(EGLDisplay dpy, EGLSurface sur)
{
eglSwapBuffers(dpy, sur);
}
void
GonkDisplayICS::SetFBReleaseFd(int fd)
{
}
__attribute__ ((visibility ("default"))) __attribute__ ((visibility ("default")))
GonkDisplay* GonkDisplay*
GetGonkDisplay() GetGonkDisplay()

View File

@ -46,6 +46,10 @@ public:
virtual bool QueueBuffer(ANativeWindowBuffer* handle); virtual bool QueueBuffer(ANativeWindowBuffer* handle);
virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur);
virtual void SetFBReleaseFd(int fd);
private: private:
hw_module_t const* mModule; hw_module_t const* mModule;
hwc_composer_device_t* mHwc; hwc_composer_device_t* mHwc;

View File

@ -272,6 +272,20 @@ GonkDisplayJB::QueueBuffer(ANativeWindowBuffer* buf)
return success; return success;
} }
void
GonkDisplayJB::UpdateFBSurface(EGLDisplay dpy, EGLSurface sur)
{
StopBootAnimation();
mBootAnimBuffer = nullptr;
eglSwapBuffers(dpy, sur);
}
void
GonkDisplayJB::SetFBReleaseFd(int fd)
{
mFBSurface->setReleaseFenceFd(fd);
}
__attribute__ ((visibility ("default"))) __attribute__ ((visibility ("default")))
GonkDisplay* GonkDisplay*
GetGonkDisplay() GetGonkDisplay()

View File

@ -45,6 +45,10 @@ public:
virtual bool QueueBuffer(ANativeWindowBuffer* buf); virtual bool QueueBuffer(ANativeWindowBuffer* buf);
virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur);
virtual void SetFBReleaseFd(int fd);
bool Post(buffer_handle_t buf, int fence); bool Post(buffer_handle_t buf, int fence);
private: private: