Skip to content

Commit 918b73d

Browse files
committed
Merge branch 'linux-5.8' of git://github.com/skeggsb/linux into drm-next
- HD audio fixes on recent systems - vGPU detection (fail probe if we're on one, for now) - Interlaced mode fixes (mostly avoidance on Turing, which doesn't support it) - SVM improvements/fixes - NVIDIA format modifier support - Misc other fixes. Signed-off-by: Dave Airlie <[email protected]> From: Ben Skeggs <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ <CACAvsv6DcRFMDVEftdL7LxNtxuSQQ=qnfqdHXO0K=BmJ8Q2-+g@mail.gmail.com
2 parents 5f0ed4f + dc455f4 commit 918b73d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1312
-630
lines changed

drivers/gpu/drm/nouveau/Kbuild

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
NOUVEAU_PATH ?= $(srctree)
2+
13
# SPDX-License-Identifier: MIT
2-
ccflags-y += -I $(srctree)/$(src)/include
3-
ccflags-y += -I $(srctree)/$(src)/include/nvkm
4-
ccflags-y += -I $(srctree)/$(src)/nvkm
5-
ccflags-y += -I $(srctree)/$(src)
4+
ccflags-y += -I $(NOUVEAU_PATH)/$(src)/include
5+
ccflags-y += -I $(NOUVEAU_PATH)/$(src)/include/nvkm
6+
ccflags-y += -I $(NOUVEAU_PATH)/$(src)/nvkm
7+
ccflags-y += -I $(NOUVEAU_PATH)/$(src)
68

79
# NVKM - HW resource manager
810
#- code also used by various userspace tools/tests

drivers/gpu/drm/nouveau/dispnv04/crtc.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,16 @@ static int
605605
nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb)
606606
{
607607
struct nv04_display *disp = nv04_display(crtc->dev);
608-
struct nouveau_framebuffer *nvfb = nouveau_framebuffer(crtc->primary->fb);
608+
struct drm_framebuffer *fb = crtc->primary->fb;
609+
struct nouveau_bo *nvbo = nouveau_gem_object(fb->obj[0]);
609610
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
610611
int ret;
611612

612-
ret = nouveau_bo_pin(nvfb->nvbo, TTM_PL_FLAG_VRAM, false);
613+
ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM, false);
613614
if (ret == 0) {
614615
if (disp->image[nv_crtc->index])
615616
nouveau_bo_unpin(disp->image[nv_crtc->index]);
616-
nouveau_bo_ref(nvfb->nvbo, &disp->image[nv_crtc->index]);
617+
nouveau_bo_ref(nvbo, &disp->image[nv_crtc->index]);
617618
}
618619

619620
return ret;
@@ -822,8 +823,8 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
822823
struct drm_device *dev = crtc->dev;
823824
struct nouveau_drm *drm = nouveau_drm(dev);
824825
struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index];
826+
struct nouveau_bo *nvbo;
825827
struct drm_framebuffer *drm_fb;
826-
struct nouveau_framebuffer *fb;
827828
int arb_burst, arb_lwm;
828829

829830
NV_DEBUG(drm, "index %d\n", nv_crtc->index);
@@ -839,13 +840,12 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
839840
*/
840841
if (atomic) {
841842
drm_fb = passed_fb;
842-
fb = nouveau_framebuffer(passed_fb);
843843
} else {
844844
drm_fb = crtc->primary->fb;
845-
fb = nouveau_framebuffer(crtc->primary->fb);
846845
}
847846

848-
nv_crtc->fb.offset = fb->nvbo->bo.offset;
847+
nvbo = nouveau_gem_object(drm_fb->obj[0]);
848+
nv_crtc->fb.offset = nvbo->bo.offset;
849849

