Bug 16221

Summary: 2.6.35-rc2-git5 -- [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
Product: Drivers Reporter: Maciej Rutecki (maciej.rutecki)
Component: Video(DRI - Intel)Assignee: drivers_video-dri-intel (drivers_video-dri-intel)
Status: CLOSED CODE_FIX    
Severity: normal CC: David, florian, jonathan.dray, maciej.rutecki, miles.lane, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35-rc2-git5 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16055    
Attachments: patch to load the fbcon
typo fix to the last patch

Description Maciej Rutecki 2010-06-15 20:28:23 UTC
Subject    : 2.6.35-rc2-git5 -- [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
Submitter  : Miles Lane <miles.lane@gmail.com>
Date       : 2010-06-11 20:31
Message-ID : AANLkTim0jVRyqkwlGOcrg_XTvUQwcBYfWJX-aRzkkrLG@mail.gmail.com
References : http://marc.info/?l=linux-kernel&m=127628828119623&w=2

This entry is being used for tracking a regression from 2.6.34.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 David Fries 2010-08-05 00:48:30 UTC
Fails for radeon when CONFIG_FB=m.  Bad as in most of bootup uses VGA text, then it goes black when switching to the frame buffer until X comes up.  Switch to console and the mouse cursor vanishes and the rest of X buffer is unchanged, no text login prompt obviously.
So, how do I disable the frame buffer code?  CONFIG_FB is forced to at least =m.  It's slow as in takes 13 times as long to display a bunch of text, and now doesn't even work.

Later when I switch from the console frame buffer to X I get the following message.
[drm:drm_mode_getfb] *ERROR* invalid framebuffer id

CONFIG_FB=y works with 2.6.35.

[drm] Initialized drm 1.1.0 20060810
[drm] radeon kernel modesetting enabled.
radeon 0000:01:05.0: power state changed by ACPI to D0
radeon 0000:01:05.0: power state changed by ACPI to D0
radeon 0000:01:05.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[drm] initializing kernel modesetting (RS480 0x1002:0x5975).
[drm] register mmio base: 0xC0100000
[drm] register mmio size: 65536
[drm:rs400_gart_adjust_size] *ERROR* Forcing to 32M GART size (because of ASIC bug ?)
[drm] Generation 2 PCI interface, using max accessible memory
radeon 0000:01:05.0: VRAM: 128M 0x78000000 - 0x7FFFFFFF (128M used)
radeon 0000:01:05.0: GTT: 32M 0x80000000 - 0x81FFFFFF
[drm] radeon: irq initialized.
[drm] Detected VRAM RAM=128M, BAR=128M
[drm] RAM width 128bits DDR
[TTM] Zone  kernel: Available graphics memory: 963794 kiB.
[TTM] Initializing pool allocator.
[drm] radeon: 128M of VRAM memory ready
[drm] radeon: 32M of GTT memory ready.
[drm] GART: num cpu pages 8192, num gpu pages 8192
[drm] radeon: 1 quad pipes, 1 z pipes initialized.
[drm] Loading R300 Microcode
[drm] radeon: ring at 0x0000000080000000
[drm] ring test succeeded in 1 usecs
[drm] radeon: ib pool ready.
[drm] ib test succeeded in 0 usecs
[drm] Default TV standard: NTSC
[drm] 14.318180000 MHz TV ref clk
[drm] Panel ID String: AUO                     
[drm] Panel Size 1280x800
[drm] Radeon Display Connectors
[drm] Connector 0:
[drm]   VGA
[drm]   DDC: 0x68 0x68 0x68 0x68 0x68 0x68 0x68 0x68
[drm]   Encoders:
[drm]     CRT1: INTERNAL_DAC2
[drm] Connector 1:
[drm]   LVDS
[drm]   DDC: 0x198 0x198 0x19c 0x19c 0x1a0 0x1a0 0x1a4 0x1a4
[drm]   Encoders:
[drm]     LCD1: INTERNAL_LVDS
[drm] radeon: power management initialized
[drm] fb mappable at 0xC8040000
[drm] vram apper at 0xC8000000
[drm] size 4096000
[drm] fb depth is 24
[drm]    pitch is 5120
fb0: radeondrmfb frame buffer device
drm: registered panic notifier
Slow work thread pool: Starting up
Slow work thread pool: Ready
[drm] Initialized radeon 2.5.0 20080528 for 0000:01:05.0 on minor 0
Comment 2 Jonathan Dray 2010-08-15 20:23:02 UTC
I have the same issue with a dell studio XPS 1645 and a 1GB ATI® Radeon™ HD 4670 graphics card. I have a black screen on boot since 2.6.34 kernel version.
I enabled the "kms by default" kernel option and also have CONFIG_FB set to module. 

I just tried with a 2.6.35.2 kernel and the situation is unchanged.
I'm going to switch CONFIG_FB=m to CONFIG_FB=y and report if it changes the screen's state at boot time.

An extract of the dmesg output : 


[    6.466734] radeon 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    6.466742] radeon 0000:02:00.0: setting latency timer to 64
[    6.468721] [drm] initializing kernel modesetting (RV730 0x1002:0x9488).
[    6.468894] [drm] register mmio base: 0xCFEF0000
[    6.468895] [drm] register mmio size: 65536
[    6.469057] ATOM BIOS: BR036993
[    6.469068] [drm] Clocks initialized !
[    6.469079] radeon 0000:02:00.0: VRAM: 1024M 0x00000000 - 0x3FFFFFFF (1024M used)
[    6.469082] radeon 0000:02:00.0: GTT: 512M 0x40000000 - 0x5FFFFFFF
[    6.471886] [drm] Detected VRAM RAM=1024M, BAR=256M
[    6.471888] [drm] RAM width 128bits DDR
[    6.471932] [TTM] Zone  kernel: Available graphics memory: 2024612 kiB.
[    6.471934] [TTM] Initializing pool allocator.
[    6.471952] [drm] radeon: 1024M of VRAM memory ready
[    6.471954] [drm] radeon: 512M of GTT memory ready.
[    6.471997]   alloc irq_desc for 55 on node -1
[    6.471999]   alloc kstat_irqs on node -1
[    6.472009] radeon 0000:02:00.0: irq 55 for MSI/MSI-X
[    6.472015] [drm] radeon: using MSI.
[    6.472050] [drm] radeon: irq initialized.
[    6.472053] [drm] GART: num cpu pages 131072, num gpu pages 131072
[    6.472712] [drm] Loading RV730 Microcode
[    6.590784] [drm] ring test succeeded in 1 usecs
[    6.590962] [drm] radeon: ib pool ready.
[    6.591107] [drm] ib test succeeded in 0 usecs
[    6.591110] [drm] Enabling audio support
[    6.591140] [drm] Default TV standard: NTSC
[    6.591449] [drm] Radeon Display Connectors
    6.591450] [drm] Connector 0:
