Bug 25938

Summary: black screen on the iMac powerpc using nouveau
Product: xorg Reporter: Andrea Tacconi <tacconet>
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: PowerPC   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
some logs from xorg and dmesg
none
dmesg TV-1 on
none
dmesg tv1 off
none
patch bzip2
none
patch bzip2 none

Description Andrea Tacconi 2010-01-07 06:11:15 UTC
Created attachment 32501 [details]
some logs from xorg and dmesg

The screen remains black when nouveau drivers are enabled, both the X server and console.
Wrong TV-out detection, there is no cable attached but is recognized TV output.
On my Imac there is only mini-VGA connector that can function as a VGA output or TV output.
Comment 1 Andrea Tacconi 2010-01-13 02:45:19 UTC
Created attachment 32608 [details]
dmesg TV-1 on

dmesg TV-1 on.
Wrong load detection and framebuffer console resolution switch to 720x576
Comment 2 Andrea Tacconi 2010-01-13 02:46:49 UTC
the problem of black screen seems to be resolved adding the following patch:
Adding nv18 card identifier to Powerbook specific quirks
in nouveau kernel module:
diff nouveau_bios.c.old nouveau_bios.c
3199c3199
<       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||
(dev->pci_device & 0xffff) == 0x0329))
---
> 	if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||(dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329))

same as in xorg driver:

diff nv_bios.c.old nv_bios.c
2592c2592
<       if (script == LVDS_RESET && ((pNv->Chipset & 0xffff) == 0x0179 ||
(pNv->Chipset & 0xffff) == 0x0329))
---
> 	if (script == LVDS_RESET && ((pNv->Chipset & 0xffff) == 0x0179 ||(pNv->Chipset & 0xffff) == 0x0189 || (pNv->Chipset & 0xffff) == 0x0329))

Now both framebuffer console and Xorg work.

But there is another problem with TV-out:
When turned on the TV output is in contrast with the LVDS output and set the
screen resolution of 720x576 on the console framebuffer.
Comment 3 Andrea Tacconi 2010-01-13 02:50:54 UTC
Created attachment 32609 [details]
dmesg tv1 off

When TV-1 output was off, the screen resolution of framebuffer console was 1024x768 an the system works fine
Comment 4 Andrea Tacconi 2010-01-13 03:05:55 UTC
From apple documentation:

http://developer.apple.com/legacy/mac/library/documentation/Hardware/Developer_Notes/Macintosh_CPUs-G4/iMac_Sep03/03_Input-Output/q26bc_inout.html#//apple_ref/doc/uid/TP40000875-CH207-DontLinkElementID_14

Video Monitor Port

The iMac computer has a port for an external video monitor and supports video mirroring mode. Video mirroring mode displays the same information on both monitors, enabling the control of a presentation on one display, while allowing an audience to watch the presentation on a second display or projector.

Due to display mirroring, the external monitor could have black borders during mirroring, depending on the supported timings between the two displays and on the monitor’s selection algotithm. Both displays show full-sized images only when the display resolution for the second monitor is set to the first display’s native resolution: 1440x900 on the 17-inch display and 1024x768 on the 15-inch display.

The external monitor supports user-selectable display sizes up to 1600x1200 at 75 Hz.

Monitor Connector

The video display connector is a 14-pin rectangular connector, Hosiden TCX3143, or compatible. The connector accepts either a VGA adapter or a composite adapter. The system requires a composite adapter to use composite output over this connector. The connector pins are identified in Table 3-3.

Figure 3-3  Video display connector
Video display connector

The pins and signals are listed in Table 3-8. An adapter is available for use with monitors with VGA 15-pin miniature D-type connectors.
Table 3-8  Video signals for a VGA R-G-B display

Pin    Signal name
1      Ground
2      VSync
3      Hsync
4      Red return
5      Red video
6      Green return
7      Green video
8      +5 volts
9      Blue video
10     DDC data
11     DDC clock
12     Ground
13     /Cable detect
14     Blue return

The cable detect function on pin 13 is implemented by connecting pin 13 to ground in the display cable. The computer gathers the display's capabilities by reading its EDID (Extended Display Identification Data) via DDC.

The video display connector is compliant with the VESA specification.
Video Display Adapter

The iMac computer detects the type of display adapter that is plugged in and programs the graphics IC to route the appropriate video signals to the connector. The signal assignments on the video connector when the composite adapter is attached are shown in Table 3-9.
Table 3-9  Video signals for a TV display

Pin	Signal name
1       Ground
2       n.c.
3       n.c.
4       Ground
5       S-video C
6       Ground
7       S-video Y
8       +5 volts
9       Composite video
10      DDC data
11      DDC clock
12      Ground
13      Ground (for /Cable Detect)
14      Ground

