Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#13100 closed Patch - Bug Fix (Abandoned)

Handle Non Integer Refresh Rates with XRandr (Fixing JudderFree)

Reported by: halovanic@… Owned by: Peter Bennett
Priority: minor Milestone: unknown
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords: xrandr nvidia refresh rate
Cc: Ticket locked: no

Description

The current code for JudderFree doesn't work anymore for recent NVIDIA drivers. It also was an NVIDIA-only solution due to relying on getting and setting refresh rates using XRandr, where they can only be integer values, or in NVIDIA's case, fake integer values.

The attached patch uses an alternate method of calculating the actual refresh rate as a more accurate double value and switching to a supported modeline without trying to match the real and fake rates through the (broken) NVIDIA extension method. This should also allow Judder Free playback for other video cards so long as they support suitable implementation of XRandr.

Attachments (2)

0001-Handle-non-integer-refresh-rates-in-XRandr.patch (11.4 KB) - added by halovanic@… 7 years ago.
Patch attempt #1
0002-Handle-non-integer-refresh-rates-in-XRandr.patch (12.7 KB) - added by halovanic@… 7 years ago.
Now handles scenarios without primary monitor

Download all attachments as: .zip

Change History (14)

Changed 7 years ago by halovanic@…

Patch attempt #1

comment:1 Changed 7 years ago by halovanic@…

Opened as Github pull request #142.

Changed 7 years ago by halovanic@…

Now handles scenarios without primary monitor

comment:2 Changed 7 years ago by halovanic@…

I have corrected this to assume the first monitor is the one we want to alter if not set as the primary, and fixed a segfault if we can't get monitor data back.

comment:3 Changed 7 years ago by Peter Bennett

Owner: changed from JYA to Peter Bennett
Status: newassigned

comment:4 Changed 7 years ago by Stuart Auchterlonie

Milestone: needs_triage30.0

comment:5 Changed 7 years ago by Steven Ellis <support@…>

Tried this 0002 patch against 0.28 and it appears to break all OpenGL based playback modes.

comment:6 Changed 7 years ago by Alex Halovanic <halovanic@…>

Hi Steven, thank you for trying this out.

OpenGL playback works for me the same as other modes since this (hopefully) should just involve switching modelines. Could you please send me the output of the "xrandr" command on the machine you tested with, and the GUI/video modes you configured (if any)?

I believe I have found at least a few problems I need to address:

  • Switching from a smaller GUI resolution to a larger video resolution doesn't work because the X screen needs to be expanded first.
  • It seems that in some cases the default primary monitor is actually a disconnected one, so probably I should just be checking for the first connected monitor. I have not been able to find any truly definitive way to report which monitor the application is currently running on.

comment:7 Changed 7 years ago by Steven Ellis <support@…>

I'm running Mythbuntu 16.04.3 and I'm testing a 0.28 frontend with patches to validate fixes for bug #13054

I'm using a force EDID to maintain the settings for my HDMI Onkyo amp with my NVidia card and currently using the nvidia-340 driver with a GT710 card

My off air content is PAL so it defaults to 25Hz with the de-interlacer on.

Xrandr output

xrandr 

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-D-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 160mm x 90mm
   1920x1080     60.00*+  59.94    50.00    29.97    25.00    23.97    60.05    60.00    50.04  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      74.98    59.89  
   1360x768      60.02  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94  
   480x576       50.00  
   480x480       59.94  
   411x576       50.07  
   411x480       59.97  

Verbose output

xrandr --verbose
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
VGA-0 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x1e6
	Timestamp:  5539448
	Subpixel:   unknown
	Clones:    
	CRTCs:      0 1 2 3
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	BorderDimensions: 4 
		supported: 4
	Border: 0 0 0 0 
		range: (0, 65535)
	SignalFormat: VGA 
		supported: VGA
	ConnectorType: VGA 
	ConnectorNumber: 2 
	_ConnectorLocation: 2 
DVI-D-0 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x1e7
	Timestamp:  5539448
	Subpixel:   unknown
	Clones:    
	CRTCs:      0 1 2 3
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	BorderDimensions: 4 
		supported: 4
	Border: 0 0 0 0 
		range: (0, 65535)
	SignalFormat: TMDS 
		supported: TMDS
	ConnectorType: DVI-D 
	ConnectorNumber: 0 
	_ConnectorLocation: 0 