[    6.591451] [drm]   VGA
[    6.591453] [drm]   DDC: 0x7fa0 0x7fa0 0x7fa4 0x7fa4 0x7fa8 0x7fa8 0x7fac 0x7fac
[    6.591454] [drm]   Encoders:
[    6.591455] [drm]     CRT1: INTERNAL_KLDSCP_DAC1
[    6.591456] [drm] Connector 1:
[    6.591457] [drm]   HDMI-A
[    6.591458] [drm]   HPD1
[    6.591459] [drm]   DDC: 0x7e40 0x7e40 0x7e44 0x7e44 0x7e48 0x7e48 0x7e4c 0x7e4c
[    6.591461] [drm]   Encoders:
[    6.591461] [drm]     DFP1: INTERNAL_UNIPHY
[    6.591462] [drm] Connector 2:
[    6.591463] [drm]   LVDS
[    6.591465] [drm]   DDC: 0x7f10 0x7f10 0x7f14 0x7f14 0x7f18 0x7f18 0x7f1c 0x7f1c
[    6.591466] [drm]   Encoders:
[    6.591467] [drm]     LCD1: INTERNAL_UNIPHY2
[    6.591468] [drm] Connector 3:
[    6.591469] [drm]   DisplayPort
[    6.591469] [drm]   HPD2
[    6.591471] [drm]   DDC: 0x7e50 0x7e50 0x7e54 0x7e54 0x7e58 0x7e58 0x7e5c 0x7e5c
[    6.591472] [drm]   Encoders:
[    6.591473] [drm]     DFP2: INTERNAL_UNIPHY
[    6.728546] [drm] Internal thermal controller with fan control
[    6.728565] [drm] radeon: power management initialized
[    7.209760] [drm] fb mappable at 0xD0141000
[    7.209764] [drm] vram apper at 0xD0000000
[    7.209766] [drm] size 5763072
[    7.209768] [drm] fb depth is 24
[    7.209771] [drm]    pitch is 6400
[    7.209844] fb0: radeondrmfb frame buffer device
[    7.209847] drm: registered panic notifier
[    7.209851] Slow work thread pool: Starting up
[    7.210027] Slow work thread pool: Ready
[    7.210035] [drm] Initialized radeon 2.5.0 20080528 for 0000:02:00.0 on minor 0

