Bug 92313 - XineramaQueryScreens broken with reverse PRIME
Summary: XineramaQueryScreens broken with reverse PRIME
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Ext/Xinerama (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 94006 (view as bug list)
Depends on:
Blocks: 92986
  Show dependency treegraph
 
Reported: 2015-10-06 08:34 UTC by Matthias Schiffer
Modified: 2016-02-12 10:42 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.log (94.52 KB, text/plain)
2015-10-06 08:34 UTC, Matthias Schiffer
no flags Details
Fix XineramaQueryScreens for reverse prime (576 bytes, patch)
2016-02-02 09:53 UTC, Jan Burgmeier
no flags Details | Splinter Review
Fix primary output detection for xinerama and reverse prime (1.43 KB, patch)
2016-02-02 18:11 UTC, Jan Burgmeier
no flags Details | Splinter Review

Description Matthias Schiffer 2015-10-06 08:34:22 UTC
Created attachment 118703 [details]
Xorg.log

When configuring a reverse PRIME output (intel+nouveau), XineramaScreenInfo reports its size as 0x0 pixels, confusing my window manager and other software.

Used versions:

* xserver 1.17.99.901-89-gf6ce23f
* xf86-video-intel 2.99.917-476-g4e668dd
* xf86-video-nouveau 1.0.11-31-g1ff13a9

This is a regression, xserver 1.17.2 is working fine.


Steps to reproduce:

% xrandr --setprovideroutputsource nouveau Intel
% xrandr --output DP-1-3 --auto --primary --output LVDS2 --right-of DP-1-3 --preferred
% xrandr
Screen 0: minimum 8 x 8, current 4160 x 1440, maximum 32767 x 32767
LVDS2 connected 1600x900+2560+0 (normal left inverted right x axis y axis) 310mm x 174mm
   1600x900      60.00*+
   1368x768      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   800x450       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00  
VGA2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
LVDS-1-1 disconnected (normal left inverted right x axis y axis)
VGA-1-1 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
DP-1-2 disconnected (normal left inverted right x axis y axis)
DP-1-3 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   1920x1200     59.95  
   1920x1080     60.00    60.00    50.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.95  
   1280x1024     75.02    60.02  
   1440x900      59.89  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.08    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
  1024x768 (0x7a) 65.000MHz
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x7c) 40.000MHz
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  640x480 (0x82) 25.175MHz
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
% ./Devel/test/XineramaScreenInfo
0: x=2560 y=0 w=1600 h=900
1: x=0 y=0 w=0 h=0
Comment 1 Jan Burgmeier 2016-02-01 19:40:51 UTC
I run into the same problem and bisected it, this is the bad commit:

5de13830709a7f2d4d112d71e062f710ef466ab6 is the first bad commit
commit 5de13830709a7f2d4d112d71e062f710ef466ab6
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 16 09:56:50 2014 -0800

    randr: Use Monitor list for Xinerama
    
    This replaces the CRTC-based Xinerama implementation with one which
    uses Monitors instead, allowing clients to manipulate the Xinerama
    configuration through the RandR Monitor list.
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>
Comment 2 Jan Burgmeier 2016-02-02 09:53:58 UTC
Created attachment 121454 [details] [review]
Fix XineramaQueryScreens for reverse prime
Comment 3 Jan Burgmeier 2016-02-02 09:57:02 UTC
The problem seems to be, that in RRMonitorInitList the primary and slave crtcs are counted but in RRMonitorMakeList only the primary.

I attached a pached which fixed the bug for me. But I'm not familiar with the code so this hopefully won't break anything else.
Comment 4 Jan Burgmeier 2016-02-02 18:11:05 UTC
Created attachment 121464 [details] [review]
Fix primary output detection for xinerama and reverse prime

I'am not sure if this patch is correct or not. The bug it tries to fix is, that RRMonitorCrtcPrimary uses rrScrPrivPtr->primaryOutput to detect if the current output is the primary one but if the current output is attached to screen slave rrScrPrivPtr->primaryOutput is not set.

This patch sets the primaryOutput variable also on all slave screens in ProcRRSetOutputPrimary.
Comment 5 Michel Dänzer 2016-02-04 03:03:26 UTC
Please send patches (preferably using git send-email, but definitely generated by git format-patch) to the xorg-devel@lists.x.org list for review.
Comment 6 Adam Jackson 2016-02-08 22:22:45 UTC
commit 26da92b284ba0aa2d51d41d926d1ffa8f5888f61
Author: Jan Burgmeier <jan.burgmeier@unicon-software.com>
Date:   Thu Feb 4 14:06:43 2016 +0100

    Fix XineramaQueryScreens for reverse prime
Comment 7 Munzir Taha 2016-02-12 10:42:34 UTC
*** Bug 94006 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.