From: krw Date: Sat, 20 Dec 2014 16:34:27 +0000 (+0000) Subject: Replace switch workq with taskq. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f3e88c5080ac24dc856e5e6acb2bd25c3731cc64;p=openbsd Replace switch workq with taskq. Diff from blambert@, double ok@ kettenis. --- diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index 0d12c17b4ef..cca4851ddcc 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.c,v 1.68 2014/10/25 14:20:09 kettenis Exp $ */ +/* $OpenBSD: i915_drv.c,v 1.69 2014/12/20 16:34:27 krw Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -714,8 +714,8 @@ inteldrm_show_screen(void *v, void *cookie, int waitok, dev_priv->switchcb = cb; dev_priv->switchcbarg = cbarg; if (cb) { - workq_queue_task(NULL, &dev_priv->switchwqt, 0, - inteldrm_doswitch, v, cookie); + dev_priv->switchcookie = cookie; + task_add(systq, &dev_priv->switchtask); return (EAGAIN); } @@ -725,13 +725,13 @@ inteldrm_show_screen(void *v, void *cookie, int waitok, } void -inteldrm_doswitch(void *v, void *cookie) +inteldrm_doswitch(void *v, void *dummy) { struct inteldrm_softc *dev_priv = v; struct rasops_info *ri = &dev_priv->ro; struct drm_device *dev = (struct drm_device *)dev_priv->drmdev; - rasops_show_screen(ri, cookie, 0, NULL, NULL); + rasops_show_screen(ri, dev_priv->switchcookie, 0, NULL, NULL); intel_fb_restore_mode(dev); if (dev_priv->switchcb) @@ -895,6 +895,8 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux) mtx_init(&dev_priv->error_completion_lock, IPL_NONE); rw_init(&dev_priv->rps.hw_lock, "rpshw"); + task_set(&dev_priv->switchtask, inteldrm_doswitch, dev_priv, NULL); + /* we need to use this api for now due to sharing with intagp */ bar = vga_pci_bar_info(vga_sc, (IS_I9XX(dev) ? 0 : 1)); if (bar == NULL) { diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h index b5e355d9efe..7c4cf650876 100644 --- a/sys/dev/pci/drm/i915/i915_drv.h +++ b/sys/dev/pci/drm/i915/i915_drv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.h,v 1.53 2014/11/06 05:48:42 jsg Exp $ */ +/* $OpenBSD: i915_drv.h,v 1.54 2014/12/20 16:34:27 krw Exp $ */ /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- */ /* @@ -553,7 +553,8 @@ struct inteldrm_softc { int nscreens; void (*switchcb)(void *, int, int); void *switchcbarg; - struct workq_task switchwqt; + void *switchcookie; + struct task switchtask; struct rasops_info ro; int sc_offset; diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h index 34d834476d4..783b9b19286 100644 --- a/sys/dev/pci/drm/radeon/radeon.h +++ b/sys/dev/pci/drm/radeon/radeon.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon.h,v 1.8 2014/04/07 06:43:11 jsg Exp $ */ +/* $OpenBSD: radeon.h,v 1.9 2014/12/20 16:34:27 krw Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1567,7 +1567,8 @@ struct radeon_device { void (*switchcb)(void *, int, int); void *switchcbarg; - struct workq_task switchwqt; + void *switchcookie; + struct task switchtask; struct rasops_info ro; int console; diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index 0b99d15ca87..e0204816e8e 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_kms.c,v 1.30 2014/10/25 14:20:09 kettenis Exp $ */ +/* $OpenBSD: radeon_kms.c,v 1.31 2014/12/20 16:34:27 krw Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -379,9 +379,9 @@ radeondrm_show_screen(void *v, void *cookie, int waitok, rdev->switchcb = cb; rdev->switchcbarg = cbarg; + rdev->switchcookie = cookie; if (cb) { - workq_queue_task(NULL, &rdev->switchwqt, 0, - radeondrm_doswitch, v, cookie); + task_add(systq, &rdev->switchtask); return (EAGAIN); } @@ -391,14 +391,14 @@ radeondrm_show_screen(void *v, void *cookie, int waitok, } void -radeondrm_doswitch(void *v, void *cookie) +radeondrm_doswitch(void *v, void *dummy) { struct rasops_info *ri = v; struct radeon_device *rdev = ri->ri_hw; struct radeon_crtc *radeon_crtc; int i, crtc; - rasops_show_screen(ri, cookie, 0, NULL, NULL); + rasops_show_screen(ri, rdev->switchcookie, 0, NULL, NULL); for (crtc = 0; crtc < rdev->num_crtc; crtc++) { for (i = 0; i < 256; i++) { radeon_crtc = rdev->mode_info.crtcs[crtc]; @@ -698,6 +698,8 @@ radeondrm_attachhook(void *xsc) struct wsemuldisplaydev_attach_args aa; struct rasops_info *ri = &rdev->ro; + task_set(&rdev->switchtask, radeondrm_doswitch, ri, NULL); + if (ri->ri_bits == NULL) return;