850850
if (nv_crtc->lut.depth != drm_fb->format->depth) {
851851
nv_crtc->lut.depth = drm_fb->format->depth;
@@ -1143,8 +1143,9 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
11431143
const int swap_interval = (flags & DRM_MODE_PAGE_FLIP_ASYNC) ? 0 : 1;
11441144
struct drm_device *dev = crtc->dev;
11451145
struct nouveau_drm *drm = nouveau_drm(dev);
1146-
struct nouveau_bo *old_bo = nouveau_framebuffer(crtc->primary->fb)->nvbo;
1147-
struct nouveau_bo *new_bo = nouveau_framebuffer(fb)->nvbo;
1146+
struct drm_framebuffer *old_fb = crtc->primary->fb;
1147+
struct nouveau_bo *old_bo = nouveau_gem_object(old_fb->obj[0]);
1148+
struct nouveau_bo *new_bo = nouveau_gem_object(fb->obj[0]);
11481149
struct nv04_page_flip_state *s;
11491150
struct nouveau_channel *chan;
11501151
struct nouveau_cli *cli;

drivers/gpu/drm/nouveau/dispnv04/disp.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "nouveau_encoder.h"
3131
#include "nouveau_connector.h"
3232
#include "nouveau_bo.h"
33+
#include "nouveau_gem.h"
3334

3435
#include <nvif/if0004.h>
3536

@@ -52,13 +53,13 @@ nv04_display_fini(struct drm_device *dev, bool suspend)
5253

5354
/* Un-pin FB and cursors so they'll be evicted to system memory. */
5455
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
55-
struct nouveau_framebuffer *nouveau_fb;
56+
struct drm_framebuffer *fb = crtc->primary->fb;
57+
struct nouveau_bo *nvbo;
5658

57-
nouveau_fb = nouveau_framebuffer(crtc->primary->fb);
58-
if (!nouveau_fb || !nouveau_fb->nvbo)
59+
if (!fb || !fb->obj[0])
5960
continue;
60-
61-
nouveau_bo_unpin(nouveau_fb->nvbo);
61+
nvbo = nouveau_gem_object(fb->obj[0]);
62+
nouveau_bo_unpin(nvbo);
6263
}
6364

6465
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -104,13 +105,13 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime)
104105

105106
/* Re-pin FB/cursors. */
106107
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
107-
struct nouveau_framebuffer *nouveau_fb;
108+
struct drm_framebuffer *fb = crtc->primary->fb;
109+
struct nouveau_bo *nvbo;
108110

109-
nouveau_fb = nouveau_framebuffer(crtc->primary->fb);
110-
if (!nouveau_fb || !nouveau_fb->nvbo)
111+
if (!fb || !fb->obj[0])
111112
continue;
112-
113-
ret = nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM, true);
113+
nvbo = nouveau_gem_object(fb->obj[0]);
114+
ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM, true);
114115
if (ret)
115116
NV_ERROR(drm, "Could not pin framebuffer\n");
116117
}

drivers/gpu/drm/nouveau/dispnv04/overlay.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "nouveau_bo.h"
3232
#include "nouveau_connector.h"
3333
#include "nouveau_display.h"
34+
#include "nouveau_gem.h"
3435
#include "nvreg.h"
3536
#include "disp.h"
3637

@@ -120,9 +121,9 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
120121
struct nvif_object *dev = &drm->client.device.object;
121122
struct nouveau_plane *nv_plane =
122123
container_of(plane, struct nouveau_plane, base);
123-
struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
124124
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
125125
struct nouveau_bo *cur = nv_plane->cur;
126+
struct nouveau_bo *nvbo;
126127
bool flip = nv_plane->flip;
127128
int soff = NV_PCRTC0_SIZE * nv_crtc->index;
128129
int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index;
@@ -140,17 +141,18 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
140141
if (ret)
141142
return ret;
142143

143-
ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM, false);
144+
nvbo = nouveau_gem_object(fb->obj[0]);
145+
ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM, false);
144146
if (ret)
145147
return ret;
146148

147-
nv_plane->cur = nv_fb->nvbo;
149+
nv_plane->cur = nvbo;
148150

149151
nvif_mask(dev, NV_PCRTC_ENGINE_CTRL + soff, NV_CRTC_FSEL_OVERLAY, NV_CRTC_FSEL_OVERLAY);
150152
nvif_mask(dev, NV_PCRTC_ENGINE_CTRL + soff2, NV_CRTC_FSEL_OVERLAY, 0);
151153

