4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 PathScale Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __PSCNV_CHAN_H__
28 #define __PSCNV_CHAN_H__
31 #include "pscnv_ramht.h"
32 #include "pscnv_engine.h"
35 extern uint64_t nvc0_fifo_ctrl_offs(struct drm_device
*dev
, int cid
);
38 struct drm_device
*dev
;
40 /* protected by ch_lock below, used for lookup */
42 struct pscnv_vspace
*vspace
;
43 struct list_head vspace_list
;
47 struct pscnv_ramht ramht
;
49 struct pscnv_bo
*cache
;
50 struct drm_file
*filp
;
52 void *engdata
[PSCNV_ENGINES_NUM
];
55 struct pscnv_chan_engine
{
56 void (*takedown
) (struct drm_device
*dev
);
57 int (*do_chan_new
) (struct pscnv_chan
*ch
);
58 void (*do_chan_free
) (struct pscnv_chan
*ch
);
59 struct pscnv_chan
*fake_chans
[4];
60 struct pscnv_chan
*chans
[128];
65 extern struct pscnv_chan
*pscnv_chan_new(struct drm_device
*dev
, struct pscnv_vspace
*, int fake
);
67 extern void pscnv_chan_ref_free(struct kref
*ref
);
69 static inline void pscnv_chan_ref(struct pscnv_chan
*ch
) {
73 static inline void pscnv_chan_unref(struct pscnv_chan
*ch
) {
74 kref_put(&ch
->ref
, pscnv_chan_ref_free
);
77 extern int pscnv_chan_mmap(struct file
*filp
, struct vm_area_struct
*vma
);
78 extern int pscnv_chan_handle_lookup(struct drm_device
*dev
, uint32_t handle
);
80 int nv50_chan_init(struct drm_device
*dev
);
81 int nvc0_chan_init(struct drm_device
*dev
);