HDMI-0 connected 1920x1080+0+0 (0x1e9) normal (normal left inverted right x axis y axis) 160mm x 90mm
	Identifier: 0x1e8
	Timestamp:  5539448
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:    
	CRTC:       0
	CRTCs:      0 1 2 3
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	EDID: 
		00ffffffffffff003dcb620a00000000
		00140103801009780aee91a3544c9926
		0f5054bdef80714f8100814081809500
		950fb300a940023a801871382d40582c
		4500a05a0000001e662150b051001b30
		40703600a05a0000001e000000fc0054
		582d53523630380a20202020000000fd
		00184b1a5111000a20202020202001f2
		020345f14f901f041305140312202122
		0f1e242638097f070f7f071707503f06
		c04d02005706005f7e01675400834f00
		006c030c001500b82dc000000000e305
		0301e2000f011d007251d01e206e2855
		00a05a0000001e011d00bc52d01e20b8
		285540a05a0000001e011d8018711c16
		20582c2500a05a0000009e000000003d
	BorderDimensions: 4 
		supported: 4
	Border: 0 0 0 0 
		range: (0, 65535)
	SignalFormat: TMDS 
		supported: TMDS
	ConnectorType: HDMI 
	ConnectorNumber: 1 
	_ConnectorLocation: 1 
  1920x1080 (0x1e9) 148.500MHz +HSync +VSync *current +preferred
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x1ea) 148.350MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1920x1080 (0x1eb) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x1ec) 74.180MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.72KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  29.97Hz
  1920x1080 (0x1ed) 74.250MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  28.12KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  25.00Hz
  1920x1080 (0x1ee) 74.160MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  26.97KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  23.97Hz
  1920x1080 (0x1ef) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.75KHz
        v: height 1080 start 1084 end 1094 total 1124           clock  60.05Hz
  1920x1080 (0x1f0) 74.180MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.72KHz
        v: height 1080 start 1084 end 1094 total 1124           clock  60.00Hz
  1920x1080 (0x1f1) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  28.12KHz
        v: height 1080 start 1084 end 1094 total 1124           clock  50.04Hz
  1680x1050 (0x1f2) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1600x1200 (0x1f3) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1440x900 (0x1f4) 136.750MHz -HSync +VSync
        h: width  1440 start 1536 end 1688 total 1936 skew    0 clock  70.64KHz
        v: height  900 start  903 end  909 total  942           clock  74.98Hz
  1440x900 (0x1f5) 106.500MHz -HSync +VSync
        h: width  1440 start 1520 end 1672 total 1904 skew    0 clock  55.93KHz
        v: height  900 start  903 end  909 total  934           clock  59.89Hz
  1360x768 (0x1f6) 85.500MHz +HSync +VSync
        h: width  1360 start 1424 end 1536 total 1792 skew    0 clock  47.71KHz
        v: height  768 start  771 end  777 total  795           clock  60.02Hz
  1280x1024 (0x1f7) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x1f8) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0x1f9) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1280x800 (0x1fa) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1280x720 (0x1fb) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x1fc) 74.180MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1280x720 (0x1fd) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1152x864 (0x1fe) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1024x768 (0x1ff) 78.750MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.02KHz
        v: height  768 start  769 end  772 total  800           clock  75.03Hz
  1024x768 (0x200) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0x201) 65.000MHz -HSync -VSync
        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 (0x202) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x203) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0x204) 40.000MHz +HSync +VSync
        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
  720x576 (0x205) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x206) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x207) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x208) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  696 total  832 skew    0 clock  37.86KHz
        v: height  480 start  481 end  484 total  520           clock  72.81Hz
  640x480 (0x209) 25.175MHz -HSync -VSync
        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
  480x576 (0x20a) 18.000MHz -HSync +VSync
        h: width   480 start  488 end  530 total  576 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  480x480 (0x20b) 18.000MHz -HSync -VSync
        h: width   480 start  490 end  532 total  572 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  411x576 (0x20c) 15.428MHz -HSync -VSync
        h: width   411 start  418 end  454 total  493 skew    0 clock  31.29KHz
        v: height  576 start  581 end  586 total  625           clock  50.07Hz
  411x480 (0x20d) 15.428MHz -HSync -VSync
        h: width   411 start  420 end  456 total  490 skew    0 clock  31.49KHz
        v: height  480 start  489 end  495 total  525           clock  59.97Hz

comment:8 Changed 7 years ago by Peter Bennett

Status: assignedinfoneeded

Set to infoneeded while waiting for updated patch.

comment:9 Changed 7 years ago by Alex Halovanic <halovanic@…>

Could you try running the following command before starting mythfrontend with the current patch? xrandr --output HDMI-0 --primary

If I'm understanding you correctly, you are running the GUI at 1920x1080@60 and you expect it to be switching to 1920x1080@50 or 1920x1080@25 using the "auto" rate calculation? If there's no screen resizing going on, then hopefully it is just my faulty guesswork at which monitor is to be controlled when there is no primary, and it's choosing something like VGA-0.

comment:10 Changed 7 years ago by Peter Bennett

Milestone: 30.0unknown
Resolution: Abandoned
Status: infoneededclosed

Closing this ticket as it is reported to break OpenGL playback, and no update for that has been submitted.

comment:11 Changed 7 years ago by Peter Bennett

Owner: changed from Peter Bennett to Peter Bennett

comment:12 Changed 5 years ago by Mark Kendall <mark.kendall@…>

In 962525f37f/mythtv:

MythDisplayX11: Use accurate XRandR refresh rates

  • use the more modern XRandR API to interrogate actual modelines

available and hence calculate refresh rates with full floating point
accuracy

  • enables the removal of libxnvtrl at some point
  • working on multiple testes linux platforms
  • there is a fairly ugly workaround to ensure the main window is not

clipped when we have moved to a higher resolution mode - if necessary,
we hide and then show the main window. I have no idea why this is
necessary and can't work out why it is needed - all the loggging/
debugging in the world doesn't indicate why sometimes the window is
clipped.

  • also moves a little state management out of MythUIHelper and

MythVideoOutput? - which is a good thing.

Refs #13100

Note: See TracTickets for help on using tickets.