NetBSD Problem Report #47828
From www@NetBSD.org Fri May 17 16:26:17 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 2415C63F465
for <gnats-bugs@gnats.NetBSD.org>; Fri, 17 May 2013 16:26:17 +0000 (UTC)
Message-Id: <20130517162616.80AB363F465@www.NetBSD.org>
Date: Fri, 17 May 2013 16:26:16 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: sysutils/libpciaccess 0.13.1 incompatible with xorg-server 1.12.4?
X-Send-Pr-Version: www-1.0
>Number: 47828
>Category: pkg
>Synopsis: sysutils/libpciaccess 0.13.1 incompatible with xorg-server 1.12.4?
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 17 16:30:00 +0000 2013
>Closed-Date: Sat Jun 22 20:51:23 +0000 2013
>Last-Modified: Sat Jun 22 20:51:23 +0000 2013
>Originator: David Shao
>Release: NetBSD 6.99.19 amd64
>Organization:
>Environment:
NetBSD 6.99.19 amd64
>Description:
Using NetBSD 6.99.19 amd64 on an Intel-processor machine with a Sapphire Radeon HD 4550 graphics card,
X11_TYPE=modular
set in /etc/mk.conf
upgrading to the latest pkgsrc results in an inability to start the X-server with problems similar to those described in:
http://www.freebsd.org/cgi/query-pr.cgi?pr=169875
It would appear at least part of the patch described in
https://bugs.freedesktop.org/show_bug.cgi?id=63583
has been incorporated into a different file for sysutils/libpciaccess 0.13.1.
An additional question is what is the goal of this set of upgrades to xorg? Many of the operating systems using pkgsrc including NetBSD 6.99.19 do not appear to support KMS kernel modesetting for even older common cards such as the Radeon 4xxx series. Is the expectation that these systems should all run the xorg xf86 vesa driver?
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Fri, 17 May 2013 16:10:44 -0700
The following patch to sysutils/libpciaccess from
https://bugs.freedesktop.org/attachment.cgi?id=78130
has been verified to at least get a DragonFly 3.5-DEVELOPMENT x86_64
machine, with an msi Radeon R4350 graphics card, to use the
xf86-video-vesa driver with KDE 4.10.2. In addition I switched to
using moused instead of usbd to get the mouse working.
It appears that someone will either have to develop a similar patch
for NetBSD for vesa or implement KMS kernel modesetting to use the
hardware accelerated ati driver for similar graphics cards.
diff --git a/sysutils/libpciaccess/distinfo b/sysutils/libpciaccess/distinfo
index 2bb05aa..ca38e5d 100644
--- a/sysutils/libpciaccess/distinfo
+++ b/sysutils/libpciaccess/distinfo
@@ -9,6 +9,7 @@ SHA1 (patch-scanpci_Makefile.am) =
086fead04b4a2e506a35aca5d5fe82395708e90c
SHA1 (patch-scanpci_scanpci.c) = 795d0572af9afb13af60f878f9f44d40edb33463
SHA1 (patch-src_common__bridge.c) = 658815c38b4f2e318bf083bc81b9042f88d04b2f
SHA1 (patch-src_common__init.c) = 2e866fbb6278e84dfa295f55a9f30563489ae12d
+SHA1 (patch-src_freebsd__pci.c) = 477fb98f33f93b79f54d085a21d45f50a0f14eca
SHA1 (patch-src_pciaccess__private.h) =
56853598f50e5656ff7ba190b31f2940d66ec468
SHA1 (patch-src_solx__devfs.c) = 924649d561bc9922b6ee8335ffe5e997b1cb8c3c
SHA1 (patch-src_x86__pci.c) = b9820f8ff9306c18d040444e57270f520f95a58f
diff --git a/sysutils/libpciaccess/patches/patch-src_freebsd__pci.c
b/sysutils/libpciaccess/patches/patch-src_freebsd__pci.c
new file mode 100644
index 0000000..06c9cfb
--- /dev/null
+++ b/sysutils/libpciaccess/patches/patch-src_freebsd__pci.c
@@ -0,0 +1,172 @@
+$NetBSD$
+
+--- src/freebsd_pci.c.orig 2013-05-17 21:55:52.935930000 +0000
++++ src/freebsd_pci.c
+@@ -1,6 +1,8 @@
+ /*
+ * (C) Copyright Eric Anholt 2006
+ * (C) Copyright IBM Corporation 2006
++ * (C) Copyright Mark Kettenis 2011
++ * (C) Copyright Robert Millan 2012
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+@@ -561,6 +563,139 @@ pci_system_freebsd_destroy(void)
+ freebsd_pci_sys = NULL;
+ }
+
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++#include <machine/cpufunc.h>
++#endif
++
++static struct pci_io_handle *
++pci_device_freebsd_open_legacy_io(struct pci_io_handle *ret,
++ struct pci_device *dev, pciaddr_t base, pciaddr_t size)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ ret->fd = open("/dev/io", O_RDWR | O_CLOEXEC);
++
++ if (ret->fd < 0)
++ return NULL;
++
++ ret->base = base;
++ ret->size = size;
++ return ret;
++#elif defined(PCI_MAGIC_IO_RANGE)
++ ret->memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
++ aperturefd, PCI_MAGIC_IO_RANGE + base);
++ if (ret->memory == MAP_FAILED)
++ return NULL;
++
++ ret->base = base;
++ ret->size = size;
++ return ret;
++#else
++ return NULL;
++#endif
++}
++
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++static void
++pci_device_freebsd_close_io(struct pci_device *dev, struct
pci_io_handle *handle)
++{
++ if (handle->fd > -1)
++ close(handle->fd);
++}
++#endif
++
++static uint32_t
++pci_device_freebsd_read32(struct pci_io_handle *handle, uint32_t reg)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ return inl(handle->base + reg);
++#else
++ return *(uint32_t *)((uintptr_t)handle->memory + reg);
++#endif
++}
++
++static uint16_t
++pci_device_freebsd_read16(struct pci_io_handle *handle, uint32_t reg)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ return inw(handle->base + reg);
++#else
++ return *(uint16_t *)((uintptr_t)handle->memory + reg);
++#endif
++}
++
++static uint8_t
++pci_device_freebsd_read8(struct pci_io_handle *handle, uint32_t reg)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ return inb(handle->base + reg);
++#else
++ return *(uint8_t *)((uintptr_t)handle->memory + reg);
++#endif
++}
++
++static void
++pci_device_freebsd_write32(struct pci_io_handle *handle, uint32_t reg,
++ uint32_t data)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ outl(handle->base + reg, data);
++#else
++ *(uint16_t *)((uintptr_t)handle->memory + reg) = data;
++#endif
++}
++
++static void
++pci_device_freebsd_write16(struct pci_io_handle *handle, uint32_t reg,
++ uint16_t data)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ outw(handle->base + reg, data);
++#else
++ *(uint8_t *)((uintptr_t)handle->memory + reg) = data;
++#endif
++}
++
++static void
++pci_device_freebsd_write8(struct pci_io_handle *handle, uint32_t reg,
++ uint8_t data)
++{
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ outb(handle->base + reg, data);
++#else
++ *(uint32_t *)((uintptr_t)handle->memory + reg) = data;
++#endif
++}
++
++static int
++pci_device_freebsd_map_legacy(struct pci_device *dev, pciaddr_t base,
++ pciaddr_t size, unsigned map_flags, void **addr)
++{
++ struct pci_device_mapping map;
++ int err;
++
++ map.base = base;
++ map.size = size;
++ map.flags = map_flags;
++ map.memory = NULL;
++ err = pci_device_freebsd_map_range(dev, &map);
++ *addr = map.memory;
++
++ return err;
++}
++
++static int
++pci_device_freebsd_unmap_legacy(struct pci_device *dev, void *addr,
++ pciaddr_t size)
++{
++ struct pci_device_mapping map;
++
++ map.memory = addr;
++ map.size = size;
++ map.flags = 0;
++ return pci_device_freebsd_unmap_range(dev, &map);
++}
++
++
+ static const struct pci_system_methods freebsd_pci_methods = {
+ .destroy = pci_system_freebsd_destroy,
+ .destroy_device = NULL, /* nothing to do for this */
+@@ -571,6 +706,18 @@ static const struct pci_system_methods f
+ .read = pci_device_freebsd_read,
+ .write = pci_device_freebsd_write,
+ .fill_capabilities = pci_fill_capabilities_generic,
++ .open_legacy_io = pci_device_freebsd_open_legacy_io,
++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
++ .close_io = pci_device_freebsd_close_io,
++#endif
++ .read32 = pci_device_freebsd_read32,
++ .read16 = pci_device_freebsd_read16,
++ .read8 = pci_device_freebsd_read8,
++ .write32 = pci_device_freebsd_write32,
++ .write16 = pci_device_freebsd_write16,
++ .write8 = pci_device_freebsd_write8,
++ .map_legacy = pci_device_freebsd_map_legacy,
++ .unmap_legacy = pci_device_freebsd_unmap_legacy,
+ };
+
+ /**
State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 18 May 2013 13:47:02 +0000
State-Changed-Why:
Unmangled the patch from GNATS and applied it. Let me know if I broke it
on the way.
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47828 CVS commit: pkgsrc/sysutils/libpciaccess
Date: Sat, 18 May 2013 13:46:36 +0000
Module Name: pkgsrc
Committed By: wiz
Date: Sat May 18 13:46:35 UTC 2013
Modified Files:
pkgsrc/sysutils/libpciaccess: Makefile distinfo
Added Files:
pkgsrc/sysutils/libpciaccess/patches: patch-src_freebsd__pci.c
Log Message:
Fix Dragonfly with Radeon 4350. From
https://bugs.freedesktop.org/attachment.cgi?id=78130
via David Shao in PR 47828.
Bump PKGREVISION.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 pkgsrc/sysutils/libpciaccess/Makefile
cvs rdiff -u -r1.18 -r1.19 pkgsrc/sysutils/libpciaccess/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/sysutils/libpciaccess/patches/patch-src_freebsd__pci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Sat, 18 May 2013 13:59:05 -0700
The applied fixes continue successful building of
sysutils/libpciaccess 0.13.1 on both DragonFly 3.5-DEVELOPMENT i386
and x86_64, and in addition allow successful use of the latest modular
xorg server using the x86-video-vesa driver. Thanks!
The decision that needs to be made however is on the NetBSD side.
libpciaccess builds, but it would appear from earlier testing that at
this moment the x86-video-vesa driver is not functional for NetBSD
6.99.19 amd64. Of course NetBSD has the better option of simply using
the native xsrc instead of setting the X11_TYPE to be modular. As the
x86-video-vesa driver is the fallback for all sorts of graphics cards
that do not have KMS kernel modesetting support, in effect pkgsrc
X11_TYPE=modular
support is being dropped for NetBSD and perhaps other operating
systems if there is neither KMS support in the kernel nor patches to
libpciaccess for legacy IO.
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Sat, 1 Jun 2013 23:15:23 +0000
not sent to gnats.
------
From: Richard PALO <richard.palo@baou.fr>
To: pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Sun, 19 May 2013 08:07:05 +0200
As already asked above, if ati (radeon) doesn't work for you, the
radeonhd could be an alternative:
> radeonhd is an Xorg driver for AMD GPG (ATI) R5xx/R6xx/R7xx
> based video cards.
>
> At the time of this writing, radeonhd has the following lim-
> itations:
>
> o Support for hardware-based 2D acceleration and Xvideo
> needs more testing on R6xx and R7xx based cards.
>
> o No TV and Component connector support so far.
>
> o After using the fglrx driver, radeonhd might fail to work
> properly. This combination is not and probably will never
> be supported. A reboot fixes problems in most cases,
> sometimes a powercycle is necessary. Unloading the kernel
> module is typically not enough.
>
From: Thomas Klausner <wiz@NetBSD.org>
To: David Shao <davshao@gmail.com>
Cc: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Wed, 12 Jun 2013 13:52:57 +0200
I'm syncing libpciaccess with upstream and noted a difference:
> ++#if defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
All these lines in upstream (and the URL
https://bugs.freedesktop.org/attachment.cgi?id=78130 which you cited
in the bug report) are just:
> +#if defined(__i386__) || defined(__amd64__)
Is the additional '|| defined(__x86_64__)' needed for DragonFly?
Thomas
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Wed, 12 Jun 2013 05:23:52 -0700
>
> Is the additional '|| defined(__x86_64__)' needed for DragonFly?
> Thomas
I do not know for certain, but I get:
$ uname -a
DragonFly 3.5-DEVELOPMENT DragonFly v3.5.0.23171.gbff059-DEVELOPMENT
#46: Tue Jun 11 08:37:52 PDT 2013
username@:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
whereas for the same architecture, I believe FreeBSD uses amd64.
Furthermore, a grep of pkgsrc reveals multiple examples of use of
__x86_64__ in patches.
From: Thomas Klausner <wiz@NetBSD.org>
To: David Shao <davshao@gmail.com>
Cc: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Wed, 12 Jun 2013 14:33:42 +0200
On Wed, Jun 12, 2013 at 12:25:01PM +0000, David Shao wrote:
> The following reply was made to PR pkg/47828; it has been noted by GNATS.
>
> From: David Shao <davshao@gmail.com>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
> xorg-server 1.12.4?
> Date: Wed, 12 Jun 2013 05:23:52 -0700
>
> >
> > Is the additional '|| defined(__x86_64__)' needed for DragonFly?
> > Thomas
>
> I do not know for certain, but I get:
>
> $ uname -a
> DragonFly 3.5-DEVELOPMENT DragonFly v3.5.0.23171.gbff059-DEVELOPMENT
> #46: Tue Jun 11 08:37:52 PDT 2013
> username@:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
>
> whereas for the same architecture, I believe FreeBSD uses amd64.
> Furthermore, a grep of pkgsrc reveals multiple examples of use of
> __x86_64__ in patches.
Well, does it work if you remove them? :)
Where did you get them from, since they weren't in the original patch?
Thomas
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Wed, 12 Jun 2013 11:48:39 -0700
I recompiled as much as I could on an x86_64 machine without the
__x86_64__ checks and the system still is able to function using
x11/x86-video-vesa as its driver. Therefore apparently the patch for
FreeBSD to libpciaccess apparently already committed should also work
for DragonFly without change.
https://bugs.freedesktop.org/show_bug.cgi?id=63583
The dragonflybsd server for its master src started updating again, so
I was able to recompile world through
http://lists.dragonflybsd.org/pipermail/commits/2013-June/130210.html
"git: Remove MACHINE_ARCH=amd64 and legacy make instructions from makefiles"
I had been worried that there wouldn't be a __amd64__ defined, but
apparently it is.
I removed the checks for definition of __x86_64__ in
sysutils/libpciaccess/patches/patch-src_freebsd__pci.c, replaced
libpciaccess, libdrm, MesaLib, modular-xorg-server, and and
x86-video-vesa, and was still able to fire up xorg in xfce4.
Thanks for checking!
From: Thomas Klausner <wiz@NetBSD.org>
To: David Shao <davshao@gmail.com>
Cc: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Wed, 12 Jun 2013 22:02:54 +0200
On Wed, Jun 12, 2013 at 06:50:00PM +0000, David Shao wrote:
> I recompiled as much as I could on an x86_64 machine without the
> __x86_64__ checks and the system still is able to function using
> x11/x86-video-vesa as its driver. Therefore apparently the patch for
> FreeBSD to libpciaccess apparently already committed should also work
> for DragonFly without change.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=63583
>
> The dragonflybsd server for its master src started updating again, so
> I was able to recompile world through
>
> http://lists.dragonflybsd.org/pipermail/commits/2013-June/130210.html
>
> "git: Remove MACHINE_ARCH=amd64 and legacy make instructions from makefiles"
>
> I had been worried that there wouldn't be a __amd64__ defined, but
> apparently it is.
>
> I removed the checks for definition of __x86_64__ in
> sysutils/libpciaccess/patches/patch-src_freebsd__pci.c, replaced
> libpciaccess, libdrm, MesaLib, modular-xorg-server, and and
> x86-video-vesa, and was still able to fire up xorg in xfce4.
>
> Thanks for checking!
So I'll leave the patch alone for now but we don't need to feed the
additional changes upstream. Good to know.
Thanks for testing!
Thomas
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/47828: sysutils/libpciaccess 0.13.1 incompatible with
xorg-server 1.12.4?
Date: Sat, 22 Jun 2013 10:22:48 -0700
I am now able to run the modular-xorg-server X11_TYPE=modular using
the xf86-video-vesa driver on a NetBSD 6.99.22 amd64 machine. The
machine has an AMD processor, Asus M5A87 motherboard, and a Radeon
4350 type graphics card. As whatever legacy pci support now appears
to work, at least to get the vesa driver going, for both DragonFly
3.5-DEVELOPMENT i386 and x86_64 and for some machine running NetBSD
6.99.22 amd64, the problem from my perspective would appear to have
been solved. Thanks!
State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 22 Jun 2013 20:51:23 +0000
State-Changed-Why:
Problem solved for submitter.
Thanks for the feedback!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.