152154
nvif_wr32(dev, NV_PVIDEO_BASE(flip), 0);
153-
nvif_wr32(dev, NV_PVIDEO_OFFSET_BUFF(flip), nv_fb->nvbo->bo.offset);
155+
nvif_wr32(dev, NV_PVIDEO_OFFSET_BUFF(flip), nvbo->bo.offset);
154156
nvif_wr32(dev, NV_PVIDEO_SIZE_IN(flip), src_h << 16 | src_w);
155157
nvif_wr32(dev, NV_PVIDEO_POINT_IN(flip), src_y << 16 | src_x);
156158
nvif_wr32(dev, NV_PVIDEO_DS_DX(flip), (src_w << 20) / crtc_w);
@@ -172,7 +174,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
172174
if (format & NV_PVIDEO_FORMAT_PLANAR) {
173175
nvif_wr32(dev, NV_PVIDEO_UVPLANE_BASE(flip), 0);
174176
nvif_wr32(dev, NV_PVIDEO_UVPLANE_OFFSET_BUFF(flip),
175-
nv_fb->nvbo->bo.offset + fb->offsets[1]);
177+
nvbo->bo.offset + fb->offsets[1]);
176178
}
177179
nvif_wr32(dev, NV_PVIDEO_FORMAT(flip), format | fb->pitches[0]);
178180
nvif_wr32(dev, NV_PVIDEO_STOP, 0);
@@ -368,8 +370,8 @@ nv04_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
368370
struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object;
369371
struct nouveau_plane *nv_plane =
370372
container_of(plane, struct nouveau_plane, base);
371-
struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
372373
struct nouveau_bo *cur = nv_plane->cur;
374+
struct nouveau_bo *nvbo;
373375
uint32_t overlay = 1;
374376
int brightness = (nv_plane->brightness - 512) * 62 / 512;
375377
int ret, i;
@@ -384,19 +386,20 @@ nv04_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
384386
if (ret)
385387
return ret;
386388

387-
ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM, false);
389+
nvbo = nouveau_gem_object(fb->obj[0]);
390+
ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM, false);
388391
if (ret)
389392
return ret;
390393

391-
nv_plane->cur = nv_fb->nvbo;
394+
nv_plane->cur = nvbo;
392395

393396
nvif_wr32(dev, NV_PVIDEO_OE_STATE, 0);
394397
nvif_wr32(dev, NV_PVIDEO_SU_STATE, 0);
395398
nvif_wr32(dev, NV_PVIDEO_RM_STATE, 0);
396399

397400
for (i = 0; i < 2; i++) {
398401
nvif_wr32(dev, NV_PVIDEO_BUFF0_START_ADDRESS + 4 * i,
399-
nv_fb->nvbo->bo.offset);
402+
nvbo->bo.offset);
400403
nvif_wr32(dev, NV_PVIDEO_BUFF0_PITCH_LENGTH + 4 * i,
401404
fb->pitches[0]);
402405
nvif_wr32(dev, NV_PVIDEO_BUFF0_OFFSET + 4 * i, 0);

drivers/gpu/drm/nouveau/dispnv50/base507c.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
263263
struct nv50_disp_base_channel_dma_v0 args = {
264264
.head = head,
265265
};
266-
struct nv50_disp *disp = nv50_disp(drm->dev);
266+
struct nouveau_display *disp = nouveau_display(drm->dev);
267+
struct nv50_disp *disp50 = nv50_disp(drm->dev);
267268
struct nv50_wndw *wndw;
268269
int ret;
269270

@@ -273,9 +274,9 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
273274
if (*pwndw = wndw, ret)
274275
return ret;
275276

276-
ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
277+
ret = nv50_dmac_create(&drm->client.device, &disp->disp.object,
277278
&oclass, head, &args, sizeof(args),
278-
disp->sync->bo.offset, &wndw->wndw);
279+
disp50->sync->bo.offset, &wndw->wndw);
279280
if (ret) {
280281
NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret);
281282
return ret;

