xf86-video-intel patch to test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

xf86-video-intel patch to test

Matthieu Herrb-7
Hi,

the patch below should not affect the intel(4) X.Org driver
functionality. It's sole purpose is to make it compatible with the
future upgrade to the X.Org 1.19 xserver.

But since I don't have much hardware still using the intel driver (we
switched to modesettings(4) for many devices), I'd like to have this
tested against the current X server as much as possible.

To test it, you need to check out the /usr/xenocara source tree and
then:

cd /usr/xenocara/driver/xf86-video-intel
patch -p0 -E < /this/patch
doas make -f Makefile.bsd-wrapper obj
doas make -f Makefile.bsd-wrapper build

Then restart the X server.

Comments, oks are welcome too.

Thanks in advance.

Index: src/compat-api.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/compat-api.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 compat-api.h
--- src/compat-api.h 16 May 2016 09:54:33 -0000 1.6
+++ src/compat-api.h 11 Nov 2017 17:39:18 -0000
@@ -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
@@ -227,4 +232,14 @@ static inline void FreePixmap(PixmapPtr
 
 #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
Index: src/sna/sna.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/sna/sna.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 sna.h
--- src/sna/sna.h 12 Apr 2015 19:42:06 -0000 1.3
+++ src/sna/sna.h 11 Nov 2017 17:39:18 -0000
@@ -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(Pixma
 
 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);
Index: src/sna/sna_accel.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/sna/sna_accel.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 sna_accel.c
--- src/sna/sna_accel.c 3 Dec 2015 22:36:46 -0000 1.7
+++ src/sna/sna_accel.c 11 Nov 2017 17:39:18 -0000
@@ -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
  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, st
  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();
 
@@ -17942,22 +17954,6 @@ set_tv:
  kgem_submit(&sna->kgem);
  sna->kgem.wedged = !sna->kgem.wedged;
  }
-}
-
-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)
Index: src/sna/sna_acpi.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/sna/sna_acpi.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 sna_acpi.c
--- src/sna/sna_acpi.c 3 Feb 2014 15:54:52 -0000 1.1
+++ src/sna/sna_acpi.c 11 Nov 2017 17:39:18 -0000
@@ -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;
 
Index: src/sna/sna_driver.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/sna/sna_driver.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 sna_driver.c
--- src/sna/sna_driver.c 12 Apr 2015 19:42:06 -0000 1.3
+++ src/sna/sna_driver.c 11 Nov 2017 17:39:18 -0000
@@ -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_DE
 
  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;
 
Index: src/uxa/intel.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/uxa/intel.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 intel.h
--- src/uxa/intel.h 5 Sep 2016 11:20:18 -0000 1.3
+++ src/uxa/intel.h 11 Nov 2017 17:39:18 -0000
@@ -252,7 +252,9 @@ typedef struct intel_screen_private {
 
  int colorKey;
  XF86VideoAdaptorPtr adaptor;
+#if! HAVE_NOTIFY_FD
  ScreenBlockHandlerProcPtr BlockHandler;
+#endif
  Bool overlayOn;
 
  struct {
Index: src/uxa/intel_display.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/uxa/intel_display.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 intel_display.c
--- src/uxa/intel_display.c 12 Apr 2015 19:42:07 -0000 1.2
+++ src/uxa/intel_display.c 11 Nov 2017 17:39:18 -0000
@@ -2068,6 +2068,7 @@ intel_pageflip_abort(ScrnInfoPtr scrn, x
 /*
  * 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
  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_priv
  * 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 *i
 
         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
Index: src/uxa/intel_driver.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-intel/src/uxa/intel_driver.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 intel_driver.c
--- src/uxa/intel_driver.c 5 Sep 2016 11:20:18 -0000 1.4
+++ src/uxa/intel_driver.c 11 Nov 2017 17:39:19 -0000
@@ -672,8 +672,9 @@ redisplay_dirty(ScreenPtr screen, Pixmap
 }
 
 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;

--
Matthieu Herrb

Reply | Threaded
Open this post in threaded view
|

Re: xf86-video-intel patch to test

Stefan Sperling-5
On Sat, Nov 11, 2017 at 07:57:16PM +0100, Matthieu Herrb wrote:

> Hi,
>
> the patch below should not affect the intel(4) X.Org driver
> functionality. It's sole purpose is to make it compatible with the
> future upgrade to the X.Org 1.19 xserver.
>
> But since I don't have much hardware still using the intel driver (we
> switched to modesettings(4) for many devices), I'd like to have this
> tested against the current X server as much as possible.
>
> To test it, you need to check out the /usr/xenocara source tree and
> then:
>
> cd /usr/xenocara/driver/xf86-video-intel
> patch -p0 -E < /this/patch
> doas make -f Makefile.bsd-wrapper obj
> doas make -f Makefile.bsd-wrapper build
>
> Then restart the X server.
>
> Comments, oks are welcome too.
>
> Thanks in advance.

No regression on my x201.

Reply | Threaded
Open this post in threaded view
|

Re: xf86-video-intel patch to test

Robert Peichaer
q

Am 13. November 2017 17:56:19 MEZ schrieb Stefan Sperling <[hidden email]>:

>On Sat, Nov 11, 2017 at 07:57:16PM +0100, Matthieu Herrb wrote:
>> Hi,
>>
>> the patch below should not affect the intel(4) X.Org driver
>> functionality. It's sole purpose is to make it compatible with the
>> future upgrade to the X.Org 1.19 xserver.
>>
>> But since I don't have much hardware still using the intel driver (we
>> switched to modesettings(4) for many devices), I'd like to have this
>> tested against the current X server as much as possible.
>>
>> To test it, you need to check out the /usr/xenocara source tree and
>> then:
>>
>> cd /usr/xenocara/driver/xf86-video-intel
>> patch -p0 -E < /this/patch
>> doas make -f Makefile.bsd-wrapper obj
>> doas make -f Makefile.bsd-wrapper build
>>
>> Then restart the X server.
>>
>> Comments, oks are welcome too.
>>
>> Thanks in advance.
>
>No regression on my x201.

No regressions on my x250

--
-=[rpe]=-
Reply | Threaded
Open this post in threaded view
|

Re: xf86-video-intel patch to test

Kevin Chadwick-4
In reply to this post by Matthieu Herrb-7
On Sat, 11 Nov 2017 19:57:16 +0100


> But since I don't have much hardware still using the intel driver (we
> switched to modesettings(4) for many devices), I'd like to have this
> tested against the current X server as much as possible.

Not sure if an unknown Intel GD would cause use of the "intel" driver
but in case it does then I thought I should say that the system of the
dmesg I have just sent in also behaved the same (display lost during
boot) on 6.2 release.