summaryrefslogtreecommitdiff
path: root/kmscube
AgeCommit message (Expand)Author
2017-02-10ExtFb: pass params in vectorsTomi Valkeinen
2016-12-09kmscube: improve egl config printsTomi Valkeinen
2016-11-26kmscube: fix X11 fullscreenTomi Valkeinen
2016-06-17kmscube: use drmModeAddFB2 version of ExtFBTomi Valkeinen
2016-06-11kms++util: split to subdirsTomi Valkeinen
2016-06-11kms++: organize into subdirsTomi Valkeinen
2016-05-23Reorganize libkms++utils headerTomi Valkeinen
2016-05-23File/dir renamesTomi Valkeinen
2016-04-25kmscube: remove unused fieldTomi Valkeinen
2016-04-25kmscube: fix wrong uses of class FramebufferTomi Valkeinen
2016-04-22kmscube: check errorsTomi Valkeinen
2016-04-20kmscube: improve the x11 mainloopTomi Valkeinen
2016-04-19kmscube: hackingTomi Valkeinen
2016-04-19kmscube: fix resource leaks & freeingTomi Valkeinen
2016-04-19kmscube: quick hack for fullscreenTomi Valkeinen
2016-04-16kmscube: waylandTomi Valkeinen
2016-04-16add -Wextra & fix warningsTomi Valkeinen
2016-04-16kmscube: split into partsTomi Valkeinen
2016-04-16kmscube: support XTomi Valkeinen
2016-04-16kmscube: disable planeTomi Valkeinen
2016-04-11kmscube: check for free bufsTomi Valkeinen
2016-04-08kmscube: support null eglTomi Valkeinen
2016-04-08kmscube: big restructureTomi Valkeinen
2016-04-08kmscube: separate swap_buffersTomi Valkeinen
2016-03-24kmscube: clean up esUtilTomi Valkeinen
2016-02-15kmscube: fix atomic FB_ID set for crtcTomi Valkeinen
2015-11-18Add kmscubeTomi Valkeinen
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
/*-
 * Copyright 2003 Eric Anholt
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors:
 *    Eric Anholt <anholt@FreeBSD.org>
 *
 */

/** @file drm_irq.c
 * Support code for handling setup/teardown of interrupt handlers and
 * handing interrupt handlers off to the drivers.
 */

#include "drmP.h"
#include "drm.h"

static void drm_locked_task(void *context, int pending __unused);

int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv)
{
	drm_irq_busid_t *irq = data;

	if ((irq->busnum >> 8) != dev->pci_domain ||
	    (irq->busnum & 0xff) != dev->pci_bus ||
	    irq->devnum != dev->pci_slot ||
	    irq->funcnum != dev->pci_func)
		return EINVAL;

	irq->irq = dev->irq;

	DRM_DEBUG("%d:%d:%d => IRQ %d\n",
		  irq->busnum, irq->devnum, irq->funcnum, irq->irq);

	return 0;
}

#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
static irqreturn_t
drm_irq_handler_wrap(DRM_IRQ_ARGS)
{
	drm_device_t *dev = (drm_device_t *)arg;

	DRM_SPINLOCK(&dev->irq_lock);
	dev->driver.irq_handler(arg);
	DRM_SPINUNLOCK(&dev->irq_lock);
}
#endif

int drm_irq_install(drm_device_t *dev)
{
	int retcode;
#ifdef __NetBSD__
	pci_intr_handle_t ih;
#endif

	if (dev->irq == 0 || dev->dev_private == NULL)
		return EINVAL;

	DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );