Re: FreeBSD/DragonFly patches for xf86-video-ati, xf86-input-mouse, and xf86-video-intel

2015-08-16 Thread Peter Hutterer
On Mon, Jul 27, 2015 at 01:20:29AM +0200, Thomas Klausner wrote:
 Hi!
 
 David Shao reported some issues against pkgsrc, providing build/run
 fixes for xorg software on DragonFly BSD and FreeBSD.
 
 However, I'd like to avoid having pkgsrc-only patches. So I'm
 wondering what your opinions are on getting (versions of) these
 patches included.
 
 He says that the patches are basically from FreeBSD ports.
 Do we have a FreeBSD committer on this mailing list?
 
 The patches are for xf86-video-ati (first one), xf86-input-mouse
 (second), and xf86-video-intel (last).

please send the xf86-input-mouse patches as proper git patches to the list,
dropping all the PKGSRC comments etc. they don't belong in the upstream
repo.

few more comments below



 - Forwarded message from davs...@gmail.com -
 
 Date: Mon, 20 Jul 2015 04:45:00 + (UTC)
 From: davs...@gmail.com
 To: pkg-mana...@netbsd.org, gnats-ad...@netbsd.org, pkgsrc-b...@netbsd.org
 Cc: 
 Subject: pkg/50068: x11/xf86-input-mouse dports patches for DragonFly and 
 FreeBSD
 Mail-Reply-To: davs...@gmail.com
 
 Number: 50068
 Category:   pkg
 Synopsis:   x11/xf86-input-mouse dports patches for DragonFly and FreeBSD
 Confidential:   no
 Severity:   non-critical
 Priority:   low
 Responsible:pkg-manager
 State:  open
 Class:  sw-bug
 Submitter-Id:   net
 Arrival-Date:   Mon Jul 20 04:45:00 + 2015
 Originator: David Shao
 Release:pkgsrc current cvs
 Organization:
 Environment:
 DragonFly  4.3-DEVELOPMENT DragonFly v4.2.2.63.ga2b9b7-DEVELOPMENT #1: Sun 
 Jul 19 19:22:57 PDT 2015 x@:/usr/obj/usr/src/sys/X86_64_GENERIC  
 x86_64
 
 Description:
 Patches from DragonFly dports to x11/xf86-input-mouse are needed for 
 DragonFly and FreeBSD to use a USB mouse in newer Xorg.  (There is a 
 workaround for DragonFly using moused called from /etc/rc.conf, but I can't 
 get that workaround to succeed on FreeBSD 10.1.  Also the DragonFly rc.conf 
 invocation of moused has been unreliable for use with pkgsrc in the past.)
 
 There are some complications.  A new options.mk file seems to require 3 new 
 options just to distinguish between three possible include paths for the usb 
 header file depending on the OS.  (This problem applies to other ports.  It 
 is fortunate that sysutils/hal is being phased out.)  Unfortunately older 
 DragonFly, newer DragonFly, and FreeBSD have three different possible paths.  
 Also one of the patches is gigantic.  Apart from trying to understand such a 
 large patch, it is quite possible I have made mistakes merging the patch from 
 dports.
 
 I have tried to enclose all of the new code in ifdefs on symbol FREEBSD_USB, 
 and supplanted code in !defined(FREEBSD_USB) blocks.  The functionality 
 should be completely unaffected on non-DragonFly and non-FreeBSD platforms.
 
 The patch itself ask why some of the logic for detecting OS and OS version 
 isn't performed by patching configure scripts, but offers no such solution.  
 How-To-Repeat:
 
 Fix:
 A small patch to Makefile for the new options.mk:
 
 --- Makefile.orig 2015-07-18 18:48:26.0 -0700
 +++ Makefile  2015-07-18 22:40:51.0 -0700
 @@ -20,6 +20,8 @@
  CONFIGURE_ENV+=  DRIVER_MAN_SUFFIX=4
  .endif
  
 +.include options.mk
 +
  .include ../../x11/randrproto/buildlink3.mk
  .include ../../x11/inputproto/buildlink3.mk
  .include ../../x11/kbproto/buildlink3.mk
 
 The new options.mk:
 
 PKG_OPTIONS_VAR=PKG_OPTIONS.xf86-input-mouse
 # dflyu4b is for DragonFly BSD newer USB stack, ported from newer FreeBSD
 # #include bus/u4b/usb.h
 # dflyusb is for DragonFly BSD older USB stack, OS version  300703
 # #include bus/usb/usb.h
 # fbsdusb is for FreeBSD USB stack 
 # #include dev/usb/usb.h
 PKG_SUPPORTED_OPTIONS= dflyu4b dflyusb fbsdusb 
 PKG_SUGGESTED_OPTIONS=
 
 .if ${OPSYS} == DragonFly
 .if !empty(OS_VERSION:M[0-2].*) || !empty(OS_VERSION:M3.0*)
 PKG_SUGGESTED_OPTIONS+= dflyusb 
 .else
 # Assume Dragonfly 3.1 - 3.6 users built U4B stack
 # 3.8 and after U4B is the default
 PKG_SUGGESTED_OPTIONS+= dflyu4b 
 .endif
 .endif
 
 .if ${OPSYS} == FreeBSD
 PKG_SUGGESTED_OPTIONS+= fbsdusb
 .endif
 
 .include ../../mk/bsd.options.mk
 
 .if !empty(PKG_OPTIONS:Mdflyu4b) || !empty(PKG_OPTIONS:Mdflyusb) || 
 !empty(PKG_OPTIONS:Mfbsdusb)
 CPPFLAGS+=-DFREEBSD_USB
 .endif
 
 .if !empty(PKG_OPTIONS:Mdflyu4b)
 CPPFLAGS+=-DDRAGONFLY_U4B
 .endif
 
 .if !empty(PKG_OPTIONS:Mdflyusb)
 CPPFLAGS+=-DDRAGONFLY_USB
 .endif
 
 .if !empty(PKG_OPTIONS:Mdflyu4b) || !empty(PKG_OPTIONS:Mdflyusb) || 
 !empty(PKG_OPTIONS:Mfbsdusb)
 SUBST_CLASSES+= freebsdusb 
 SUBST_STAGE.freebsdusb=   post-extract
 SUBST_MESSAGE.freebsdusb= Patching src/Makefile.in for DragonFly or 
 FreeBSD compatible USB 
 SUBST_FILES.freebsdusb+=  src/Makefile.in
 SUBST_SED.freebsdusb+=-e 's|-module -avoid-version|-module 
 -avoid-version -lusbhid|'
 .endif
 
 The patch to 

