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.
27 #include "nouveau_drv.h"
28 #include <core/ramht.h>
29 #include "nouveau_software.h"
31 #include "nv50_display.h"
33 struct nvc0_software_priv
{
34 struct nouveau_software_priv base
;
37 struct nvc0_software_chan
{
38 struct nouveau_software_chan base
;
42 nvc0_software_context_new(struct nouveau_channel
*chan
, int engine
)
44 struct nvc0_software_chan
*pch
;
46 pch
= kzalloc(sizeof(*pch
), GFP_KERNEL
);
50 nouveau_software_context_new(chan
, &pch
->base
);
51 chan
->engctx
[engine
] = pch
;
56 nvc0_software_context_del(struct nouveau_channel
*chan
, int engine
)
58 struct nvc0_software_chan
*pch
= chan
->engctx
[engine
];
59 chan
->engctx
[engine
] = NULL
;
64 nvc0_software_object_new(struct nouveau_channel
*chan
, int engine
,
65 u32 handle
, u16
class)
71 nvc0_software_init(struct drm_device
*dev
, int engine
)
77 nvc0_software_fini(struct drm_device
*dev
, int engine
, bool suspend
)
83 nvc0_software_destroy(struct drm_device
*dev
, int engine
)
85 struct nvc0_software_priv
*psw
= nv_engine(dev
, engine
);
87 NVOBJ_ENGINE_DEL(dev
, SW
);
92 nvc0_software_create(struct drm_device
*dev
)
94 struct nvc0_software_priv
*psw
= kzalloc(sizeof(*psw
), GFP_KERNEL
);
98 psw
->base
.base
.destroy
= nvc0_software_destroy
;
99 psw
->base
.base
.init
= nvc0_software_init
;
100 psw
->base
.base
.fini
= nvc0_software_fini
;
101 psw
->base
.base
.context_new
= nvc0_software_context_new
;
102 psw
->base
.base
.context_del
= nvc0_software_context_del
;
103 psw
->base
.base
.object_new
= nvc0_software_object_new
;
104 nouveau_software_create(&psw
->base
);
106 NVOBJ_ENGINE_ADD(dev
, SW
, &psw
->base
.base
);
107 NVOBJ_CLASS(dev
, 0x906e, SW
);