summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2017-11-19 20:16:13 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2017-11-19 20:16:13 +0000
commit5ac2542cfc65dc76c653cc9c3e6490a31b078121 (patch)
treec48c1ff5604cfdc254793ff21c7f2e795f0d88a4 /driver
parent0dde029a66be1918fc41f786fb9008fc203fa72a (diff)
Adapt xf86-video-intel to xserver 1.19 ABI changes. Mostly
from upstreams commits. Tested by many. Thanks.
Diffstat (limited to 'driver')
-rw-r--r--driver/xf86-video-intel/src/compat-api.h15
-rw-r--r--driver/xf86-video-intel/src/sna/sna.h5
-rw-r--r--driver/xf86-video-intel/src/sna/sna_accel.c34
-rw-r--r--driver/xf86-video-intel/src/sna/sna_acpi.c11
-rw-r--r--driver/xf86-video-intel/src/sna/sna_driver.c38
-rw-r--r--driver/xf86-video-intel/src/uxa/intel.h2
-rw-r--r--driver/xf86-video-intel/src/uxa/intel_display.c17
-rw-r--r--driver/xf86-video-intel/src/uxa/intel_driver.c25
8 files changed, 115 insertions, 32 deletions
diff --git a/driver/xf86-video-intel/src/compat-api.h b/driver/xf86-video-intel/src/compat-api.h
index d30459b71..be9c04909 100644
--- a/driver/xf86-video-intel/src/compat-api.h
+++ b/driver/xf86-video-intel/src/compat-api.h
@@ -30,6 +30,7 @@
#include <xorg-server.h>
#include <xorgVersion.h>
+#include <xf86Module.h>
#include <picturestr.h>
#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
@@ -42,6 +43,10 @@
#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
#endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 22
+#define HAVE_NOTIFY_FD 1
+#endif
+
#ifndef XF86_SCRN_INTERFACE
#define SCRN_ARG_TYPE int
@@ -228,3 +233,13 @@ static inline void FreePixmap(PixmapPtr pixmap)
#if HAS_DIRTYTRACKING_ROTATION
#define PixmapSyncDirtyHelper(d, dd) PixmapSyncDirtyHelper(d)
#endif
+
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22, 0)
+#define OsBlockSIGIO()
+#define OsReleaseSIGIO()
+#endif
+
+#if !HAVE_NOTIFY_FD
+#define SetNotifyFd(fd, cb, mode, data) AddGeneralSocket(fd);
+#define RemoveNotifyFd(fd) RemoveGeneralSocket(fd)
+#endif
diff --git a/driver/xf86-video-intel/src/sna/sna.h b/driver/xf86-video-intel/src/sna/sna.h
index bb0cbb289..a1bc4d5de 100644
--- a/driver/xf86-video-intel/src/sna/sna.h
+++ b/driver/xf86-video-intel/src/sna/sna.h
@@ -367,8 +367,10 @@ struct sna {
EntityInfoPtr pEnt;
const struct intel_device_info *info;
+#if !HAVE_NOTIFY_FD
ScreenBlockHandlerProcPtr BlockHandler;
ScreenWakeupHandlerProcPtr WakeupHandler;
+#endif
CloseScreenProcPtr CloseScreen;
PicturePtr clear;
@@ -995,8 +997,7 @@ static inline uint32_t pixmap_size(PixmapPtr pixmap)
bool sna_accel_init(ScreenPtr sreen, struct sna *sna);
void sna_accel_create(struct sna *sna);
-void sna_accel_block_handler(struct sna *sna, struct timeval **tv);
-void sna_accel_wakeup_handler(struct sna *sna);
+void sna_accel_block(struct sna *sna, struct timeval **tv);
void sna_accel_watch_flush(struct sna *sna, int enable);
void sna_accel_flush(struct sna *sna);
void sna_accel_enter(struct sna *sna);
diff --git a/driver/xf86-video-intel/src/sna/sna_accel.c b/driver/xf86-video-intel/src/sna/sna_accel.c
index 534b6487f..867caae6e 100644
--- a/driver/xf86-video-intel/src/sna/sna_accel.c
+++ b/driver/xf86-video-intel/src/sna/sna_accel.c
@@ -112,6 +112,11 @@
#define MAKE_COW_OWNER(ptr) ((void*)((uintptr_t)(ptr) | 1))
#define COW(ptr) (void *)((uintptr_t)(ptr) & ~1)
+#if XFONT2_CLIENT_FUNCS_VERSION >= 1
+#define AllocateFontPrivateIndex() xfont2_allocate_font_private_index()
+#define FontSetPrivate(font, idx, data) xfont2_font_set_private(font, idx, data)
+#endif
+
#if 0
static void __sna_fallback_flush(DrawablePtr d)
{
@@ -17676,6 +17681,13 @@ static bool sna_option_accel_blt(struct sna *sna)
return strcasecmp(s, "blt") == 0;
}
+#if HAVE_NOTIFY_FD
+static void sna_accel_notify(int fd, int ready, void *data)
+{
+ sna_mode_wakeup(data);
+}
+#endif
+
bool sna_accel_init(ScreenPtr screen, struct sna *sna)
{
const char *backend;
@@ -17687,7 +17699,7 @@ bool sna_accel_init(ScreenPtr screen, struct sna *sna)
list_init(&sna->flush_pixmaps);
list_init(&sna->active_pixmaps);
- AddGeneralSocket(sna->kgem.fd);
+ SetNotifyFd(sna->kgem.fd, sna_accel_notify, X_NOTIFY_READ, sna);
#ifdef DEBUG_MEMORY
sna->timer_expire[DEBUG_MEMORY_TIMER] = GetTimeInMillis()+ 10 * 1000;
@@ -17862,12 +17874,12 @@ void sna_accel_close(struct sna *sna)
sna_pixmap_expire(sna);
DeleteCallback(&FlushCallback, sna_accel_flush_callback, sna);
- RemoveGeneralSocket(sna->kgem.fd);
+ RemoveNotifyFd(sna->kgem.fd);
kgem_cleanup_cache(&sna->kgem);
}
-void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
+void sna_accel_block(struct sna *sna, struct timeval **tv)
{
sigtrap_assert_inactive();
@@ -17944,22 +17956,6 @@ set_tv:
}
}
-void sna_accel_wakeup_handler(struct sna *sna)
-{
- DBG(("%s: nbatch=%d, need_retire=%d, need_purge=%d\n", __FUNCTION__,
- sna->kgem.nbatch, sna->kgem.need_retire, sna->kgem.need_purge));
-
- if (!sna->kgem.nbatch)
- return;
-
- if (kgem_is_idle(&sna->kgem)) {
- DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
- _kgem_submit(&sna->kgem);
- }
-
- sigtrap_assert_inactive();
-}
-
void sna_accel_free(struct sna *sna)
{
DBG(("%s\n", __FUNCTION__));
diff --git a/driver/xf86-video-intel/src/sna/sna_acpi.c b/driver/xf86-video-intel/src/sna/sna_acpi.c
index dcc0287b0..643d04af8 100644
--- a/driver/xf86-video-intel/src/sna/sna_acpi.c
+++ b/driver/xf86-video-intel/src/sna/sna_acpi.c
@@ -92,7 +92,7 @@ void _sna_acpi_wakeup(struct sna *sna)
DBG(("%s: error [%d], detaching from acpid\n", __FUNCTION__, n));
/* XXX reattach later? */
- RemoveGeneralSocket(sna->acpi.fd);
+ RemoveNotifyFd(sna->acpi.fd);
sna_acpi_fini(sna);
return;
}
@@ -136,6 +136,13 @@ void _sna_acpi_wakeup(struct sna *sna)
} while (n);
}
+#if HAVE_NOTIFY_FD
+static void sna_acpi_notify(int fd, int read, void *data)
+{
+ _sna_acpi_wakeup(data);
+}
+#endif
+
static int read_power_state(const char *path)
{
DIR *dir;
@@ -200,7 +207,7 @@ void sna_acpi_init(struct sna *sna)
DBG(("%s: attaching to acpid\n", __FUNCTION__));
- AddGeneralSocket(sna->acpi.fd);
+ SetNotifyFd(sna->acpi.fd, sna_acpi_notify, X_NOTIFY_READ, sna);
sna->acpi.remain = sizeof(sna->acpi.event) - 1;
sna->acpi.offset = 0;
diff --git a/driver/xf86-video-intel/src/sna/sna_driver.c b/driver/xf86-video-intel/src/sna/sna_driver.c
index 66f72dc28..9afa80ad3 100644
--- a/driver/xf86-video-intel/src/sna/sna_driver.c
+++ b/driver/xf86-video-intel/src/sna/sna_driver.c
@@ -729,6 +729,7 @@ cleanup:
return FALSE;
}
+#if !HAVE_NOTIFY_FD
static bool has_shadow(struct sna *sna)
{
if (!sna->mode.shadow_damage)
@@ -756,7 +757,7 @@ sna_block_handler(BLOCKHANDLER_ARGS_DECL)
sna->BlockHandler(BLOCKHANDLER_ARGS);
if (*tv == NULL || ((*tv)->tv_usec | (*tv)->tv_sec) || has_shadow(sna))
- sna_accel_block_handler(sna, tv);
+ sna_accel_block(sna, tv);
}
static void
@@ -778,11 +779,34 @@ sna_wakeup_handler(WAKEUPHANDLER_ARGS_DECL)
sna->WakeupHandler(WAKEUPHANDLER_ARGS);
- sna_accel_wakeup_handler(sna);
-
if (FD_ISSET(sna->kgem.fd, (fd_set*)read_mask))
sna_mode_wakeup(sna);
}
+#else
+static void
+sna_block_handler(void *data, void *_timeout)
+{
+ struct sna *sna = data;
+ int *timeout = _timeout;
+ struct timeval tv, *tvp;
+
+ DBG(("%s (timeout=%d)\n", __FUNCTION__, *timeout));
+ if (*timeout == 0)
+ return;
+
+ if (*timeout < 0) {
+ tvp = NULL;
+ } else {
+ tv.tv_sec = *timeout / 1000;
+ tv.tv_usec = (*timeout % 1000) * 1000;
+ tvp = &tv;
+ }
+
+ sna_accel_block(sna, &tvp);
+ if (tvp)
+ *timeout = tvp->tv_sec * 1000 + tvp->tv_usec / 1000;
+}
+#endif
#if HAVE_UDEV
static void
@@ -1132,13 +1156,17 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */
scrn->vtSema = TRUE;
-
+#if !HAVE_NOTIFY_FD
sna->BlockHandler = screen->BlockHandler;
screen->BlockHandler = sna_block_handler;
sna->WakeupHandler = screen->WakeupHandler;
screen->WakeupHandler = sna_wakeup_handler;
-
+#else
+ RegisterBlockAndWakeupHandlers(sna_block_handler,
+ (ServerWakeupHandlerProcPtr)NoopDDA,
+ sna);
+#endif
screen->SaveScreen = sna_save_screen;
screen->CreateScreenResources = sna_create_screen_resources;
diff --git a/driver/xf86-video-intel/src/uxa/intel.h b/driver/xf86-video-intel/src/uxa/intel.h
index 0191ea900..dc9d5cfc1 100644
--- a/driver/xf86-video-intel/src/uxa/intel.h
+++ b/driver/xf86-video-intel/src/uxa/intel.h
@@ -252,7 +252,9 @@ typedef struct intel_screen_private {
int colorKey;
XF86VideoAdaptorPtr adaptor;
+#if! HAVE_NOTIFY_FD
ScreenBlockHandlerProcPtr BlockHandler;
+#endif
Bool overlayOn;
struct {
diff --git a/driver/xf86-video-intel/src/uxa/intel_display.c b/driver/xf86-video-intel/src/uxa/intel_display.c
index 97af76d40..c8ea5f826 100644
--- a/driver/xf86-video-intel/src/uxa/intel_display.c
+++ b/driver/xf86-video-intel/src/uxa/intel_display.c
@@ -2068,6 +2068,7 @@ intel_pageflip_abort(ScrnInfoPtr scrn, xf86CrtcPtr crtc, void *data)
/*
* Check for pending DRM events and process them.
*/
+#if !HAVE_NOTIFY_FD
static void
drm_wakeup_handler(pointer data, int err, pointer p)
{
@@ -2082,6 +2083,14 @@ drm_wakeup_handler(pointer data, int err, pointer p)
if (FD_ISSET(mode->fd, read_mask))
drmHandleEvent(mode->fd, &mode->event_context);
}
+#else
+static void
+drm_notify_fd(int fd, int ready, void *data)
+{
+ struct intel_mode *mode = data;
+ drmHandleEvent(mode->fd, &mode->event_context);
+}
+#endif
/*
* If there are any available, read drm_events
@@ -2246,9 +2255,11 @@ intel_mode_init(struct intel_screen_private *intel)
* registration within ScreenInit and not PreInit.
*/
mode->flip_count = 0;
- AddGeneralSocket(mode->fd);
+ SetNotifyFd(mode->fd, drm_notify_fd, X_NOTIFY_READ, mode);
+#if !HAVE_NOTIFY_FD
RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
drm_wakeup_handler, mode);
+#endif
}
void
@@ -2272,9 +2283,11 @@ intel_mode_close(intel_screen_private *intel)
intel_drm_abort_scrn(intel->scrn);
+#if !HAVE_NOTIFY_FD
RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
drm_wakeup_handler, mode);
- RemoveGeneralSocket(mode->fd);
+#endif
+ RemoveNotifyFd(mode->fd);
}
void
diff --git a/driver/xf86-video-intel/src/uxa/intel_driver.c b/driver/xf86-video-intel/src/uxa/intel_driver.c
index 7877eb5a6..347bda49a 100644
--- a/driver/xf86-video-intel/src/uxa/intel_driver.c
+++ b/driver/xf86-video-intel/src/uxa/intel_driver.c
@@ -672,8 +672,9 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
}
static void
-intel_dirty_update(ScreenPtr screen)
+intel_dirty_update(intel_screen_private *intel)
{
+ ScreenPtr screen = xf86ScrnToScreen(intel->scrn);
RegionPtr region;
PixmapDirtyUpdatePtr ent;
@@ -690,6 +691,7 @@ intel_dirty_update(ScreenPtr screen)
}
#endif
+#if !HAVE_NOTIFY_FD
static void
I830BlockHandler(BLOCKHANDLER_ARGS_DECL)
{
@@ -707,9 +709,22 @@ I830BlockHandler(BLOCKHANDLER_ARGS_DECL)
intel_uxa_block_handler(intel);
intel_video_block_handler(intel);
#ifdef INTEL_PIXMAP_SHARING
- intel_dirty_update(screen);
+ intel_dirty_update(intel);
#endif
}
+#else
+static void
+I830BlockHandler(void *data, void *timeout)
+{
+ intel_screen_private *intel = data;
+
+ intel_uxa_block_handler(intel);
+ intel_video_block_handler(intel);
+#ifdef INTEL_PIXMAP_SHARING
+ intel_dirty_update(intel);
+#endif
+}
+#endif
static Bool
intel_init_initial_framebuffer(ScrnInfoPtr scrn)
@@ -959,8 +974,14 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
"Hardware cursor initialization failed\n");
}
+#if !HAVE_NOTIFY_FD
intel->BlockHandler = screen->BlockHandler;
screen->BlockHandler = I830BlockHandler;
+#else
+ RegisterBlockAndWakeupHandlers(I830BlockHandler,
+ (ServerWakeupHandlerProcPtr)NoopDDA,
+ intel);
+#endif
#ifdef INTEL_PIXMAP_SHARING
screen->StartPixmapTracking = PixmapStartDirtyTracking;