On 2018-06-06 15:48 +0200, Michel Dänzer wrote:

> On 2018-06-06 03:05 PM, Sam Morris wrote:
>> Source: xserver-xorg-video-nouveau
>> Followup-For: Bug #896979
>> 
>> I'm still seeing this with Xorg 1.20 (which is not unexpected). Here's a
>> better backtrace:
>> 
>>     #0  0x00007fd90edb5e7b in __GI_raise (sig=sig@entry=6) at 
>> ../sysdeps/unix/sysv/linux/raise.c:51
>>     #1  0x00007fd90edb7231 in __GI_abort () at abort.c:79
>>     #2  0x0000557576dc55ca in OsAbort () at ../../../../os/utils.c:1350
>>     #3  0x0000557576dcb163 in AbortServer () at ../../../../os/log.c:877
>>     #4  0x0000557576dcbf85 in FatalError (f=f@entry=0x557576dfec30 "Caught 
>> signal %d (%s). Server aborting\n") at ../../../../os/log.c:1015
>>     #5  0x0000557576dc26b3 in OsSigHandler (signo=11, sip=<optimized out>, 
>> unused=<optimized out>) at ../../../../os/osinit.c:156
>>     #6  0x00007fd90f14cf50 in <signal handler called> () at 
>> /lib/x86_64-linux-gnu/libpthread.so.0
>>     #7  0x00007fd90c027f29 in drmmode_output_dpms (output=0x557578bfaf20, 
>> mode=3) at ../../src/drmmode_display.c:921
>>     #8  0x0000557576cd8813 in xf86DisableUnusedFunctions 
>> (pScrn=0x557578a6a120) at ../../../../../../hw/xfree86/modes/xf86Crtc.c:3021
>>     #9  0x0000557576ce0980 in xf86RandR12CrtcSet (pScreen=<optimized out>, 
>> randr_crtc=0x557578c33220, randr_mode=0x0, x=0, y=0, rotation=<optimized 
>> out>, num_randr_outputs=0, randr_outputs=0x0) at 
>> ../../../../../../hw/xfree86/modes/xf86RandR12.c:1241
>>     #10 0x0000557576d20122 in RRCrtcSet (crtc=<optimized out>, mode=0x0, 
>> x=0, y=0, rotation=rotation@entry=1, numOutputs=numOutputs@entry=0, 
>> outputs=0x0) at ../../../../randr/rrcrtc.c:774
>>     #11 0x0000557576d219fe in ProcRRSetCrtcConfig (client=0x557578a598f0) at 
>> ../../../../randr/rrcrtc.c:1401
>>     #12 0x0000557576c660b8 in Dispatch () at ../../../../dix/dispatch.c:478
>>     #13 0x0000557576c6a0b8 in dix_main (argc=13, argv=0x7ffd47296448, 
>> envp=<optimized out>) at ../../../../dix/main.c:276
>>     #14 0x00007fd90eda2a87 in __libc_start_main (main=0x557576c53d80 <main>, 
>> argc=13, argv=0x7ffd47296448, init=<optimized out>, fini=<optimized out>, 
>> rtld_fini=<optimized out>, stack_end=0x7ffd47296438) at 
>> ../csu/libc-start.c:310
>>     #15 0x0000557576c53dba in _start ()
>> 
>>     (gdb) frame 7
>>     #7  drmmode_output_dpms (output=0x557578bfaf20, mode=3) at 
>> ../../src/drmmode_display.c:921
>>     921      in ../../src/drmmode_display.c
>> 
>> Looking at that file in nouveau's source code:
>> 
>> static void
>> drmmode_output_dpms(xf86OutputPtr output, int mode)
>> {
>>         drmmode_output_private_ptr drmmode_output = output->driver_private;
>>         drmModeConnectorPtr koutput = drmmode_output->mode_output;
>>         drmModePropertyPtr props;
>>         drmmode_ptr drmmode = drmmode_output->drmmode;
>>         int mode_id = -1, i;
>> 
>>         for (i = 0; i < koutput->count_props; i++) { // <-- this line!
>>                 props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
>>                 if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
>>                         if (!strcmp(props->name, "DPMS")) {
>>                                 mode_id = koutput->props[i];
>>                                 drmModeFreeProperty(props);
>>                                 break;
>>                         }
>>                         drmModeFreeProperty(props);
>>                 }
>>         }
>> 
>> Examining some variables:
>> 
>>     (gdb) p i
>>     $7 = 0
>> 
>>     (gdb) p koutput
>>     $8 = (struct _drmModeConnector *) 0x0
>
> Looks like the nouveau driver needs something like
>
> https://cgit.freedesktop.org/xorg/driver/xf86-video-amdgpu/commit/?id=f4107f67f147e2500582fc36cf0f0f76bc1ef098

Sam, could you please test the attached patch?

TIA,
    Sven

>From f3ba56e9adf8ed96642b70ec5cf50234a98ab23b Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Wed, 6 Jun 2018 19:43:31 +0200
Subject: [PATCH] Check for NULL koutput in drmmode_output_dpms

---
 src/drmmode_display.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2b71c9c4..9900674c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -918,6 +918,9 @@ drmmode_output_dpms(xf86OutputPtr output, int mode)
 	drmmode_ptr drmmode = drmmode_output->drmmode;
 	int mode_id = -1, i;
 
+	if (!koutput)
+		return;
+
 	for (i = 0; i < koutput->count_props; i++) {
 		props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
 		if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
-- 
2.17.1

Reply via email to