Skip to content

Commit 9c1c08a

Browse files
author
Ben Skeggs
committed
drm/nouveau/disp/gv100-: expose capabilities class
Signed-off-by: Ben Skeggs <[email protected]>
1 parent b950c8c commit 9c1c08a

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed

drivers/gpu/drm/nouveau/include/nvif/class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
#define GV100_DISP /* cl5070.h */ 0x0000c370
9090
#define TU102_DISP /* cl5070.h */ 0x0000c570
9191

92+
#define GV100_DISP_CAPS 0x0000c373
93+
9294
#define NV31_MPEG 0x00003174
9395
#define G82_MPEG 0x00008274
9496

drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ nvkm-y += nvkm/engine/disp/rootgp102.o
7474
nvkm-y += nvkm/engine/disp/rootgv100.o
7575
nvkm-y += nvkm/engine/disp/roottu102.o
7676

77+
nvkm-y += nvkm/engine/disp/capsgv100.o
78+
7779
nvkm-y += nvkm/engine/disp/channv50.o
7880
nvkm-y += nvkm/engine/disp/changf119.o
7981
nvkm-y += nvkm/engine/disp/changv100.o
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2020 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+
#define gv100_disp_caps(p) container_of((p), struct gv100_disp_caps, object)
23+
#include "rootnv50.h"
24+
25+
struct gv100_disp_caps {
26+
struct nvkm_object object;
27+
struct nv50_disp *disp;
28+
};
29+
30+
static int
31+
gv100_disp_caps_map(struct nvkm_object *object, void *argv, u32 argc,
32+
enum nvkm_object_map *type, u64 *addr, u64 *size)
33+
{
34+
struct gv100_disp_caps *caps = gv100_disp_caps(object);
35+
struct nvkm_device *device = caps->disp->base.engine.subdev.device;
36+
*type = NVKM_OBJECT_MAP_IO;
37+
*addr = 0x640000 + device->func->resource_addr(device, 0);
38+
*size = 0x1000;
39+
return 0;
40+
}
41+
42+
static const struct nvkm_object_func
43+
gv100_disp_caps = {
44+
.map = gv100_disp_caps_map,
45+
};
46+
47+
int
48+
gv100_disp_caps_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
49+
struct nv50_disp *disp, struct nvkm_object **pobject)
50+
{
51+
struct gv100_disp_caps *caps;
52+
53+
if (!(caps = kzalloc(sizeof(*caps), GFP_KERNEL)))
54+
return -ENOMEM;
55+
*pobject = &caps->object;
56+
57+
nvkm_object_ctor(&gv100_disp_caps, oclass, &caps->object);
58+
caps->disp = disp;
59+
return 0;
60+
}

drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgv100.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
static const struct nv50_disp_root_func
2828
gv100_disp_root = {
2929
.user = {
30+
{{-1,-1,GV100_DISP_CAPS }, gv100_disp_caps_new },
3031
{{0,0,GV100_DISP_CURSOR }, gv100_disp_curs_new },
3132
{{0,0,GV100_DISP_WINDOW_IMM_CHANNEL_DMA}, gv100_disp_wimm_new },
3233
{{0,0,GV100_DISP_CORE_CHANNEL_DMA }, gv100_disp_core_new },

drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ int nv50_disp_root_new_(const struct nv50_disp_root_func *, struct nvkm_disp *,
2424
const struct nvkm_oclass *, void *data, u32 size,
2525
struct nvkm_object **);
2626

27+
int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32,
28+
struct nv50_disp *, struct nvkm_object **);
29+
2730
extern const struct nvkm_disp_oclass nv50_disp_root_oclass;
2831
extern const struct nvkm_disp_oclass g84_disp_root_oclass;
2932
extern const struct nvkm_disp_oclass g94_disp_root_oclass;

drivers/gpu/drm/nouveau/nvkm/engine/disp/roottu102.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
static const struct nv50_disp_root_func
2828
tu102_disp_root = {
2929
.user = {
30+
{{-1,-1,GV100_DISP_CAPS }, gv100_disp_caps_new },
3031
{{0,0,TU102_DISP_CURSOR }, gv100_disp_curs_new },
3132
{{0,0,TU102_DISP_WINDOW_IMM_CHANNEL_DMA}, gv100_disp_wimm_new },
3233
{{0,0,TU102_DISP_CORE_CHANNEL_DMA }, gv100_disp_core_new },

0 commit comments

Comments
 (0)