]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/nvc0_software.c
drm/nouveau/pageflip: kick flip handling out of engsw and into fence
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / nvc0_software.c
CommitLineData
20abd163
BS
1/*
2 * Copyright 2012 Red Hat Inc.
3 *
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:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
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.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include "drmP.h"
35bcf5d5 26
20abd163 27#include "nouveau_drv.h"
02a841d4 28#include <core/ramht.h>
20abd163
BS
29#include "nouveau_software.h"
30
35bcf5d5
BS
31#include "nv50_display.h"
32
20abd163
BS
33struct nvc0_software_priv {
34 struct nouveau_software_priv base;
35};
36
37struct nvc0_software_chan {
38 struct nouveau_software_chan base;
39};
40
41static int
42nvc0_software_context_new(struct nouveau_channel *chan, int engine)
43{
44 struct nvc0_software_chan *pch;
45
46 pch = kzalloc(sizeof(*pch), GFP_KERNEL);
47 if (!pch)
48 return -ENOMEM;
49
f589be88 50 nouveau_software_context_new(chan, &pch->base);
20abd163 51 chan->engctx[engine] = pch;
f589be88 52 return 0;
20abd163
BS
53}
54
55static void
56nvc0_software_context_del(struct nouveau_channel *chan, int engine)
57{
58 struct nvc0_software_chan *pch = chan->engctx[engine];
59 chan->engctx[engine] = NULL;
60 kfree(pch);
61}
62
63static int
64nvc0_software_object_new(struct nouveau_channel *chan, int engine,
65 u32 handle, u16 class)
66{
67 return 0;
68}
69
70static int
71nvc0_software_init(struct drm_device *dev, int engine)
72{
73 return 0;
74}
75
76static int
77nvc0_software_fini(struct drm_device *dev, int engine, bool suspend)
78{
79 return 0;
80}
81
82static void
83nvc0_software_destroy(struct drm_device *dev, int engine)
84{
85 struct nvc0_software_priv *psw = nv_engine(dev, engine);
86
87 NVOBJ_ENGINE_DEL(dev, SW);
88 kfree(psw);
89}
90
91int
92nvc0_software_create(struct drm_device *dev)
93{
94 struct nvc0_software_priv *psw = kzalloc(sizeof(*psw), GFP_KERNEL);
95 if (!psw)
96 return -ENOMEM;
97
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);
105
106 NVOBJ_ENGINE_ADD(dev, SW, &psw->base.base);
107 NVOBJ_CLASS(dev, 0x906e, SW);
108 return 0;
109}