open-src/kernel/sys/drm/drmP.h
author Randy Fishel <Randy.Fishel@Oracle.COM>
Wed, 30 Nov 2016 21:57:49 -0800
changeset 1684 9f5a5146d91f
parent 1637 4d091a29bd63
permissions -rw-r--r--
25177273 Enable dumb_create in i915
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     1
/*
1637
4d091a29bd63 23216116 i915/drm should use header files from libdrm, not have copies
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1512
diff changeset
     2
 * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     3
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     4
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     5
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     6
 * drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     7
 * Created: Mon Jan  4 10:05:05 1999 by [email protected]
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     8
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
     9
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    10
 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    11
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    12
 * Copyright (c) 2009, 2013, Intel Corporation.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    13
 * All rights reserved.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    14
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    15
 * Permission is hereby granted, free of charge, to any person obtaining a
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    16
 * copy of this software and associated documentation files (the "Software"),
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    17
 * to deal in the Software without restriction, including without limitation
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    18
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    19
 * and/or sell copies of the Software, and to permit persons to whom the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    20
 * Software is furnished to do so, subject to the following conditions:
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    21
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    22
 * The above copyright notice and this permission notice (including the next
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    23
 * paragraph) shall be included in all copies or substantial portions of the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    24
 * Software.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    25
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    26
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    27
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    28
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    29
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    30
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    31
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    32
 * OTHER DEALINGS IN THE SOFTWARE.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    33
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    34
 * Authors:
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    35
 *    Rickard E. (Rik) Faith <[email protected]>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    36
 *    Gareth Hughes <[email protected]>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    37
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    38
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    39
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    40
#ifndef	_DRMP_H
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    41
#define	_DRMP_H
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    42
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    43
#include <sys/types.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    44
#include <sys/conf.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    45
#include <sys/modctl.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    46
#include <sys/stat.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    47
#include <sys/file.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    48
#include <sys/cmn_err.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    49
#include <sys/varargs.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    50
#include <sys/pci.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    51
#include <sys/ddi.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    52
#include <sys/sunddi.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    53
#include <sys/sunldi.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    54
#include <sys/agpgart.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    55
#include <sys/time.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    56
#include <sys/gfx_private.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    57
#include <sys/ddifm.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    58
#include <sys/fm/protocol.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    59
#include <sys/fm/util.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    60
#include <sys/fm/io/ddi.h>
1637
4d091a29bd63 23216116 i915/drm should use header files from libdrm, not have copies
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1512
diff changeset
    61
#include <drm/drm.h>
1512
4b04d1e46a1d 20395950 Move efb to the X consolidation
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1494
diff changeset
    62
#include <drm/drm_os_solaris.h>
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    63
#include "drm_atomic.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    64
#include <sys/queue.h>
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    65
#include "drm_linux.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    66
#include "drm_linux_list.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    67
#include "drm_mm.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    68
#include "drm_mode.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    69
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    70
#include "drm_sun_idr.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    71
#include "drm_sun_timer.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    72
#include "drm_sun_workqueue.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    73
#include "drm_sun_pci.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    74
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    75
#ifndef __inline__
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    76
#define	__inline__	inline
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    77
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    78
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    79
#if !defined(__FUNCTION__)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    80
#if defined(_STDC_C99) || defined(__C99FEATURES__)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    81
#define	__FUNCTION__ __func__
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    82
#else
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    83
#define	__FUNCTION__ " "
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    84
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    85
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    86
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    87
#define KB(x)	((x) * 1024)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    88
#define MB(x)	(KB (KB (x)))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    89
#define GB(x)	(MB (KB (x)))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    90
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    91
#define	DRM_MINOR_NBITS      (9)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    92
#define DRM_MINOR_SHIFT      (0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    93
#define DRM_MINOR_MAX        ((1 << DRM_MINOR_NBITS) - 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    94
#define DRM_DEV2MINOR(dev)   ((getminor(dev) >> DRM_MINOR_SHIFT) & DRM_MINOR_MAX)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    95
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    96
#define DRM_CLONEID_NBITS    (NBITSMINOR - DRM_MINOR_NBITS)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    97
#define DRM_CLONEID_SHIFT    (DRM_MINOR_NBITS)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    98
#define DRM_CLONEID_MAX      ((1 << DRM_CLONEID_NBITS) - 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
    99
#define DRM_DEV2CLONEID(dev) ((getminor(dev) >> DRM_CLONEID_SHIFT) & DRM_CLONEID_MAX)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   100
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   101
#define DRM_MAKEDEV(major_id, minor_id, clone_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   102
    makedevice(major_id, (minor_id << DRM_MINOR_SHIFT) | (clone_id << DRM_CLONEID_SHIFT))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   103
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   104
/* driver capabilities and requirements mask */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   105
#define DRIVER_USE_AGP     0x1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   106
#define DRIVER_REQUIRE_AGP 0x2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   107
#define DRIVER_USE_MTRR    0x4
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   108
#define DRIVER_PCI_DMA     0x8
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   109
#define DRIVER_SG          0x10
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   110
#define DRIVER_HAVE_DMA    0x20
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   111
#define DRIVER_HAVE_IRQ    0x40
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   112
#define DRIVER_IRQ_SHARED  0x80
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   113
#define DRIVER_IRQ_VBL     0x100
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   114
#define DRIVER_DMA_QUEUE   0x200
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   115
#define DRIVER_FB_DMA      0x400
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   116
#define DRIVER_IRQ_VBL2    0x800
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   117
#define DRIVER_GEM         0x1000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   118
#define DRIVER_MODESET     0x2000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   119
#define DRIVER_PRIME       0x4000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   120
#define	DRIVER_USE_PLATFORM_DEVICE	0x8000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   121
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   122
/* DRM space units */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   123
#define	DRM_PAGE_SHIFT			PAGESHIFT
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   124
#define	DRM_PAGE_SIZE			(1 << DRM_PAGE_SHIFT)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   125
#define	DRM_PAGE_OFFSET			(DRM_PAGE_SIZE - 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   126
#define	DRM_PAGE_MASK			~(DRM_PAGE_SIZE - 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   127
#define	DRM_MB2PAGES(x)			((x) << 8)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   128
#define	DRM_PAGES2BYTES(x)		((x) << DRM_PAGE_SHIFT)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   129
#define	DRM_BYTES2PAGES(x)		((x) >> DRM_PAGE_SHIFT)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   130
#define	DRM_PAGES2KB(x)			((x) << 2)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   131
#define	DRM_ALIGNED(offset)		(((offset) & DRM_PAGE_OFFSET) == 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   132
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   133
#define	PAGE_SHIFT			DRM_PAGE_SHIFT
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   134
#define	PAGE_SIZE			DRM_PAGE_SIZE
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   135
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   136
#define	DRM_MAX_INSTANCES	8
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   137
#define	DRM_DEVNODE		"drm"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   138
#define	DRM_UNOPENED		0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   139
#define	DRM_OPENED		1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   140
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   141
#define	DRM_HASH_SIZE		16 /* Size of key hash table */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   142
#define	DRM_KERNEL_CONTEXT	0  /* Change drm_resctx if changed */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   143
#define	DRM_RESERVED_CONTEXTS	1  /* Change drm_resctx if changed */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   144
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   145
#define	DRM_MEM_DMA	   0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   146
#define	DRM_MEM_SAREA	   1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   147
#define	DRM_MEM_DRIVER	   2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   148
#define	DRM_MEM_MAGIC	   3
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   149
#define	DRM_MEM_IOCTLS	   4
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   150
#define	DRM_MEM_MAPS	   5
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   151
#define	DRM_MEM_BUFS	   6
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   152
#define	DRM_MEM_SEGS	   7
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   153
#define	DRM_MEM_PAGES	   8
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   154
#define	DRM_MEM_FILES	  9
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   155
#define	DRM_MEM_QUEUES	  10
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   156
#define	DRM_MEM_CMDS	  11
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   157
#define	DRM_MEM_MAPPINGS  12
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   158
#define	DRM_MEM_BUFLISTS  13
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   159
#define	DRM_MEM_DRMLISTS  14
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   160
#define	DRM_MEM_TOTALDRM  15
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   161
#define	DRM_MEM_BOUNDDRM  16
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   162
#define	DRM_MEM_CTXBITMAP 17
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   163
#define	DRM_MEM_STUB	  18
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   164
#define	DRM_MEM_SGLISTS	  19
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   165
#define	DRM_MEM_AGPLISTS  20
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   166
#define	DRM_MEM_CTXLIST   21
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   167
#define	DRM_MEM_MM		22
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   168
#define	DRM_MEM_HASHTAB		23
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   169
#define	DRM_MEM_OBJECTS		24
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   170
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   171
#define	DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   172
#define	DRM_MAP_HASH_OFFSET 0x10000000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   173
#define	DRM_MAP_HASH_ORDER 12
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   174
#define	DRM_OBJECT_HASH_ORDER 12
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   175
#define	DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   176
#define	DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 16)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   177
#define	DRM_MM_INIT_MAX_PAGES 256
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   178
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   179
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   180
/* Internal types and structures */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   181
#define	DRM_ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0]))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   182
#define	DRM_MIN(a, b) ((a) < (b) ? (a) : (b))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   183
#define	DRM_MAX(a, b) ((a) > (b) ? (a) : (b))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   184
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   185
#define	DRM_IF_VERSION(maj, min) (maj << 16 | min)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   186
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   187
#define	__OS_HAS_AGP	1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   188
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   189
#define	DRM_DEV_MOD	(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   190
#define	DRM_DEV_UID	0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   191
#define	DRM_DEV_GID	0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   192
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   193
#define	DRM_CURRENTPID		ddi_get_pid()
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   194
#define	DRM_SPINLOCK(l)		mutex_enter(l)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   195
#define	DRM_SPINUNLOCK(u)	mutex_exit(u)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   196
#define	DRM_UDELAY(d)		udelay(d)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   197
#define	DRM_MEMORYBARRIER()
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   198
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   199
#define DRM_MINOR_UNASSIGNED 0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   200
#define DRM_MINOR_LEGACY 1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   201
#define DRM_MINOR_CONTROL 2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   202
#define DRM_MINOR_RENDER 3
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   203
#define DRM_MINOR_VGATEXT 4
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   204
#define DRM_MINOR_AGPMASTER 5
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   205
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   206
#define DRM_MINOR_ID_BASE_LEGACY     0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   207
#define DRM_MINOR_ID_BASE_CONTROL    64
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   208
#define DRM_MINOR_ID_BASE_RENDER     128
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   209
#define DRM_MINOR_ID_BASE_VGATEXT    384
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   210
#define DRM_MINOR_ID_BASE_AGPMASTER  448
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   211
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   212
#define DRM_MINOR_ID_LIMIT_LEGACY     63
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   213
#define DRM_MINOR_ID_LIMIT_CONTROL    127
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   214
#define DRM_MINOR_ID_LIMIT_RENDER     383
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   215
#define DRM_MINOR_ID_LIMIT_VGATEXT    447
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   216
#define DRM_MINOR_ID_LIMIT_AGPMASTER  511
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   217
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   218
#define DRM_MINOR_IS_LEGACY(minor_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   219
    (minor_id >= DRM_MINOR_ID_BASE_LEGACY && minor_id < DRM_MINOR_ID_LIMIT_LEGACY)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   220
