Closed Bug 838505 Opened 8 years ago Closed 8 years ago

Support QHD and other HiDPI screen dimensions and resolutions

Categories

(Firefox OS Graveyard :: Gaia, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: timdream, Unassigned)

References

Details

+++ This bug was initially created as a clone of Bug #830644 +++

Read bug 830644 comment 23. The work involved in this bug will be:

1. Get the build config to set |layout.css.devPixelsPerPx| pref to 2 on those devices
2. Fix OOP/OTMA rendering issues caused by the above change, like bug 828531
3. Ensure Gaia looks all right with the new (CSS) pixel dimensions
Ideally, there will be nothing to do about (3) as it is already handled in bug 830644.
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #0)
> 1. Get the build config to set |layout.css.devPixelsPerPx| pref to 2 on

Correction on this one, for qHD and WVGA hardware we are currently developing on, the devPixelsPerPx should be 1.5, instead of 2, as Ismael points out.

Better yet, if B2G Gecko could figure out the "internal default scale" of the device through Gonk(?), we can keep Gecko pref default ("-1") and express the hardware spec there.

https://mxr.mozilla.org/mozilla-central/source/widget/xpwidgets/nsBaseWidget.cpp#394

roc, is my assumption on Gecko correct?
mwu, are you the right person for feasibility of that?

Thanks.
Flags: needinfo?(roc)
Flags: needinfo?(mwu)
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #2)
> roc, is my assumption on Gecko correct?

Yes, I think so.b
Flags: needinfo?(roc)
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #2)
> (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #0)
> > 1. Get the build config to set |layout.css.devPixelsPerPx| pref to 2 on
> 
> Correction on this one, for qHD and WVGA hardware we are currently
> developing on, the devPixelsPerPx should be 1.5, instead of 2, as Ismael
> points out.

qHD = 1.6875

https://github.com/mozilla-b2g/gaia/pull/8044#discussion_r3113679
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #2)
> mwu, are you the right person for feasibility of that?

Besides |layout.css.devPixelsPerPx|, can we also keep the "-1" default of |layout.css.dpi| and expose the real dpi to the web content with the same way?
I suspect that what we really need in B2G is fully support for meta viewport tags:

<meta name="viewport" content = "width = device-width, initial-scale = 1, user-scalable = no" />

Using this meta tag in a qHD device, should scale up the UI in the same way as it would do layout.css.devPixelsPerPx = 1.6875.

And for WVGA ones it should be equal to layout.css.devPixelsPerPx=1.5

Having this supported we let the developers to choose when and when not to use the scaled web content.

Of course this will need to modify the matching values for mediaqueries and the returned ones via window object properties (innerWidth, innerHeight)

I could imagine that is is a huge effort from b2g team, and it may covered in a long term, but this is the way that web works right now. And the way that webapp developers expects to do.

My 2 cnt

And
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #5)
> Besides |layout.css.devPixelsPerPx|, can we also keep the "-1" default of
> |layout.css.dpi| and expose the real dpi to the web content with the same
> way?

Yes, but it's important to note that the "real dpi" is very little used for Web apps. In particular CSS "in" units are always 1in per 96px. The CSS unit where the "real dpi" is actually used is the Mozilla-specific "mozmm" unit.

(In reply to Ismael from comment #6)
> I suspect that what we really need in B2G is fully support for meta viewport
> tags:

I agree that supporting <meta viewport> for B2G apps would be a good idea.
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #7)
> (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #5)
> > Besides |layout.css.devPixelsPerPx|, can we also keep the "-1" default of
> > |layout.css.dpi| and expose the real dpi to the web content with the same
> > way?
> 
> Yes, but it's important to note that the "real dpi" is very little used for
> Web apps. In particular CSS "in" units are always 1in per 96px. The CSS unit
> where the "real dpi" is actually used is the Mozilla-specific "mozmm" unit.
> 
> (In reply to Ismael from comment #6)
> > I suspect that what we really need in B2G is fully support for meta viewport
> > tags:
> 
> I agree that supporting <meta viewport> for B2G apps would be a good idea.

Should we file a bug to track the work for supporting it?
By the way I have found a related bug that can be relevant to these discussions: bug 677989
(In reply to Jose M. Cantera from comment #8)
> > (In reply to Ismael from comment #6)
> > > I suspect that what we really need in B2G is fully support for meta viewport
> > > tags:
> > 
> > I agree that supporting <meta viewport> for B2G apps would be a good idea.
> 
> Should we file a bug to track the work for supporting it?

Yes, that should go to another bug. To enable <meta viewport> we could simply add |mozasyncpanzoom| in shell.js/xul (which embeds System app) and in window_manager.js in System app (which embeds all other apps). Yet I remembered there were some noises from UX/E.me/Apps that we shouldn't be using |mozasyncpanzoom| on known mobile web/apps. Be sure to check on them for that ...
I have filed bug 845690.
I can get layout.css.devPixelsPerPx set to the right thing per device. Looks like it's just a matter of implementing GetDefaultScaleInternal. We can add a system property/quirk that gecko looks for.
Flags: needinfo?(mwu)
Actually, it looks like we can directly determine the dpi and calculate the right value.
Tim, do you want to:

1. Calculate/look up devPixelsPerPx based on screen size/resolution/dpi, or
2. Configure devPixelsPerPx per device

For #1, I'll need some sort of table or algorithm.
Flags: needinfo?(timdream)
(In reply to Michael Wu [:mwu] from comment #14)
> Tim, do you want to:
> 
> 1. Calculate/look up devPixelsPerPx based on screen size/resolution/dpi, or
> 2. Configure devPixelsPerPx per device
> 
> For #1, I'll need some sort of table or algorithm.

I believe #1 is what we need. Algorithm has been discussed in bug 845182. Could you take that bug? If not let me find some Gecko/Gonk people in Taipei for that.
Flags: needinfo?(timdream)
Depends on: 867703
FWIW, the peak kernel just got support for reporting the screen size, so a build for the peak will have devPixelsPerPx set to 1.5. There appears to be a few glitches in gaia related to this that I don't see on devices with devPixelsPerPx set to 2.0.

Use this to configure for a peak:

BRANCH=master ./config.sh peak
Since all work involved have since been covered by other bugs (bug 845182 bug 867703 bug 870311), I am closing this one.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.