Re: FreeBSD/DragonFly patches for xf86-video-ati, xf86-input-mouse, and xf86-video-intel

2015-08-12 Thread Michel Dänzer

Some comments on the xf86-video-ati patch below. Please send
xf86-video-ati patches with a proper Git commit log, generated by git
format-patch, to the xorg-driver-...@lists.x.org list.


On 27.07.2015 08:20, Thomas Klausner wrote:
 @@ -280,7 +286,7 @@ static void
  radeon_dirty_update(ScreenPtr screen)
  {
   RegionPtr region;
 - PixmapDirtyUpdatePtr ent;
 + PixmapDirtyUpdatePtr ent = NULL;
  
   if (xorg_list_is_empty(screen-pixmap_dirty_list))
   return;

This hunk should be in a separate patch.


 @@ -589,7 +595,11 @@ static int radeon_get_drm_master_fd(Scrn
  #endif
  struct pci_device *dev = info-PciInfo;
  char *busid;
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
 defined(__DragonFly__)
 +int fd, err;
 +#else
  int fd;
 +#endif

If err really needs to be added (see below), just add

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__)
int err;
#endif


 @@ -608,6 +618,17 @@ static int radeon_get_drm_master_fd(Scrn
 dev-domain, dev-bus, dev-dev, dev-func);
  #endif
  
 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
 defined(__DragonFly__)
 +err = kldload(radeonkms);
 +if (err == -1  errno != EEXIST) {
 +xf86DrvMsg(pScrn-scrnIndex, X_ERROR,
 + [drm] Failed to load kernel module for %s: %s\n,
 + busid, strerror(errno));
 +free(busid);
 +return -1;
 +}
 +#endif
 +
  fd = drmOpen(NULL, busid);
  if (fd == -1)
   xf86DrvMsg(pScrn-scrnIndex, X_ERROR,

Couldn't this either pass the kernel module name as the first parameter
to drmOpen(), or use xf86LoadKernelModule()?


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

FreeBSD/DragonFly patches for xf86-video-ati, xf86-input-mouse, and xf86-video-intel

2015-07-26 Thread Thomas Klausner
Hi!

David Shao reported some issues against pkgsrc, providing build/run
fixes for xorg software on DragonFly BSD and FreeBSD.

However, I'd like to avoid having pkgsrc-only patches. So I'm
wondering what your opinions are on getting (versions of) these
patches included.

He says that the patches are basically from FreeBSD ports.
Do we have a FreeBSD committer on this mailing list?

The patches are for xf86-video-ati (first one), xf86-input-mouse
(second), and xf86-video-intel (last).

Cheers,
 Thomas

(two FreeBSD X.org team members from https://wiki.freebsd.org/Graphics added to 
cc)

- Forwarded message from davs...@gmail.com -

Date: Mon, 20 Jul 2015 04:05:00 + (UTC)
From: davs...@gmail.com
To: pkg-mana...@netbsd.org, gnats-ad...@netbsd.org, pkgsrc-b...@netbsd.org
Cc: 
Subject: pkg/50067: x11/xf86-video-ati dports patch-src_radeon__kms.c for newer 
DragonFly and FreeBSD
Mail-Reply-To: davs...@gmail.com

Number: 50067
Category:   pkg
Synopsis:   x11/xf86-video-ati dports patch-src_radeon__kms.c for newer 
DragonFly and FreeBSD
Confidential:   no
Severity:   non-critical
Priority:   low
Responsible:pkg-manager
State:  open
Class:  sw-bug
Submitter-Id:   net
Arrival-Date:   Mon Jul 20 04:05:00 + 2015
Originator: David Shao
Release:pkgsrc current cvs
Organization:
Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.2.2.63.ga2b9b7-DEVELOPMENT #1: Sun Jul 
19 19:22:57 PDT 2015 x@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
Description:
x11/xf86-video-ati can be patched using a patch from DragonFly dports so that 
KMS and other capabilities from newer DragonFly and FreeBSD Oses can be 
activated.  Unlike say NetBSD or OpenBSD, for DragonFly and FreeBSD the Radeon 
drm kernel modules are not necessarily loaded before Xorg is started using say 
startx.  

The following patch is from DragonFly dports master as of commit 
4f04bfe0ea83ce09 ..., 
file x11-drivers/xf86-video-ati/files/patch-src__radeon_kms.c:

It has been tested on DragonFly 4.3-DEVELOPMENT x86_64 and FreeBSD 10.1 release 
amd64, using openbox and a patched xf86-input-mouse.  It also at least compiled 
and built successfully on NetBSD 6.99.20 amd64 X11_type=modular, and should 
have no affect on it.  The result for DragonFly and FreeBSD is the desired 
activation, as can be seen from Xorg.0.log:

[61.049] (II) [KMS] Kernel modesetting enabled.
...
[63.244] (II) RADEON(0): KMS Color Tiling: enabled
[63.244] (II) RADEON(0): KMS Color Tiling 2D: enabled
[63.244] (II) RADEON(0): KMS Pageflipping: enabled
[63.244] (II) RADEON(0): SwapBuffers wait for vsync: enabled
[63.319] (II) RADEON(0): Output VGA-0 has no monitor section
[63.319] (II) RADEON(0): Output HDMI-0 has no monitor section
[63.326] (II) RADEON(0): Output DVI-0 has no monitor section
[63.400] (II) RADEON(0): EDID for output VGA-0
[63.400] (II) RADEON(0): Manufacturer: VSC  Model: d427  Serial#: 16843009
[63.400] (II) RADEON(0): Year: 2010  Week: 44
...
[63.425] (II) RADEON(0): [DRI2] Setup complete
[63.425] (II) RADEON(0): [DRI2]   DRI driver: r600
[63.425] (II) RADEON(0): [DRI2]   VDPAU driver: r600
[63.425] (II) RADEON(0): Front buffer size: 5120K
[63.425] (II) RADEON(0): VRAM usage limit set to 462384K
[63.440] (==) RADEON(0): Backing store enabled
[63.440] (II) RADEON(0): Direct rendering enabled
[63.440] (II) EXA(0): Driver allocated offscreen pixmaps
[63.440] (II) EXA(0): Driver registered support for the following 
operations:
[63.440] (II) Solid
[63.440] (II) Copy
[63.440] (II) Composite (RENDER acceleration)
[63.440] (II) UploadToScreen
[63.440] (II) DownloadFromScreen
[63.440] (II) RADEON(0): Acceleration enabled
[63.441] (==) RADEON(0): DPMS enabled
...
[63.444] (--) RandR disabled
[63.833] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[63.833] (II) AIGLX: enabled GLX_ARB_create_context
[63.833] (II) AIGLX: enabled GLX_ARB_create_context_profile
[63.833] (II) AIGLX: enabled GLX_EXT_create_context_es2_profile
[63.833] (II) AIGLX: enabled GLX_INTEL_swap_event
[63.833] (II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
[63.833] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[63.833] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[63.833] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[63.834] (II) AIGLX: Loaded and initialized r600






How-To-Repeat:

Fix:
The following is the patch:

$NetBSD$

--- src/radeon_kms.c.orig   2014-10-02 03:31:27.0 +
+++ src/radeon_kms.c
@@ -30,6 +30,12 @@
 
 #include errno.h
 #include sys/ioctl.h
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__)
+#include sys/param.h
+#include sys/linker.h
+#endif
+
 /* Driver data structures */
 #include radeon.h
 #include radeon_reg.h
@@ -280,7 +286,7 @@ static void