Implement drm_drawable gunk and drm_locked_task, untested. i915drm links now.
This commit is contained in:
parent
b6ecf59844
commit
4a648a5b9a
11
sys/external/bsd/drm/dist/bsd-core/drmP.h
vendored
11
sys/external/bsd/drm/dist/bsd-core/drmP.h
vendored
@ -116,6 +116,7 @@ typedef struct drm_file drm_file_t;
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/atomic.h>
|
||||
#include <sys/workqueue.h>
|
||||
#include <uvm/uvm.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
@ -966,13 +967,19 @@ struct drm_device {
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
struct unrhdr *drw_unrhdr;
|
||||
#else
|
||||
int drw_no;
|
||||
#endif
|
||||
/* RB tree of drawable infos */
|
||||
RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
|
||||
|
||||
/* XXXMRG */
|
||||
#ifdef __FreeBSD__
|
||||
struct task locked_task;
|
||||
void (*locked_task_call)(struct drm_device *dev);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct workqueue *locked_task;
|
||||
#endif
|
||||
void (*locked_task_call)(struct drm_device *dev);
|
||||
};
|
||||
|
||||
extern int drm_debug_flag;
|
||||
|
@ -35,7 +35,6 @@
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
struct bsd_drm_drawable_info {
|
||||
struct drm_drawable_info info;
|
||||
int handle;
|
||||
@ -77,7 +76,12 @@ int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||
if (info == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
info->handle = alloc_unr(dev->drw_unrhdr);
|
||||
#else
|
||||
/* XXXJDM */
|
||||
info->handle = ++dev->drw_no;
|
||||
#endif
|
||||
DRM_SPINLOCK(&dev->drw_lock);
|
||||
RB_INSERT(drawable_tree, &dev->drw_head, info);
|
||||
draw->handle = info->handle;
|
||||
@ -99,7 +103,9 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||
RB_REMOVE(drawable_tree, &dev->drw_head,
|
||||
(struct bsd_drm_drawable_info *)info);
|
||||
DRM_SPINUNLOCK(&dev->drw_lock);
|
||||
#ifdef __FreeBSD__
|
||||
free_unr(dev->drw_unrhdr, draw->handle);
|
||||
#endif
|
||||
drm_free(info, sizeof(struct bsd_drm_drawable_info),
|
||||
DRM_MEM_DRAWABLE);
|
||||
return 0;
|
||||
@ -152,23 +158,3 @@ int drm_update_draw(struct drm_device *dev, void *data,
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||
{
|
||||
drm_draw_t draw;
|
||||
|
||||
draw.handle = 0; /* NOOP */
|
||||
DRM_DEBUG("%d\n", draw.handle);
|
||||
|
||||
DRM_COPY_TO_USER(data, &draw, sizeof(draw));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||
{
|
||||
return 0; /* NOOP */
|
||||
}
|
||||
#endif
|
||||
|
2
sys/external/bsd/drm/dist/bsd-core/drm_drv.c
vendored
2
sys/external/bsd/drm/dist/bsd-core/drm_drv.c
vendored
@ -697,6 +697,8 @@ static int drm_load(struct drm_device *dev)
|
||||
DRM_ERROR("Couldn't allocate drawable number allocator\n");
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
dev->drw_no = 0;
|
||||
#endif
|
||||
|
||||
DRM_INFO("Initialized %s %d.%d.%d %s\n",
|
||||
|
39
sys/external/bsd/drm/dist/bsd-core/drm_irq.c
vendored
39
sys/external/bsd/drm/dist/bsd-core/drm_irq.c
vendored
@ -33,9 +33,10 @@
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
|
||||
/* XXXMRG */
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__)
|
||||
static void drm_locked_task(void *context, int pending __unused);
|
||||
#elif defined(__NetBSD__)
|
||||
static void drm_locked_task(struct work *, void *);
|
||||
#endif
|
||||
|
||||
int drm_irq_by_busid(struct drm_device *dev, void *data,
|
||||
@ -285,10 +286,16 @@ int drm_irq_install(struct drm_device *dev)
|
||||
dev->driver.irq_postinstall(dev);
|
||||
DRM_UNLOCK();
|
||||
|
||||
/* XXXMRG */
|
||||
#ifdef __FreeBSD__
|
||||
TASK_INIT(&dev->locked_task, 0, drm_locked_task, dev);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
retcode = workqueue_create(&dev->locked_task, "drmirq",
|
||||
drm_locked_task, dev, PRI_NONE, IPL_VM, 0);
|
||||
if (retcode)
|
||||
goto err;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
err:
|
||||
DRM_LOCK();
|
||||
@ -330,6 +337,12 @@ int drm_irq_uninstall(struct drm_device *dev)
|
||||
DRM_LOCK();
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
|
||||
#endif
|
||||
#if defined(__NetBSD__)
|
||||
if (dev->locked_task) {
|
||||
workqueue_destroy(dev->locked_task);
|
||||
dev->locked_task = NULL;
|
||||
}
|
||||
#endif
|
||||
drm_vblank_cleanup(dev);
|
||||
|
||||
@ -614,9 +627,12 @@ void drm_handle_vblank(struct drm_device *dev, int crtc)
|
||||
drm_vbl_send_signals(dev, crtc);
|
||||
}
|
||||
|
||||
/* XXXMRG */
|
||||
static void
|
||||
#if defined(__FreeBSD__)
|
||||
static void drm_locked_task(void *context, int pending __unused)
|
||||
drm_locked_task(void *context, int pending __unused)
|
||||
#elif defined(__NetBSD__)
|
||||
drm_locked_task(struct work *wk, void *context)
|
||||
#endif
|
||||
{
|
||||
struct drm_device *dev = context;
|
||||
|
||||
@ -655,7 +671,14 @@ void
|
||||
drm_locked_tasklet(struct drm_device *dev,
|
||||
void (*tasklet)(struct drm_device *dev))
|
||||
{
|
||||
dev->locked_task_call = tasklet;
|
||||
taskqueue_enqueue(taskqueue_swi, &dev->locked_task);
|
||||
}
|
||||
#if defined(__NetBSD__)
|
||||
static struct work drm_tasklet_wk;
|
||||
#endif
|
||||
|
||||
dev->locked_task_call = tasklet;
|
||||
#if defined(__FreeBSD__)
|
||||
taskqueue_enqueue(taskqueue_swi, &dev->locked_task);
|
||||
#elif defined(__NetBSD__)
|
||||
workqueue_enqueue(dev->locked_task, &drm_tasklet_wk, NULL);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user