2 * Copyright 2012 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
25 #include <engine/disp.h>
27 #include <core/event.h>
28 #include <core/class.h>
30 struct nv04_disp_priv
{
31 struct nouveau_disp base
;
34 static struct nouveau_oclass
35 nv04_disp_sclass
[] = {
36 { NV04_DISP_CLASS
, &nouveau_object_ofuncs
},
40 /*******************************************************************************
41 * Display engine implementation
42 ******************************************************************************/
45 nv04_disp_vblank_enable(struct nouveau_event
*event
, int head
)
47 nv_wr32(event
->priv
, 0x600140 + (head
* 0x2000) , 0x00000001);
51 nv04_disp_vblank_disable(struct nouveau_event
*event
, int head
)
53 nv_wr32(event
->priv
, 0x600140 + (head
* 0x2000) , 0x00000000);
57 nv04_disp_intr(struct nouveau_subdev
*subdev
)
59 struct nv04_disp_priv
*priv
= (void *)subdev
;
60 u32 crtc0
= nv_rd32(priv
, 0x600100);
61 u32 crtc1
= nv_rd32(priv
, 0x602100);
63 if (crtc0
& 0x00000001) {
64 nouveau_event_trigger(priv
->base
.vblank
, 0);
65 nv_wr32(priv
, 0x600100, 0x00000001);
68 if (crtc1
& 0x00000001) {
69 nouveau_event_trigger(priv
->base
.vblank
, 1);
70 nv_wr32(priv
, 0x602100, 0x00000001);
75 nv04_disp_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
76 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
77 struct nouveau_object
**pobject
)
79 struct nv04_disp_priv
*priv
;
82 ret
= nouveau_disp_create(parent
, engine
, oclass
, 2, "DISPLAY",
84 *pobject
= nv_object(priv
);
88 nv_engine(priv
)->sclass
= nv04_disp_sclass
;
89 nv_subdev(priv
)->intr
= nv04_disp_intr
;
90 priv
->base
.vblank
->priv
= priv
;
91 priv
->base
.vblank
->enable
= nv04_disp_vblank_enable
;
92 priv
->base
.vblank
->disable
= nv04_disp_vblank_disable
;
98 .handle
= NV_ENGINE(DISP
, 0x04),
99 .ofuncs
= &(struct nouveau_ofuncs
) {
100 .ctor
= nv04_disp_ctor
,
101 .dtor
= _nouveau_disp_dtor
,
102 .init
= _nouveau_disp_init
,
103 .fini
= _nouveau_disp_fini
,
This page took 0.093639 seconds and 5 git commands to generate.