drivers/gpu/drm/nouveau/dispnv50/core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __NV50_KMS_CORE_H__
33
#include "disp.h"
44
#include "atom.h"
5+
#include <nouveau_encoder.h>
56

67
struct nv50_core {
78
const struct nv50_core_func *func;
@@ -15,6 +16,7 @@ void nv50_core_del(struct nv50_core **);
1516
struct nv50_core_func {
1617
void (*init)(struct nv50_core *);
1718
void (*ntfy_init)(struct nouveau_bo *, u32 offset);
19+
int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
1820
int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
1921
struct nvif_device *);
2022
void (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
@@ -27,6 +29,9 @@ struct nv50_core_func {
2729
const struct nv50_outp_func {
2830
void (*ctrl)(struct nv50_core *, int or, u32 ctrl,
2931
struct nv50_head_atom *);
32+
/* XXX: Only used by SORs and PIORs for now */
33+
void (*get_caps)(struct nv50_disp *,
34+
struct nouveau_encoder *, int or);
3035
} *dac, *pior, *sor;
3136
};
3237

@@ -35,6 +40,7 @@ int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
3540
struct nv50_core **);
3641
void core507d_init(struct nv50_core *);
3742
void core507d_ntfy_init(struct nouveau_bo *, u32);
43+
int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
3844
int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
3945
void core507d_update(struct nv50_core *, u32 *, bool);
4046

@@ -51,6 +57,7 @@ extern const struct nv50_outp_func sor907d;
5157
int core917d_new(struct nouveau_drm *, s32, struct nv50_core **);
5258

5359
int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **);
60+
int corec37d_caps_init(struct nouveau_drm *, struct nv50_disp *);
5461
int corec37d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
5562
void corec37d_update(struct nv50_core *, u32 *, bool);
5663
void corec37d_wndw_owner(struct nv50_core *);

drivers/gpu/drm/nouveau/dispnv50/core507d.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ core507d_ntfy_init(struct nouveau_bo *bo, u32 offset)
6262
nouveau_bo_wr32(bo, offset / 4, 0x00000000);
6363
}
6464

65+
int
66+
core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
67+
{
68+
u32 *push = evo_wait(&disp->core->chan, 2);
69+
70+
if (push) {
71+
evo_mthd(push, 0x008c, 1);
72+
evo_data(push, 0x0);
73+
evo_kick(push, &disp->core->chan);
74+
}
75+
76+
return 0;
77+
}
78+
6579
void
6680
core507d_init(struct nv50_core *core)
6781
{
@@ -77,6 +91,7 @@ static const struct nv50_core_func
7791
core507d = {
7892
.init = core507d_init,
7993
.ntfy_init = core507d_ntfy_init,
94+
.caps_init = core507d_caps_init,
8095
.ntfy_wait_done = core507d_ntfy_wait_done,
8196
.update = core507d_update,
8297
.head = &head507d,

drivers/gpu/drm/nouveau/dispnv50/core827d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static const struct nv50_core_func
2626
core827d = {
2727
.init = core507d_init,
2828
.ntfy_init = core507d_ntfy_init,
29+
.caps_init = core507d_caps_init,
2930
.ntfy_wait_done = core507d_ntfy_wait_done,
3031
.update = core507d_update,
3132
.head = &head827d,

drivers/gpu/drm/nouveau/dispnv50/core907d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static const struct nv50_core_func
2626
core907d = {
2727
.init = core507d_init,
2828
.ntfy_init = core507d_ntfy_init,
29+
.caps_init = core507d_caps_init,
2930
.ntfy_wait_done = core507d_ntfy_wait_done,
3031
.update = core507d_update,
3132
.head = &head907d,

drivers/gpu/drm/nouveau/dispnv50/core917d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static const struct nv50_core_func
2626
core917d = {
2727
.init = core507d_init,
2828
.ntfy_init = core507d_ntfy_init,
29+
.caps_init = core507d_caps_init,
2930
.ntfy_wait_done = core507d_ntfy_wait_done,
3031
.update = core507d_update,
3132
.head = &head917d,

0 commit comments

Comments
 (0)