#define DRM_MINOR_IS_CONTROL(minor_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   221
    (minor_id >= DRM_MINOR_ID_BASE_CONTROL && minor_id < DRM_MINOR_ID_LIMIT_CONTROL)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   222
#define DRM_MINOR_IS_RENDER(minor_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   223
    (minor_id >= DRM_MINOR_ID_BASE_RENDER && minor_id < DRM_MINOR_ID_LIMIT_RENDER)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   224
#define DRM_MINOR_IS_VGATEXT(minor_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   225
    (minor_id >= DRM_MINOR_ID_BASE_VGATEXT && minor_id < DRM_MINOR_ID_LIMIT_VGATEXT)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   226
#define DRM_MINOR_IS_AGPMASTER(minor_id)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   227
    (minor_id >= DRM_MINOR_ID_BASE_AGPMASTER && minor_id < DRM_MINOR_ID_LIMIT_AGPMASTER)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   228
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   229
/* Legacy VGA regions */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   230
#define VGA_RSRC_NONE	       0x00
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   231
#define VGA_RSRC_LEGACY_IO     0x01
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   232
#define VGA_RSRC_LEGACY_MEM    0x02
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   233
#define VGA_RSRC_LEGACY_MASK   (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   234
/* Non-legacy access */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   235
#define VGA_RSRC_NORMAL_IO     0x04
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   236
#define VGA_RSRC_NORMAL_MEM    0x08
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   237
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   238
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   239
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   240
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   241
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   242
typedef	struct drm_file		drm_file_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   243
typedef struct drm_device	drm_device_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   244
typedef struct drm_driver	drm_driver_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   245
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   246
#define	DRM_COPYFROM_WITH_RETURN(dest, src, size)     \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   247
	if (ddi_copyin((src), (dest), (size), 0)) {   \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   248
		DRM_ERROR("copy from user failed");   \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   249
		return (-EFAULT);                     \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   250
	}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   251
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   252
#define	DRM_COPYTO_WITH_RETURN(dest, src, size)       \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   253
	if (ddi_copyout((src), (dest), (size), 0)) {  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   254
		DRM_ERROR("copy to user failed");     \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   255
		return (-EFAULT);                     \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   256
	}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   257
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   258
#define	DRM_COPY_FROM_USER(dest, src, size) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   259
	ddi_copyin((src), (dest), (size), 0) /* flag for src */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   260
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   261
#define	DRM_COPY_TO_USER(dest, src, size) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   262
	ddi_copyout((src), (dest), (size), 0) /* flags for dest */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   263
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   264
#define	DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   265
	ddi_copyin((arg2), (arg1), (arg3), 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   266
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   267
#define	DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3)        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   268
	ddi_copyout((arg2), arg1, arg3, 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   269
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   270
#define	DRM_READ8(map, offset) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   271
	*(volatile uint8_t *)((uintptr_t)((map)->handle) + (offset))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   272
#define	DRM_READ16(map, offset) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   273
	*(volatile uint16_t *)((uintptr_t)((map)->handle) + (offset))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   274
#define	DRM_READ32(map, offset) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   275
	*(volatile uint32_t *)((uintptr_t)((map)->handle) + (offset))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   276
#define	DRM_READ64(map, offset) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   277
	*(volatile uint64_t *)((uintptr_t)((map)->handle) + (offset))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   278
#define	DRM_WRITE8(map, offset, val) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   279
	*(volatile uint8_t *)((uintptr_t)((map)->handle) + (offset)) = (val)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   280
#define	DRM_WRITE16(map, offset, val) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   281
	*(volatile uint16_t *)((uintptr_t)((map)->handle) + (offset)) = (val)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   282
#define	DRM_WRITE32(map, offset, val) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   283
	*(volatile uint32_t *)((uintptr_t)((map)->handle) + (offset)) = (val)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   284
#define	DRM_WRITE64(map, offset, val) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   285
	*(volatile uint64_t *)((uintptr_t)((map)->handle) + (offset)) = (val)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   286
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   287
typedef struct drm_wait_queue {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   288
	kcondvar_t	cv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   289
	kmutex_t	lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   290
}wait_queue_head_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   291
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   292
#define	DRM_INIT_WAITQUEUE(q, pri)	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   293
{ \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   294
	mutex_init(&(q)->lock, NULL, MUTEX_DRIVER, pri); \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   295
	cv_init(&(q)->cv, NULL, CV_DRIVER, NULL);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   296
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   297
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   298
#define	DRM_FINI_WAITQUEUE(q)	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   299
{ \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   300
	mutex_destroy(&(q)->lock);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   301
	cv_destroy(&(q)->cv);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   302
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   303
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   304
#define	DRM_WAKEUP(q)	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   305
{ \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   306
	mutex_enter(&(q)->lock); \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   307
	cv_broadcast(&(q)->cv);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   308
	mutex_exit(&(q)->lock);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   309
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   310
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   311
#define	DRM_WAIT_ON(ret, q, timeout, condition)  			\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   312
	mutex_enter(&(q)->lock);					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   313
	while (!(condition)) {						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   314
		ret = cv_reltimedwait_sig(&(q)->cv, &(q)->lock, timeout,\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   315
		    TR_CLOCK_TICK);					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   316
		if (ret == -1) {					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   317
			ret = EBUSY;					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   318
			break;						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   319
		} else if (ret == 0) {					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   320
			ret = EINTR;  					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   321
			break; 						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   322
		} else { 						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   323
			ret = 0; 					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   324
		} 							\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   325
	} 								\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   326
	mutex_exit(&(q)->lock);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   327
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   328
#define	DRM_WAIT(ret, q, condition)  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   329
mutex_enter(&(q)->lock);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   330
if (!(condition)) {	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   331
	(void) cv_timedwait_sig(&(q)->cv, &(q)->lock, jiffies + 3 * DRM_HZ); \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   332
	ret = 0;					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   333
	if (!(condition)) {				\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   334
		/* make sure we got what we want */	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   335
		if (wait_for(condition, 3000))		\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   336
			ret = EBUSY;			\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   337
	}						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   338
} \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   339
mutex_exit(&(q)->lock);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   340
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   341
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   342
#define	DRM_GETSAREA()  					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   343
{                                				\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   344
	drm_local_map_t *map;					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   345
	TAILQ_FOREACH(map, &dev->maplist, link) {		\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   346
		if (map->type == _DRM_SHM &&			\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   347
			map->flags & _DRM_CONTAINS_LOCK) {	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   348
			dev_priv->sarea = map;			\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   349
			break;					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   350
		}						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   351
	}							\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   352
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   353
*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   354
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   355
#define wake_up_all DRM_WAKEUP
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   356
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   357
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   358
 * Test that the hardware lock is held by the caller, returning otherwise.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   359
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   360
 * \param dev DRM device.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   361
 * \param filp file pointer of the caller.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   362
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   363
#define LOCK_TEST_WITH_RETURN( dev, _file_priv )				\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   364
do {										\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   365
	if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) ||	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   366
	    _file_priv->master->lock.file_priv != _file_priv)	{		\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   367
		DRM_ERROR( "%s called without lock held, held  %d owner %p %p\n",\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   368
			   __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   369
			   (void *)_file_priv->master->lock.file_priv, (void *)_file_priv); \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   370
		return -EINVAL;							\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   371
	}									\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   372
} while (*"\0")
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   373
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   374
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   375
 * Copy and IOCTL return string to user space
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   376
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   377
#define	DRM_COPY(name, value)                            \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   378
	len = strlen(value);                             \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   379
	if (len > name##_len) len = name##_len;          \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   380
		name##_len = strlen(value);              \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   381
	if (len && name) {                               \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   382
		if (DRM_COPY_TO_USER(name, value, len))  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   383
			return (EFAULT);                 \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   384
	}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   385
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   386
#define	DRM_IRQ_ARGS	caddr_t	arg
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   387
#define	IRQ_HANDLED		DDI_INTR_CLAIMED
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   388
#define	IRQ_NONE		DDI_INTR_UNCLAIMED
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   389
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   390
enum {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   391
	DRM_IS_NOT_AGP,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   392
	DRM_IS_AGP,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   393
	DRM_MIGHT_BE_AGP
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   394
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   395
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   396
/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   397
#ifndef PCIY_AGP
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   398
#define	PCIY_AGP		0x02
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   399
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   400
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   401
#ifndef PCIY_EXPRESS
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   402
#define	PCIY_EXPRESS		0x10
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   403
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   404
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   405
#define	PAGE_ALIGN(addr)	(((addr) + DRM_PAGE_SIZE - 1) & DRM_PAGE_MASK)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   406
#define	DRM_SUSER(p)		(crgetsgid(p) == 0 || crgetsuid(p) == 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   407
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   408
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   409
 * wait for 400 milliseconds
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   410
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   411
//#define	DRM_HZ			drv_usectohz(400000)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   412
#define	DRM_HZ			drv_usectohz(1000000)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   413
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   414
#define	DRM_SUPPORT	1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   415
#define	DRM_UNSUPPORT	0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   416
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   417
#define	__OS_HAS_AGP	1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   418
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   419
#ifndef offsetof
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   420
#define	__offsetof(type, field) ((size_t)(&((type *)0)->field))
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   421
#define	offsetof(type, field)   __offsetof(type, field)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   422
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   423
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   424
typedef struct drm_pci_id_list {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   425
	int vendor;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   426
	int device;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   427
	unsigned long driver_data;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   428
} drm_pci_id_list_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   429
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   430
#define	DRM_DEVICE	drm_device_t *dev = dev1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   431
#define	DRM_IOCTL_ARGS	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   432
	dev_t dev_id, struct drm_device *dev, void *data, struct drm_file *file, int ioctl_mode, cred_t *credp
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   433
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   434
typedef int drm_ioctl_t(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   435
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   436
#define	DRM_AUTH	0x1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   437
#define	DRM_MASTER	0x2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   438
#define	DRM_ROOT_ONLY	0x4
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   439
#define DRM_CONTROL_ALLOW 0x8
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   440
#define DRM_UNLOCKED	0x10
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   441
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   442
typedef struct drm_ioctl_desc {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   443
	drm_ioctl_t *func;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   444
	int flags;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   445
	int cmd;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   446
	unsigned int cmd_drv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   447
	const char *name;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   448
	int (*copyin32)(void *dest, void *src);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   449
	int (*copyout32)(void *dest, void *src);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   450
} drm_ioctl_desc_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   451
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   452
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   453
 * Creates a driver or general drm_ioctl_desc array entry for the given
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   454
 * ioctl, for use by drm_ioctl().
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   455
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   456
#ifdef _MULTI_DATAMODEL
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   457
#define DRM_IOCTL_DEF(ioctl, _func, _flags, _copyin32, _copyout32) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   458
	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .flags = _flags, .func = _func, .copyin32 = _copyin32, .copyout32 = _copyout32}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   459
#else
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   460
#define DRM_IOCTL_DEF(ioctl, _func, _flags, _copyin32, _copyout32) \
1684
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
   461
	[DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .flags = _flags, .func = _func, .copyin32 = NULL, .copyout32 = NULL, .name = ##_func}
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   462
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   463
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   464
typedef struct drm_magic_entry {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   465
	drm_magic_t		magic;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   466
	struct drm_file		*priv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   467
	struct drm_magic_entry	*next;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   468
} drm_magic_entry_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   469
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   470
typedef struct drm_magic_head {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   471
	struct drm_magic_entry *head;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   472
	struct drm_magic_entry *tail;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   473
} drm_magic_head_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   474
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   475
typedef struct drm_buf {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   476
	int		idx;		/* Index into master buflist */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   477
	int		total;		/* Buffer size */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   478
	int		order;		/* log-base-2(total) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   479
	int		used;		/* Amount of buffer in use (for DMA) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   480
	unsigned long	offset;		/* Byte offset (used internally) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   481
	void		*address;	/* Address of buffer */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   482
	unsigned long	bus_address;	/* Bus address of buffer */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   483
	struct drm_buf	*next;		/* Kernel-only: used for free list */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   484
	volatile int	pending;	/* On hardware DMA queue */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   485
	struct drm_file	*file_priv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   486
				/* Uniq. identifier of holding process */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   487
	int		context;	/* Kernel queue for this buffer */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   488
	enum {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   489
		DRM_LIST_NONE	 = 0,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   490
		DRM_LIST_FREE	 = 1,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   491
		DRM_LIST_WAIT	 = 2,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   492
		DRM_LIST_PEND	 = 3,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   493
		DRM_LIST_PRIO	 = 4,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   494
		DRM_LIST_RECLAIM = 5
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   495
	}		list;		/* Which list we're on */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   496
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   497
	int		dev_priv_size;	/* Size of buffer private storage */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   498
	void		*dev_private;	/* Per-buffer private storage */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   499
} drm_buf_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   500
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   501
typedef struct drm_freelist {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   502
	int		  initialized;	/* Freelist in use		*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   503
	uint32_t	  count;	/* Number of free buffers	*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   504
	drm_buf_t	  *next;	/* End pointer			*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   505
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   506
	int		  low_mark;	/* Low water mark		*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   507
	int		  high_mark;	/* High water mark		*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   508
} drm_freelist_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   509
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   510
typedef struct drm_buf_entry {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   511
	int		  buf_size;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   512
	int		  buf_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   513
	drm_buf_t	  *buflist;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   514
	int		  seg_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   515
	int		  page_order;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   516
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   517
	uint32_t	  *seglist;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   518
	unsigned long	  *seglist_bus;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   519
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   520
	drm_freelist_t	  freelist;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   521
} drm_buf_entry_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   522
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   523
/* Event queued up for userspace to read */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   524
struct drm_pending_event {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   525
	struct drm_event *event;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   526
	struct list_head link;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   527
	struct drm_file *file_priv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   528
	pid_t pid; /* pid of requester, no guarantee it's valid by the time
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   529
		      we deliver the event, for tracing only */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   530
	void (*destroy)(void *event, size_t size);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   531
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   532
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   533
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   534
typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   535
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   536
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   537
 * Kernel side of a mapping
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   538
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   539
typedef struct drm_local_map {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   540
	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   541
	unsigned long size;	 /**< Requested physical size (bytes) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   542
	enum drm_map_type type;	 /**< Type of memory to map */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   543
	enum drm_map_flags flags;	 /**< Flags */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   544
	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   545
				 /**< Kernel-space: kernel-virtual address */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   546
	int mtrr;		 /**< MTRR slot used */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   547
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   548
	/* OSOL_drm Begin */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   549
	ddi_acc_handle_t acc_handle;	 /**< The data access handle */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   550
	ddi_umem_cookie_t umem_cookie;	 /**< For SAREA alloc and free */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   551
	int callback;			/** need callback ops to handle GTT mmap */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   552
	int gtt_mmap;			/** gtt mmap has been setuped */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   553
	/* OSOL_drm End */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   554
} drm_local_map_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   555
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   556
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   557
 * Mappings list
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   558
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   559
struct drm_map_list {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   560
	struct list_head head;		/**< list head */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   561
	/* OSOL_drm: struct drm_hash_item hash; */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   562
	struct drm_local_map *map;	/**< mapping */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   563
	uint64_t user_token;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   564
	struct drm_master *master;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   565
	struct drm_mm_node *file_offset_node;	/**< fake offset */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   566
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   567
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   568
struct drm_ctx_list {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   569
	struct list_head head;		/**< list head */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   570
	drm_context_t handle;		/**< context handle */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   571
	struct drm_file *tag;		/**< associated fd private data */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   572
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   573
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   574
struct drm_history_list {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   575
	struct list_head head;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   576
	char info[20];			/**< history info */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   577
	uint32_t cur_seq;		/**< current system seqno */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   578
	uint32_t last_seq;		/**< last seqno */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   579
	void *ring_ptr;			/**< current ring ptr */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   580
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   581
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   582
struct gem_map_list {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   583
	struct list_head head;		/**< list head */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   584
	devmap_cookie_t dhp;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   585
	offset_t mapoffset;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   586
	size_t maplen;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   587
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   588
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   589
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   590
 * This structure defines the drm_mm memory object, which will be used by the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   591
 * DRM for its buffer objects.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   592
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   593
struct drm_gem_object {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   594
	/* Reference count of this object */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   595
	struct kref refcount;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   596
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   597
	/* Handle count of this object. Each handle also holds a reference */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   598
	atomic_t handle_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   599
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   600
	/* Related drm device */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   601
	struct drm_device *dev;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   602
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   603
	/* Mapping info for this object */
1684
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
   604
	/* Not used in this driver, should remove to prevent confusion */
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   605
	struct drm_map_list map_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   606
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   607
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   608
	 * Size of the object, in bytes.  Immutable over the object's
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   609
	 * lifetime.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   610
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   611
	size_t size;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   612
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   613
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   614
	 * Global name for this object, starts at 1. 0 means unnamed.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   615
	 * Access is covered by the object_name_lock in the related drm_device
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   616
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   617
	int name;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   618
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   619
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   620
	 * Memory domains. These monitor which caches contain read/write data
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   621
	 * related to the object. When transitioning from one set of domains
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   622
	 * to another, the driver is called to ensure that caches are suitably
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   623
	 * flushed and invalidated
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   624
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   625
	uint32_t read_domains;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   626
	uint32_t write_domain;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   627
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   628
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   629
	 * While validating an exec operation, the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   630
	 * new read/write domain values are computed here.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   631
	 * They will be transferred to the above values
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   632
	 * at the point that any cache flushing occurs
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   633
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   634
	uint32_t pending_read_domains;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   635
	uint32_t pending_write_domain;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   636
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   637
	void *driver_private;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   638
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   639
	struct drm_map_list maplist;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   640
	ddi_dma_handle_t dma_hdl;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   641
	ddi_acc_handle_t acc_hdl;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   642
	caddr_t kaddr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   643
	size_t real_size;	/* real size of memory */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   644
	pfn_t *pfnarray;
1684
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
   645
	/* Obsolete?  Probably should be using the kaddr value above? */
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   646
	caddr_t gtt_map_kaddr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   647
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   648
	struct gfxp_pmem_cookie	mempool_cookie;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   649
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   650
	struct list_head seg_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   651
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   652
	struct list_head track_list;	/* for i915 mdb */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   653
	struct list_head his_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   654
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   655
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   656
typedef struct drm_lock_data {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   657
	struct drm_hw_lock *hw_lock;	/**< Hardware lock */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   658
	/** Private of lock holder's file (NULL=kernel) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   659
	struct drm_file *file_priv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   660
	kcondvar_t lock_cv;		/* lock queue - SOLARIS Specific */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   661
	kmutex_t lock_mutex;		/* lock - SOLARIS Specific */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   662
	unsigned long lock_time;	/* Time of last lock in clock ticks */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   663
	uint32_t kernel_waiters;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   664
	uint32_t user_waiters;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   665
	int idle_has_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   666
} drm_lock_data_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   667
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   668
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   669
 * This structure, in drm_device_t, is always initialized while the device
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   670
 * is open.  dev->dma_lock protects the incrementing of dev->buf_use, which
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   671
 * when set marks that no further bufs may be allocated until device teardown
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   672
 * occurs (when the last open of the device has closed).  The high/low
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   673
 * watermarks of bufs are only touched by the X Server, and thus not
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   674
 * concurrently accessed, so no locking is needed.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   675
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   676
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   677
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   678
 * DMA data.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   679
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   680
typedef struct drm_device_dma {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   681
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   682
	struct drm_buf_entry bufs[DRM_MAX_ORDER + 1];	/**< buffers, grouped by their size order */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   683
	int buf_count;			/**< total number of buffers */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   684
	struct drm_buf **buflist;		/**< Vector of pointers into drm_device_dma::bufs */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   685
	int seg_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   686
	int page_count;			/**< number of pages */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   687
	unsigned long *pagelist;	/**< page list */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   688
	unsigned long byte_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   689
	enum {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   690
		_DRM_DMA_USE_AGP = 0x01,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   691
		_DRM_DMA_USE_SG = 0x02,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   692
		_DRM_DMA_USE_FB = 0x04,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   693
		_DRM_DMA_USE_PCI_RO = 0x08
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   694
	} flags;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   695
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   696
} drm_device_dma_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   697
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   698
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   699
 * AGP memory entry.  Stored as a doubly linked list.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   700
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   701
typedef struct drm_agp_mem {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   702
	unsigned long handle;		/**< handle */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   703
	unsigned long bound;		/**< address */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   704
	int pages;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   705
	struct list_head head;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   706
} drm_agp_mem_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   707
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   708
/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   709
 * AGP data.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   710
 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   711
 * \sa drm_agp_init() and drm_device::agp.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   712
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   713
typedef struct drm_agp_head {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   714
	agp_info_t agp_info;		/**< AGP device information */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   715
	struct list_head memory;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   716
	unsigned long mode;		/**< AGP mode */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   717
	int enabled;			/**< whether the AGP bus as been enabled */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   718
	int acquired;			/**< whether the AGP device has been acquired */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   719
	unsigned long base;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   720
	int mtrr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   721
	int cant_use_aperture;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   722
	unsigned long page_mask;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   723
	ldi_ident_t agpgart_li;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   724
	ldi_handle_t agpgart_lh;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   725
} drm_agp_head_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   726
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   727
typedef struct drm_dma_handle {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   728
	ddi_dma_handle_t dma_hdl;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   729
	ddi_acc_handle_t acc_hdl;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   730
	ddi_dma_cookie_t cookie;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   731
	uint_t cookie_num;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   732
	uintptr_t vaddr;   /* virtual addr */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   733
	uintptr_t paddr;   /* physical addr */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   734
	size_t real_sz;    /* real size of memory */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   735
} drm_dma_handle_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   736
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   737
typedef struct drm_sg_mem {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   738
	unsigned long handle;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   739
	void *virtual;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   740
	int pages;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   741
	dma_addr_t *busaddr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   742
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   743
	ddi_umem_cookie_t *umem_cookie;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   744
	drm_dma_handle_t *dmah_sg;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   745
	drm_dma_handle_t *dmah_gart; /* Handle to PCI memory */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   746
} drm_sg_mem_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   747
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   748
typedef TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig) drm_vbl_sig_list_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   749
typedef struct drm_vbl_sig {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   750
	TAILQ_ENTRY(drm_vbl_sig) link;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   751
	unsigned int	sequence;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   752
	int		signo;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   753
	int		pid;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   754
} drm_vbl_sig_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   755
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   756
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   757
/* used for clone device */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   758
typedef TAILQ_HEAD(drm_cminor_list, drm_cminor) drm_cminor_list_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   759
typedef struct drm_cminor {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   760
	TAILQ_ENTRY(drm_cminor) link;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   761
	drm_file_t		*fpriv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   762
	int			minor;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   763
} drm_cminor_t;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   764
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   765
/* location of GART table */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   766
#define	DRM_ATI_GART_MAIN	1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   767
#define	DRM_ATI_GART_FB		2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   768
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   769
typedef struct ati_pcigart_info {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   770
	int gart_table_location;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   771
	int is_pcie;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   772
	void *addr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   773
	dma_addr_t bus_addr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   774
	drm_local_map_t mapping;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   775
} drm_ati_pcigart_info;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   776
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   777
/* Size of ringbuffer for vblank timestamps. Just double-buffer
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   778
 * in initial implementation.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   779
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   780
#define DRM_VBLANKTIME_RBSIZE 2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   781
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   782
/* Flags and return codes for get_vblank_timestamp() driver function. */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   783
#define DRM_CALLED_FROM_VBLIRQ 1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   784
#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   785
#define DRM_VBLANKTIME_INVBL             (1 << 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   786
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   787
/* get_scanout_position() return flags */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   788
#define DRM_SCANOUTPOS_VALID        (1 << 0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   789
#define DRM_SCANOUTPOS_INVBL        (1 << 1)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   790
#define DRM_SCANOUTPOS_ACCURATE     (1 << 2)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   791
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   792
/* DRM device structure */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   793
struct drm_device;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   794
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   795
struct drm_bus {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   796
	int bus_type;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   797
	int (*get_irq)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   798
	const char *(*get_name)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   799
	int (*set_busid)(struct drm_device *dev, struct drm_master *master);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   800
	int (*set_unique)(struct drm_device *dev, struct drm_master *master,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   801
			  struct drm_unique *unique);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   802
	int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   803
	/* hooks that are for PCI */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   804
	int (*agp_init)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   805
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   806
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   807
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   808
struct drm_driver {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   809
	int (*load)(struct drm_device *, unsigned long);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   810
	int (*firstopen)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   811
	int (*open)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   812
	void (*preclose)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   813
	void (*postclose)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   814
	void (*lastclose)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   815
	int (*unload)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   816
	void (*reclaim_buffers_locked)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   817
	int (*presetup)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   818
	int (*postsetup)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   819
	int (*open_helper)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   820
	void (*free_filp_priv)(struct drm_device *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   821
	void (*release)(struct drm_device *, void *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   822
	int (*dma_ioctl)(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   823
	int (*dma_quiescent)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   824
	int (*dma_flush_block_and_flush)(struct drm_device *,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   825
			int, drm_lock_flags_t);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   826
	int (*dma_flush_unblock)(struct drm_device *, int,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   827
					drm_lock_flags_t);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   828
	int (*context_dtor)(struct drm_device *, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   829
	int (*device_is_agp) (struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   830
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   831
	/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   832
	 * Called by vblank timestamping code.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   833
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   834
	 * Return the current display scanout position from a crtc.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   835
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   836
	 * \param dev  DRM device.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   837
	 * \param crtc Id of the crtc to query.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   838
	 * \param *vpos Target location for current vertical scanout position.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   839
	 * \param *hpos Target location for current horizontal scanout position.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   840
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   841
	 * Returns vpos as a positive number while in active scanout area.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   842
	 * Returns vpos as a negative number inside vblank, counting the number
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   843
	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   844
	 * until start of active scanout / end of vblank."
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   845
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   846
	 * \return Flags, or'ed together as follows:
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   847
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   848
	 * DRM_SCANOUTPOS_VALID = Query successfull.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   849
	 * DRM_SCANOUTPOS_INVBL = Inside vblank.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   850
	 * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   851
	 * this flag means that returned position may be offset by a constant
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   852
	 * but unknown small number of scanlines wrt. real scanout position.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   853
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   854
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   855
	int (*get_scanout_position) (struct drm_device *dev, int crtc,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   856
				     int *vpos, int *hpos);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   857
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   858
	/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   859
	 * Called by \c drm_get_last_vbltimestamp. Should return a precise
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   860
	 * timestamp when the most recent VBLANK interval ended or will end.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   861
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   862
	 * Specifically, the timestamp in @vblank_time should correspond as
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   863
	 * closely as possible to the time when the first video scanline of
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   864
	 * the video frame after the end of VBLANK will start scanning out,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   865
	 * the time immmediately after end of the VBLANK interval. If the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   866
	 * @crtc is currently inside VBLANK, this will be a time in the future.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   867
	 * If the @crtc is currently scanning out a frame, this will be the
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   868
	 * past start time of the current scanout. This is meant to adhere
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   869
	 * to the OpenML OML_sync_control extension specification.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   870
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   871
	 * \param dev dev DRM device handle.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   872
	 * \param crtc crtc for which timestamp should be returned.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   873
	 * \param *max_error Maximum allowable timestamp error in nanoseconds.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   874
	 *                   Implementation should strive to provide timestamp
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   875
	 *                   with an error of at most *max_error nanoseconds.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   876
	 *                   Returns true upper bound on error for timestamp.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   877
	 * \param *vblank_time Target location for returned vblank timestamp.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   878
	 * \param flags 0 = Defaults, no special treatment needed.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   879
	 * \param       DRM_CALLED_FROM_VBLIRQ = Function is called from vblank
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   880
	 *	        irq handler. Some drivers need to apply some workarounds
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   881
	 *              for gpu-specific vblank irq quirks if flag is set.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   882
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   883
	 * \returns
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   884
	 * Zero if timestamping isn't supported in current display mode or a
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   885
	 * negative number on failure. A positive status code on success,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   886
	 * which describes how the vblank_time timestamp was computed.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   887
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   888
	int (*get_vblank_timestamp) (struct drm_device *dev, int crtc,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   889
				     int *max_error,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   890
				     struct timeval *vblank_time,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   891
				     unsigned flags);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   892
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   893
	void (*irq_preinstall)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   894
	int (*irq_postinstall)(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   895
	void (*irq_uninstall)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   896
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   897
	uint_t (*irq_handler)(DRM_IRQ_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   898
	int (*vblank_wait)(struct drm_device *, unsigned int *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   899
	int (*vblank_wait2)(struct drm_device *, unsigned int *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   900
	/* added for intel minimized vblank */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   901
	u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   902
	int (*enable_vblank)(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   903
	void (*disable_vblank)(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   904
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   905
	/* Master routines */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   906
	int (*master_create)(struct drm_device *dev, struct drm_master *master);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   907
	void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   908
	/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   909
	 * master_set is called whenever the minor master is set.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   910
	 * master_drop is called whenever the minor master is dropped.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   911
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   912
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   913
	int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   914
			  bool from_open);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   915
	void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   916
			    bool from_release);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   917
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   918
	void (*entervt)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   919
	void (*leavevt)(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   920
	void (*agp_support_detect)(struct drm_device *dev, unsigned long flags);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   921
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   922
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   923
	 * Driver-specific constructor for drm_gem_objects, to set up
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   924
	 * obj->driver_private.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   925
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   926
	 * Returns 0 on success.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   927
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   928
	int (*gem_init_object) (struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   929
	void (*gem_free_object) (struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   930
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   931
	int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   932
	void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   933
	void (*gem_fault) (struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   934
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   935
	/* vga arb irq handler */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   936
	void (*vgaarb_irq)(struct drm_device *dev, bool state);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   937
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   938
	/* dumb alloc support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   939
	int (*dumb_create)(struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   940
			   struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   941
			   struct drm_mode_create_dumb *args);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   942
	int (*dumb_map_offset)(struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   943
			       struct drm_device *dev, uint32_t handle,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   944
			       uint64_t *offset);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   945
	int (*dumb_destroy)(struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   946
			    struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   947
			    uint32_t handle);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   948
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   949
	int major;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   950
	int minor;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   951
	int patchlevel;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   952
	char *name;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   953
	char *desc;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   954
	char *date;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   955
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   956
	u32 driver_features;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   957
	drm_ioctl_desc_t *ioctls;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   958
	int num_ioctls;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   959
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   960
	int	buf_priv_size;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   961
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   962
	unsigned use_agp :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   963
	unsigned require_agp :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   964
	unsigned use_sg :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   965
	unsigned use_dma :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   966
	unsigned use_pci_dma :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   967
	unsigned use_dma_queue :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   968
	unsigned use_irq :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   969
	unsigned use_vbl_irq :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   970
	unsigned use_vbl_irq2 :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   971
	unsigned use_mtrr :1;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   972
	unsigned use_gem;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   973
	unsigned use_kms;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   974
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   975
	struct drm_pci_id_list *id_table;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   976
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   977
#include "drm_crtc.h"
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   978
struct drm_master {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   979
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   980
	struct kref refcount; /* refcount for this master */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   981
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   982
	struct list_head head; /**< each minor contains a list of masters */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   983
	struct drm_minor *minor; /**< link back to minor we are a master for */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   984
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   985
	char *unique;			/**< Unique identifier: e.g., busid */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   986
	int unique_len;			/**< Length of unique field */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   987
	int unique_size;		/**< amount allocated */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   988
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   989
	int blocked;			/**< Blocked due to VC switch? */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   990
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   991
	/** \name Authentication */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   992
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   993
	drm_magic_head_t magiclist[DRM_HASH_SIZE];
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   994
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   995
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   996
	struct drm_lock_data lock;	/**< Information on hardware lock */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   997
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   998
	void *driver_priv; /**< Private structure for driver to use */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
   999
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1000
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1001
struct drm_minor {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1002
	int index;			/**< Minor device number */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1003
	int type;                       /**< Control or render */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1004
	dev_t device;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1005
	struct drm_device *dev;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1006
	struct drm_master *master; /* currently active master for this node */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1007
	struct list_head master_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1008
	struct drm_mode_group mode_group;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1009
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1010
	char name[32];
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1011
	struct idr clone_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1012
	void *private;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1013
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1014
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1015
/* mode specified on the command line */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1016
struct drm_cmdline_mode {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1017
	bool specified;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1018
	bool refresh_specified;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1019
	bool bpp_specified;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1020
	int xres, yres;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1021
	int bpp;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1022
	int refresh;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1023
	bool rb;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1024
	bool interlace;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1025
	bool cvt;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1026
	bool margins;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1027
	enum drm_connector_force force;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1028
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1029
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1030
struct drm_pending_vblank_event {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1031
	struct drm_pending_event base;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1032
	int pipe;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1033
	struct drm_event_vblank event;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1034
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1035
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1036
struct drm_file {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1037
	TAILQ_ENTRY(drm_file) link;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1038
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1039
	int authenticated;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1040
	pid_t pid;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1041
	uid_t uid;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1042
	drm_magic_t magic;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1043
	unsigned long ioctl_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1044
	struct list_head lhead;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1045
	struct drm_minor *minor;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1046
	unsigned long lock_count;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1047
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1048
	/** Mapping of mm object handles to object pointers. */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1049
	struct idr_list object_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1050
	/** Lock for synchronization of access to object_idr. */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1051
	spinlock_t table_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1052
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1053
	void *driver_priv;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1054
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1055
	int is_master; /* this file private is a master for a minor */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1056
	struct drm_master *master; /* master this node is currently associated with
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1057
				      N.B. not always minor->master */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1058
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1059
	/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1060
	 * fbs - List of framebuffers associated with this file.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1061
	 *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1062
	 * Protected by fbs_lock. Note that the fbs list holds a reference on
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1063
	 * the fb object to prevent it from untimely disappearing.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1064
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1065
	struct list_head fbs;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1066
	struct mutex fbs_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1067
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1068
	wait_queue_head_t event_wait;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1069
	struct list_head event_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1070
	int event_space;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1071
	struct pollhead drm_pollhead;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1072
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1073
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1074
/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1075
 * hardware-specific code needs to initialize mutexes which
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1076
 * can be used in interrupt context, so they need to know
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1077
 * the interrupt priority. Interrupt cookie in drm_device
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1078
 * structure is the intr_block field.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1079
 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1080
#define	DRM_INTR_PRI(dev) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1081
	DDI_INTR_PRI((dev)->pdev->intr_block)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1082
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1083
struct drm_device {
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1084
	int if_version;			/**< Highest interface version set */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1085
	
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1086
	/** \name Locks */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1087
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1088
	spinlock_t count_lock;		/**< For inuse, drm_device::open_count, drm_device::buf_use */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1089
	kmutex_t struct_mutex;		/* < For others	*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1090
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1091
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1092
	/** \name Usage Counters */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1093
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1094
	int open_count;			/**< Outstanding files open */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1095
	atomic_t ioctl_count;		/**< Outstanding IOCTLs pending */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1096
	int buf_use;			/**< Buffers in use -- cannot alloc */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1097
	atomic_t buf_alloc;		/**< Buffer allocation in progress */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1098
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1099
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1100
	/** \name Performance counters */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1101
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1102
	unsigned long counters;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1103
	enum drm_stat_type types[15];
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1104
	atomic_t counts[15];
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1105
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1106
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1107
	struct list_head filelist;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1108
	
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1109
	/** \name Memory management */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1110
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1111
	struct list_head maplist;	/**< Linked list of regions */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1112
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1113
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1114
	/** \name Context handle management */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1115
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1116
	struct list_head ctxlist;	/**< Linked list of context handles */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1117
	int ctx_count;			/**< Number of context handles */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1118
	struct mutex ctxlist_mutex;	/**< For ctxlist */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1119
	
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1120
	struct idr ctx_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1121
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1122
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1123
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1124
	/** \name DMA queues (contexts) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1125
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1126
	struct drm_device_dma *dma;		/**< Optional pointer for DMA support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1127
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1128
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1129
	/** \name Context support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1130
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1131
	int irq_enabled;		/* True if the irq handler is enabled */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1132
	atomic_t context_flag;		/* Context swapping flag */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1133
	wait_queue_head_t context_wait;	/**< Processes waiting on ctx switch */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1134
	int last_context;		/* Last current context */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1135
	unsigned long last_switch;	/**< jiffies at last context switch */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1136
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1137
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1138
	struct workqueue_struct *drm_wq;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1139
	struct work_struct work;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1140
	/** \name VBLANK IRQ support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1141
	/*@{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1142
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1143
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1144
	 * At load time, disabling the vblank interrupt won't be allowed since
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1145
	 * old clients may not call the modeset ioctl and therefore misbehave.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1146
	 * Once the modeset ioctl *has* been called though, we can safely
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1147
	 * disable them when unused.
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1148
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1149
	int vblank_disable_allowed;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1150
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1151
	wait_queue_head_t *vbl_queue;   /**< VBLANK wait queue */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1152
	atomic_t *_vblank_count;        /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1153
	struct timeval *_vblank_time;   /**< timestamp of current vblank_count (drivers must alloc right number of fields) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1154
	spinlock_t vblank_time_lock;    /**< Protects vblank count and time updates during vblank enable/disable */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1155
	spinlock_t vbl_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1156
	atomic_t *vblank_refcount;      /* number of users of vblank interruptsper crtc */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1157
	u32 *last_vblank;               /* protected by dev->vbl_lock, used */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1158
					/* for wraparound handling */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1159
	int *vblank_enabled;            /* so we don't call enable more than
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1160
					   once per disable */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1161
	int *vblank_inmodeset;          /* Display driver is setting mode */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1162
	u32 *last_vblank_wait;		/* Last vblank seqno waited per CRTC */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1163
	struct timer_list vblank_disable_timer;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1164
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1165
	u32 max_vblank_count;           /**< size of vblank counter register */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1166
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1167
	/**
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1168
	  * List of events
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1169
	  */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1170
	struct list_head vblank_event_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1171
	spinlock_t event_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1172
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1173
	/*@} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1174
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1175
	struct drm_agp_head *agp;	/**< AGP data */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1176
	ulong_t	agp_aperbase;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1177
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1178
	struct device *dev;             /**< Device structure */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1179
	struct pci_dev *pdev;		/**< PCI device structure */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1180
	int pci_vendor;			/**< PCI vendor id */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1181
	int pci_device;			/**< PCI device id */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1182
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1183
	struct drm_sg_mem *sg;	/**< Scatter gather memory */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1184
	unsigned int num_crtcs;                  /**< Number of CRTCs on this device */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1185
	void *dev_private;		/**< device private data */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1186
	void *mm_private;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1187
	struct drm_driver *driver;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1188
	struct drm_local_map *agp_buffer_map;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1189
	unsigned int agp_buffer_token;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1190
	struct drm_minor *control;		/**< Control node for card */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1191
	struct drm_minor *primary;		/**< render type primary screen head */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1192
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1193
	struct drm_mode_config mode_config;	/**< Current mode config */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1194
	struct work_struct	output_poll_work;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1195
	struct timer_list	output_poll_timer;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1196
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1197
	/* \name GEM information */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1198
	/* @{ */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1199
	kmutex_t object_name_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1200
	struct idr_list object_name_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1201
	/* @} */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1202
	int switch_power_state;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1203
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1204
	/* OSOL Begin*/
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1205
	dev_info_t *devinfo;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1206
	struct drm_minor *vgatext;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1207
	struct drm_minor *agpmaster;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1208
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1209
	struct idr map_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1210
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1211
	/* Locks */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1212
	kmutex_t dma_lock;		/* protects dev->dma */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1213
	kmutex_t irq_lock;		/* protects irq condition checks */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1214
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1215
	kmutex_t page_fault_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1216
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1217
	kstat_t *asoft_ksp;		/* kstat support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1218
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1219
	struct list_head gem_objects_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1220
	spinlock_t track_lock;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1221
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1222
	uint32_t *old_gtt;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1223
	size_t	old_gtt_size;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1224
	uint32_t *gtt_dump;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1225
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1226
	/*
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1227
	 * FMA capabilities
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1228
	 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1229
	int	drm_fm_cap;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1230
	/* OSOL End */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1231
};
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1232
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1233
#define DRM_SWITCH_POWER_ON 0
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1234
#define DRM_SWITCH_POWER_OFF 1
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1235
#define DRM_SWITCH_POWER_CHANGING 2
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1236
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1237
static __inline__ int drm_core_check_feature(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1238
					     int feature)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1239
{
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1240
	return ((dev->driver->driver_features & feature) ? 1 : 0);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1241
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1242
#if __OS_HAS_AGP
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1243
static inline int drm_core_has_AGP(struct drm_device *dev)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1244
{
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1245
	return drm_core_check_feature(dev, DRIVER_USE_AGP);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1246
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1247
#else
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1248
#define drm_core_has_AGP(dev) (0)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1249
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1250
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1251
extern struct idr drm_minors_idr;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1252
extern struct cb_ops drm_cb_ops;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1253
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1254
void	*drm_alloc(size_t, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1255
void	*drm_calloc(size_t, size_t, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1256
void	*drm_realloc(void *, size_t, size_t, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1257
void	drm_free(void *, size_t, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1258
int 	drm_ioremap(drm_device_t *, drm_local_map_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1259
void	drm_ioremapfree(drm_local_map_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1260
void *drm_sun_ioremap(uint64_t paddr, size_t size, uint32_t mode);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1261
void drm_sun_iounmap(void *addr);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1262
void drm_core_ioremap(struct drm_local_map *, struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1263
void drm_core_ioremapfree(struct drm_local_map *, struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1264
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1265
void drm_pci_free(drm_dma_handle_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1266
void *drm_pci_alloc(drm_device_t *, size_t, size_t, dma_addr_t, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1267
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1268
int	drm_ctxbitmap_init(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1269
void	drm_ctxbitmap_cleanup(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1270
void	drm_ctxbitmap_free(drm_device_t *, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1271
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1272
/* Locking IOCTL support (drm_lock.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1273
int drm_lock_take(struct drm_lock_data *, unsigned int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1274
int drm_lock_free(struct drm_lock_data *, unsigned int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1275
int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1276
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1277
/* Buffer management support (drm_bufs.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1278
extern int drm_map_handle(struct drm_device *dev, struct drm_map_list *list);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1279
unsigned long drm_get_resource_start(drm_device_t *, unsigned int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1280
unsigned long drm_get_resource_len(drm_device_t *, unsigned int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1281
int	drm_initmap(drm_device_t *, unsigned long, unsigned long,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1282
    unsigned int, int, int);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1283
extern int drm_rmmap(struct drm_device *, struct drm_local_map *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1284
extern int drm_addmap(struct drm_device *, unsigned long, unsigned long,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1285
    enum drm_map_type, enum drm_map_flags, struct drm_local_map **);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1286
int	drm_order(unsigned long);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1287
int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1288
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1289
/* DMA support (drm_dma.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1290
int	drm_dma_setup(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1291
void	drm_dma_takedown(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1292
void	drm_free_buffer(drm_device_t *, drm_buf_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1293
void	drm_core_reclaim_buffers(drm_device_t *, drm_file_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1294
#define	drm_reclaim_buffers  drm_core_reclaim_buffers
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1295
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1296
/* IRQ support (drm_irq.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1297
int	drm_irq_install(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1298
int	drm_irq_uninstall(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1299
uint_t	drm_irq_handler(DRM_IRQ_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1300
void	drm_driver_irq_preinstall(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1301
void	drm_driver_irq_postinstall(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1302
void	drm_driver_irq_uninstall(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1303
int	drm_vblank_wait(drm_device_t *, unsigned int *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1304
u32	drm_vblank_count(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1305
u32	drm_vblank_count_and_time(struct drm_device *dev, int crtc,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1306
				     struct timeval *vblanktime);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1307
extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1308
				     struct drm_pending_vblank_event *e);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1309
bool	drm_handle_vblank(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1310
int	drm_vblank_get(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1311
void	drm_vblank_put(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1312
void   drm_vblank_off(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1313
extern void drm_vblank_off(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1314
int	drm_vblank_init(struct drm_device *dev, int num_crtcs);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1315
void	drm_vblank_cleanup(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1316
u32	drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1317
				     struct timeval *tvblank, unsigned flags);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1318
int	drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1319
						 int crtc, int *max_error,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1320
						 struct timeval *vblank_time,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1321
						 unsigned flags,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1322
						 struct drm_crtc *refcrtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1323
void	drm_calc_timestamping_constants(struct drm_crtc *crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1324
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1325
extern struct drm_display_mode *
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1326
drm_mode_create_from_cmdline_mode(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1327
				  struct drm_cmdline_mode *cmd);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1328
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1329
/* Modesetting support */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1330
int    drm_modeset_ctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1331
void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1332
void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1333
int pci_enable_msi(struct pci_dev *pdev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1334
void pci_disable_msi(struct pci_dev *pdev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1335
/* AGP/GART support (drm_agpsupport.h) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1336
extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1337
extern int drm_agp_acquire(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1338
extern int drm_agp_acquire_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1339
extern int drm_agp_release(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1340
extern int drm_agp_release_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1341
extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1342
extern int drm_agp_enable_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1343
extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1344
extern int drm_agp_info_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1345
extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1346
extern int drm_agp_alloc_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1347
extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1348
extern int drm_agp_free_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1349
extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1350
extern int drm_agp_unbind_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1351
extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1352
extern int drm_agp_bind_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1353
extern void *drm_agp_allocate_memory(size_t pages, uint32_t type, struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1354
extern int drm_agp_free_memory(agp_allocate_t *handle, drm_device_t *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1355
extern int drm_agp_bind_memory(unsigned int, uint32_t, drm_device_t *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1356
extern int drm_agp_unbind_memory(unsigned long, drm_device_t *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1357
extern void drm_agp_chipset_flush(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1358
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1359
extern void drm_agp_cleanup(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1360
extern int drm_agp_bind_pages(struct drm_device *dev, pfn_t *pages,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1361
		unsigned long num_pages, uint32_t gtt_offset, unsigned int agp_type);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1362
extern int drm_agp_unbind_pages(struct drm_device *dev, pfn_t *pages,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1363
		unsigned long num_pages, uint32_t gtt_offset, pfn_t scratch, uint32_t type);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1364
extern int drm_agp_rw_gtt(struct drm_device *dev, unsigned long num_pages,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1365
		uint32_t gtt_offset, void *gttp, uint32_t type);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1366
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1367
/* kstat support (drm_kstats.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1368
int	drm_init_kstats(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1369
void	drm_fini_kstats(drm_device_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1370
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1371
/* Scatter Gather Support (drm_scatter.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1372
extern void drm_sg_cleanup(drm_sg_mem_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1373
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1374
/* ATI PCIGART support (ati_pcigart.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1375
int	drm_ati_pcigart_init(drm_device_t *, drm_ati_pcigart_info *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1376
int	drm_ati_pcigart_cleanup(drm_device_t *, drm_ati_pcigart_info *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1377
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1378
				/* Locking IOCTL support (drm_lock.h) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1379
extern int drm_lock(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1380
extern int drm_unlock(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1381
extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1382
extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1383
extern void drm_idlelock_take(struct drm_lock_data *lock_data);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1384
extern void drm_idlelock_release(struct drm_lock_data *lock_data);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1385
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1386
int	drm_setversion(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1387
struct drm_local_map *drm_getsarea(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1388
/* Cache management (drm_cache.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1389
void drm_clflush_pages(caddr_t *pages, unsigned long num_pages);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1390
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1391
/* Misc. IOCTL support (drm_ioctl.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1392
int	drm_irq_by_busid(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1393
int	drm_getunique(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1394
int	drm_setunique(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1395
int	drm_getmap(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1396
int	drm_getclient(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1397
int	drm_getstats(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1398
int	drm_getcap(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1399
int	drm_noop(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1400
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1401
/* Context IOCTL support (drm_context.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1402
int	drm_resctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1403
int	drm_addctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1404
int	drm_modctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1405
int	drm_getctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1406
int	drm_switchctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1407
int	drm_newctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1408
int	drm_rmctx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1409
int	drm_setsareactx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1410
int	drm_getsareactx(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1411
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1412
/* Drawable IOCTL support (drm_drawable.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1413
int	drm_adddraw(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1414
int	drm_rmdraw(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1415
int	drm_update_drawable_info(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1416
struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1417
						  drm_drawable_t id);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1418
void drm_drawable_free_all(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1419
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1420
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1421
				/* Authentication IOCTL support (drm_auth.h) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1422
int	drm_getmagic(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1423
int	drm_authmagic(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1424
int	drm_remove_magic(struct drm_master *master, drm_magic_t magic);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1425
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1426
/* Buffer management support (drm_bufs.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1427
int	drm_addmap_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1428
int	drm_rmmap_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1429
int	drm_addbufs(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1430
int	drm_infobufs(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1431
int	drm_markbufs(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1432
int	drm_freebufs(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1433
int	drm_mapbufs(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1434
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1435
/* IRQ support (drm_irq.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1436
int	drm_control(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1437
int	drm_wait_vblank(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1438
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1439
/* Scatter Gather Support (drm_scatter.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1440
int	drm_sg_alloc_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1441
int	drm_sg_free(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1442
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1443
extern int drm_debug_flag;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1444
extern int mdb_track_enable;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1445
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1446
extern struct list_head drm_iomem_list;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1447
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1448
#define MDB_TRACK_ENABLE	mdb_track_enable
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1449
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1450
#define TRACE_GEM_OBJ_HISTORY(obj, str)					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1451
do {									\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1452
	if (MDB_TRACK_ENABLE) {						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1453
		int seq_t = 0;						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1454
		if (obj->ring)						\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1455
			seq_t = obj->ring->get_seqno(obj->ring, true);	\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1456
		drm_gem_object_track(&obj->base, str,			\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1457
			seq_t, 0,					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1458
			(void *)obj->ring);				\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1459
	}								\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1460
} while (*"\0")
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1461
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1462
/* We add function to support DRM_DEBUG,DRM_ERROR,DRM_INFO */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1463
/* PRINTFLIKE4 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1464
extern void drm_debug_print(int cmn_err, const char* func, int line, const char *fmt, ...);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1465
/* PRINTFLIKE1 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1466
extern void drm_debug(const char *fmt, ...);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1467
/* PRINTFLIKE1 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1468
extern void drm_error(const char *fmt, ...);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1469
/* PRINTFLIKE1 */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1470
extern void drm_info(const char *fmt, ...);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1471
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1472
#ifdef DEBUG
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1473
#define	DRM_DEBUG(...)                                          \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1474
	do {                                                    \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1475
		if (drm_debug_flag & 0x08)                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1476
			drm_debug_print(                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1477
			    CE_NOTE, __func__, __LINE__, ##__VA_ARGS__);  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1478
	} while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1479
#define DRM_DEBUG_KMS(...)					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1480
	do {                                                    \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1481
		if (drm_debug_flag & 0x04)                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1482
			drm_debug_print(                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1483
			    CE_NOTE, __func__, __LINE__, ##__VA_ARGS__);  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1484
	} while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1485
#define DRM_DEBUG_DRIVER(...)					\
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1486
	do {                                                    \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1487
		if (drm_debug_flag & 0x02)                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1488
			drm_debug_print(                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1489
			    CE_NOTE, __func__, __LINE__, ##__VA_ARGS__);  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1490
	} while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1491
#define	DRM_INFO(...)                                           \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1492
	do {                                                    \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1493
		if (drm_debug_flag & 0x01)                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1494
			drm_debug_print(                        \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1495
			    CE_NOTE, __func__, __LINE__, ##__VA_ARGS__);  \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1496
	} while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1497
#else
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1498
#define	DRM_DEBUG(...)		do { } while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1499
#define DRM_DEBUG_KMS(...)	do { } while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1500
#define DRM_DEBUG_DRIVER(...)	do { } while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1501
#define	DRM_INFO(...)		do { } while (__lintzero)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1502
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1503
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1504
#define	DRM_ERROR(...) \
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1505
	drm_debug_print(CE_WARN, __func__, __LINE__, ##__VA_ARGS__)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1506
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1507
#define DRM_LOG_KMS       DRM_INFO
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1508
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1509
extern int drm_lastclose(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1510
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1511
extern int drm_open(struct drm_minor *, int, int, cred_t *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1512
extern int drm_release(struct drm_file *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1513
extern ssize_t drm_read(struct drm_file *, struct uio *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1514
extern short drm_poll(struct drm_file *, short);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1515
extern int drm_init(struct drm_device *, struct drm_driver *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1516
extern void drm_exit(struct drm_device *);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1517
extern void drm_fm_init(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1518
extern void drm_fm_fini(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1519
extern void drm_fm_ereport(struct drm_device *dev, char *detail);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1520
extern int drm_check_dma_handle(struct drm_device *dev, ddi_dma_handle_t handle);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1521
extern int drm_check_acc_handle(struct drm_device *dev, ddi_acc_handle_t handle);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1522
extern int drm_ioctl(dev_t dev_id, struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1523
	int cmd, intptr_t arg, int mode, cred_t *credp);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1524
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1525
extern int drm_put_minor(struct drm_minor **minor_p);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1526
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1527
extern int drm_setmaster_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1528
extern int drm_dropmaster_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1529
extern struct drm_master *drm_master_create(struct drm_minor *minor);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1530
extern struct drm_master *drm_master_get(struct drm_master *master);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1531
extern void drm_master_put(struct drm_master **master);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1532
extern int drm_get_dev(struct drm_device *dev, struct pci_dev *pdev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1533
	struct drm_driver *driver, unsigned long driver_data);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1534
extern void drm_put_dev(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1535
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1536
void drm_master_release(struct drm_device *dev, struct drm_file *fpriv);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1537
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1538
extern unsigned int drm_vblank_offdelay;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1539
extern unsigned int drm_timestamp_precision;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1540
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1541
/* sysfs support (drm_sysfs.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1542
extern int drm_sysfs_device_add(struct drm_minor *minor);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1543
extern void drm_sysfs_device_remove(struct drm_minor *minor);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1544
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1545
/* Graphics Execution Manager library functions (drm_gem.c) */
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1546
int drm_gem_init(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1547
void drm_gem_destroy(struct drm_device *dev);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1548
void drm_gem_object_release(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1549
void drm_gem_object_free(struct kref *kref);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1550
void drm_gem_object_free_unlocked(struct kref *kref);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1551
struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1552
					    size_t size);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1553
int drm_gem_object_init(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1554
			struct drm_gem_object *obj, size_t size, int gen);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1555
int drm_gem_private_object_init(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1556
			struct drm_gem_object *obj, size_t size);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1557
void drm_gem_object_handle_free(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1558
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1559
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1560
drm_gem_object_reference(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1561
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1562
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1563
drm_gem_object_unreference(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1564
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1565
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1566
drm_gem_object_unreference_unlocked(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1567
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1568
int drm_gem_handle_create(struct drm_file *file_priv,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1569
			  struct drm_gem_object *obj,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1570
			  u32 *handlep);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1571
int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1572
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1573
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1574
drm_gem_object_handle_reference(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1575
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1576
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1577
drm_gem_object_handle_unreference(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1578
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1579
extern void
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1580
drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1581
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1582
struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1583
					     struct drm_file *filp,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1584
					     u32 handle);
1684
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
  1585
int drm_gem_dumb_destroy(struct drm_file *file,
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
  1586
                         struct drm_device *dev,
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
  1587
                         uint32_t handle);
9f5a5146d91f 25177273 Enable dumb_create in i915
Randy Fishel <Randy.Fishel@Oracle.COM>
parents: 1637
diff changeset
  1588
1494
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1589
int drm_gem_close_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1590
int drm_gem_flink_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1591
int drm_gem_open_ioctl(DRM_IOCTL_ARGS);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1592
void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1593
void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1594
int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1595
void drm_gem_mmap(struct drm_gem_object *obj, pfn_t pfn);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1596
void drm_gem_release_mmap(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1597
void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1598
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1599
extern struct drm_local_map *drm_core_findmap(struct drm_device *dev,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1600
							 unsigned int token);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1601
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1602
#ifdef NEVER
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1603
static __inline__ int drm_device_is_pcie(struct drm_device *dev)
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1604
{
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1605
	return 0;
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1606
}
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1607
#endif
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1608
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1609
void drm_gem_object_track(struct drm_gem_object *obj, const char *name,
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1610
			uint32_t cur_seq, uint32_t last_seq, void* ptr);
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1611
a72f39592745 PSARC 2014/148 Move DRM drivers to X11
Randy Fishel <Randy.Fishel@Oracle.COM>
parents:
diff changeset
  1612
#endif	/* _DRMP_H */