...
[   16.517353] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   20.619932] [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
[   56.326812] hda-intel: IRQ timing workaround is activated for card #1. Suggest a bigger bdl_pos_adj.
Comment 3 Jonathan Dray 2010-08-16 00:22:35 UTC
I reconfigured the kernel with option CONFIG_FB=y and recompiled.
The newly installed kernel still have the bug and a black screen is diplayed at boot time.

The [drm:drm_mode_getfb] *ERROR* invalid framebuffer id error message is still there.

I need help on this one.
Comment 4 David Fries 2010-08-16 01:58:56 UTC
Comparing my output when it fails and when it works I'm seeing,
-fails
+works
 [drm] fb depth is 24
 [drm]    pitch is 5120
+Console: switching to colour frame buffer device 160x50
 fb0: radeondrmfb frame buffer device
 drm: registered panic notifier
 Slow work thread pool: Starting up
 Slow work thread pool: Ready
 [drm] Initialized radeon 2.5.0 20080528 for 0000:01:05.0 on minor 0
...
-[drm:drm_mode_getfb] *ERROR* invalid framebuffer id

Looking at your (failing) output, you are missing the Console line as
well.  For a sanity check make sure this is empty, `lsmod |grep fb`.
Can you post your kernel configuration, or at least "Graphics support",
through "Console display driver support" sections?

Did 2.6.33 work, and was it using the frame buffer, or was it using
VGA text for console?  I was assuming something in Debian changed to
enable the graphics console, so I don't think I ever tried making the
framebuffer a module before 3.6.35, so I don't know how far back I
would need to go to find a good kernel to bisect.

Here's what I'm running with on 2.6.35.

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
# CONFIG_AGP_INTEL is not set
# CONFIG_AGP_SIS is not set
# CONFIG_AGP_VIA is not set
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=2
CONFIG_VGA_SWITCHEROO=y
CONFIG_DRM=m
CONFIG_DRM_KMS_HELPER=m
CONFIG_DRM_TTM=m
# CONFIG_DRM_TDFX is not set
# CONFIG_DRM_R128 is not set
CONFIG_DRM_RADEON=m
# CONFIG_DRM_RADEON_KMS is not set
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_SIS is not set
# CONFIG_DRM_VIA is not set
# CONFIG_DRM_SAVAGE is not set
CONFIG_VGASTATE=m
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
CONFIG_FB=y
CONFIG_FIRMWARE_EDID=y
CONFIG_FB_DDC=m
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=m
CONFIG_FB_SYS_COPYAREA=m
CONFIG_FB_SYS_IMAGEBLIT=m
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYS_FOPS=m
# CONFIG_FB_SVGALIB is not set
# CONFIG_FB_MACMODES is not set
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y

#
# Frame buffer hardware drivers
#
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
CONFIG_FB_VGA16=m
# CONFIG_FB_UVESA is not set
CONFIG_FB_VESA=y
# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_LE80578 is not set
# CONFIG_FB_MATROX is not set
CONFIG_FB_RADEON=m
CONFIG_FB_RADEON_I2C=y
CONFIG_FB_RADEON_BACKLIGHT=y
# CONFIG_FB_RADEON_DEBUG is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_VIA is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_GEODE is not set
CONFIG_FB_VIRTUAL=m
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
# CONFIG_FB_BROADSHEET is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=m
CONFIG_LCD_PLATFORM=m
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_GENERIC is not set
# CONFIG_BACKLIGHT_PROGEAR is not set
# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
# CONFIG_BACKLIGHT_SAHARA is not set
# CONFIG_BACKLIGHT_ADP8860 is not set

#
# Display device support
#
CONFIG_DISPLAY_SUPPORT=m

#
# Display hardware drivers
#

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
# CONFIG_LOGO is not set
CONFIG_SOUND=m
Comment 5 Jonathan Dray 2010-08-17 22:08:31 UTC
I made a few kernel configuration tests and I finally got the init output displayed. It was the CONFIG_FRAMEBUFFER_CONSOLE option that was set to "module". Switching it to "yes" resolved my issue.

I don't think it is the Debian kernel configuration default value for that option. I must have changed it when I configured my kernel.

I think this have something to do with the early initialisation of the radeon KMS. When the initram is loaded at boot time, the console framebuffer module was not loaded because it is not included in the default module list.

Can someone confirm this please ?

Thanks for your help.
Comment 6 Florian Mickler 2010-09-07 06:31:05 UTC
If you enable kernel mode setting, the graphics card switches away from "VGA Textmode" into Graphics-Mode. Thus normal text-mode (also known as "vga console") can't be displayed any more and the kernel needs to use a special framebuffer-device to take over rendering of the text-characters into the scan-out-area of the graphics card.

For this to work CONFIG_FRAMEBUFFER_CONSOLE and CONFIG_FB has to be enabled. 

As soon as those 2 are loaded the kernel can display the console again. 

Does someone in here still has problems?  If so, please post your .config. 

I'm closing this, please reopen if your issue is not solved by enabling the frame buffer console in your .config or if you think there is a Bug/Something that needs to be addressed. 

Thx,
Flo
Comment 7 David Fries 2010-09-09 03:43:22 UTC
CONFIG_FRAMEBUFFER_CONSOLE=m
CONFIG_FB=m
CONFIG_FB_RADEON=m

Fail.  Something is loading the radeon module on boot, it looks like
when that happens the screen goes black until X starts.  I expect the
radeon driver is being loaded based on the PCI id.

In the kernel configuration, radeon requires fbcon to be compiled, but
the radeon module doesn't depend on fbcon, so it isn't loaded.  If I
manually load fbcon, console starts working again (tested with
2.6.36-rc2+).  I'll call the bug that when radeon loads it takes the
system from a working text console to a non-working console.

I think either radeon should not depend on the framebuffer console,
and leave the system in a usable VGA text console mode (my preference
since VGA text displays 13 times faster), or the radeon module needs to
depend on on fbcon so fbcon gets loaded and moves the system from a
working VGA text console to a working frame buffer console.

In the kernel configuration,
DRM_RADEON requires DRM_KMS_HELPER
DRM_KMS_HELPER requires FRAMEBUFFER_CONSOLE
Comment 8 Florian Mickler 2010-09-09 04:54:25 UTC
Make sure the CONFIG_FB_RADEON doesn't get loaded. I don't know if it is handled gracefully nowadays, but in the early days of kernel modes setting that would clash. (CONFIG_FB_RADEON is the old Framebuffer driver which should be deactivated as the new KMS radeon driver substitutes for it, providing a framebuffer device itself.)

Other from that, I'm not exactly sure why the display goes black. 


I'm reopening the bugreport until this is resolved. There probably is also a way to tell the radeon driver to not switch the mode. Perhaps via the video= kernel commandline?
Comment 9 Rafael J. Wysocki 2010-09-12 18:50:53 UTC
Notify-Also :  David Fries <David@Fries.net>
Comment 10 David Fries 2010-12-11 21:16:11 UTC
Created attachment 39872 [details]
patch to load the fbcon

This solves compiling CONFIG_FB=m and being left with a blank screen
because the radeon module is automatically loaded, but fbcon isn't.
If radeon had to be manually loaded, then it would be the user's fault for
not loading fbcon as well, but as radeon is being loaded automatically,
there isn't much a user can do from console to even fix it.  More bug
details from here,
https://bugzilla.kernel.org/show_bug.cgi?id=16221

Does this look like a reasonable solution?  Should it bother checking
find_module first?
Comment 11 Florian Mickler 2010-12-12 16:56:09 UTC
hi, david!

+	const char *namue = "fbcon";
You typoed an u in there..?

Maybe you should also post that patch to lkml and the drm mailinglist for comments and review?  I'm not shure the relevant people notice it here in this bugzilla. 

(I think this is a reasonable idea. Not shure what the drawbacks are.)
Comment 12 David Fries 2010-12-12 18:39:43 UTC
Created attachment 39942 [details]
typo fix to the last patch

My goof, thanks for pointing that out.  I checked it really, then ran checkpatch.pl before submitting and broke it...  Here's the correction that I compiled and booted into.
The distribution list was,
To: linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org
Comment 13 Florian Mickler 2011-03-30 22:40:41 UTC
Got this resolved somehow?
Comment 14 David Fries 2011-03-31 02:11:06 UTC
Well, what do you know, it's in.  Thanks, for querying, I hadn't looked until you asked.

commit 3ce05168907c9b1358492a73badb0ff1603fb81d
Author: David Fries <david@fries.net>  2010-12-12 12:39:22
Committer: Dave Airlie <airlied@redhat.com>  2010-12-20 21:00:04
Precedes: v2.6.38-rc1
Comment 15 Florian Mickler 2011-03-31 07:39:52 UTC
Cool.