user/xf86-video-fbdev-rm: new aport

This commit is contained in:
Antoine Martin 2023-05-17 02:47:03 -04:00 committed by Antoine Martin
parent 470e476872
commit 5182055bca
3 changed files with 185 additions and 0 deletions

View file

@ -0,0 +1,40 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xf86-video-fbdev-rm
pkgver=0.5.0
pkgrel=0
pkgdesc="Video driver for framebuffer device with rM patches"
url="https://www.x.org"
arch="all"
license="MIT"
subpackages="$pkgname-doc"
provides="xf86-video-fbdev=$pkgver-r$pkgrel"
makedepends="xorg-server-dev libxi-dev util-macros xorgproto linux-rm-headers"
builddir="$srcdir"/xf86-video-fbdev-$pkgver
source="
https://www.x.org/releases/individual/driver/xf86-video-fbdev-$pkgver.tar.bz2
epdc_auto-update-patch.patch
fix-build.patch
"
build() {
export LDFLAGS="$LDFLAGS -Wl,-z,lazy"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr
make
}
check() {
make check
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
c1217b943bbe3301b3c2a8649ed1004c3c67b02607bd56bbc14f6dfa05e7f0184332c81a6a19595514745501ed88526aee932e555779b7c3a8233646b0979448 xf86-video-fbdev-0.5.0.tar.bz2
d57ac5c8454da9a3af7379226ee7d124c04fd710b15a818a4845e55f3b96462450acb791acd07cfffdf6f2a28deef30ae1b8a656f85eb412fa019102bf2efce0 epdc_auto-update-patch.patch
19c6680d8e8b0ba3903fb76438b54f294a1715b93d50e1cb2ef95bb04770add5fdad1df4260ab7eb00bb26578baa79b7cfed3f7fa6cba70348611cc3797af3ee fix-build.patch
"

View file

@ -0,0 +1,128 @@
diff --git a/src/fbdev.c.orig b/src/fbdev.c
index f25ef72..46b3c8c 100644
--- a/src/fbdev.c.orig
+++ b/src/fbdev.c
@@ -8,6 +8,8 @@
#endif
#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/mxcfb.h>
/* all driver need this */
#include "xf86.h"
@@ -18,6 +20,7 @@
#include "colormapst.h"
#include "xf86cmap.h"
#include "shadow.h"
+#include "os.h"
#include "dgaproc.h"
/* for visuals */
@@ -186,6 +189,9 @@ typedef struct {
int rotate;
Bool shadowFB;
Bool shadow24;
+ Bool timerActive;
+ OsTimerPtr timer;
+ RegionPtr region_queue;
void *shadow;
CloseScreenProcPtr CloseScreen;
CreateScreenResourcesProcPtr CreateScreenResources;
@@ -697,6 +703,87 @@ fbdevUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
shadowUpdatePacked(pScreen, pBuf);
}
+static CARD32 FBDevEPDUpdateWork(OsTimerPtr timer,
+ CARD32 time,
+ void *arg);
+
+static void FBDevEPDUpdate(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ RegionPtr damage = DamageRegion(pBuf->pDamage);
+
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ FBDevPtr fPtr = FBDEVPTR(pScrn);
+ shadowUpdateProc update;
+ if (fPtr->shadow24)
+ update = fbdevUpdate32to24;
+ else if (fPtr->rotate)
+ update = fbdevUpdateRotatePacked;
+ else
+ update = fbdevUpdatePacked;
+
+ update(pScreen, pBuf);
+
+ if (fPtr->region_queue) {
+ RegionAppend(fPtr->region_queue, damage);
+ } else {
+ fPtr->region_queue = RegionDuplicate(damage);
+ }
+
+ if (!fPtr->timerActive) {
+ FBDevEPDUpdateWork(fPtr->timer, GetTimeInMillis(),
+ pScreen);
+ }
+}
+
+static CARD32 FBDevEPDUpdateWork(OsTimerPtr timer,
+ CARD32 time,
+ void *arg)
+{
+ ScreenPtr pScreen = (void *)arg;
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ FBDevPtr fPtr = FBDEVPTR(pScrn);
+ BoxPtr pbox;
+ Bool overlap;
+ int nbox;
+ int fd = fbdevHWGetFD(pScrn);
+ if (fPtr->region_queue == NULL) {
+ fPtr->timerActive = FALSE;
+ return 0;
+ }
+
+ struct mxcfb_update_data upd_region;
+ RegionValidate(fPtr->region_queue, &overlap);
+ pbox = RegionRects(fPtr->region_queue);
+ nbox = RegionNumRects(fPtr->region_queue);
+
+ while(nbox--) {
+ int x, y, w, h;
+ int ret;
+ x = pbox->x1;
+ y = pbox->y1;
+ w = (pbox->x2 - pbox->x1);
+ h = pbox->y2 - pbox->y1;
+ memset(&upd_region, 0, sizeof(upd_region));
+ upd_region.update_region.left = x;
+ upd_region.update_region.top = y;
+ upd_region.update_region.width = w;
+ upd_region.update_region.height = h;
+ upd_region.waveform_mode = WAVEFORM_MODE_AUTO;
+ upd_region.temp = TEMP_USE_AMBIENT;
+ upd_region.update_mode = UPDATE_MODE_PARTIAL;
+ upd_region.flags = 0;
+ ret = ioctl(fd, MXCFB_SEND_UPDATE, &upd_region);
+ if (ret < 0)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"update ioctl failed: %d\n", ret);
+ pbox++;
+ }
+ fPtr->timer = TimerSet(timer, 0, 1000, FBDevEPDUpdateWork, pScreen);
+ fPtr->timerActive = TRUE;
+ RegionDestroy(fPtr->region_queue);
+ fPtr->region_queue = NULL;
+ return 0;
+}
+
static Bool
FBDevCreateScreenResources(ScreenPtr pScreen)
{
@@ -722,7 +809,7 @@ FBDevCreateScreenResources(ScreenPtr pScreen)
else
update = fbdevUpdatePacked;
- if (!shadowAdd(pScreen, pPixmap, update, FBDevWindowLinear, fPtr->rotate,
+ if (!shadowAdd(pScreen, pPixmap, FBDevEPDUpdate, FBDevWindowLinear, fPtr->rotate,
NULL)) {
return FALSE;
}

View file

@ -0,0 +1,17 @@
Upstream: no (too lazy)
Reason: fixes build by getting rid of old cpp macro
diff --git a/src/fbdev.c b/src/fbdev.c
index f25ef72..02a2b7a 100644
--- a/src/fbdev.c
+++ b/src/fbdev.c
@@ -1010,7 +1010,7 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
fPtr->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = FBDevCloseScreen;
-#if XV
+#if defined(XV)
{
XF86VideoAdaptorPtr *ptr;