"window->screen()->physicalDotsPerInch() / 25.4" may be negative on xenial

Bug #1525293 reported by Timo Jyrinki
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Invalid
Undecided
Unassigned
mir (Ubuntu)
Invalid
Undecided
Unassigned
qtmir (Ubuntu)
New
Undecided
Unassigned

Bug Description

Window->screen()->physicalDotsPerInch() / 25.4 can be negative on Xenial when using the latest UI Toolkit.

(see bug #1525174 for original finding)

Revision history for this message
Gerry Boland (gerboland) wrote :

Qtubuntu reads the physical display size from Mir's DisplayConfiguration. That is then used by Qt to calculate physicalDotsPerInch().

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Found the aforementioned expression in the unity8 source. Of course the data comes from Mir still.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I've been testing and trying to reproduce this issue, including hacking 'mirout' so it works with unity8.

In all cases I only see valid positive numbers for the physical display dimensions. So this bug is either nothing to do with Mir, or some device-specific problem. What device do you see the problem on?

Changed in mir:
status: New → Incomplete
Changed in mir (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Or (possibility #3) comment #1 might be wrong and maybe Qt gets the DPI from the new DPI events, and fails.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

This is on xenial only, using the latest UITK, and seen in the address-book-app's contact_list unit test as described in bug #1525174 if https://code.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/validDpi/+merge/280312 is not applied in UI Toolkit.

Notably this may have something to do with the Qt 5.5 landing also as I guess it'd be unlikely for any UI Toolkit change itself to cause that (but it blocked UITK landing until the workaround was implemented). Xenial images starting this week now have Qt 5.5.

description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It appears QScreen.physicalDotsPerInch for Mir is implemented in QtMir:

void Screen::setMirDisplayConfiguration(const mir::graphics::DisplayConfigurationOutput &screen)
{
...
    // Physical screen size
    m_physicalSize.setWidth(screen.physical_size_mm.width.as_float());
    m_physicalSize.setHeight(screen.physical_size_mm.height.as_float());

Per previous comments above however I have not been able to find any case in which these values from Mir were wrong. It appears that possibly QtMir is getting its data from an inactive or invalid mir::graphics::DisplayConfigurationOutput. So QtMir should be careful to enumerate all the outputs available and pick one that is valid, because some outputs do exist but are unplugged or turned off. And so will have invalid data in some fields like physical_size_mm.

affects: qtubuntu (Ubuntu) → qtmir (Ubuntu)
affects: unity8 (Ubuntu) → qtmir
Revision history for this message
Albert Astals Cid (aacid) wrote :

I'd say error of negative values is when running under xvfb, we just workarounded that in unity8 version of that code, so probably not a mir problem?

http://bazaar.launchpad.net/~dandrader/unity8/fixDragHandleTest/revision/2101

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Invalid for Mir. Unless you can show Mir returning bad data using the 'mirout' command or such.

Mir will indeed have some DisplayConfigurationOutput structures whose contents are not fully populated. However QtMir should be ignoring those structures on the basis of the 'used' and 'connected' flags being false. Admittedly the header file docs don't make this obvious.

Changed in mir:
status: Incomplete → Invalid
Changed in mir (Ubuntu):
status: Incomplete → Invalid
Michał Sawicz (saviq)
no longer affects: qtmir
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.