author | Wes Kocher <wkocher@mozilla.com> |
Tue, 09 Jun 2015 19:25:38 -0700 | |
changeset 247790 | 5787d784485edff3d792d4c08cf4e76821aaadfd |
parent 247746 | d9156ad9b7a253d382dfd3df463453a2c744aca6 (current diff) |
parent 247789 | b142bf204e04b600604e7d40bf3c16a3ef3da8a4 (diff) |
child 247791 | c063c543ebc23056e1f248df7d2af87c7874a5cb |
child 247801 | ebc68ec5e69d785fe411528c0c7cfb5ee2dd853f |
child 247863 | bc32a90612e53d180e919521dda9fbf95cba525d |
child 247973 | f56708a631edd68c16e44eb73eed02f2c3cc1650 |
push id | 28882 |
push user | kwierso@gmail.com |
push date | Wed, 10 Jun 2015 02:25:43 +0000 |
treeherder | mozilla-central@5787d784485e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 41.0a1 |
first release with | nightly linux32
5787d784485e
/
41.0a1
/
20150610030209
/
files
nightly linux64
5787d784485e
/
41.0a1
/
20150610030209
/
files
nightly mac
5787d784485e
/
41.0a1
/
20150610030209
/
files
nightly win32
5787d784485e
/
41.0a1
/
20150610030209
/
files
nightly win64
5787d784485e
/
41.0a1
/
20150610030209
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
41.0a1
/
20150610030209
/
pushlog to previous
nightly linux64
41.0a1
/
20150610030209
/
pushlog to previous
nightly mac
41.0a1
/
20150610030209
/
pushlog to previous
nightly win32
41.0a1
/
20150610030209
/
pushlog to previous
nightly win64
41.0a1
/
20150610030209
/
pushlog to previous
|
--- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="a1e239a0bb5cd1d69680bf1075883aa9a7bf2429"/> <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="c7931763d41be602407ed9d71e2c0292c6597e00"/> <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="a32003194f707f66a2d8cdb913ed1869f1926c5d"/> <project name="device/common" path="device/common" revision="96d4d2006c4fcb2f19a3fa47ab10cb409faa017b"/> @@ -117,17 +117,17 @@ <project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/> <project name="platform/system/vold" path="system/vold" revision="42fa2a0f14f965970a4b629a176bbd2666edf017"/> <project name="platform/external/curl" path="external/curl" revision="e68addd988448959ea8157c5de637346b4180c33"/> <project name="platform/external/icu4c" path="external/icu4c" revision="d3ec7428eb276db43b7ed0544e09344a6014806c"/> <project name="platform/hardware/libhardware_legacy" path="hardware/libhardware_legacy" revision="76c4bf4bc430a1b8317f2f21ef735867733e50cc"/> <project name="platform/system/media" path="system/media" revision="c1332c21c608f4932a6d7e83450411cde53315ef"/> <default remote="caf" revision="LNX.LA.3.5.2.1.1" sync-j="4"/> <!-- Platform common things --> - <project name="device-shinano-common" path="device/sony/shinano-common" remote="b2g" revision="f4e8f3b19fedc7e08c455de93fe4cef90744c169"/> + <project name="device-shinano-common" path="device/sony/shinano-common" remote="b2g" revision="9934000e6d842b4c4d76fb56f52584e1a3819c9c"/> <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/> <project name="device/qcom/common" path="device/qcom/common" revision="2501e5940ba69ece7654ff85611c76ae5bda299c"/> <project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="5ada05ac150f643ef19e87015df7e106b88effe7"/> <project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="d61fc97258c8b0c362430dd2eb195dcc4d266f14"/> <project name="init_sh" path="external/init_sh" remote="b2g" revision="3bdd26e092db9c47c5beb04b4809a35f8f767b8a"/> <project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="0a01977f34d6e86fe23d6c0ec75e96ba988bbebb"/> <project name="platform_external_libnfc-pn547" path="external/libnfc-pn547" remote="b2g" revision="5bb999b84b8adc14f6bea004d523ba258dea8188"/> <project name="timekeep" path="external/timekeep" remote="b2g" revision="58e9fd70a62d2c0ebf9bc2bd99439dcc5be8cad8"/>
--- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="a1e239a0bb5cd1d69680bf1075883aa9a7bf2429"/> <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="c7931763d41be602407ed9d71e2c0292c6597e00"/> <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="83760d213fb3bec7b4117d266fcfbf6fe2ba14ab"/> <project name="device/common" path="device/common" revision="6a2995683de147791e516aae2ccb31fdfbe2ad30"/> @@ -123,17 +123,17 @@ <project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/> <project name="platform/system/vold" path="system/vold" revision="fe12a9e2268da653d1cd4c39ec89a42211d22f25"/> <!--original fetch url was http://sprdsource.spreadtrum.com:8085/b2g/android--> <remote fetch="https://git.mozilla.org/external/sprd-aosp" name="sprd-aosp"/> <default remote="sprd-aosp" revision="sprdb2g_gonk4.4" sync-j="4"/> <!-- Stock Android things --> <project name="platform/external/icu4c" path="external/icu4c" revision="2bb01561780583cc37bc667f0ea79f48a122d8a2"/> <!-- dolphin specific things --> - <project name="device/sprd" path="device/sprd" revision="e73ddda9fede64134d949050e3fc53bd4121cb30"/> + <project name="device/sprd" path="device/sprd" revision="09b87b777f1e03c81459d8cba55ba7fb95da3bab"/> <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="39a5b5bcadad745df3e6882316fce426f98b1669"/> <project name="platform/frameworks/av" path="frameworks/av" revision="8bb69db127112fc66da75f8ca7a1158614b919f6"/> <project name="platform/hardware/akm" path="hardware/akm" revision="6d3be412647b0eab0adff8a2768736cf4eb68039"/> <project groups="invensense" name="platform/hardware/invensense" path="hardware/invensense" revision="e6d9ab28b4f4e7684f6c07874ee819c9ea0002a2"/> <project name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/> <project name="kernel/common" path="kernel" revision="0f36762ab0c1d8ce10c6a5eda948b05d5d6cc379"/> <project name="platform/system/core" path="system/core" revision="21aded5b180f7bcc9e2cefbe6e570b1d51b6065b"/> <project name="u-boot" path="u-boot" revision="f1502910977ac88f43da7bf9277c3523ad4b0b2f"/>
--- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -14,17 +14,17 @@ <!--original fetch url was git://github.com/apitrace/--> <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/> <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/> <!-- Gonk specific things and forks --> <project name="platform_build" path="build" remote="b2g" revision="173b3104bfcbd23fc9dccd4b0035fc49aae3d444"> <copyfile dest="Makefile" src="core/root.mk"/> </project> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> - <project name="gaia.git" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia.git" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="aac9cc4bb94cf720baf8f7ee419b4d76ac86b1ac"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="9d0e5057ee5404a31ec1bf76131cb11336a7c3b6"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/> <!-- Stock Android things --> <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -12,20 +12,20 @@ <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="4efd19d199ae52656604f794c5a77518400220fd"> <copyfile dest="Makefile" src="core/root.mk"/> </project> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/> <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="9025e50b9d29b3cabbbb21e1dd94d0d13121a17e"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
--- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="1950e4760fa14688b83cdbb5acaa1af9f82ef434"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="ac6eb97a37035c09fb5ede0852f0881e9aadf9ad"/> <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="737f591c5f95477148d26602c7be56cbea0cdeb9"/> <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="51da9b1981be481b92a59a826d4d78dc73d0989a"/> <project name="device/common" path="device/common" revision="798a3664597e6041985feab9aef42e98d458bc3d"/>
--- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" revision="8af5ff6f5dced9eb5a8127459df6c75d24342204"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" revision="30915518fa7ea07166efedc191a4f40aef516fe7"/> <project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" revision="96eee58e3389fb05a835310d6a06a6ba4486097a"/> <project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" revision="7c8a46698171aa2e0be09edb43d15a6acf832770"/> <project groups="pdk,linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" path="prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" revision="24b2038be8a636fd4a5d21f0abae1e466b07bcf7"/>
--- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -14,17 +14,17 @@ <!--original fetch url was git://github.com/apitrace/--> <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/> <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/> <!-- Gonk specific things and forks --> <project name="platform_build" path="build" remote="b2g" revision="173b3104bfcbd23fc9dccd4b0035fc49aae3d444"> <copyfile dest="Makefile" src="core/root.mk"/> </project> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> - <project name="gaia.git" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia.git" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="aac9cc4bb94cf720baf8f7ee419b4d76ac86b1ac"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="9d0e5057ee5404a31ec1bf76131cb11336a7c3b6"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/> <!-- Stock Android things --> <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="a1e239a0bb5cd1d69680bf1075883aa9a7bf2429"/> <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="c7931763d41be602407ed9d71e2c0292c6597e00"/> <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="a32003194f707f66a2d8cdb913ed1869f1926c5d"/> <project name="device/common" path="device/common" revision="96d4d2006c4fcb2f19a3fa47ab10cb409faa017b"/> @@ -120,17 +120,17 @@ <project name="platform/hardware/libhardware_legacy" path="hardware/libhardware_legacy" revision="76c4bf4bc430a1b8317f2f21ef735867733e50cc"/> <project name="platform/system/media" path="system/media" revision="c1332c21c608f4932a6d7e83450411cde53315ef"/> <!--original fetch url was git://github.com/t2m-foxfone/--> <remote fetch="https://git.mozilla.org/external/t2m-foxfone" name="t2m"/> <default remote="caf" revision="LNX.LA.3.5.2.1.1" sync-j="4"/> <!-- Flame specific things --> <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/> <project name="device/qcom/common" path="device/qcom/common" revision="2501e5940ba69ece7654ff85611c76ae5bda299c"/> - <project name="device-flame" path="device/t2m/flame" remote="b2g" revision="040bb1e9ac8a5b6dd756fdd696aa37a8868b5c67"/> + <project name="device-flame" path="device/t2m/flame" remote="b2g" revision="a4f6f31d1fe213ac935ca8ede7d05e47324101a4"/> <project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="0865bc4134b67220df4058625fba29305d6b10c3"/> <project name="kernel_lk" path="bootable/bootloader/lk" remote="b2g" revision="fda40423ffa573dc6cafd3780515010cb2a086be"/> <project name="platform_bootable_recovery" path="bootable/recovery" remote="b2g" revision="d5e53ed6f22fa06052351dc03510af9473af01ea"/> <project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="d61fc97258c8b0c362430dd2eb195dcc4d266f14"/> <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="5b71e40213f650459e95d35b6f14af7e88d8ab62"/> <project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="t2m" revision="4186bdecb4dae911b39a8202252cc2310d91b0be"/> <project name="platform_external_libnfc-pn547" path="external/libnfc-pn547" remote="b2g" revision="5bb999b84b8adc14f6bea004d523ba258dea8188"/> <project name="platform/frameworks/av" path="frameworks/av" revision="65f5144987afff35a932262c0c5fad6ecce0c04a"/>
--- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "31ef8deec7a04a988eb92309178b87cc0bde8220", + "git_revision": "9844b7c9d4429a041cff7201f1a63d0264e155ff", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "7ede26b2954bae2861dccff4f92adc1e9897fef3", + "revision": "8edfc1021ec1ceb0a7f7fb0b23e96b44a0fe8254", "repo_path": "integration/gaia-central" }
--- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -12,20 +12,20 @@ <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="4efd19d199ae52656604f794c5a77518400220fd"> <copyfile dest="Makefile" src="core/root.mk"/> </project> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <!-- Stock Android things --> <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/> <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="9025e50b9d29b3cabbbb21e1dd94d0d13121a17e"/> <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/> <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
--- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -10,25 +10,25 @@ <!--original fetch url was git://codeaurora.org/--> <remote fetch="https://git.mozilla.org/external/caf" name="caf"/> <!--original fetch url was https://git.mozilla.org/releases--> <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/> <!-- B2G specific things. --> <project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33"> <copyfile dest="Makefile" src="core/root.mk"/> </project> - <project name="gaia" path="gaia" remote="mozillaorg" revision="31ef8deec7a04a988eb92309178b87cc0bde8220"/> + <project name="gaia" path="gaia" remote="mozillaorg" revision="9844b7c9d4429a041cff7201f1a63d0264e155ff"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> - <project name="apitrace" path="external/apitrace" remote="apitrace" revision="d172b02d2d43774b934a866912b9a170c7f495df"/> + <project name="apitrace" path="external/apitrace" remote="apitrace" revision="70b7fcbf7ff0ef38d04f82d68a56f2bb44ec694a"/> <!-- Stock Android things --> <project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" revision="8af5ff6f5dced9eb5a8127459df6c75d24342204"/> <project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" revision="30915518fa7ea07166efedc191a4f40aef516fe7"/> <project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" revision="96eee58e3389fb05a835310d6a06a6ba4486097a"/> <project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" revision="7c8a46698171aa2e0be09edb43d15a6acf832770"/> <project groups="pdk,linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" path="prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" revision="24b2038be8a636fd4a5d21f0abae1e466b07bcf7"/>
--- a/dom/apps/ImportExport.jsm +++ b/dom/apps/ImportExport.jsm @@ -384,45 +384,48 @@ this.ImportExport = { meta.downloadSize = 0; meta.lastUpdateCheck = Date.now(); meta.updateTime = Date.now(); meta.manifestHash = AppsUtils.computeHash(manifestString); meta.installerAppId = Ci.nsIScriptSecurityManager.NO_APP_ID; meta.installerIsBrowser = false; meta.role = manifest.role; + let devMode = false; + try { + devMode = Services.prefs.getBoolPref("dom.apps.developer_mode"); + } catch(e) {} + // Set the appropriate metadata for hosted and packaged apps. if (isPackage) { meta.origin = "app://" + meta.id; // Signature check // TODO: stop accessing internal methods of other objects. let [reader, isSigned] = yield DOMApplicationRegistry._openPackage(appFile, meta, false); let maxStatus = isSigned ? Ci.nsIPrincipal.APP_STATUS_PRIVILEGED : Ci.nsIPrincipal.APP_STATUS_INSTALLED; - try { - // Anything is possible in developer mode. - if (Services.prefs.getBoolPref("dom.apps.developer_mode")) { - maxStatus = Ci.nsIPrincipal.APP_STATUS_CERTIFIED; - } - } catch(e) {}; + // Anything is possible in developer mode. + if (devMode) { + maxStatus = Ci.nsIPrincipal.APP_STATUS_CERTIFIED; + } meta.appStatus = AppsUtils.getAppManifestStatus(manifest); debug("Signed app? " + isSigned); if (meta.appStatus > maxStatus) { throw "InvalidPrivilegeLevel"; } // Custom origin. // We unfortunately can't reuse _checkOrigin here. - if (isSigned && - meta.appStatus == Ci.nsIPrincipal.APP_STATUS_PRIVILEGED && + if ((isSigned || devMode) && + meta.appStatus >= Ci.nsIPrincipal.APP_STATUS_PRIVILEGED && manifest.origin) { let uri; try { - uri = Services.io.newURI(aManifest.origin, null, null); + uri = Services.io.newURI(manifest.origin, null, null); } catch(e) { throw "InvalidOrigin"; } if (uri.scheme != "app") { throw "InvalidOrigin"; } meta.id = uri.prePath.substring(6); // "app://".length if (meta.id in DOMApplicationRegistry.webapps) {
--- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp @@ -252,16 +252,35 @@ GonkAudioDecoderManager::Output(int64_t } aOutData = data; return NS_OK; } case android::INFO_FORMAT_CHANGED: { // If the format changed, update our cached info. GADM_LOG("Decoder format changed"); + sp<AMessage> audioCodecFormat; + + if (mDecoder->getOutputFormat(&audioCodecFormat) != OK || + audioCodecFormat == nullptr) { + return NS_ERROR_UNEXPECTED; + } + + int32_t codec_channel_count = 0; + int32_t codec_sample_rate = 0; + + if (!audioCodecFormat->findInt32("channel-count", &codec_channel_count) || + !audioCodecFormat->findInt32("sample-rate", &codec_sample_rate)) { + return NS_ERROR_UNEXPECTED; + } + + // Update AudioInfo + mAudioChannels = codec_channel_count; + mAudioRate = codec_sample_rate; + return Output(aStreamOffset, aOutData); } case android::INFO_OUTPUT_BUFFERS_CHANGED: { GADM_LOG("Info Output Buffers Changed"); if (mDecoder->UpdateOutputBuffers()) { return Output(aStreamOffset, aOutData); }
--- a/dom/media/platforms/gonk/GonkAudioDecoderManager.h +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.h @@ -40,18 +40,18 @@ public: private: bool PerformFormatSpecificProcess(MediaRawData* aSample); nsresult CreateAudioData(int64_t aStreamOffset, AudioData** aOutData); void ReleaseAudioBuffer(); - const uint32_t mAudioChannels; - const uint32_t mAudioRate; + uint32_t mAudioChannels; + uint32_t mAudioRate; const uint32_t mAudioProfile; bool mUseAdts; MediaDataDecoderCallback* mReaderCallback; android::MediaBuffer* mAudioBuffer; android::sp<ALooper> mLooper; // MediaCodedc's wrapper that performs the decoding.
--- a/dom/secureelement/DOMSecureElement.js +++ b/dom/secureelement/DOMSecureElement.js @@ -27,16 +27,26 @@ XPCOMUtils.defineLazyServiceGetter(this, "nsISyncMessageSender"); XPCOMUtils.defineLazyGetter(this, "SE", function() { let obj = {}; Cu.import("resource://gre/modules/se_consts.js", obj); return obj; }); +// Extend / Inherit from Error object +function SEError(name, message) { + this.name = name || SE.ERROR_GENERIC; + this.message = message || ""; +} + +SEError.prototype = { + __proto__: Error.prototype, +}; + function PromiseHelpersSubclass(win) { this._window = win; } PromiseHelpersSubclass.prototype = { __proto__: DOMRequestIpcHelper.prototype, _window: null, @@ -69,21 +79,21 @@ PromiseHelpersSubclass.prototype = { // Get the context associated with this resolverId let context = this._context[resolverId]; delete this._context[resolverId]; return {resolver: resolver, context: context}; }, - rejectWithSEError: function rejectWithSEError(reason) { - return this.createSEPromise((resolverId) => { - debug("rejectWithSEError : " + reason); - this.takePromiseResolver(resolverId).reject(new Error(reason)); - }); + rejectWithSEError: function rejectWithSEError(name, message) { + let error = new SEError(name, message); + debug("rejectWithSEError - " + error.toString()); + + return this._window.Promise.reject(Cu.cloneInto(error, this._window)); } }; // Helper wrapper class to do promises related chores let PromiseHelpers; /** * Instance of 'SEReaderImpl' class is the connector to a secure element. @@ -150,18 +160,19 @@ SEReaderImpl.prototype = { } let resolver = PromiseHelpers.takePromiseResolver(resolverId); // Wait till all the promises are resolved Promise.all(promises).then(() => { this._sessions = []; resolver.resolve(); }, (reason) => { - resolver.reject(new Error(SE.ERROR_BADSTATE + - " Unable to close all channels associated with this reader")); + let error = new SEError(SE.ERROR_BADSTATE, + "Unable to close all channels associated with this reader"); + resolver.reject(Cu.cloneInto(error, this._window)); }); }); }, updateSEPresence: function updateSEPresence(isSEPresent) { if (!isSEPresent) { this.invalidate(); return; @@ -198,23 +209,16 @@ SESessionImpl.prototype = { _isClosed: false, _reader: null, classID: Components.ID("{2b1809f8-17bd-4947-abd7-bdef1498561c}"), contractID: "@mozilla.org/secureelement/session;1", QueryInterface: XPCOMUtils.generateQI([]), - // Private function - _checkClosed: function _checkClosed() { - if (this._isClosed) { - throw new Error(SE.ERROR_BADSTATE + " Session Already Closed!"); - } - }, - // Chrome-only function onChannelOpen: function onChannelOpen(channelCtx) { this._channels.push(channelCtx); }, // Chrome-only function onChannelClose: function onChannelClose(channelCtx) { let index = this._channels.indexOf(channelCtx); @@ -224,22 +228,25 @@ SESessionImpl.prototype = { }, initialize: function initialize(win, readerCtx) { this._window = win; this._reader = readerCtx; }, openLogicalChannel: function openLogicalChannel(aid) { - this._checkClosed(); + if (this._isClosed) { + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, + "Session Already Closed!"); + } let aidLen = aid ? aid.length : 0; if (aidLen < SE.MIN_AID_LEN || aidLen > SE.MAX_AID_LEN) { - return PromiseHelpers.rejectWithSEError(SE.ERROR_GENERIC + - " Invalid AID length - " + aidLen); + return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER, + "Invalid AID length - " + aidLen); } return PromiseHelpers.createSEPromise((resolverId) => { /** * @params for 'SE:OpenChannel' * * resolverId : ID that identifies this IPC request. * aid : AID that identifies the applet on SecureElement @@ -251,17 +258,20 @@ SESessionImpl.prototype = { aid: aid, type: this.reader.type, appId: this._window.document.nodePrincipal.appId }); }, this); }, closeAll: function closeAll() { - this._checkClosed(); + if (this._isClosed) { + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, + "Session Already Closed!"); + } return PromiseHelpers.createSEPromise((resolverId) => { let promises = []; for (let channel of this._channels) { if (!channel.isClosed) { promises.push(channel.close()); } } @@ -271,17 +281,17 @@ SESessionImpl.prototype = { this._isClosed = true; this._channels = []; // Notify parent of this session instance's closure, so that its // instance entry can be removed from the parent as well. this._reader.onSessionClose(this.__DOM_IMPL__); resolver.resolve(); }, (reason) => { resolver.reject(new Error(SE.ERROR_BADSTATE + - " Unable to close all channels associated with this session")); + "Unable to close all channels associated with this session")); }); }); }, invalidate: function invlidate() { this._isClosed = true; this._channels.forEach(ch => ch.invalidate()); this._channels = []; @@ -315,22 +325,16 @@ SEChannelImpl.prototype = { openResponse: [], type: null, classID: Components.ID("{181ebcf4-5164-4e28-99f2-877ec6fa83b9}"), contractID: "@mozilla.org/secureelement/channel;1", QueryInterface: XPCOMUtils.generateQI([]), - _checkClosed: function _checkClosed() { - if (this._isClosed) { - throw new Error(SE.ERROR_BADSTATE + " Channel Already Closed!"); - } - }, - // Chrome-only function onClose: function onClose() { this._isClosed = true; // Notify the parent this._session.onChannelClose(this.__DOM_IMPL__); }, initialize: function initialize(win, channelToken, isBasicChannel, @@ -344,38 +348,41 @@ SEChannelImpl.prototype = { this.openResponse = Cu.cloneInto(new Uint8Array(openResponse), win); this.type = isBasicChannel ? "basic" : "logical"; }, transmit: function transmit(command) { // TODO remove this once it will be possible to have a non-optional dict // in the WebIDL if (!command) { - return PromiseHelpers.rejectWithSEError(SE.ERROR_GENERIC + - " SECommand dict must be defined"); + return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER, + "SECommand dict must be defined"); } - this._checkClosed(); + if (this._isClosed) { + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, + "Channel Already Closed!"); + } let dataLen = command.data ? command.data.length : 0; if (dataLen > SE.MAX_APDU_LEN) { - return PromiseHelpers.rejectWithSEError(SE.ERROR_GENERIC + + return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER, " Command data length exceeds max limit - 255. " + " Extended APDU is not supported!"); } if ((command.cla & 0x80 === 0) && ((command.cla & 0x60) !== 0x20)) { if (command.ins === SE.INS_MANAGE_CHANNEL) { - return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY + - ", MANAGE CHANNEL command not permitted"); + return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY, + "MANAGE CHANNEL command not permitted"); } if ((command.ins === SE.INS_SELECT) && (command.p1 == 0x04)) { // SELECT by DF Name (p1=04) is not allowed - return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY + - ", SELECT command not permitted"); + return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY, + "SELECT command not permitted"); } debug("Attempting to transmit an ISO command"); } else { debug("Attempting to transmit GlobalPlatform command"); } return PromiseHelpers.createSEPromise((resolverId) => { /** @@ -392,17 +399,20 @@ SEChannelImpl.prototype = { apdu: command, channelToken: this._channelToken, appId: this._window.document.nodePrincipal.appId }); }, this); }, close: function close() { - this._checkClosed(); + if (this._isClosed) { + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, + "Channel Already Closed!"); + } return PromiseHelpers.createSEPromise((resolverId) => { /** * @params for 'SE:CloseChannel' * * resolverId : Id that identifies this IPC request. * channelToken: Token that identifies the current channel over which 'c-apdu' is being sent. @@ -578,29 +588,29 @@ SEManagerImpl.prototype = { context.onClose(); } resolver.resolve(); break; case "SE:GetSEReadersRejected": case "SE:OpenChannelRejected": case "SE:CloseChannelRejected": case "SE:TransmitAPDURejected": - let error = result.error || SE.ERROR_GENERIC; - resolver.reject(error); + let error = new SEError(result.error, result.reason); + resolver.reject(Cu.cloneInto(error, this._window)); break; case "SE:ReaderPresenceChanged": debug("Reader " + result.type + " present: " + result.isPresent); let reader = this._readers.find(r => r.type === result.type); if (reader) { reader.updateSEPresence(result.isPresent); } break; default: debug("Could not find a handler for " + message.name); - resolver.reject(); + resolver.reject(Cu.cloneInto(new SEError(), this._window)); break; } } }; this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ SEResponseImpl, SEChannelImpl, SESessionImpl, SEReaderImpl, SEManagerImpl ]);
--- a/dom/secureelement/gonk/se_consts.js +++ b/dom/secureelement/gonk/se_consts.js @@ -54,14 +54,15 @@ this.INS_GET_RESPONSE = 0xC0; this.ERROR_NONE = ""; this.ERROR_SECURITY = "SESecurityError"; this.ERROR_IO = "SEIoError"; this.ERROR_BADSTATE = "SEBadStateError"; this.ERROR_INVALIDCHANNEL = "SEInvalidChannelError"; this.ERROR_INVALIDAPPLICATION = "SEInvalidApplicationError"; this.ERROR_GENERIC = "SEGenericError"; this.ERROR_NOTPRESENT = "SENotPresentError"; +this.ERROR_ILLEGALPARAMETER = "SEIllegalParameterError"; this.TYPE_UICC = "uicc"; this.TYPE_ESE = "eSE"; // Allow this file to be imported via Components.utils.import(). this.EXPORTED_SYMBOLS = Object.keys(this);
--- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -9825,26 +9825,26 @@ ICCPDUHelperObject.prototype = { number = number.substring(1); } GsmPDUHelper.writeHexOctet(toa); GsmPDUHelper.writeSwappedNibbleBCD(number); }, readNumberWithLength: function() { let Buf = this.context.Buf; - let number; + let number = ""; let numLen = this.context.GsmPDUHelper.readHexOctet(); if (numLen != 0xff) { if (numLen > ADN_MAX_BCD_NUMBER_BYTES) { if (DEBUG) { this.context.debug( "Error: invalid length of BCD number/SSC contents - " + numLen); } Buf.seekIncoming(ADN_MAX_BCD_NUMBER_BYTES * Buf.PDU_HEX_OCTET_SIZE); - return ""; + return number; } number = this.readDiallingNumber(numLen); Buf.seekIncoming((ADN_MAX_BCD_NUMBER_BYTES - numLen) * Buf.PDU_HEX_OCTET_SIZE); } else { Buf.seekIncoming(ADN_MAX_BCD_NUMBER_BYTES * Buf.PDU_HEX_OCTET_SIZE); }
--- a/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js @@ -555,18 +555,18 @@ add_test(function test_read_number_with_ let iccHelper = context.ICCPDUHelper; let numbers = [ { number: "123456789", expectedNumber: "123456789" }, { - number: null, - expectedNumber: null + number: "", + expectedNumber: "" }, // Invalid length of BCD number/SSC contents { number: "12345678901234567890123", expectedNumber: "" }, ]; @@ -574,17 +574,17 @@ add_test(function test_read_number_with_ context.Buf.seekIncoming = function(offset) { }; function do_test(aNumber, aExpectedNumber) { iccHelper.readDiallingNumber = function(numLen) { return aNumber.substring(0, numLen); }; - if (aNumber != null) { + if (aNumber) { helper.writeHexOctet(aNumber.length + 1); } else { helper.writeHexOctet(0xff); } equal(iccHelper.readNumberWithLength(), aExpectedNumber); }
--- a/dom/telephony/test/marionette/head.js +++ b/dom/telephony/test/marionette/head.js @@ -274,16 +274,28 @@ let emulator = (function() { return telephony.calls.length === 0; }); }); } /** * @return Promise */ + function changeModemTech(aTech, aPreferredMask) { + return Promise.resolve() + .then(() => emulator.runCmd("modem tech " + aTech + " " + aPreferredMask)) + .then(() => emulator.runCmd("modem tech")) + .then(result => is(result[0], + aTech + " " + aPreferredMask, + "Check modem 'tech/preferred mask'")); + } + + /** + * @return Promise + */ function clearCalls() { log("Clear existing calls."); // Hang up all calls. let hangUpPromises = []; for (let call of telephony.calls) { log(".. hangUp " + call.id.number); @@ -1147,16 +1159,17 @@ let emulator = (function() { this.gDelay = delay; this.gWaitForSystemMessage = waitForSystemMessage; this.gWaitForEvent = waitForEvent; this.gWaitForCallsChangedEvent = waitForCallsChangedEvent; this.gWaitForNamedStateEvent = waitForNamedStateEvent; this.gWaitForStateChangeEvent = waitForStateChangeEvent; this.gCheckInitialState = checkInitialState; + this.gChangeModemTech = changeModemTech; this.gClearCalls = clearCalls; this.gOutCallStrPool = outCallStrPool; this.gInCallStrPool = inCallStrPool; this.gCheckState = checkState; this.gCheckAll = checkAll; this.gSendMMI = sendMMI; this.gDial = dial; this.gDialEmergency = dialEmergency;
new file mode 100644 --- /dev/null +++ b/dom/telephony/test/marionette/test_modem_switch_tech.js @@ -0,0 +1,54 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +let settings = [ + // "gsm/wcdma" + {tech: "gsm", mask: "gsm/wcdma"}, + {tech: "wcdma", mask: "gsm/wcdma"}, + + // "gsm" + {tech: "gsm", mask: "gsm"}, + + // "wcdma" + {tech: "wcdma", mask: "wcdma"}, + + // "gsm/wcdma-auto" + {tech: "gsm", mask: "gsm/wcdma-auto"}, + {tech: "wcdma", mask: "gsm/wcdma-auto"}, + + // "cdma/evdo" + {tech: "cdma", mask: "cdma/evdo"}, + {tech: "evdo", mask: "cdma/evdo"}, + + // "cdma" + {tech: "cdma", mask: "cdma"}, + + // "evdo" + {tech: "evdo", mask: "evdo"}, + + // "gsm/wcdma/cdma/evdo" + {tech: "gsm", mask: "gsm/wcdma/cdma/evdo"}, + {tech: "wcdma", mask: "gsm/wcdma/cdma/evdo"}, + {tech: "cdma", mask: "gsm/wcdma/cdma/evdo"}, + {tech: "evdo", mask: "gsm/wcdma/cdma/evdo"} +]; + +startTest(function() { + + let promise = settings.reduce((aPromise, aSetting) => { + return aPromise.then(() => gChangeModemTech(aSetting.tech, aSetting.mask)); + }, Promise.resolve()); + + return promise + // Exception Catching + .catch(error => ok(false, "Promise reject: " + error)) + + // Switch to the default modem tech + .then(() => gChangeModemTech("wcdma", "gsm/wcdma")) + .catch(error => ok(false, "Fetal Error: Promise reject: " + error)) + + .then(finish); +});
--- a/dom/webidl/SecureElement.webidl +++ b/dom/webidl/SecureElement.webidl @@ -11,16 +11,17 @@ enum SEType { enum SEError { "SESecurityError", // Requested operation does not match the access control rules of the application. "SEIoError", // I/O Error while communicating with the secure element. "SEBadStateError", // Error occuring as a result of bad state. "SEInvalidChannelError", // Opening a channel failed because no channel is available. "SEInvalidApplicationError", // The requested application was not found on the secure element. "SENotPresentError", // Secure Element is not present + "SEIllegalParameterError", // Request operation does not have valid parameters. "SEGenericError" // Generic failures. }; enum SEChannelType { "basic", "logical" };
--- a/dom/workers/ServiceWorkerContainer.cpp +++ b/dom/workers/ServiceWorkerContainer.cpp @@ -3,16 +3,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ServiceWorkerContainer.h" #include "nsIDocument.h" #include "nsIServiceWorkerManager.h" +#include "nsNetUtil.h" #include "nsPIDOMWindow.h" #include "mozilla/Services.h" #include "nsCycleCollectionParticipant.h" #include "nsServiceManagerUtils.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ServiceWorkerContainerBinding.h"
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -751,16 +751,24 @@ nsWindowWatcher::OpenWindowInternal(nsID popupConditions = !isCallerChrome; } if (popupConditions) { contextFlags |= nsIWindowCreator2::PARENT_IS_LOADING_OR_RUNNING_TIMEOUT; } + // B2G multi-screen support. mozDisplayId is returned from the + // "display-changed" event, it is also platform-dependent. +#ifdef MOZ_WIDGET_GONK + int retval = WinHasOption(features.get(), "mozDisplayId", 0, nullptr); + windowCreator2->SetScreenId(retval); +#endif + + bool cancel = false; rv = windowCreator2->CreateChromeWindow2(parentChrome, chromeFlags, contextFlags, uriToLoad, aOpeningTab, &cancel, getter_AddRefs(newChrome)); if (NS_SUCCEEDED(rv) && cancel) { newChrome = 0; // just in case rv = NS_ERROR_ABORT;
--- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -14,16 +14,18 @@ // we're using default display for now #define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW)) #elif defined(MOZ_WIDGET_QT) #define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)(aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW)) #elif defined(MOZ_WIDGET_GONK) #define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW)) #include "HwcComposer2D.h" #include "libdisplay/GonkDisplay.h" +#include "nsWindow.h" +#include "nsScreenManagerGonk.h" #endif #if defined(ANDROID) /* from widget */ #if defined(MOZ_WIDGET_ANDROID) #include "AndroidBridge.h" #endif @@ -123,17 +125,17 @@ namespace gl { (_array).AppendElement(_v); \ } while (0) #define ADD_ATTR_1(_array, _k) do { \ (_array).AppendElement(_k); \ } while (0) static bool -CreateConfig(EGLConfig* aConfig); +CreateConfig(EGLConfig* aConfig, nsIWidget* aWidget); // append three zeros at the end of attribs list to work around // EGL implementation bugs that iterate until they find 0, instead of // EGL_NONE. See bug 948406. #define EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS \ LOCAL_EGL_NONE, 0, 0, 0 static EGLint gTerminationAttribs[] = { @@ -478,17 +480,17 @@ GLContextEGL::HoldSurface(gfxASurface *a GLContextEGL::CreateSurfaceForWindow(nsIWidget* aWidget) { if (!sEGLLibrary.EnsureInitialized()) { MOZ_CRASH("Failed to load EGL library!\n"); return nullptr; } EGLConfig config; - if (!CreateConfig(&config)) { + if (!CreateConfig(&config, aWidget)) { MOZ_CRASH("Failed to create EGLConfig!\n"); return nullptr; } EGLSurface surface = mozilla::gl::CreateSurfaceForWindow(aWidget, config); return surface; } @@ -632,17 +634,17 @@ static const EGLint kEGLConfigAttribsRGB LOCAL_EGL_ALPHA_SIZE, 8, #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17 LOCAL_EGL_FRAMEBUFFER_TARGET_ANDROID, LOCAL_EGL_TRUE, #endif EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS }; static bool -CreateConfig(EGLConfig* aConfig, int32_t depth) +CreateConfig(EGLConfig* aConfig, int32_t depth, nsIWidget* aWidget) { EGLConfig configs[64]; const EGLint* attribs; EGLint ncfg = ArrayLength(configs); switch (depth) { case 16: attribs = kEGLConfigAttribsRGB16; @@ -668,22 +670,23 @@ CreateConfig(EGLConfig* aConfig, int32_t // On gonk, it's important to select a configuration with the // the correct order as well as bits per channel. // EGL_NATIVE_VISUAL_ID gives us the Android pixel format which // is an enum that tells us both order and bits per channel. // For example - // HAL_PIXEL_FORMAT_RGBX_8888 // HAL_PIXEL_FORMAT_BGRA_8888 // HAL_PIXEL_FORMAT_RGB_565 + nsWindow* window = static_cast<nsWindow*>(aWidget); for (int j = 0; j < ncfg; ++j) { EGLConfig config = configs[j]; EGLint format; if (sEGLLibrary.fGetConfigAttrib(EGL_DISPLAY(), config, LOCAL_EGL_NATIVE_VISUAL_ID, &format) && - format == GetGonkDisplay()->surfaceformat) + format == window->GetScreen()->GetSurfaceFormat()) { *aConfig = config; return true; } } #endif for (int j = 0; j < ncfg; ++j) { @@ -709,30 +712,30 @@ CreateConfig(EGLConfig* aConfig, int32_t } // Return true if a suitable EGLConfig was found and pass it out // through aConfig. Return false otherwise. // // NB: It's entirely legal for the returned EGLConfig to be valid yet // have the value null. static bool -CreateConfig(EGLConfig* aConfig) +CreateConfig(EGLConfig* aConfig, nsIWidget* aWidget) { int32_t depth = gfxPlatform::GetPlatform()->GetScreenDepth(); - if (!CreateConfig(aConfig, depth)) { + if (!CreateConfig(aConfig, depth, aWidget)) { #ifdef MOZ_WIDGET_ANDROID // Bug 736005 // Android doesn't always support 16 bit so also try 24 bit if (depth == 16) { - return CreateConfig(aConfig, 24); + return CreateConfig(aConfig, 24, aWidget); } // Bug 970096 // Some devices that have 24 bit screens only support 16 bit OpenGL? if (depth == 24) { - return CreateConfig(aConfig, 16); + return CreateConfig(aConfig, 16, aWidget); } #endif return false; } else { return true; } } @@ -767,17 +770,17 @@ GLContextProviderEGL::CreateForWindow(ns if (!sEGLLibrary.EnsureInitialized()) { MOZ_CRASH("Failed to load EGL library!\n"); return nullptr; } bool doubleBuffered = true; EGLConfig config; - if (!CreateConfig(&config)) { + if (!CreateConfig(&config, aWidget)) { MOZ_CRASH("Failed to create EGLConfig!\n"); return nullptr; } EGLSurface surface = mozilla::gl::CreateSurfaceForWindow(aWidget, config); if (surface == EGL_NO_SURFACE) { MOZ_CRASH("Failed to create EGLSurface!\n"); @@ -806,17 +809,17 @@ GLContextProviderEGL::CreateForWindow(ns EGLSurface GLContextProviderEGL::CreateEGLSurface(void* aWindow) { if (!sEGLLibrary.EnsureInitialized()) { MOZ_CRASH("Failed to load EGL library!\n"); } EGLConfig config; - if (!CreateConfig(&config)) { + if (!CreateConfig(&config, static_cast<nsIWidget*>(aWindow))) { MOZ_CRASH("Failed to create EGLConfig!\n"); } MOZ_ASSERT(aWindow); EGLSurface surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, aWindow, 0); if (surface == EGL_NO_SURFACE) {
--- a/gfx/layers/YCbCrImageDataSerializer.cpp +++ b/gfx/layers/YCbCrImageDataSerializer.cpp @@ -5,16 +5,17 @@ #include "mozilla/layers/YCbCrImageDataSerializer.h" #include <string.h> // for memcpy #include "mozilla/gfx/2D.h" // for DataSourceSurface, Factory #include "mozilla/gfx/BaseSize.h" // for BaseSize #include "mozilla/gfx/Logging.h" // for gfxDebug #include "mozilla/gfx/Types.h" #include "mozilla/mozalloc.h" // for operator delete +#include "nsDebug.h" // for NS_WARN_IF #include "yuv_convert.h" // for ConvertYCbCrToRGB32, etc #define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3) namespace mozilla { using namespace gfx;
--- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -661,17 +661,18 @@ LayerManagerComposite::Render() /** Our more efficient but less powerful alter ego, if one is available. */ nsRefPtr<Composer2D> composer2D; composer2D = mCompositor->GetWidget()->GetComposer2D(); // We can't use composert2D if we have layer effects if (!mTarget && !haveLayerEffects && gfxPrefs::Composer2DCompositionEnabled() && - composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot, mGeometryChanged)) + composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot, + mCompositor->GetWidget(), mGeometryChanged)) { LayerScope::SetHWComposed(); if (mFPS) { double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now()); if (gfxPrefs::LayersDrawFPS()) { printf_stderr("HWComposer: FPS is %g\n", fps); } } @@ -767,17 +768,17 @@ LayerManagerComposite::Render() PROFILER_LABEL("LayerManagerComposite", "EndFrame", js::ProfileEntry::Category::GRAPHICS); mCompositor->EndFrame(); mCompositor->SetDispAcquireFence(mRoot); } if (composer2D) { - composer2D->Render(); + composer2D->Render(mCompositor->GetWidget()); } mCompositor->GetWidget()->PostRender(this); RecordFrame(); } #ifdef MOZ_WIDGET_ANDROID
--- a/gfx/layers/opengl/Composer2D.h +++ b/gfx/layers/opengl/Composer2D.h @@ -21,16 +21,18 @@ * * Composer2D is a very simple interface to this class of hardware * that allows an implementation to "try rendering" with the fast * path. If the given layer tree requires more generality than the * hardware provides, the implementation should bail and have the * layer manager fall back on full GPU composition. */ +class nsIWidget; + namespace mozilla { namespace layers { class Layer; class Composer2D { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Composer2D) @@ -42,23 +44,24 @@ public: /** * Return true if |aRoot| met the implementation's criteria for fast * composition and the render was successful. Return false to fall * back on the GPU. * * Currently, when TryRender() returns true, the entire framebuffer * must have been rendered. */ - virtual bool TryRenderWithHwc(Layer* aRoot, bool aGeometryChanged) = 0; + virtual bool TryRenderWithHwc(Layer* aRoot, nsIWidget* aWidget, + bool aGeometryChanged) = 0; /** * Return true if Composer2D does composition. Return false if Composer2D * failed the composition. */ - virtual bool Render() = 0; + virtual bool Render(nsIWidget* aWidget) = 0; /** * Return true if Composer2D has a fast composition hardware. * Return false if Composer2D does not have a fast composition hardware. */ virtual bool HasHwc() = 0; };
--- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -52,16 +52,18 @@ #include "nsCocoaFeatures.h" #endif #include "GeckoProfiler.h" #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17 #include "libdisplay/GonkDisplay.h" // for GonkDisplay #include <ui/Fence.h> +#include "nsWindow.h" +#include "nsScreenManagerGonk.h" #endif namespace mozilla { using namespace std; using namespace gfx; namespace layers { @@ -1404,18 +1406,19 @@ CompositorOGL::SetDispAcquireFence(Layer // to prevent flickering and tearing. // DispAcquireFence is DisplaySurface's AcquireFence. // AcquireFence will be signaled when a buffer's content is available. // See Bug 974152. if (!aLayer) { return; } - - RefPtr<FenceHandle::FdObj> fence = new FenceHandle::FdObj(GetGonkDisplay()->GetPrevDispAcquireFd()); + nsWindow* window = static_cast<nsWindow*>(mWidget); + RefPtr<FenceHandle::FdObj> fence = new FenceHandle::FdObj( + window->GetScreen()->GetPrevDispAcquireFd()); mReleaseFenceHandle.Merge(FenceHandle(fence)); } FenceHandle CompositorOGL::GetReleaseFence() { if (!mReleaseFenceHandle.IsValid()) { return FenceHandle();
--- a/testing/taskcluster/taskcluster_graph/commit_parser.py +++ b/testing/taskcluster/taskcluster_graph/commit_parser.py @@ -18,16 +18,44 @@ TEST_CHUNK_SUFFIX = re.compile('(.*)-([0 BUILD_TYPE_ALIASES = { 'o': 'opt', 'd': 'debug' } class InvalidCommitException(Exception): pass +def escape_whitspace_in_brackets(input_str): + ''' + In tests you may restrict them by platform [] inside of the brackets + whitespace may occur this is typically invalid shell syntax so we escape it + with backslash sequences . + ''' + result = "" + in_brackets = False + for char in input_str: + if char == '[': + in_brackets = True + result += char + continue + + if char == ']': + in_brackets = False + result += char + continue + + if char == ' ' and in_brackets: + result += '\ ' + continue + + result += char + + return result + + def normalize_platform_list(alias, all_builds, build_list): if build_list == 'all': return all_builds results = [] for build in build_list.split(','): if build in alias: build = alias[build] @@ -173,17 +201,17 @@ the "jobs" datastructure (see job_flags. def parse_commit(message, jobs): ''' :param message: Commit message that is typical to a try push. :param jobs: Dict (see job_flags.yml) ''' # shlex used to ensure we split correctly when giving values to argparse. - parts = shlex.split(message) + parts = shlex.split(escape_whitspace_in_brackets(message)) try_idx = None for idx, part in enumerate(parts): if part == TRY_DELIMITER: try_idx = idx break if try_idx is None: raise InvalidCommitException('Invalid commit format contain ' +
--- a/testing/taskcluster/tasks/builds/dbg_linux64.yml +++ b/testing/taskcluster/tasks/builds/dbg_linux64.yml @@ -1,10 +1,10 @@ $inherits: - from: 'tasks/opt_linux64.yml' + from: 'tasks/builds/opt_linux64.yml' variables: build_name: 'linux64' build_type: 'dbg' task: metadata: name: '[TC] Linux64 Dbg' description: 'Linux64 Dbg'
--- a/testing/taskcluster/tasks/tests/b2g_gaia_js_integration_tests.yml +++ b/testing/taskcluster/tasks/tests/b2g_gaia_js_integration_tests.yml @@ -28,17 +28,17 @@ task: artifacts: 'public/build': type: directory path: '/home/worker/artifacts/' expires: '{{#from_now}}1 year{{/from_now}}' extra: chunks: - total: 30 + total: 20 treeherderEnv: - production - staging treeherder: groupName: Gaia JS Integration Test groupSymbol: Gij symbol: '{{chunk}}' productName: b2g
--- a/testing/taskcluster/tests/test_commit_parser.py +++ b/testing/taskcluster/tests/test_commit_parser.py @@ -255,18 +255,19 @@ class TestCommitParser(unittest.TestCase ] result = parse_commit(commit, jobs) self.assertEqual(expected, result) def test_specific_test_platforms(self): ''' This test cases covers the platform specific test exclusion options. + Intentionally includes platforms with spaces. ''' - commit = 'try: -b od -p all -u all[windows,b2g] -t none' + commit = 'try: -b od -p all -u all[Windows XP,b2g] -t none' jobs = { 'flags': { 'builds': ['linux', 'win32'], 'tests': ['web-platform-tests', 'mochitest'], }, 'builds': { 'linux': { 'types': { @@ -274,17 +275,17 @@ class TestCommitParser(unittest.TestCase 'task': 'task/linux', }, 'debug': { 'task': 'task/linux-debug' } } }, 'win32': { - 'platforms': ['windows'], + 'platforms': ['Windows XP'], 'types': { 'opt': { 'task': 'task/win32', } } }, }, 'tests': {
--- a/testing/taskcluster/tests/test_try_test_parser.py +++ b/testing/taskcluster/tests/test_try_test_parser.py @@ -1,16 +1,21 @@ import unittest import mozunit from taskcluster_graph.try_test_parser import parse_test_opts class TryTestParserTest(unittest.TestCase): def test_parse_opts_valid(self): self.assertEquals( + parse_test_opts('all[Mulet Linux]'), + [{ 'test': 'all', 'platforms': ['Mulet Linux'] }] + ) + + self.assertEquals( parse_test_opts('all[Amazing, Foobar woot,yeah]'), [{ 'test': 'all', 'platforms': ['Amazing', 'Foobar woot', 'yeah'] }] ) self.assertEquals( parse_test_opts('a,b, c'), [ { 'test': 'a' }, @@ -43,9 +48,8 @@ class TryTestParserTest(unittest.TestCas self.assertEquals( parse_test_opts(''), [] ) if __name__ == '__main__': mozunit.main() -
--- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -28,16 +28,18 @@ #include "mozilla/layers/PLayerTransaction.h" #include "mozilla/layers/ShadowLayerUtilsGralloc.h" #include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL #include "mozilla/StaticPtr.h" #include "cutils/properties.h" #include "gfx2DGlue.h" #include "gfxPlatform.h" #include "VsyncSource.h" +#include "nsScreenManagerGonk.h" +#include "nsWindow.h" #if ANDROID_VERSION >= 17 #include "libdisplay/DisplaySurface.h" #include "gfxPrefs.h" #include "nsThreadUtils.h" #endif #if ANDROID_VERSION >= 21 @@ -91,34 +93,31 @@ HookVsync(const struct hwc_procs* aProcs { HwcComposer2D::GetInstance()->Vsync(aDisplay, aTimestamp); } static void HookHotplug(const struct hwc_procs* aProcs, int aDisplay, int aConnected) { - // no op + HwcComposer2D::GetInstance()->Hotplug(aDisplay, aConnected); } static const hwc_procs_t sHWCProcs = { &HookInvalidate, // 1st: void (*invalidate)(...) &HookVsync, // 2nd: void (*vsync)(...) &HookHotplug // 3rd: void (*hotplug)(...) }; #endif static StaticRefPtr<HwcComposer2D> sInstance; HwcComposer2D::HwcComposer2D() : mHwc(nullptr) , mList(nullptr) - , mDpy(EGL_NO_DISPLAY) - , mSur(EGL_NO_SURFACE) - , mGLContext(nullptr) , mMaxLayerCount(0) , mColorFill(false) , mRBSwapSupport(false) , mPrepared(false) , mHasHWVsync(false) , mLock("mozilla.HwcComposer2D.mLock") { #if ANDROID_VERSION >= 17 @@ -128,17 +127,18 @@ HwcComposer2D::HwcComposer2D() mHwc = (HwcDevice*)GetGonkDisplay()->GetHWCDevice(); if (!mHwc) { LOGD("no hwc support"); return; } nsIntSize screenSize; - ANativeWindow *win = GetGonkDisplay()->GetNativeWindow(); + GonkDisplay::NativeData data = GetGonkDisplay()->GetNativeData(GonkDisplay::DISPLAY_PRIMARY); + ANativeWindow *win = data.mNativeWindow.get(); win->query(win, NATIVE_WINDOW_WIDTH, &screenSize.width); win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height); mScreenRect = gfx::IntRect(gfx::IntPoint(0, 0), screenSize); #if ANDROID_VERSION >= 17 int supported = 0; if (mHwc->query) { @@ -243,33 +243,57 @@ HwcComposer2D::Invalidate() return; } MutexAutoLock lock(mLock); if (mCompositorParent) { mCompositorParent->ScheduleRenderOnCompositorThread(); } } + +namespace { +class HotplugEvent : public nsRunnable { +public: + HotplugEvent(GonkDisplay::DisplayType aType, bool aConnected) + : mType(aType) + , mConnected(aConnected) + { + } + + NS_IMETHOD Run() + { + nsRefPtr<nsScreenManagerGonk> screenManager = + nsScreenManagerGonk::GetInstance(); + if (mConnected) { + screenManager->AddScreen(mType); + } else { + screenManager->RemoveScreen(mType); + } + } +private: + GonkDisplay::DisplayType mType; + bool mConnected; +}; +} // anonymous namespace + +void +HwcComposer2D::Hotplug(int aDisplay, int aConnected) +{ + NS_DispatchToMainThread(new HotplugEvent(GonkDisplay::DISPLAY_EXTERNAL, + aConnected)); +} #endif void HwcComposer2D::SetCompositorParent(CompositorParent* aCompositorParent) { MutexAutoLock lock(mLock); mCompositorParent = aCompositorParent; } -void -HwcComposer2D::SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, gl::GLContext* aGLContext) -{ - mDpy = aDisplay; - mSur = aSurface; - mGLContext = aGLContext; -} - bool HwcComposer2D::ReallocLayerList() { int size = sizeof(HwcList) + ((mMaxLayerCount + LAYER_COUNT_INCREMENTS) * sizeof(HwcLayer)); HwcList* listrealloc = (HwcList*)realloc(mList, size); @@ -679,35 +703,35 @@ HwcComposer2D::PrepareLayerList(Layer* a mHwcLayerMap.AppendElement(static_cast<LayerComposite*>(aLayer->ImplData())); mList->numHwLayers++; return true; } #if ANDROID_VERSION >= 17 bool -HwcComposer2D::TryHwComposition() +HwcComposer2D::TryHwComposition(nsScreenGonk* aScreen) { - DisplaySurface* dispSurface = (DisplaySurface*)(GetGonkDisplay()->GetDispSurface()); + DisplaySurface* dispSurface = aScreen->GetDisplaySurface(); if (!(dispSurface && dispSurface->lastHandle)) { LOGD("H/W Composition failed. DispSurface 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(dispSurface->lastHandle, -1); + Prepare(dispSurface->lastHandle, -1, aScreen); /* Possible composition paths, after hwc prepare: 1. GPU Composition 2. BLIT Composition 3. Full OVERLAY Composition 4. Partial OVERLAY Composition (GPU + OVERLAY) */ bool gpuComposite = false; @@ -752,44 +776,47 @@ HwcComposer2D::TryHwComposition() } } if (gpuComposite) { // GPU or partial OVERLAY Composition return false; } else if (blitComposite) { // BLIT Composition, flip DispSurface target - GetGonkDisplay()->UpdateDispSurface(mDpy, mSur); - DisplaySurface* dispSurface = (DisplaySurface*)(GetGonkDisplay()->GetDispSurface()); + GetGonkDisplay()->UpdateDispSurface(aScreen->GetDpy(), aScreen->GetSur()); + DisplaySurface* dispSurface = aScreen->GetDisplaySurface(); if (!dispSurface) { LOGE("H/W Composition failed. NULL DispSurface."); return false; } mList->hwLayers[idx].handle = dispSurface->lastHandle; mList->hwLayers[idx].acquireFenceFd = dispSurface->GetPrevDispAcquireFd(); } } // BLIT or full OVERLAY Composition - Commit(); + Commit(aScreen); - GetGonkDisplay()->SetDispReleaseFd(mList->hwLayers[idx].releaseFenceFd); + DisplaySurface* displaySurface = aScreen->GetDisplaySurface(); + displaySurface->setReleaseFenceFd(mList->hwLayers[idx].releaseFenceFd); mList->hwLayers[idx].releaseFenceFd = -1; return true; } bool -HwcComposer2D::Render() +HwcComposer2D::Render(nsIWidget* aWidget) { + nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen(); + // HWC module does not exist or mList is not created yet. if (!mHwc || !mList) { - return GetGonkDisplay()->SwapBuffers(mDpy, mSur); + return GetGonkDisplay()->SwapBuffers(screen->GetDpy(), screen->GetSur()); } - DisplaySurface* dispSurface = (DisplaySurface*)(GetGonkDisplay()->GetDispSurface()); + DisplaySurface* dispSurface = screen->GetDisplaySurface(); if (!dispSurface) { LOGE("H/W Composition failed. DispSurface not initialized."); return false; } if (mPrepared) { // No mHwc prepare, if already prepared in current draw cycle mList->hwLayers[mList->numHwLayers - 1].handle = dispSurface->lastHandle; @@ -799,35 +826,36 @@ HwcComposer2D::Render() mList->numHwLayers = 2; mList->hwLayers[0].hints = 0; mList->hwLayers[0].compositionType = HWC_FRAMEBUFFER; mList->hwLayers[0].flags = HWC_SKIP_LAYER; mList->hwLayers[0].backgroundColor = {0}; mList->hwLayers[0].acquireFenceFd = -1; mList->hwLayers[0].releaseFenceFd = -1; mList->hwLayers[0].displayFrame = {0, 0, mScreenRect.width, mScreenRect.height}; - Prepare(dispSurface->lastHandle, dispSurface->GetPrevDispAcquireFd()); + Prepare(dispSurface->lastHandle, dispSurface->GetPrevDispAcquireFd(), screen); } // GPU or partial HWC Composition - Commit(); + Commit(screen); - GetGonkDisplay()->SetDispReleaseFd(mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd); + dispSurface->setReleaseFenceFd(mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd); mList->hwLayers[mList->numHwLayers - 1].releaseFenceFd = -1; return true; } void -HwcComposer2D::Prepare(buffer_handle_t dispHandle, int fence) +HwcComposer2D::Prepare(buffer_handle_t dispHandle, int fence, nsScreenGonk* screen) { int idx = mList->numHwLayers - 1; const hwc_rect_t r = {0, 0, mScreenRect.width, mScreenRect.height}; hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr }; - displays[HWC_DISPLAY_PRIMARY] = mList; + uint32_t displaytype = screen->GetDisplayType(); + displays[displaytype] = mList; mList->outbufAcquireFenceFd = -1; mList->outbuf = nullptr; mList->retireFenceFd = -1; mList->hwLayers[idx].hints = 0; mList->hwLayers[idx].flags = 0; mList->hwLayers[idx].transform = 0; mList->hwLayers[idx].handle = dispHandle; @@ -840,25 +868,27 @@ HwcComposer2D::Prepare(buffer_handle_t d mList->hwLayers[idx].acquireFenceFd = fence; mList->hwLayers[idx].releaseFenceFd = -1; #if ANDROID_VERSION >= 18 mList->hwLayers[idx].planeAlpha = 0xFF; #endif if (mPrepared) { LOGE("Multiple hwc prepare calls!"); } + mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays); mPrepared = true; } bool -HwcComposer2D::Commit() +HwcComposer2D::Commit(nsScreenGonk* aScreen) { hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr }; - displays[HWC_DISPLAY_PRIMARY] = mList; + uint32_t displaytype = aScreen->GetDisplayType(); + displays[displaytype] = mList; for (uint32_t j=0; j < (mList->numHwLayers - 1); j++) { mList->hwLayers[j].acquireFenceFd = -1; if (mHwcLayerMap.IsEmpty() || (mList->hwLayers[j].compositionType == HWC_FRAMEBUFFER)) { continue; } LayerRenderState state = mHwcLayerMap[j]->GetLayer()->GetRenderState(); @@ -905,70 +935,76 @@ HwcComposer2D::Reset() LOGD("hwcomposer is already prepared, reset with null set"); hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr }; displays[HWC_DISPLAY_PRIMARY] = nullptr; mHwc->set(mHwc, HWC_DISPLAY_PRIMARY, displays); mPrepared = false; } #else bool -HwcComposer2D::TryHwComposition() +HwcComposer2D::TryHwComposition(nsScreenGonk* aScreen) { - return !mHwc->set(mHwc, mDpy, mSur, mList); + return !mHwc->set(mHwc, aScreen->GetDpy(), aScreen->GetSur(), mList); } bool -HwcComposer2D::Render() +HwcComposer2D::Render(nsIWidget* aWidget) { - return GetGonkDisplay()->SwapBuffers(mDpy, mSur); + nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen(); + + return GetGonkDisplay()->SwapBuffers(screen->GetDpy(), screen->GetSur()); } void HwcComposer2D::Reset() { mPrepared = false; } #endif bool HwcComposer2D::TryRenderWithHwc(Layer* aRoot, + nsIWidget* aWidget, bool aGeometryChanged) { if (!mHwc) { return false; } + nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen(); + if (mList) { setHwcGeometry(aGeometryChanged); mList->numHwLayers = 0; mHwcLayerMap.Clear(); } if (mPrepared) { Reset(); } // XXX: The clear() below means all rect vectors will be have to be // reallocated. We may want to avoid this if possible mVisibleRegions.clear(); + mScreenRect = screen->GetNaturalBounds(); MOZ_ASSERT(mHwcLayerMap.IsEmpty()); if (!PrepareLayerList(aRoot, mScreenRect, gfx::Matrix())) { mHwcLayerMap.Clear(); LOGD("Render aborted. Nothing was drawn to the screen"); return false; } // Send data to LayerScope for debugging SendtoLayerScope(); - if (!TryHwComposition()) { + if (!TryHwComposition(screen)) { LOGD("Full HWC Composition failed. Fallback to GPU Composition or partial OVERLAY Composition"); LayerScope::CleanLayer(); return false; } LOGD("Frame rendered"); return true; }
--- a/widget/gonk/HwcComposer2D.h +++ b/widget/gonk/HwcComposer2D.h @@ -26,16 +26,18 @@ #include <list> #include <hardware/hwcomposer.h> #if ANDROID_VERSION >= 17 #include <ui/Fence.h> #include <utils/Timers.h> #endif +class nsScreenGonk; + namespace mozilla { namespace gl { class GLContext; } namespace layers { class CompositorParent; @@ -78,51 +80,46 @@ public: virtual ~HwcComposer2D(); static HwcComposer2D* GetInstance(); // Returns TRUE if the container has been succesfully rendered // Returns FALSE if the container cannot be fully rendered // by this composer so nothing was rendered at all virtual bool TryRenderWithHwc(layers::Layer* aRoot, + nsIWidget* aWidget, bool aGeometryChanged) override; - virtual bool Render() override; + virtual bool Render(nsIWidget* aWidget) override; virtual bool HasHwc() override { return mHwc; } bool EnableVsync(bool aEnable); #if ANDROID_VERSION >= 17 bool RegisterHwcEventCallback(); void Vsync(int aDisplay, int64_t aTimestamp); void Invalidate(); + void Hotplug(int aDisplay, int aConnected); #endif void SetCompositorParent(layers::CompositorParent* aCompositorParent); - // Set EGL info of primary display. Used for BLIT Composition. - // XXX Add multiple displays compostion support. - void SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, gl::GLContext* aGLContext); - private: void Reset(); - void Prepare(buffer_handle_t dispHandle, int fence); - bool Commit(); - bool TryHwComposition(); + void Prepare(buffer_handle_t dispHandle, int fence, nsScreenGonk* screen); + bool Commit(nsScreenGonk* aScreen); + bool TryHwComposition(nsScreenGonk* aScreen); bool ReallocLayerList(); bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip, const gfx::Matrix& aParentTransform); void setCrop(HwcLayer* layer, hwc_rect_t srcCrop); void setHwcGeometry(bool aGeometryChanged); void SendtoLayerScope(); HwcDevice* mHwc; HwcList* mList; - hwc_display_t mDpy; // Store for BLIT Composition and GonkDisplayICS - hwc_surface_t mSur; // Store for BLIT Composition and GonkDisplayICS - gl::GLContext* mGLContext; // Store for BLIT Composition nsIntRect mScreenRect; int mMaxLayerCount; bool mColorFill; bool mRBSwapSupport; //Holds all the dynamically allocated RectVectors needed //to render the current frame std::list<RectVector> mVisibleRegions; layers::FenceHandle mPrevRetireFence;
--- a/widget/gonk/libdisplay/GonkDisplay.h +++ b/widget/gonk/libdisplay/GonkDisplay.h @@ -12,60 +12,76 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef GONKDISPLAY_H #define GONKDISPLAY_H #include <system/window.h> +#include <utils/StrongPointer.h> #include "mozilla/Types.h" +namespace android { +class DisplaySurface; +class IGraphicBufferProducer; +} + namespace mozilla { typedef void * EGLDisplay; typedef void * EGLSurface; class MOZ_EXPORT GonkDisplay { public: - virtual ANativeWindow* GetNativeWindow() = 0; + /** + * This enum is for types of display. DISPLAY_PRIMARY refers to the default + * built-in display, DISPLAY_EXTERNAL refers to displays connected with + * HDMI, and DISPLAY_VIRTUAL are displays which makes composited output + * available within the system. Currently, displays of external are detected + * via the hotplug detection in HWC, and displays of virtual are connected + * via Wifi Display. + */ + enum DisplayType { + DISPLAY_PRIMARY, + DISPLAY_EXTERNAL, + DISPLAY_VIRTUAL, + NUM_DISPLAY_TYPES + }; + + struct NativeData { + android::sp<ANativeWindow> mNativeWindow; +#if ANDROID_VERSION >= 17 + android::sp<android::DisplaySurface> mDisplaySurface; +#endif + float mXdpi; + }; virtual void SetEnabled(bool enabled) = 0; typedef void (*OnEnabledCallbackType)(bool enabled); virtual void OnEnabled(OnEnabledCallbackType callback) = 0; virtual void* GetHWCDevice() = 0; - virtual void* GetDispSurface() = 0; - /** * Only GonkDisplayICS uses arguments. */ virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur) = 0; virtual ANativeWindowBuffer* DequeueBuffer() = 0; virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0; virtual void UpdateDispSurface(EGLDisplay dpy, EGLSurface sur) = 0; - /** - * Set FramebufferSurface ReleaseFence's file descriptor. - * ReleaseFence will be signaled after the HWC has finished reading - * from a buffer. - */ - virtual void SetDispReleaseFd(int fd) = 0; - - /** - * Get FramebufferSurface AcquireFence's file descriptor - * AcquireFence will be signaled when a buffer's content is available. - */ - virtual int GetPrevDispAcquireFd() = 0; + virtual NativeData GetNativeData( + GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer = nullptr) = 0; float xdpi; int32_t surfaceformat; }; MOZ_EXPORT __attribute__ ((weak)) GonkDisplay* GetGonkDisplay();
--- a/widget/gonk/libdisplay/GonkDisplayICS.cpp +++ b/widget/gonk/libdisplay/GonkDisplayICS.cpp @@ -18,16 +18,17 @@ #include <hardware/hardware.h> #include <hardware/gralloc.h> #include <hardware/hwcomposer.h> #include <hardware_legacy/power.h> #include <cutils/log.h> #include <fcntl.h> +#include "mozilla/Assertions.h" #include "mozilla/FileUtils.h" #include "mozilla/FileUtils.h" #include "BootAnimation.h" using namespace android; @@ -134,23 +135,16 @@ GonkDisplayICS::GonkDisplayICS() } GonkDisplayICS::~GonkDisplayICS() { if (mHwc) hwc_close(mHwc); } -ANativeWindow* -GonkDisplayICS::GetNativeWindow() -{ - StopBootAnimation(); - return static_cast<ANativeWindow *>(mFBSurface.get()); -} - void GonkDisplayICS::SetEnabled(bool enabled) { set_screen_state(enabled); } void GonkDisplayICS::OnEnabled(OnEnabledCallbackType callback) @@ -202,24 +196,37 @@ GonkDisplayICS::QueueBuffer(ANativeWindo { ANativeWindow *window = static_cast<ANativeWindow *>(mFBSurface.get()); return !window->queueBuffer(window, buf); } void GonkDisplayICS::UpdateDispSurface(EGLDisplay dpy, EGLSurface sur) { - eglSwapBuffers(dpy, sur); } void GonkDisplayICS::SetDispReleaseFd(int fd) { } +GonkDisplay::NativeData +GonkDisplayICS::GetNativeData(GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer) +{ + MOZ_ASSERT(aDisplayType == DISPLAY_PRIMARY, "ICS gonk supports primary display only."); + + NativeData data; + StopBootAnimation(); + data.mNativeWindow = static_cast<ANativeWindow *>(mFBSurface.get()); + data.mXdpi = xdpi; + + return data; +} + __attribute__ ((visibility ("default"))) GonkDisplay* GetGonkDisplay() { if (!sGonkDisplay) sGonkDisplay = new GonkDisplayICS(); return sGonkDisplay; }
--- a/widget/gonk/libdisplay/GonkDisplayICS.h +++ b/widget/gonk/libdisplay/GonkDisplayICS.h @@ -18,51 +18,52 @@ #include <string.h> #include "GonkDisplay.h" #include "ui/FramebufferNativeWindow.h" #include "hardware/hwcomposer.h" #include "utils/RefBase.h" +namespace android { +class IGraphicBufferProducer; +} + namespace mozilla { class MOZ_EXPORT GonkDisplayICS : public GonkDisplay { public: GonkDisplayICS(); ~GonkDisplayICS(); - virtual ANativeWindow* GetNativeWindow(); - virtual void SetEnabled(bool enabled); virtual void OnEnabled(OnEnabledCallbackType callback); virtual void* GetHWCDevice(); - virtual void* GetDispSurface() - { - return nullptr; - } - virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur); virtual ANativeWindowBuffer* DequeueBuffer(); virtual bool QueueBuffer(ANativeWindowBuffer* handle); virtual void UpdateDispSurface(EGLDisplay dpy, EGLSurface sur); virtual void SetDispReleaseFd(int fd); virtual int GetPrevDispAcquireFd() { return -1; } + virtual NativeData GetNativeData( + GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer = nullptr); + private: hw_module_t const* mModule; hwc_composer_device_t* mHwc; android::sp<android::FramebufferNativeWindow> mFBSurface; }; }
--- a/widget/gonk/libdisplay/GonkDisplayJB.cpp +++ b/widget/gonk/libdisplay/GonkDisplayJB.cpp @@ -21,21 +21,24 @@ #include <gui/GraphicBufferAlloc.h> #endif #include <hardware/hardware.h> #include <hardware/hwcomposer.h> #include <hardware/power.h> #include <suspend/autosuspend.h> +#include "BootAnimation.h" #include "FramebufferSurface.h" #if ANDROID_VERSION == 17 #include "GraphicBufferAlloc.h" #endif -#include "BootAnimation.h" +#include "mozilla/Assertions.h" + +#define DEFAULT_XDPI 75.0 using namespace android; namespace mozilla { static GonkDisplayJB* sGonkDisplay = nullptr; GonkDisplayJB::GonkDisplayJB() @@ -103,38 +106,30 @@ GonkDisplayJB::GonkDisplayJB() err = hw_get_module(POWER_HARDWARE_MODULE_ID, (hw_module_t const**)&mPowerModule); if (!err) mPowerModule->init(mPowerModule); ALOGW_IF(err, "Couldn't load %s module (%s)", POWER_HARDWARE_MODULE_ID, strerror(-err)); mAlloc = new GraphicBufferAlloc(); - CreateSurface(mSTClient, mDispSurface); + CreateSurface(mSTClient, mDispSurface, mWidth, mHeight); mList = (hwc_display_contents_1_t *)calloc(1, sizeof(*mList) + (sizeof(hwc_layer_1_t)*2)); uint32_t usage = GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER; if (mFBDevice) { // If device uses fb, they can not use single buffer for boot animation mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_BUFFER_COUNT, 2); mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_USAGE, usage); } else if (mHwc) { -#if ANDROID_VERSION >= 21 - if (mHwc->common.version >= HWC_DEVICE_API_VERSION_1_4) { - mHwc->setPowerMode(mHwc, HWC_DISPLAY_PRIMARY, HWC_POWER_MODE_NORMAL); - } else { - mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, 0); - } -#else - mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, 0); -#endif + PowerOnDisplay(HWC_DISPLAY_PRIMARY); // For devices w/ hwc v1.0 or no hwc, this buffer can not be created, // only create this buffer for devices w/ hwc version > 1.0. - CreateSurface(mBootAnimSTClient, mBootAnimDispSurface); + CreateSurface(mBootAnimSTClient, mBootAnimDispSurface, mWidth, mHeight); } ALOGI("Starting bootanimation with (%d) format framebuffer", surfaceformat); StartBootAnimation(); } GonkDisplayJB::~GonkDisplayJB() { @@ -142,50 +137,43 @@ GonkDisplayJB::~GonkDisplayJB() hwc_close_1(mHwc); if (mFBDevice) framebuffer_close(mFBDevice); free(mList); } void GonkDisplayJB::CreateSurface(android::sp<ANativeWindow>& aNativeWindow, - android::sp<android::DisplaySurface>& aDisplaySurface) + android::sp<android::DisplaySurface>& aDisplaySurface, + uint32_t aWidth, uint32_t aHeight) { #if ANDROID_VERSION >= 21 sp<IGraphicBufferProducer> producer; sp<IGraphicBufferConsumer> consumer; BufferQueue::createBufferQueue(&producer, &consumer, mAlloc); #elif ANDROID_VERSION >= 19 sp<BufferQueue> consumer = new BufferQueue(mAlloc); sp<IGraphicBufferProducer> producer = consumer; #elif ANDROID_VERSION >= 18 sp<BufferQueue> consumer = new BufferQueue(true, mAlloc); sp<IGraphicBufferProducer> producer = consumer; #else sp<BufferQueue> consumer = new BufferQueue(true, mAlloc); #endif - aDisplaySurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, consumer); + aDisplaySurface = new FramebufferSurface(0, aWidth, aHeight, surfaceformat, consumer); #if ANDROID_VERSION == 17 aNativeWindow = new SurfaceTextureClient( static_cast<sp<ISurfaceTexture>>(aDisplaySurface->getBufferQueue())); #else aNativeWindow = new Surface(producer); #endif } -ANativeWindow* -GonkDisplayJB::GetNativeWindow() -{ - StopBootAnim(); - - return mSTClient.get(); -} - void GonkDisplayJB::SetEnabled(bool enabled) { if (enabled) { autosuspend_disable(); mPowerModule->setInteractive(mPowerModule, true); } @@ -229,22 +217,16 @@ GonkDisplayJB::OnEnabled(OnEnabledCallba } void* GonkDisplayJB::GetHWCDevice() { return mHwc; } -void* -GonkDisplayJB::GetDispSurface() -{ - return mDispSurface.get(); -} - bool GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur) { StopBootAnim(); // Should be called when composition rendering is complete for a frame. // Only HWC v1.0 needs this call. // HWC > v1.0 case, do not call compositionComplete(). @@ -359,37 +341,76 @@ void GonkDisplayJB::UpdateDispSurface(EGLDisplay dpy, EGLSurface sur) { StopBootAnim(); eglSwapBuffers(dpy, sur); } void -GonkDisplayJB::SetDispReleaseFd(int fd) -{ - mDispSurface->setReleaseFenceFd(fd); -} - -int -GonkDisplayJB::GetPrevDispAcquireFd() -{ - return mDispSurface->GetPrevDispAcquireFd(); -} - -void GonkDisplayJB::StopBootAnim() { StopBootAnimation(); if (mBootAnimSTClient.get()) { mBootAnimSTClient = nullptr; mBootAnimDispSurface = nullptr; } } +void +GonkDisplayJB::PowerOnDisplay(int aDpy) +{ + MOZ_ASSERT(mHwc);; +#if ANDROID_VERSION >= 21 + if (mHwc->common.version >= HWC_DEVICE_API_VERSION_1_4) { + mHwc->setPowerMode(mHwc, aDpy, HWC_POWER_MODE_NORMAL); + } else { + mHwc->blank(mHwc, aDpy, 0); + } +#else + mHwc->blank(mHwc, aDpy, 0); +#endif +} + +GonkDisplay::NativeData +GonkDisplayJB::GetNativeData(GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer) +{ + NativeData data; + + if (aDisplayType == DISPLAY_PRIMARY) { + StopBootAnim(); + data.mNativeWindow = mSTClient; + data.mDisplaySurface = mDispSurface; + data.mXdpi = xdpi; + } else if (aDisplayType == DISPLAY_EXTERNAL) { + int32_t values[3]; + const uint32_t attrs[] = { + HWC_DISPLAY_WIDTH, + HWC_DISPLAY_HEIGHT, + HWC_DISPLAY_DPI_X, + HWC_DISPLAY_NO_ATTRIBUTE + }; + mHwc->getDisplayAttributes(mHwc, aDisplayType, 0, attrs, values); + int width = values[0]; + int height = values[1]; + // FIXME!! values[2] returns 0 for external display, which doesn't + // sound right, Bug 1169176 is the follow-up bug for this issue. + data.mXdpi = values[2] ? values[2] / 1000.f : DEFAULT_XDPI; + PowerOnDisplay(HWC_DISPLAY_EXTERNAL); + CreateSurface(data.mNativeWindow, data.mDisplaySurface, width, height); + } else if (aDisplayType == DISPLAY_VIRTUAL) { + // TODO: Bug 1161874 (the support of WifiDisplay) should fill up the + // implementation of virtual display. + MOZ_CRASH("Display type of virtual is not supported yet."); + } + + return data; +} + __attribute__ ((visibility ("default"))) GonkDisplay* GetGonkDisplay() { if (!sGonkDisplay) sGonkDisplay = new GonkDisplayJB(); return sGonkDisplay; }
--- a/widget/gonk/libdisplay/GonkDisplayJB.h +++ b/widget/gonk/libdisplay/GonkDisplayJB.h @@ -25,44 +25,42 @@ namespace mozilla { class MOZ_EXPORT GonkDisplayJB : public GonkDisplay { public: GonkDisplayJB(); ~GonkDisplayJB(); - virtual ANativeWindow* GetNativeWindow(); - virtual void SetEnabled(bool enabled); virtual void OnEnabled(OnEnabledCallbackType callback); virtual void* GetHWCDevice(); - virtual void* GetDispSurface(); - virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur); virtual ANativeWindowBuffer* DequeueBuffer(); virtual bool QueueBuffer(ANativeWindowBuffer* buf); virtual void UpdateDispSurface(EGLDisplay dpy, EGLSurface sur); - virtual void SetDispReleaseFd(int fd); + bool Post(buffer_handle_t buf, int fence); - virtual int GetPrevDispAcquireFd(); - - bool Post(buffer_handle_t buf, int fence); + virtual NativeData GetNativeData( + GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer = nullptr); private: void StopBootAnim(); void CreateSurface(android::sp<ANativeWindow>& aNativeWindow, - android::sp<android::DisplaySurface>& aDisplaySurface); + android::sp<android::DisplaySurface>& aDisplaySurface, + uint32_t aWidth, uint32_t aHeight); + void PowerOnDisplay(int aDpy); hw_module_t const* mModule; hw_module_t const* mFBModule; hwc_composer_device_1_t* mHwc; framebuffer_device_t* mFBDevice; power_module_t* mPowerModule; android::sp<android::DisplaySurface> mDispSurface; android::sp<ANativeWindow> mSTClient;
--- a/widget/gonk/moz.build +++ b/widget/gonk/moz.build @@ -51,16 +51,17 @@ SOURCES += [ 'GonkMemoryPressureMonitoring.cpp', 'GonkPermission.cpp', 'HwcComposer2D.cpp', 'HwcUtils.cpp', 'nsAppShell.cpp', 'nsClipboard.cpp', 'nsIdleServiceGonk.cpp', 'nsLookAndFeel.cpp', + 'nsScreenManagerGonk.cpp', 'nsWidgetFactory.cpp', 'nsWindow.cpp', 'OrientationObserver.cpp', 'ProcessOrientation.cpp', 'WidgetTraceEvent.cpp' ] include('/ipc/chromium/chromium-config.mozbuild')
new file mode 100644 --- /dev/null +++ b/widget/gonk/nsScreenManagerGonk.cpp @@ -0,0 +1,649 @@ +/* Copyright 2012 Mozilla Foundation and Mozilla contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "android/log.h" +#include "GLContext.h" +#include "mozilla/MouseEvents.h" +#include "mozilla/TouchEvents.h" +#include "mozilla/Hal.h" +#include "libdisplay/GonkDisplay.h" +#include "nsScreenManagerGonk.h" +#include "nsThreadUtils.h" +#include "HwcComposer2D.h" +#include "VsyncSource.h" +#include "nsWindow.h" +#include "mozilla/Services.h" +#include "mozilla/ProcessPriorityManager.h" +#include "nsIdleService.h" +#include "nsIObserverService.h" +#include "nsAppShell.h" +#include "nsTArray.h" +#include "pixelflinger/format.h" +#include "nsIDisplayInfo.h" + +#if ANDROID_VERSION >= 17 +#include "libdisplay/DisplaySurface.h" +#endif + +#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "nsScreenGonk" , ## args) +#define LOGW(args...) __android_log_print(ANDROID_LOG_WARN, "nsScreenGonk", ## args) +#define LOGE(args...) __android_log_print(ANDROID_LOG_ERROR, "nsScreenGonk", ## args) + +using namespace mozilla; +using namespace mozilla::hal; +using namespace mozilla::gfx; +using namespace mozilla::gl; +using namespace mozilla::dom; + +namespace { + +class ScreenOnOffEvent : public nsRunnable { +public: + ScreenOnOffEvent(bool on) + : mIsOn(on) + {} + + NS_IMETHOD Run() { + // Notify observers that the screen state has just changed. + nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); + if (observerService) { + observerService->NotifyObservers( + nullptr, "screen-state-changed", + mIsOn ? MOZ_UTF16("on") : MOZ_UTF16("off") + ); + } + + nsRefPtr<nsScreenGonk> screen = nsScreenManagerGonk::GetPrimaryScreen(); + const nsTArray<nsWindow*>& windows = screen->GetTopWindows(); + + for (uint32_t i = 0; i < windows.Length(); i++) { + nsWindow *win = windows[i]; + + if (nsIWidgetListener* listener = win->GetWidgetListener()) { + listener->SizeModeChanged(mIsOn ? nsSizeMode_Fullscreen : nsSizeMode_Minimized); + } + } + + return NS_OK; + } + +private: + bool mIsOn; +}; + +static void +displayEnabledCallback(bool enabled) +{ + nsRefPtr<nsScreenManagerGonk> screenManager = nsScreenManagerGonk::GetInstance(); + screenManager->DisplayEnabled(enabled); +} + +} // anonymous namespace + +static uint32_t +SurfaceFormatToColorDepth(int32_t aSurfaceFormat) +{ + switch (aSurfaceFormat) { + case GGL_PIXEL_FORMAT_RGB_565: + return 16; + case GGL_PIXEL_FORMAT_RGBA_8888: + return 32; + } + return 24; // GGL_PIXEL_FORMAT_RGBX_8888 +} + +// nsScreenGonk.cpp + +nsScreenGonk::nsScreenGonk(uint32_t aId, + GonkDisplay::DisplayType aDisplayType, + const GonkDisplay::NativeData& aNativeData) + : mId(aId) + , mNativeWindow(aNativeData.mNativeWindow) + , mDpi(aNativeData.mXdpi) + , mScreenRotation(nsIScreen::ROTATION_0_DEG) + , mPhysicalScreenRotation(nsIScreen::ROTATION_0_DEG) +#if ANDROID_VERSION >= 17 + , mDisplaySurface(aNativeData.mDisplaySurface) +#endif + , mDisplayType(aDisplayType) + , mDpy(EGL_NO_DISPLAY) + , mSur(EGL_NO_SURFACE) + , mGLContext(nullptr) +{ + if (mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_WIDTH, &mVirtualBounds.width) || + mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_HEIGHT, &mVirtualBounds.height) || + mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_FORMAT, &mSurfaceFormat)) { + NS_RUNTIMEABORT("Failed to get native window size, aborting..."); + } + + mNaturalBounds = mVirtualBounds; + + if (IsPrimaryScreen()) { + char propValue[PROPERTY_VALUE_MAX]; + property_get("ro.sf.hwrotation", propValue, "0"); + mPhysicalScreenRotation = atoi(propValue) / 90; + } + + mColorDepth = SurfaceFormatToColorDepth(mSurfaceFormat); +} + +nsScreenGonk::~nsScreenGonk() +{ +} + +bool +nsScreenGonk::IsPrimaryScreen() +{ + return mDisplayType == GonkDisplay::DISPLAY_PRIMARY; +} + +NS_IMETHODIMP +nsScreenGonk::GetId(uint32_t *outId) +{ + *outId = mId; + return NS_OK; +} + +uint32_t +nsScreenGonk::GetId() +{ + return mId; +} + +NS_IMETHODIMP +nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop, + int32_t *outWidth, int32_t *outHeight) +{ + *outLeft = mVirtualBounds.x; + *outTop = mVirtualBounds.y; + + *outWidth = mVirtualBounds.width; + *outHeight = mVirtualBounds.height; + + return NS_OK; +} + +nsIntRect +nsScreenGonk::GetRect() +{ + return mVirtualBounds; +} + +NS_IMETHODIMP +nsScreenGonk::GetAvailRect(int32_t *outLeft, int32_t *outTop, + int32_t *outWidth, int32_t *outHeight) +{ + return GetRect(outLeft, outTop, outWidth, outHeight); +} + +NS_IMETHODIMP +nsScreenGonk::GetPixelDepth(int32_t *aPixelDepth) +{ + // XXX: this should actually return 32 when we're using 24-bit + // color, because we use RGBX. + *aPixelDepth = mColorDepth; + return NS_OK; +} + +NS_IMETHODIMP +nsScreenGonk::GetColorDepth(int32_t *aColorDepth) +{ + *aColorDepth = mColorDepth; + return NS_OK; +} + +NS_IMETHODIMP +nsScreenGonk::GetRotation(uint32_t* aRotation) +{ + *aRotation = mScreenRotation; + return NS_OK; +} + +float +nsScreenGonk::GetDpi() +{ + return mDpi; +} + +int32_t +nsScreenGonk::GetSurfaceFormat() +{ + return mSurfaceFormat; +} + +ANativeWindow* +nsScreenGonk::GetNativeWindow() +{ + return mNativeWindow.get(); +} + +NS_IMETHODIMP +nsScreenGonk::SetRotation(uint32_t aRotation) +{ + if (!(aRotation <= ROTATION_270_DEG)) { + return NS_ERROR_ILLEGAL_VALUE; + } + + if (mScreenRotation == aRotation) { + return NS_OK; + } + + mScreenRotation = aRotation; + uint32_t rotation = EffectiveScreenRotation(); + if (rotation == nsIScreen::ROTATION_90_DEG || + rotation == nsIScreen::ROTATION_270_DEG) { + mVirtualBounds = nsIntRect(0, 0, + mNaturalBounds.height, + mNaturalBounds.width); + } else { + mVirtualBounds = mNaturalBounds; + } + + nsAppShell::NotifyScreenRotation(); + + for (unsigned int i = 0; i < mTopWindows.Length(); i++) { + mTopWindows[i]->Resize(mVirtualBounds.width, + mVirtualBounds.height, + true); + } + + return NS_OK; +} + +nsIntRect +nsScreenGonk::GetNaturalBounds() +{ + return mNaturalBounds; +} + +uint32_t +nsScreenGonk::EffectiveScreenRotation() +{ + return (mScreenRotation + mPhysicalScreenRotation) % (360 / 90); +} + +// NB: This isn't gonk-specific, but gonk is the only widget backend +// that does this calculation itself, currently. +static ScreenOrientation +ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize) +{ + bool naturallyPortrait = (aScreenSize.height > aScreenSize.width); + switch (aRotation) { + case nsIScreen::ROTATION_0_DEG: + return (naturallyPortrait ? eScreenOrientation_PortraitPrimary : + eScreenOrientation_LandscapePrimary); + case nsIScreen::ROTATION_90_DEG: + // Arbitrarily choosing 90deg to be primary "unnatural" + // rotation. + return (naturallyPortrait ? eScreenOrientation_LandscapePrimary : + eScreenOrientation_PortraitPrimary); + case nsIScreen::ROTATION_180_DEG: + return (naturallyPortrait ? eScreenOrientation_PortraitSecondary : + eScreenOrientation_LandscapeSecondary); + case nsIScreen::ROTATION_270_DEG: + return (naturallyPortrait ? eScreenOrientation_LandscapeSecondary : + eScreenOrientation_PortraitSecondary); + default: + MOZ_CRASH("Gonk screen must always have a known rotation"); + } +} + +ScreenConfiguration +nsScreenGonk::GetConfiguration() +{ + ScreenOrientation orientation = ComputeOrientation(mScreenRotation, + mNaturalBounds.Size()); + + // NB: perpetuating colorDepth == pixelDepth illusion here, for + // consistency. + return ScreenConfiguration(mVirtualBounds, orientation, + mColorDepth, mColorDepth); +} + +void +nsScreenGonk::RegisterWindow(nsWindow* aWindow) +{ + mTopWindows.AppendElement(aWindow); +} + +void +nsScreenGonk::UnregisterWindow(nsWindow* aWindow) +{ + mTopWindows.RemoveElement(aWindow); +} + +void +nsScreenGonk::BringToTop(nsWindow* aWindow) +{ + mTopWindows.RemoveElement(aWindow); + mTopWindows.InsertElementAt(0, aWindow); +} + +#if ANDROID_VERSION >= 17 +android::DisplaySurface* +nsScreenGonk::GetDisplaySurface() +{ + return mDisplaySurface.get(); +} + +int +nsScreenGonk::GetPrevDispAcquireFd() +{ + if (!mDisplaySurface.get()) { + return -1; + } + return mDisplaySurface->GetPrevDispAcquireFd(); +} +#endif + +GonkDisplay::DisplayType +nsScreenGonk::GetDisplayType() +{ + return mDisplayType; +} + +void +nsScreenGonk::SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, + gl::GLContext* aGLContext) +{ + mDpy = aDisplay; + mSur = aSurface; + mGLContext = aGLContext; +} + +hwc_display_t +nsScreenGonk::GetDpy() +{ + return mDpy; +} + +hwc_surface_t +nsScreenGonk::GetSur() +{ + return mSur; +} + +NS_IMPL_ISUPPORTS(nsScreenManagerGonk, nsIScreenManager) + +nsScreenManagerGonk::nsScreenManagerGonk() + : mInitialized(false) +{ +} + +nsScreenManagerGonk::~nsScreenManagerGonk() +{ +} + +/* static */ already_AddRefed<nsScreenManagerGonk> +nsScreenManagerGonk::GetInstance() +{ + nsCOMPtr<nsIScreenManager> manager; + manager = do_GetService("@mozilla.org/gfx/screenmanager;1"); + MOZ_ASSERT(manager); + return already_AddRefed<nsScreenManagerGonk>( + static_cast<nsScreenManagerGonk*>(manager.forget().take())); +} + +/* static */ already_AddRefed< nsScreenGonk> +nsScreenManagerGonk::GetPrimaryScreen() +{ + nsRefPtr<nsScreenManagerGonk> manager = nsScreenManagerGonk::GetInstance(); + nsCOMPtr<nsIScreen> screen; + manager->GetPrimaryScreen(getter_AddRefs(screen)); + MOZ_ASSERT(screen); + return already_AddRefed<nsScreenGonk>( + static_cast<nsScreenGonk*>(screen.forget().take())); +} + +void +nsScreenManagerGonk::Initialize() +{ + if (mInitialized) { + return; + } + + mScreenOnEvent = new ScreenOnOffEvent(true); + mScreenOffEvent = new ScreenOnOffEvent(false); + GetGonkDisplay()->OnEnabled(displayEnabledCallback); + + AddScreen(GonkDisplay::DISPLAY_PRIMARY); + + nsAppShell::NotifyScreenInitialized(); + mInitialized = true; +} + +void +nsScreenManagerGonk::DisplayEnabled(bool aEnabled) +{ + if (gfxPrefs::HardwareVsyncEnabled()) { + VsyncControl(aEnabled); + } + + NS_DispatchToMainThread(aEnabled ? mScreenOnEvent : mScreenOffEvent); +} + +NS_IMETHODIMP +nsScreenManagerGonk::GetPrimaryScreen(nsIScreen **outScreen) +{ + NS_IF_ADDREF(*outScreen = mScreens[0].get()); + return NS_OK; +} + +NS_IMETHODIMP +nsScreenManagerGonk::ScreenForId(uint32_t aId, + nsIScreen **outScreen) +{ + for (size_t i = 0; i < mScreens.Length(); i++) { + if (mScreens[i]->GetId() == aId) { + NS_IF_ADDREF(*outScreen = mScreens[i].get()); + return NS_OK; + } + } + + *outScreen = nullptr; + return NS_OK; +} + +NS_IMETHODIMP +nsScreenManagerGonk::ScreenForRect(int32_t inLeft, + int32_t inTop, + int32_t inWidth, + int32_t inHeight, + nsIScreen **outScreen) +{ + // Since all screens have independent coordinate system, we could + // only return the primary screen no matter what rect is given. + return GetPrimaryScreen(outScreen); +} + +NS_IMETHODIMP +nsScreenManagerGonk::ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen) +{ + for (size_t i = 0; i < mScreens.Length(); i++) { + if (aWidget == mScreens[i]->GetNativeWindow()) { + NS_IF_ADDREF(*outScreen = mScreens[i].get()); + return NS_OK; + } + } + + *outScreen = nullptr; + return NS_OK; +} + +NS_IMETHODIMP +nsScreenManagerGonk::GetNumberOfScreens(uint32_t *aNumberOfScreens) +{ + *aNumberOfScreens = mScreens.Length(); + return NS_OK; +} + +NS_IMETHODIMP +nsScreenManagerGonk::GetSystemDefaultScale(float *aDefaultScale) +{ + *aDefaultScale = 1.0f; + return NS_OK; +} + +void +nsScreenManagerGonk::VsyncControl(bool aEnabled) +{ + MOZ_ASSERT(gfxPrefs::HardwareVsyncEnabled()); + + if (!NS_IsMainThread()) { + NS_DispatchToMainThread( + NS_NewRunnableMethodWithArgs<bool>(this, + &nsScreenManagerGonk::VsyncControl, + aEnabled)); + return; + } + + MOZ_ASSERT(NS_IsMainThread()); + VsyncSource::Display &display = gfxPlatform::GetPlatform()->GetHardwareVsync()->GetGlobalDisplay(); + if (aEnabled) { + display.EnableVsync(); + } else { + display.DisableVsync(); + } +} + +uint32_t +nsScreenManagerGonk::GetIdFromType(GonkDisplay::DisplayType aDisplayType) +{ + // This is the only place where we make the assumption that + // display type is equivalent to screen id. + + // Bug 1138287 will address the conversion from type to id. + return aDisplayType; +} + +bool +nsScreenManagerGonk::IsScreenConnected(uint32_t aId) +{ + for (size_t i = 0; i < mScreens.Length(); ++i) { + if (mScreens[i]->GetId() == aId) { + return true; + } + } + + return false; +} + +namespace { + +// A concrete class as a subject for 'display-changed' observer event. +class DisplayInfo : public nsIDisplayInfo { +public: + NS_DECL_ISUPPORTS + + DisplayInfo(uint32_t aId, bool aConnected) + : mId(aId) + , mConnected(aConnected) + { + } + + NS_IMETHODIMP GetId(int32_t *aId) + { + *aId = mId; + return NS_OK; + } + + NS_IMETHODIMP GetConnected(bool *aConnected) + { + *aConnected = mConnected; + return NS_OK; + } + +private: + virtual ~DisplayInfo() {} + + uint32_t mId; + bool mConnected; +}; + +NS_IMPL_ISUPPORTS(DisplayInfo, nsIDisplayInfo, nsISupports) + +class NotifyTask : public nsRunnable { +public: + NotifyTask(uint32_t aId, bool aConnected) + : mDisplayInfo(new DisplayInfo(aId, aConnected)) + { + } + + NS_IMETHOD Run() + { + nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService(); + if (os) { + os->NotifyObservers(mDisplayInfo, "display-changed", nullptr); + } + + return NS_OK; + } +private: + nsRefPtr<DisplayInfo> mDisplayInfo; +}; + +void +NotifyDisplayChange(uint32_t aId, bool aConnected) +{ + NS_DispatchToMainThread(new NotifyTask(aId, aConnected)); +} + +} // end of unnamed namespace. + +nsresult +nsScreenManagerGonk::AddScreen(GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer) +{ + MOZ_ASSERT(NS_IsMainThread()); + + NS_ENSURE_TRUE(aDisplayType < GonkDisplay::DisplayType::NUM_DISPLAY_TYPES, + NS_ERROR_FAILURE); + + uint32_t id = GetIdFromType(aDisplayType); + NS_ENSURE_TRUE(!IsScreenConnected(id), NS_ERROR_FAILURE); + + GonkDisplay::NativeData nativeData = + GetGonkDisplay()->GetNativeData(aDisplayType, aProducer); + nsScreenGonk* screen = new nsScreenGonk(id, aDisplayType, nativeData); + + mScreens.AppendElement(screen); + + NotifyDisplayChange(id, true); + + return NS_OK; +} + +nsresult +nsScreenManagerGonk::RemoveScreen(GonkDisplay::DisplayType aDisplayType) +{ + MOZ_ASSERT(NS_IsMainThread()); + + NS_ENSURE_TRUE(aDisplayType < GonkDisplay::DisplayType::NUM_DISPLAY_TYPES, + NS_ERROR_FAILURE); + + uint32_t screenId = GetIdFromType(aDisplayType); + NS_ENSURE_TRUE(IsScreenConnected(screenId), NS_ERROR_FAILURE); + + for (size_t i = 0; i < mScreens.Length(); i++) { + if (mScreens[i]->GetId() == screenId) { + mScreens.RemoveElementAt(i); + break; + } + } + + NotifyDisplayChange(screenId, false); + + return NS_OK; +}
--- a/widget/gonk/nsScreenManagerGonk.h +++ b/widget/gonk/nsScreenManagerGonk.h @@ -13,101 +13,136 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef nsScreenManagerGonk_h___ #define nsScreenManagerGonk_h___ #include "mozilla/Hal.h" + +#include "cutils/properties.h" +#include "hardware/hwcomposer.h" +#include "libdisplay/GonkDisplay.h" +#include "nsBaseScreen.h" #include "nsCOMPtr.h" - -#include "nsBaseScreen.h" #include "nsIScreenManager.h" class nsRunnable; class nsWindow; +namespace android { + class DisplaySurface; + class IGraphicBufferProducer; +}; + +namespace mozilla { +namespace gl { + class GLContext; +} +} + class nsScreenGonk : public nsBaseScreen { typedef mozilla::hal::ScreenConfiguration ScreenConfiguration; + typedef mozilla::GonkDisplay GonkDisplay; public: - nsScreenGonk(uint32_t aId, ANativeWindow* aNativeWindow); + nsScreenGonk(uint32_t aId, + GonkDisplay::DisplayType aDisplayType, + const GonkDisplay::NativeData& aNativeData); ~nsScreenGonk(); NS_IMETHOD GetId(uint32_t* aId); NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight); NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight); NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth); NS_IMETHOD GetColorDepth(int32_t* aColorDepth); NS_IMETHOD GetRotation(uint32_t* aRotation); NS_IMETHOD SetRotation(uint32_t aRotation); uint32_t GetId(); nsIntRect GetRect(); float GetDpi(); + int32_t GetSurfaceFormat(); ANativeWindow* GetNativeWindow(); nsIntRect GetNaturalBounds(); uint32_t EffectiveScreenRotation(); ScreenConfiguration GetConfiguration(); bool IsPrimaryScreen(); +#if ANDROID_VERSION >= 17 + android::DisplaySurface* GetDisplaySurface(); + int GetPrevDispAcquireFd(); +#endif + GonkDisplay::DisplayType GetDisplayType(); + void RegisterWindow(nsWindow* aWindow); void UnregisterWindow(nsWindow* aWindow); void BringToTop(nsWindow* aWindow); const nsTArray<nsWindow*>& GetTopWindows() const { return mTopWindows; } + // Set EGL info of primary display. Used for BLIT Composition. + void SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, + mozilla::gl::GLContext* aGLContext); + hwc_display_t GetDpy(); + hwc_surface_t GetSur(); + protected: uint32_t mId; int32_t mColorDepth; android::sp<ANativeWindow> mNativeWindow; float mDpi; + int32_t mSurfaceFormat; nsIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account. nsIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account. uint32_t mScreenRotation; uint32_t mPhysicalScreenRotation; nsTArray<nsWindow*> mTopWindows; +#if ANDROID_VERSION >= 17 + android::sp<android::DisplaySurface> mDisplaySurface; +#endif + GonkDisplay::DisplayType mDisplayType; + hwc_display_t mDpy; // Store for BLIT Composition and GonkDisplayICS + hwc_surface_t mSur; // Store for BLIT Composition and GonkDisplayICS + mozilla::gl::GLContext* mGLContext; // Store for BLIT Composition }; class nsScreenManagerGonk final : public nsIScreenManager { public: - enum { - // TODO: Bug 1138287 will define more screen/display types. - PRIMARY_SCREEN_TYPE = 0, - - // TODO: Maintain a mapping from type to id dynamically. - PRIMARY_SCREEN_ID = 0, - }; + typedef mozilla::GonkDisplay GonkDisplay; public: nsScreenManagerGonk(); NS_DECL_ISUPPORTS NS_DECL_NSISCREENMANAGER static already_AddRefed<nsScreenManagerGonk> GetInstance(); static already_AddRefed<nsScreenGonk> GetPrimaryScreen(); void Initialize(); void DisplayEnabled(bool aEnabled); - void AddScreen(uint32_t aDisplayType); - void RemoveScreen(uint32_t aDisplayType); + nsresult AddScreen(GonkDisplay::DisplayType aDisplayType, + android::IGraphicBufferProducer* aProducer = nullptr); + + nsresult RemoveScreen(GonkDisplay::DisplayType aDisplayType); protected: ~nsScreenManagerGonk(); void VsyncControl(bool aEnabled); - uint32_t GetIdFromType(uint32_t aDisplayType); + uint32_t GetIdFromType(GonkDisplay::DisplayType aDisplayType); + bool IsScreenConnected(uint32_t aId); bool mInitialized; nsTArray<nsRefPtr<nsScreenGonk>> mScreens; nsRefPtr<nsRunnable> mScreenOnEvent; nsRefPtr<nsRunnable> mScreenOffEvent; }; #endif /* nsScreenManagerGonk_h___ */
--- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -13,55 +13,44 @@ * limitations under the License. */ #include "mozilla/DebugOnly.h" #include <fcntl.h> #include "android/log.h" - #include "mozilla/dom/TabParent.h" -#include "mozilla/Hal.h" #include "mozilla/Preferences.h" -#include "mozilla/ProcessPriorityManager.h" #include "mozilla/Services.h" #include "mozilla/FileUtils.h" #include "mozilla/ClearOnShutdown.h" #include "gfxContext.h" #include "gfxPlatform.h" #include "gfxUtils.h" #include "GLContextProvider.h" #include "GLContext.h" #include "GLContextEGL.h" #include "nsAutoPtr.h" #include "nsAppShell.h" -#include "nsIdleService.h" -#include "nsIObserverService.h" #include "nsScreenManagerGonk.h" #include "nsTArray.h" #include "nsWindow.h" #include "nsIWidgetListener.h" -#include "cutils/properties.h" #include "ClientLayerManager.h" #include "BasicLayers.h" #include "libdisplay/GonkDisplay.h" -#include "pixelflinger/format.h" #include "mozilla/TextEvents.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Logging.h" #include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/APZThreadUtils.h" #include "mozilla/layers/CompositorParent.h" -#include "mozilla/layers/InputAPZContext.h" -#include "mozilla/MouseEvents.h" #include "mozilla/TouchEvents.h" -#include "nsThreadUtils.h" #include "HwcComposer2D.h" -#include "VsyncSource.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args) #define LOGW(args...) __android_log_print(ANDROID_LOG_WARN, "Gonk", ## args) #define LOGE(args...) __android_log_print(ANDROID_LOG_ERROR, "Gonk", ## args) #define IS_TOPLEVEL() (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) using namespace mozilla; @@ -69,61 +58,16 @@ using namespace mozilla::dom; using namespace mozilla::hal; using namespace mozilla::gfx; using namespace mozilla::gl; using namespace mozilla::layers; using namespace mozilla::widget; static nsWindow *gFocusedWindow = nullptr; -namespace { - -class ScreenOnOffEvent : public nsRunnable { -public: - ScreenOnOffEvent(bool on) - : mIsOn(on) - {} - - NS_IMETHOD Run() { - // Notify observers that the screen state has just changed. - nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); - if (observerService) { - observerService->NotifyObservers( - nullptr, "screen-state-changed", - mIsOn ? MOZ_UTF16("on") : MOZ_UTF16("off") - ); - } - - nsRefPtr<nsScreenGonk> screen = nsScreenManagerGonk::GetPrimaryScreen(); - const nsTArray<nsWindow*>& windows = screen->GetTopWindows(); - - for (uint32_t i = 0; i < windows.Length(); i++) { - nsWindow *win = windows[i]; - - if (nsIWidgetListener* listener = win->GetWidgetListener()) { - listener->SizeModeChanged(mIsOn ? nsSizeMode_Fullscreen : nsSizeMode_Minimized); - } - } - - return NS_OK; - } - -private: - bool mIsOn; -}; - -static void -displayEnabledCallback(bool enabled) -{ - nsRefPtr<nsScreenManagerGonk> screenManager = nsScreenManagerGonk::GetInstance(); - screenManager->DisplayEnabled(enabled); -} - -} // anonymous namespace - NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget) nsWindow::nsWindow() { mFramebuffer = nullptr; nsRefPtr<nsScreenManagerGonk> screenManager = nsScreenManagerGonk::GetInstance(); screenManager->Initialize(); @@ -597,21 +541,19 @@ nsWindow::GetNativeData(uint32_t aDataTy void nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal) { switch (aDataType) { case NS_NATIVE_OPENGL_CONTEXT: // Called after primary display's GLContextEGL creation. GLContext* context = reinterpret_cast<GLContext*>(aVal); - - HwcComposer2D* hwc = HwcComposer2D::GetInstance(); - hwc->SetEGLInfo(GLContextEGL::Cast(context)->GetEGLDisplay(), - GLContextEGL::Cast(context)->GetEGLSurface(), - context); + mScreen->SetEGLInfo(GLContextEGL::Cast(context)->GetEGLDisplay(), + GLContextEGL::Cast(context)->GetEGLSurface(), + context); return; } } NS_IMETHODIMP nsWindow::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) { if (mWidgetListener) { @@ -858,430 +800,32 @@ nsWindow::GetGLFrameBufferFormat() } nsIntRect nsWindow::GetNaturalBounds() { return mScreen->GetNaturalBounds(); } +nsScreenGonk* +nsWindow::GetScreen() +{ + return mScreen; +} + bool nsWindow::NeedsPaint() { if (!mLayerManager) { return false; } return nsIWidget::NeedsPaint(); } Composer2D* nsWindow::GetComposer2D() { - if (!mScreen->IsPrimaryScreen()) { + if (mScreen->GetDisplayType() == GonkDisplay::DISPLAY_VIRTUAL) { return nullptr; } return HwcComposer2D::GetInstance(); } - -static uint32_t -SurfaceFormatToColorDepth(int32_t aSurfaceFormat) -{ - switch (aSurfaceFormat) { - case GGL_PIXEL_FORMAT_RGB_565: - return 16; - case GGL_PIXEL_FORMAT_RGBA_8888: - return 32; - } - return 24; // GGL_PIXEL_FORMAT_RGBX_8888 -} - -// nsScreenGonk.cpp - -nsScreenGonk::nsScreenGonk(uint32_t aId, ANativeWindow* aNativeWindow) - : mId(aId) - , mNativeWindow(aNativeWindow) - , mScreenRotation(nsIScreen::ROTATION_0_DEG) - , mPhysicalScreenRotation(nsIScreen::ROTATION_0_DEG) -{ - int surfaceFormat; - if (mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_WIDTH, &mVirtualBounds.width) || - mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_HEIGHT, &mVirtualBounds.height) || - mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_FORMAT, &surfaceFormat)) { - NS_RUNTIMEABORT("Failed to get native window size, aborting..."); - } - - mNaturalBounds = mVirtualBounds; - - if (IsPrimaryScreen()) { - char propValue[PROPERTY_VALUE_MAX]; - property_get("ro.sf.hwrotation", propValue, "0"); - mPhysicalScreenRotation = atoi(propValue) / 90; - } - - mDpi = GetGonkDisplay()->xdpi; - mColorDepth = SurfaceFormatToColorDepth(surfaceFormat); -} - -nsScreenGonk::~nsScreenGonk() -{ -} - -bool -nsScreenGonk::IsPrimaryScreen() -{ - return nsScreenManagerGonk::PRIMARY_SCREEN_ID == mId; -} - -NS_IMETHODIMP -nsScreenGonk::GetId(uint32_t *outId) -{ - *outId = mId; - return NS_OK; -} - -uint32_t -nsScreenGonk::GetId() -{ - return mId; -} - -NS_IMETHODIMP -nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop, - int32_t *outWidth, int32_t *outHeight) -{ - *outLeft = mVirtualBounds.x; - *outTop = mVirtualBounds.y; - - *outWidth = mVirtualBounds.width; - *outHeight = mVirtualBounds.height; - - return NS_OK; -} - -nsIntRect -nsScreenGonk::GetRect() -{ - return mVirtualBounds; -} - -NS_IMETHODIMP -nsScreenGonk::GetAvailRect(int32_t *outLeft, int32_t *outTop, - int32_t *outWidth, int32_t *outHeight) -{ - return GetRect(outLeft, outTop, outWidth, outHeight); -} - -NS_IMETHODIMP -nsScreenGonk::GetPixelDepth(int32_t *aPixelDepth) -{ - // XXX: this should actually return 32 when we're using 24-bit - // color, because we use RGBX. - *aPixelDepth = mColorDepth; - return NS_OK; -} - -NS_IMETHODIMP -nsScreenGonk::GetColorDepth(int32_t *aColorDepth) -{ - *aColorDepth = mColorDepth; - return NS_OK; -} - -NS_IMETHODIMP -nsScreenGonk::GetRotation(uint32_t* aRotation) -{ - *aRotation = mScreenRotation; - return NS_OK; -} - -float -nsScreenGonk::GetDpi() -{ - return mDpi; -} - -ANativeWindow* -nsScreenGonk::GetNativeWindow() -{ - return mNativeWindow.get(); -} - -NS_IMETHODIMP -nsScreenGonk::SetRotation(uint32_t aRotation) -{ - if (!(aRotation <= ROTATION_270_DEG)) { - return NS_ERROR_ILLEGAL_VALUE; - } - - if (mScreenRotation == aRotation) { - return NS_OK; - } - - mScreenRotation = aRotation; - uint32_t rotation = EffectiveScreenRotation(); - if (rotation == nsIScreen::ROTATION_90_DEG || - rotation == nsIScreen::ROTATION_270_DEG) { - mVirtualBounds = nsIntRect(0, 0, - mNaturalBounds.height, - mNaturalBounds.width); - } else { - mVirtualBounds = mNaturalBounds; - } - - nsAppShell::NotifyScreenRotation(); - - for (unsigned int i = 0; i < mTopWindows.Length(); i++) { - mTopWindows[i]->Resize(mVirtualBounds.width, - mVirtualBounds.height, - true); - } - - return NS_OK; -} - -nsIntRect -nsScreenGonk::GetNaturalBounds() -{ - return mNaturalBounds; -} - -uint32_t -nsScreenGonk::EffectiveScreenRotation() -{ - return (mScreenRotation + mPhysicalScreenRotation) % (360 / 90); -} - -// NB: This isn't gonk-specific, but gonk is the only widget backend -// that does this calculation itself, currently. -static ScreenOrientation -ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize) -{ - bool naturallyPortrait = (aScreenSize.height > aScreenSize.width); - switch (aRotation) { - case nsIScreen::ROTATION_0_DEG: - return (naturallyPortrait ? eScreenOrientation_PortraitPrimary : - eScreenOrientation_LandscapePrimary); - case nsIScreen::ROTATION_90_DEG: - // Arbitrarily choosing 90deg to be primary "unnatural" - // rotation. - return (naturallyPortrait ? eScreenOrientation_LandscapePrimary : - eScreenOrientation_PortraitPrimary); - case nsIScreen::ROTATION_180_DEG: - return (naturallyPortrait ? eScreenOrientation_PortraitSecondary : - eScreenOrientation_LandscapeSecondary); - case nsIScreen::ROTATION_270_DEG: - return (naturallyPortrait ? eScreenOrientation_LandscapeSecondary : - eScreenOrientation_PortraitSecondary); - default: - MOZ_CRASH("Gonk screen must always have a known rotation"); - } -} - -ScreenConfiguration -nsScreenGonk::GetConfiguration() -{ - ScreenOrientation orientation = ComputeOrientation(mScreenRotation, - mNaturalBounds.Size()); - - // NB: perpetuating colorDepth == pixelDepth illusion here, for - // consistency. - return ScreenConfiguration(mVirtualBounds, orientation, - mColorDepth, mColorDepth); -} - -void -nsScreenGonk::RegisterWindow(nsWindow* aWindow) -{ - mTopWindows.AppendElement(aWindow); -} - -void -nsScreenGonk::UnregisterWindow(nsWindow* aWindow) -{ - mTopWindows.RemoveElement(aWindow); -} - -void -nsScreenGonk::BringToTop(nsWindow* aWindow) -{ - mTopWindows.RemoveElement(aWindow); - mTopWindows.InsertElementAt(0, aWindow); -} - -NS_IMPL_ISUPPORTS(nsScreenManagerGonk, nsIScreenManager) - -nsScreenManagerGonk::nsScreenManagerGonk() - : mInitialized(false) -{ -} - -nsScreenManagerGonk::~nsScreenManagerGonk() -{ -} - -/* static */ already_AddRefed<nsScreenManagerGonk> -nsScreenManagerGonk::GetInstance() -{ - nsCOMPtr<nsIScreenManager> manager; - manager = do_GetService("@mozilla.org/gfx/screenmanager;1"); - MOZ_ASSERT(manager); - return already_AddRefed<nsScreenManagerGonk>( - static_cast<nsScreenManagerGonk*>(manager.forget().take())); -} - -/* static */ already_AddRefed< nsScreenGonk> -nsScreenManagerGonk::GetPrimaryScreen() -{ - nsRefPtr<nsScreenManagerGonk> manager = nsScreenManagerGonk::GetInstance(); - nsCOMPtr<nsIScreen> screen; - manager->GetPrimaryScreen(getter_AddRefs(screen)); - MOZ_ASSERT(screen); - return already_AddRefed<nsScreenGonk>( - static_cast<nsScreenGonk*>(screen.forget().take())); -} - -void -nsScreenManagerGonk::Initialize() -{ - if (mInitialized) { - return; - } - - mScreenOnEvent = new ScreenOnOffEvent(true); - mScreenOffEvent = new ScreenOnOffEvent(false); - GetGonkDisplay()->OnEnabled(displayEnabledCallback); - - AddScreen(PRIMARY_SCREEN_TYPE); - - nsAppShell::NotifyScreenInitialized(); - mInitialized = true; -} - -void -nsScreenManagerGonk::DisplayEnabled(bool aEnabled) -{ - if (gfxPrefs::HardwareVsyncEnabled()) { - VsyncControl(aEnabled); - } - - NS_DispatchToMainThread(aEnabled ? mScreenOnEvent : mScreenOffEvent); -} - -NS_IMETHODIMP -nsScreenManagerGonk::GetPrimaryScreen(nsIScreen **outScreen) -{ - NS_IF_ADDREF(*outScreen = mScreens[0].get()); - return NS_OK; -} - -NS_IMETHODIMP -nsScreenManagerGonk::ScreenForId(uint32_t aId, - nsIScreen **outScreen) -{ - for (size_t i = 0; i < mScreens.Length(); i++) { - if (mScreens[i]->GetId() == aId) { - NS_IF_ADDREF(*outScreen = mScreens[i].get()); - return NS_OK; - } - } - - *outScreen = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsScreenManagerGonk::ScreenForRect(int32_t inLeft, - int32_t inTop, - int32_t inWidth, - int32_t inHeight, - nsIScreen **outScreen) -{ - // Since all screens have independent coordinate system, we could - // only return the primary screen no matter what rect is given. - return GetPrimaryScreen(outScreen); -} - -NS_IMETHODIMP -nsScreenManagerGonk::ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen) -{ - for (size_t i = 0; i < mScreens.Length(); i++) { - if (aWidget == mScreens[i]->GetNativeWindow()) { - NS_IF_ADDREF(*outScreen = mScreens[i].get()); - return NS_OK; - } - } - - *outScreen = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsScreenManagerGonk::GetNumberOfScreens(uint32_t *aNumberOfScreens) -{ - *aNumberOfScreens = mScreens.Length(); - return NS_OK; -} - -NS_IMETHODIMP -nsScreenManagerGonk::GetSystemDefaultScale(float *aDefaultScale) -{ - *aDefaultScale = 1.0f; - return NS_OK; -} - -void -nsScreenManagerGonk::VsyncControl(bool aEnabled) -{ - MOZ_ASSERT(gfxPrefs::HardwareVsyncEnabled()); - - if (!NS_IsMainThread()) { - NS_DispatchToMainThread( - NS_NewRunnableMethodWithArgs<bool>(this, - &nsScreenManagerGonk::VsyncControl, - aEnabled)); - return; - } - - MOZ_ASSERT(NS_IsMainThread()); - VsyncSource::Display &display = gfxPlatform::GetPlatform()->GetHardwareVsync()->GetGlobalDisplay(); - if (aEnabled) { - display.EnableVsync(); - } else { - display.DisableVsync(); - } -} - -uint32_t -nsScreenManagerGonk::GetIdFromType(uint32_t aDisplayType) -{ - // This is the only place where we make the assumption that - // display type is equivalent to screen id. - - // Bug 1138287 will address the conversion from type to id. - return aDisplayType; -} - -void -nsScreenManagerGonk::AddScreen(uint32_t aDisplayType) -{ - // We currently only support adding primary screen. - MOZ_ASSERT(PRIMARY_SCREEN_TYPE == aDisplayType); - - uint32_t id = GetIdFromType(aDisplayType); - - ANativeWindow* win = GetGonkDisplay()->GetNativeWindow(); - nsScreenGonk* screen = new nsScreenGonk(id, win); - - mScreens.AppendElement(screen); -} - -void -nsScreenManagerGonk::RemoveScreen(uint32_t aDisplayType) -{ - uint32_t screenId = GetIdFromType(aDisplayType); - for (size_t i = 0; i < mScreens.Length(); i++) { - if (mScreens[i]->GetId() == screenId) { - mScreens.RemoveElementAt(i); - break; - } - } -}
--- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -118,16 +118,18 @@ public: virtual nsIntRect GetNaturalBounds() override; virtual bool NeedsPaint(); virtual Composer2D* GetComposer2D() override; void ConfigureAPZControllerThread() override; + nsScreenGonk* GetScreen(); + protected: nsWindow* mParent; bool mVisible; InputContext mInputContext; nsCOMPtr<nsIIdleServiceInternal> mIdleService; // If we're using a BasicCompositor, these fields are temporarily // set during frame composition. They wrap the hardware // framebuffer.
--- a/widget/moz.build +++ b/widget/moz.build @@ -61,16 +61,17 @@ XPIDL_SOURCES += [ 'nsIBaseWindow.idl', 'nsIBidiKeyboard.idl', 'nsIClipboard.idl', 'nsIClipboardDragDropHookList.idl', 'nsIClipboardDragDropHooks.idl', 'nsIClipboardHelper.idl', 'nsIClipboardOwner.idl', 'nsIColorPicker.idl', + 'nsIDisplayInfo.idl', 'nsIDragService.idl', 'nsIDragSession.idl', 'nsIFilePicker.idl', 'nsIFormatConverter.idl', 'nsIGfxInfo.idl', 'nsIGfxInfoDebug.idl', 'nsIIdleService.idl', 'nsIIdleServiceInternal.idl',
new file mode 100644 --- /dev/null +++ b/widget/nsIDisplayInfo.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(615bc23d-6346-4b15-9c10-add002f140b6)] +interface nsIDisplayInfo : nsISupports +{ + readonly attribute long id; + readonly attribute boolean connected; +};