[patch] drm-stable-kmod on i386
Johannes Lundberg
johalun0 at gmail.com
Wed Oct 24 17:56:51 UTC 2018
On Sat, Oct 20, 2018 at 20:29 Tijl Coosemans <tijl at freebsd.org> wrote:
> Hi,
>
> Attached are two patches, one for base and one for ports, that make
> graphics/drm-stable-kmod mostly working on i386. I tested on an old
> laptop from 2004 with ATI Radeon 9600 AGP (RV350) (dmesg below). Two
> issues remain:
>
> 1) [drm:radeon_device_init] Unable to find PCI I/O BAR
>
> In the base system radeon_device_init allocates this BAR. In
> drm-stable-kmod this code is missing. The linux code is there but
> ifdef'ed out. This doesn't seem to affect my device, but looking at
> the code it may be needed by slightly less older hardware.
Hi
The driver falls back to using MMIO which is clarified in logs in newer drm
driver version. ioread/iowrite functions in linuxkpi only supports mmio at
this time.
>
> 2) [drm:radeon_vga_detect] VGA-1: probed a monitor but no|invalid EDID
>
> The driver seems to think a monitor is connected to the VGA port and keeps
> probing it. Sometimes this causes the lcd (LVDS) to flicker. Another
> side effect appears to be that X creates a wide virtual screen with size
> 2304x800 according to xrandr while the lcd size is 1280x800.
>
>
> drm-i386-base.patch:
>
> Add readq to sys/compat/linuxkpi/common/include/linux/io.h (like readl and
> similar functions). This function is used in the i915 driver. The amd64
> build currently picks up the definition in sys/amd64/include/cpufunc.h.
> On i386 cpufunc.h doesn't define readq because there's no 64 bit load
> instruction. Linux doesn't define readq on i386 either and if readq
> isn't defined drm_os_linux.h defines it as (readl(addr)|read(addr+4)<<32).
> This isn't atomic of course and I think the order in which both words are
> read by the cpu isn't guaranteed either. A comment in the i915 code
> indicates the developers are aware of that.
>
> So, I defined it as (*(volatile uint64_t *)addr). This is ok for drm but
> this is a generic linuxkpi header so I'm not sure this patch is correct.
> I think it would be better to define readq in this header only for amd64
> (and as a macro instead of a function), and then, if undefined, define it
> in drm_os_freebsd.h as (*(volatile uint64_t *)addr).
>
> It would be nice to sort this out before the 12.0 release.
>
>
> drm-i386-ports.patch:
>
> port Makefile:
> Allow building on i386 but comment out the amdgpu driver which is only
> built on amd64.
>
> patch-drm-drm_bufs.c:
> Use ai_aperture_size correctly. The Linux AGP aper_size is in MiB, while
> the FreeBSD AGP ai_aperture_size is in bytes, so one can't simply replace
> aper_size with ai_aperture_size.
> Also fix a compiler error about incompatible pointer types.
>
> patch-drm-drm_os_config.h:
> Only define COMPAT_FREEBSD32 on amd64.
>
> patch-drm-drm_pci.c:
> Use ai_aperture_size correctly.
> Tell the VM system that addresses in the AGP aperture are valid. The
> base system drm2 code does this in radeon_device_init, but
> drm_pci_agp_init looks like a better place.
>
> patch-i915-i915_gem.c:
> Incompatible pointer type fixes.
>
> patch-linuxkpi-gplv2-include-asm-processor.h:
> Hide redefinitions of mb, wmb and rmb. The compiler didn't complain on
> amd64 because these definitions are exactly the same as the ones in
> machine/atomic.h, but that's not the case on i386.
>
> patch-linuxkpi-gplv2-src-linux_notifier.c:
> Incompatible pointer type fix.
>
> patch-linuxkpi-gplv2-src-linux_page.c:
> The i386 code in this file needs <sys/sf_buf.h>.
>
> patch-radeon-radeon_agp.c:
> Use ai_aperture_size correctly.
>
>
> xrandr:
> Screen 0: minimum 320 x 200, current 2304 x 800, maximum 4096 x 4096
> LVDS connected 1280x800+0+0 (normal left inverted right x axis y axis) 0mm
> x 0mm
> 1280x800 59.97*+
> 1280x720 59.86
> 1152x768 59.78
> 1024x768 59.92
> 800x600 59.86
> 848x480 59.66
> 720x480 59.71
> 640x480 59.38
> VGA-0 disconnected 1024x768+1280+0 (normal left inverted right x axis y
> axis) 0mm x 0mm
> S-video disconnected (normal left inverted right x axis y axis)
> 1024x768 (0x5d) 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
>
>
> dmesg:
> [drm] Initialized
> [drm] radeon kernel modesetting enabled.
> drmn0: <drmn> on vgapci0
> vgapci0: child drmn0 requested pci_enable_io
> vgapci0: child drmn0 requested pci_enable_io
> [drm] initializing kernel modesetting (RV350 0x1002:0x4E50 0x1043:0x1772
> 0x00).
> [drm] register mmio base: 0xFF8F0000
> [drm] register mmio size: 65536
> [drm:radeon_device_init] Unable to find PCI I/O BAR
> drmn0: GTT: 256M 0xE0000000 - 0xEFFFFFFF
> [drm] Generation 2 PCI interface, using max accessible memory
> drmn0: VRAM: 128M 0x00000000D0000000 - 0x00000000D7FFFFFF (64M used)
> [drm] Detected VRAM RAM=128M, BAR=128M
> [drm] RAM width 128bits DDR
> Zone kernel: Available graphics memory: 517482 kiB
> [TTM] Initializing pool allocator
> [drm] radeon: 64M of VRAM memory ready
> [drm] radeon: 256M of GTT memory ready.
> [drm] radeon: 1 quad pipes, 1 Z pipes initialized.
> drmn0: WB disabled
> drmn0: fence driver on ring 0 use gpu addr 0x00000000e0000000 and cpu addr
> 0x0x13d96000
> [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> [drm] Driver supports precise vblank timestamp query.
> [drm] radeon: irq initialized.
> [drm] Loading R300 Microcode
> radeon/R300_cp.bin: could not load firmware image, error 2
> radeon/R300_cp.bin: could not load firmware image, error 2
> [drm] radeon: ring at 0x00000000E0001000
> [drm] ring test succeeded in 1 usecs
> [drm] ib test succeeded in 0 usecs
> [drm] hw_i2c forced on, you may experience display detection problems!
> [drm] Connector VGA-1: get mode from tunables:
> [drm] - kern.vt.fb.modes.VGA-1
> [drm] - kern.vt.fb.default_mode
> [drm] Panel ID String: Samsung LTN154X1 WXGA
> [drm] Panel Size 1280x800
> [drm] Connector LVDS-1: get mode from tunables:
> [drm] - kern.vt.fb.modes.LVDS-1
> [drm] - kern.vt.fb.default_mode
> [drm] Connector SVIDEO-1: get mode from tunables:
> [drm] - kern.vt.fb.modes.SVIDEO-1
> [drm] - kern.vt.fb.default_mode
> [drm] Radeon Display Connectors
> [drm] Connector 0:
> [drm] VGA-1
> [drm] DDC: 0x60 0x60 0x60 0x60 0x60 0x60 0x60 0x60
> [drm] Encoders:
> [drm] CRT1: INTERNAL_DAC1
> [drm] Connector 1:
> [drm] LVDS-1
> [drm] Encoders:
> [drm] LCD1: INTERNAL_LVDS
> [drm] Connector 2:
> [drm] SVIDEO-1
> [drm] Encoders:
> [drm] TV1: INTERNAL_DAC2
> [drm] fb mappable at 0xD0040000
> [drm] vram apper at 0xD0000000
> [drm] size 4096000
> [drm] fb depth is 24
> [drm] pitch is 5120
> VT: Replacing driver "vga" with new "fb".
> start FB_INFO:
> type=11 height=800 width=1280 depth=32
> cmsize=16 size=4096000
> pbase=0xd0040000 vbase=0x6814000
> name=drmn0 flags=0x0 stride=5120 bpp=32
> cmap[0]=0 cmap[1]=7f0000 cmap[2]=7f00 cmap[3]=c4a000
> end FB_INFO
> drmn0: fb0: radeondrmfb frame buffer device
> [drm] Initialized radeon 2.48.0 20080528 for drmn on minor 0
> Raw EDID:
> ff ff ff bf ff ff ff fd ff ff ff ff ff ef ff ff
> ff ff ff ff ff ff ff fd ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff fb ff ff ff ff ff df ff ff
> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bf
> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> bf ff ff ff ff ff ff ff ff ff ef ff ff ff ff ff
> [drm:drm_edid_block_valid] EDID checksum is invalid, remainder is 189
> Raw EDID:
> 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff fd
> ff ff ff ff ff ff ff ff fe ff ff ff ff ff f7 ff
> ff ff ff ff bf ff ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff f7 ff ff ff ff ff bf ff ff
> ff fd ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff bf ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff ff a1 ff ff 7f ff ef ff ff
> ff ff ff ff ff ff ff ff fd ff ff ff ff ff ff ff
> Raw EDID:
> ff ff 7f ff ff ff fb ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff ff ff ff ff 7f ff ff ff fb
> ff ff ff ff ff df ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff 7f ff ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff ff ff df ff ff ff fe ff ff ff ff a1
> ff ff 7f ff ff ff ff ff ff ff ff ff df ff ff ff
> fe ff ff ff ff ff f7 ff ff ff ff ff ff ff ff fb
> ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff ff
> [drm:drm_edid_block_valid] EDID checksum is invalid, remainder is 15
> Raw EDID:
> 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> fe ff ff ff ff ff ff ff ff ff ff ff bf ff ff ff
> ff ff ff ff ff df ff ff ff ff ff ff ff ff ff ff
> ff ff ff ff 7f ff ff ff a1 ff ff ff ff ff ff ff
> ff ff ff ff ff ff ff ff ff ff 7f ff ff ff fb ff
> ff ff ff ff ff ff ff ff ff ff ff ff ff ef ff ff
> ff ff ff ff ff ff ff ff ff ff ff ff ff df ff ff
> ff ff ff ff ff ff ff ff ff ff ff ff 7f ff ff ff
> drmn0: VGA-1: EDID block 0 invalid.
> [drm:radeon_vga_detect] VGA-1: probed a monitor but no|invalid EDID
> [drm:radeon_vga_detect] VGA-1: probed a monitor but no|invalid EDID
> [drm:radeon_vga_detect] VGA-1: probed a monitor but no|invalid EDID
> _______________________________________________
> freebsd-x11 at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-x11
> To unsubscribe, send any mail to "freebsd-x11-unsubscribe at freebsd.org"
>
More information about the freebsd-x11
mailing list