Skip to content

Commit 47c9136

Browse files
Ben Skeggsairlied
authored andcommitted
drm/nouveau/nvenc/tu102-: prepare for GSP-RM
- (temporarily) disable if GSP-RM detected, will be added later - provide empty class list for non-GSP paths - split tu102 from gm107, it will provide host classes later Signed-off-by: Ben Skeggs <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 796928c commit 47c9136

File tree

7 files changed

+46
-7
lines changed

7 files changed

+46
-7
lines changed

drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ struct nvkm_nvenc {
1212
};
1313

1414
int gm107_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
15+
int tu102_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
1516
#endif

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@ nv162_chipset = {
24272427
.fifo = { 0x00000001, tu102_fifo_new },
24282428
.gr = { 0x00000001, tu102_gr_new },
24292429
.nvdec = { 0x00000001, tu102_nvdec_new },
2430-
.nvenc = { 0x00000001, gm107_nvenc_new },
2430+
.nvenc = { 0x00000001, tu102_nvenc_new },
24312431
.sec2 = { 0x00000001, tu102_sec2_new },
24322432
};
24332433

@@ -2462,7 +2462,7 @@ nv164_chipset = {
24622462
.fifo = { 0x00000001, tu102_fifo_new },
24632463
.gr = { 0x00000001, tu102_gr_new },
24642464
.nvdec = { 0x00000003, tu102_nvdec_new },
2465-
.nvenc = { 0x00000001, gm107_nvenc_new },
2465+
.nvenc = { 0x00000001, tu102_nvenc_new },
24662466
.sec2 = { 0x00000001, tu102_sec2_new },
24672467
};
24682468

@@ -2497,7 +2497,7 @@ nv166_chipset = {
24972497
.fifo = { 0x00000001, tu102_fifo_new },
24982498
.gr = { 0x00000001, tu102_gr_new },
24992499
.nvdec = { 0x00000007, tu102_nvdec_new },
2500-
.nvenc = { 0x00000001, gm107_nvenc_new },
2500+
.nvenc = { 0x00000001, tu102_nvenc_new },
25012501
.sec2 = { 0x00000001, tu102_sec2_new },
25022502
};
25032503

@@ -2532,7 +2532,7 @@ nv167_chipset = {
25322532
.fifo = { 0x00000001, tu102_fifo_new },
25332533
.gr = { 0x00000001, tu102_gr_new },
25342534
.nvdec = { 0x00000001, tu102_nvdec_new },
2535-
.nvenc = { 0x00000001, gm107_nvenc_new },
2535+
.nvenc = { 0x00000001, tu102_nvenc_new },
25362536
.sec2 = { 0x00000001, tu102_sec2_new },
25372537
};
25382538

@@ -2567,7 +2567,7 @@ nv168_chipset = {
25672567
.fifo = { 0x00000001, tu102_fifo_new },
25682568
.gr = { 0x00000001, tu102_gr_new },
25692569
.nvdec = { 0x00000001, tu102_nvdec_new },
2570-
.nvenc = { 0x00000001, gm107_nvenc_new },
2570+
.nvenc = { 0x00000001, tu102_nvenc_new },
25712571
.sec2 = { 0x00000001, tu102_sec2_new },
25722572
};
25732573

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: MIT
22
nvkm-y += nvkm/engine/nvenc/base.o
33
nvkm-y += nvkm/engine/nvenc/gm107.o
4+
nvkm-y += nvkm/engine/nvenc/tu102.o

drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ nvkm_nvenc_dtor(struct nvkm_engine *engine)
3434
static const struct nvkm_engine_func
3535
nvkm_nvenc = {
3636
.dtor = nvkm_nvenc_dtor,
37+
.sclass = { {} },
3738
};
3839

3940
int
@@ -59,4 +60,4 @@ nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *fwif, struct nvkm_device *device,
5960

6061
return nvkm_falcon_ctor(nvenc->func->flcn, &nvenc->engine.subdev,
6162
nvenc->engine.subdev.name, 0, &nvenc->falcon);
62-
};
63+
}

drivers/gpu/drm/nouveau/nvkm/engine/nvenc/gm107.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ gm107_nvenc_nofw(struct nvkm_nvenc *nvenc, int ver,
3838
return 0;
3939
}
4040

41-
static const struct nvkm_nvenc_fwif
41+
const struct nvkm_nvenc_fwif
4242
gm107_nvenc_fwif[] = {
4343
{ -1, gm107_nvenc_nofw, &gm107_nvenc },
4444
{}

drivers/gpu/drm/nouveau/nvkm/engine/nvenc/priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ struct nvkm_nvenc_fwif {
1414
const struct nvkm_nvenc_func *func;
1515
};
1616

17+
extern const struct nvkm_nvenc_fwif gm107_nvenc_fwif[];
18+
1719
int nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
1820
int, struct nvkm_nvenc **pnvenc);
1921
#endif
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2023 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+
#include "priv.h"
23+
24+
#include <subdev/gsp.h>
25+
26+
int
27+
tu102_nvenc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
28+
struct nvkm_nvenc **pnvenc)
29+
{
30+
if (nvkm_gsp_rm(device->gsp))
31+
return -ENODEV;
32+
33+
return nvkm_nvenc_new_(gm107_nvenc_fwif, device, type, inst, pnvenc);
34+
}

0 commit comments

Comments
 (0)