From 6e5bffcde1c9f14f2348556bccb9c1a9d557c7b7 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Thu, 1 Aug 2024 15:31:01 +0200 Subject: [PATCH] x11-drivers/xf86-video-mga: Restore port This hardware is still present on server hardware. Sponsored by: Beckhoff Automation GmbH & Co. KG PR: 270509 --- x11-drivers/Makefile | 1 + x11-drivers/xf86-video-mga/Makefile | 16 ++++++++++++++ x11-drivers/xf86-video-mga/distinfo | 3 +++ .../files/patch-src_mga__dac3026.c | 15 +++++++++++++ .../xf86-video-mga/files/patch-src_mga__dri.c | 22 +++++++++++++++++++ .../files/patch-src_mga__driver.c | 19 ++++++++++++++++ x11-drivers/xf86-video-mga/pkg-descr | 1 + x11-drivers/xf86-video-mga/pkg-plist | 2 ++ 8 files changed, 79 insertions(+) create mode 100644 x11-drivers/xf86-video-mga/Makefile create mode 100644 x11-drivers/xf86-video-mga/distinfo create mode 100644 x11-drivers/xf86-video-mga/files/patch-src_mga__dac3026.c create mode 100644 x11-drivers/xf86-video-mga/files/patch-src_mga__dri.c create mode 100644 x11-drivers/xf86-video-mga/files/patch-src_mga__driver.c create mode 100644 x11-drivers/xf86-video-mga/pkg-descr create mode 100644 x11-drivers/xf86-video-mga/pkg-plist diff --git a/x11-drivers/Makefile b/x11-drivers/Makefile index 688416d9f60a..a3c59c418859 100644 --- a/x11-drivers/Makefile +++ b/x11-drivers/Makefile @@ -16,6 +16,7 @@ SUBDIR += xf86-video-ati SUBDIR += xf86-video-dummy SUBDIR += xf86-video-intel + SUBDIR += xf86-video-mga SUBDIR += xf86-video-nv SUBDIR += xf86-video-qxl SUBDIR += xf86-video-scfb diff --git a/x11-drivers/xf86-video-mga/Makefile b/x11-drivers/xf86-video-mga/Makefile new file mode 100644 index 000000000000..8999babe9e91 --- /dev/null +++ b/x11-drivers/xf86-video-mga/Makefile @@ -0,0 +1,16 @@ +PORTNAME= xf86-video-mga +PORTVERSION= 2.0.0 +PORTREVISION= 5 +PORTEPOCH= 3 +CATEGORIES= x11-drivers + +MAINTAINER= x11@FreeBSD.org +COMMENT= X.Org mga display driver +WWW= https://www.x.org/ + +USES= gl xorg-cat:driver +USE_GL= gl + +GNU_CONFIGURE_MANPREFIX=${PREFIX}/share + +.include diff --git a/x11-drivers/xf86-video-mga/distinfo b/x11-drivers/xf86-video-mga/distinfo new file mode 100644 index 000000000000..ddc579a06475 --- /dev/null +++ b/x11-drivers/xf86-video-mga/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1546479273 +SHA256 (xorg/driver/xf86-video-mga-2.0.0.tar.bz2) = 268946e1a13e9d80e4f724a0740df9e6e8c8bad37697fcbf456924e9fdbb5d79 +SIZE (xorg/driver/xf86-video-mga-2.0.0.tar.bz2) = 452486 diff --git a/x11-drivers/xf86-video-mga/files/patch-src_mga__dac3026.c b/x11-drivers/xf86-video-mga/files/patch-src_mga__dac3026.c new file mode 100644 index 000000000000..4a225c085a78 --- /dev/null +++ b/x11-drivers/xf86-video-mga/files/patch-src_mga__dac3026.c @@ -0,0 +1,15 @@ +# Fix a style warning +# +--- src/mga_dac3026.c.orig 2017-01-17 22:40:29 UTC ++++ src/mga_dac3026.c +@@ -886,8 +886,8 @@ MGA3026LoadCursorImage( + outTi3026dreg(TVP3026_WADR_PAL, 0x00); + + while(i--) { +- while (INREG8(0x1FDA) & 0x01); +- while (!(INREG8(0x1FDA) & 0x01)); ++ while (INREG8(0x1FDA) & 0x01) {} ++ while (!(INREG8(0x1FDA) & 0x01)) {} + outTi3026dreg(TVP3026_CUR_RAM, *(src++)); + } + } diff --git a/x11-drivers/xf86-video-mga/files/patch-src_mga__dri.c b/x11-drivers/xf86-video-mga/files/patch-src_mga__dri.c new file mode 100644 index 000000000000..1c4114bc5920 --- /dev/null +++ b/x11-drivers/xf86-video-mga/files/patch-src_mga__dri.c @@ -0,0 +1,22 @@ +# Use the correct constants for this type +# +--- src/mga_dri.c.orig 2017-01-17 22:40:29 UTC ++++ src/mga_dri.c +@@ -316,7 +316,7 @@ static void MGAWaitForIdleDMA( ScrnInfoP + for (;;) { + do { + /* first ask for quiescent and flush */ +- lock.flags = DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH; ++ lock.flags = _DRM_LOCK_QUIESCENT | _DRM_LOCK_FLUSH; + do { + ret = drmCommandWrite( pMga->drmFD, DRM_MGA_FLUSH, + &lock, sizeof( drm_lock_t ) ); +@@ -324,7 +324,7 @@ static void MGAWaitForIdleDMA( ScrnInfoP + + /* if it's still busy just try quiescent */ + if ( ret == -EBUSY ) { +- lock.flags = DRM_LOCK_QUIESCENT; ++ lock.flags = _DRM_LOCK_QUIESCENT; + do { + ret = drmCommandWrite( pMga->drmFD, DRM_MGA_FLUSH, + &lock, sizeof( drm_lock_t ) ); diff --git a/x11-drivers/xf86-video-mga/files/patch-src_mga__driver.c b/x11-drivers/xf86-video-mga/files/patch-src_mga__driver.c new file mode 100644 index 000000000000..7f54cb869b32 --- /dev/null +++ b/x11-drivers/xf86-video-mga/files/patch-src_mga__driver.c @@ -0,0 +1,19 @@ +--- src/mga_driver.c.orig 2024-08-01 13:23:52 UTC ++++ src/mga_driver.c +@@ -702,6 +702,8 @@ MGAPciProbe(DriverPtr drv, int entity_num, struct pci_ + ScrnInfoPtr pScrn = NULL; + MGAPtr pMga; + ++#ifndef __FreeBSD__ ++ /* FreeBSD always has vgapci driver attached. */ + if (pci_device_has_kernel_driver(dev)) { + /* If it's a G200 server chip, it's probably on KMS, so bail; if not, + * it might be using matroxfb, which is ok. */ +@@ -721,6 +723,7 @@ MGAPciProbe(DriverPtr drv, int entity_num, struct pci_ + return FALSE; + } + } ++#endif + + /* Allocate a ScrnInfoRec and claim the slot */ + pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, MGAPciChipsets, diff --git a/x11-drivers/xf86-video-mga/pkg-descr b/x11-drivers/xf86-video-mga/pkg-descr new file mode 100644 index 000000000000..6eb856b4abf9 --- /dev/null +++ b/x11-drivers/xf86-video-mga/pkg-descr @@ -0,0 +1 @@ +This package contains the X.Org xf86-video-mga driver. diff --git a/x11-drivers/xf86-video-mga/pkg-plist b/x11-drivers/xf86-video-mga/pkg-plist new file mode 100644 index 000000000000..f75700697c98 --- /dev/null +++ b/x11-drivers/xf86-video-mga/pkg-plist @@ -0,0 +1,2 @@ +lib/xorg/modules/drivers/mga_drv.so +share/man/man4/mga.4x.gz