-/* $OpenBSD: drmP.h,v 1.215 2017/07/22 14:33:45 kettenis Exp $ */
+/* $OpenBSD: drmP.h,v 1.216 2018/01/13 13:03:42 robert Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*/
struct drm_driver *driver;
+ struct klist note;
+
struct pci_dev _pdev;
struct pci_dev *pdev;
u_int16_t pci_device;
int drm_agp_unbind_ioctl(struct drm_device *, void *, struct drm_file *);
int drm_agp_bind_ioctl(struct drm_device *, void *, struct drm_file *);
+/* hotplug support */
+void drm_sysfs_hotplug_event(struct drm_device *);
+
static inline int
drm_sysfs_connector_add(struct drm_connector *connector)
{
{
}
-static inline void
-drm_sysfs_hotplug_event(struct drm_device *dev)
-{
-}
-
/* Graphics Execution Manager library functions (drm_gem.c) */
int drm_gem_init(struct drm_device *dev);
void drm_gem_destroy(struct drm_device *dev);
-/* $OpenBSD: drm_drv.c,v 1.154 2017/07/19 22:05:58 kettenis Exp $ */
+/* $OpenBSD: drm_drv.c,v 1.155 2018/01/13 13:03:42 robert Exp $ */
/*-
* Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org>
* Copyright © 2008 Intel Corporation
#include <sys/systm.h>
#include <sys/ttycom.h> /* for TIOCSGRP */
#include <sys/vnode.h>
+#include <sys/event.h>
#include <uvm/uvm.h>
#include <uvm/uvm_device.h>
return 0;
}
+void
+filt_drmdetach(struct knote *kn)
+{
+ struct drm_device *dev = kn->kn_hook;
+ int s;
+
+ s = spltty();
+ SLIST_REMOVE(&dev->note, kn, knote, kn_selnext);
+ splx(s);
+}
+
+int
+filt_drmkms(struct knote *kn, long hint)
+{
+ if (kn->kn_sfflags & hint)
+ kn->kn_fflags |= hint;
+ return (kn->kn_fflags != 0);
+}
+
+struct filterops drm_filtops =
+ { 1, NULL, filt_drmdetach, filt_drmkms };
+
+int
+drmkqfilter(dev_t kdev, struct knote *kn)
+{
+ struct drm_device *dev = NULL;
+ int s;
+
+ dev = drm_get_device_from_kdev(kdev);
+ if (dev == NULL || dev->dev_private == NULL)
+ return (ENXIO);
+
+ switch (kn->kn_filter) {
+ case EVFILT_DEVICE:
+ kn->kn_fop = &drm_filtops;
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ kn->kn_hook = dev;
+
+ s = spltty();
+ SLIST_INSERT_HEAD(&dev->note, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
+
int
drmopen(dev_t kdev, int flags, int fmt, struct proc *p)
{
-/* $OpenBSD: drm_linux.c,v 1.16 2018/01/12 11:03:15 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.17 2018/01/13 13:03:42 robert Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
#include <dev/pci/drm/drmP.h>
#include <dev/pci/ppbreg.h>
+#include <sys/event.h>
void
flush_barrier(void *arg)
{
task_add(systq, &bd->task);
}
+
+void
+drm_sysfs_hotplug_event(struct drm_device *dev)
+{
+ KNOTE(&dev->note, NOTE_CHANGE);
+}
-/* $OpenBSD: conf.h,v 1.143 2016/09/04 10:51:24 naddy Exp $ */
+/* $OpenBSD: conf.h,v 1.144 2018/01/13 13:03:42 robert Exp $ */
/* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */
/*-
dev_init(c,n,open), dev_init(c,n,close), dev_init(c, n, read), \
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
- dev_init(c,n,mmap), 0, D_CLONE }
+ dev_init(c,n,mmap), 0, D_CLONE, dev_init(c,n,kqfilter) }
/* open, close, ioctl */
#define cdev_amdmsr_init(c,n) { \