pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/50067: x11/xf86-video-ati dports patch-src_radeon__kms.c for newer DragonFly and FreeBSD



>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 +0000 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     xxxxx@:/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.000000000 +0000
+++ 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
 radeon_dirty_update(ScreenPtr screen)
 {
 	RegionPtr region;
-	PixmapDirtyUpdatePtr ent;
+	PixmapDirtyUpdatePtr ent = NULL;
 
 	if (xorg_list_is_empty(&screen->pixmap_dirty_list))
 		return;
@@ -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
 
 #ifdef XF86_PDEV_SERVER_FD
     if (pRADEONEnt->platform_dev) {
@@ -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,



Home | Main Index | Thread Index | Old Index