Composite video and S-video signals can be displayed on either an NTSC display or a PAL display. When a display is connected by way of the composite adapter, the computer detects this configuration and enables the composite and S-video outputs. The settings for the resolutions and standards (NTSC or PAL) are then selectable in System Preferences.
Comment 5 Francisco Jerez 2010-01-13 06:50:31 UTC
(In reply to comment #2)
> the problem of black screen seems to be resolved adding the following patch:
> Adding nv18 card identifier to Powerbook specific quirks
> in nouveau kernel module:
> diff nouveau_bios.c.old nouveau_bios.c
> 3199c3199
> <       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||
> (dev->pci_device & 0xffff) == 0x0329))
> ---
> >       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||(dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329))
> 

Would you mind sending a properly formatted, Signed-off-by patch with this to the ML? (You might want to read Documentation/SubmittingPatches in the kernel tree first).

> same as in xorg driver:
> 
> diff nv_bios.c.old nv_bios.c
> 2592c2592
> <       if (script == LVDS_RESET && ((pNv->Chipset & 0xffff) == 0x0179 ||
> (pNv->Chipset & 0xffff) == 0x0329))
> ---
> >       if (script == LVDS_RESET && ((pNv->Chipset & 0xffff) == 0x0179 ||(pNv->Chipset & 0xffff) == 0x0189 || (pNv->Chipset & 0xffff) == 0x0329))
> 

No need to do this anymore, this code has just been nuked.

> Now both framebuffer console and Xorg work.
> 
> But there is another problem with TV-out:
> When turned on the TV output is in contrast with the LVDS output and set the
> screen resolution of 720x576 on the console framebuffer.
> 

These integrated apple connectors aren't really supported yet, an mmiotrace from the blob would be useful (See [1] or the docs in the kernel tree for instructions).

[1] http://nouveau.freedesktop.org/wiki/MmioTrace
Comment 6 Andrea Tacconi 2010-01-14 01:51:42 UTC
From: Andrea Tacconi <tacconet@libero.it>

Subject: [PATCH] drm/nouveau: add NV18 device id to call_lvds_manufacturer_script 

This fixes imac black screen (NV18 card)  

Signed-off-by: Andrea Tacconi <tacconet@libero.it>
---
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index ba14397..e24f2a8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -3196,7 +3196,7 @@ static int call_lvds_manufacturer_script(struct drm_device *dev, struct dcb_entr
 	}
 #ifdef __powerpc__
 	/* Powerbook specific quirks */
-	if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff) == 0x0329))
+	if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329))
 		nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
 	if ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329) {
 		if (script == LVDS_PANEL_ON) {
Comment 7 Francisco Jerez 2010-01-14 06:13:11 UTC
(In reply to comment #6)
> From: Andrea Tacconi <tacconet@libero.it>
> 
> Subject: [PATCH] drm/nouveau: add NV18 device id to
> call_lvds_manufacturer_script 
> 
> This fixes imac black screen (NV18 card)  
> 
> Signed-off-by: Andrea Tacconi <tacconet@libero.it>
> ---
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c
> b/drivers/gpu/drm/nouveau/nouveau_bios.c
> index ba14397..e24f2a8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bios.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
> @@ -3196,7 +3196,7 @@ static int call_lvds_manufacturer_script(struct
> drm_device *dev, struct dcb_entr
>         }
>  #ifdef __powerpc__
>         /* Powerbook specific quirks */
> -       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||
> (dev->pci_device & 0xffff) == 0x0329))
> +       if (script == LVDS_RESET && ((dev->pci_device & 0xffff) == 0x0179 ||
> (dev->pci_device & 0xffff) == 0x0189 || (dev->pci_device & 0xffff) == 0x0329))
>                 nv_write_tmds(dev, dcbent->or, 0, 0x02, 0x72);
>         if ((dev->pci_device & 0xffff) == 0x0179 || (dev->pci_device & 0xffff)
> == 0x0189 || (dev->pci_device & 0xffff) == 0x0329) {
>                 if (script == LVDS_PANEL_ON) {
> 

Thanks, pushed, but please, next time you send a patch use the mailing list, bugzilla adds some gratuitous line breaks and I had to do it manually.
Comment 8 Andrea Tacconi 2010-01-15 00:55:14 UTC
Created attachment 32652 [details] [review]
patch bzip2

(In reply to comment #7)
> 
> Thanks, pushed, but please, next time you send a patch use the mailing list,
> bugzilla adds some gratuitous line breaks and I had to do it manually.
> 

I'm Sorry but I didn't know this.
Comment 9 Andrea Tacconi 2010-01-15 00:58:36 UTC
Created attachment 32653 [details]
patch bzip2

damn another mistake...
Comment 10 Marcin Slusarz 2011-03-07 10:48:17 UTC
Patch was commited, so I'm closing this bug report as FIXED.

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.