Re: [Nouveau] [PATCH v2] drm/nouveau: bring back blit subchannel for pre nv50 GPUs
On Fri, 26 May 2023 at 19:11, Karol Herbst wrote: > > 1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 > was important as otherwise the GPU spams us with `CACHE_ERROR` messages. > > We use the blit subchannel inside our vblank handling, so we should keep > at least this part. > > v2: Only do it for NV11+ GPUs > > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/201 > Fixes: 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers") > Signed-off-by: Karol Herbst Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/nouveau_chan.c | 1 + > drivers/gpu/drm/nouveau/nouveau_chan.h | 1 + > drivers/gpu/drm/nouveau/nouveau_drm.c | 20 +--- > 3 files changed, 19 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c > b/drivers/gpu/drm/nouveau/nouveau_chan.c > index e648ecd0c1a0..3dfbc374478e 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_chan.c > +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c > @@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) > if (cli) > nouveau_svmm_part(chan->vmm->svmm, chan->inst); > > + nvif_object_dtor(>blit); > nvif_object_dtor(>nvsw); > nvif_object_dtor(>gart); > nvif_object_dtor(>vram); > diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.h > b/drivers/gpu/drm/nouveau/nouveau_chan.h > index e06a8ffed31a..bad7466bd0d5 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_chan.h > +++ b/drivers/gpu/drm/nouveau/nouveau_chan.h > @@ -53,6 +53,7 @@ struct nouveau_channel { > u32 user_put; > > struct nvif_object user; > + struct nvif_object blit; > > struct nvif_event kill; > atomic_t killed; > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c > b/drivers/gpu/drm/nouveau/nouveau_drm.c > index cc7c5b4a05fd..9512f1c2f871 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_drm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c > @@ -369,15 +369,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm) > ret = nvif_object_ctor(>channel->user, "drmNvsw", >NVDRM_NVSW, nouveau_abi16_swclass(drm), >NULL, 0, >channel->nvsw); > + > + if (ret == 0 && device->info.chipset >= 0x11) { > + ret = nvif_object_ctor(>channel->user, "drmBlit", > + 0x005f, 0x009f, > + NULL, 0, >channel->blit); > + } > + > if (ret == 0) { > struct nvif_push *push = drm->channel->chan.push; > - ret = PUSH_WAIT(push, 2); > - if (ret == 0) > + ret = PUSH_WAIT(push, 8); > + if (ret == 0) { > + if (device->info.chipset >= 0x11) { > + PUSH_NVSQ(push, NV05F, 0x, > drm->channel->blit.handle); > + PUSH_NVSQ(push, NV09F, 0x0120, 0, > + 0x0124, 1, > + 0x0128, 2); > + } > PUSH_NVSQ(push, NV_SW, 0x, > drm->channel->nvsw.handle); > + } > } > > if (ret) { > - NV_ERROR(drm, "failed to allocate sw class, %d\n", > ret); > + NV_ERROR(drm, "failed to allocate sw or blit class, > %d\n", ret); > nouveau_accel_gr_fini(drm); > return; > } > -- > 2.40.1 >
Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
On Thu, 13 Jul 2023 at 05:31, Dave Airlie wrote: > > On Tue, 23 May 2023 at 19:37, Karol Herbst wrote: > > > > On Mon, May 22, 2023 at 10:18 PM Karol Herbst wrote: > > > > > > This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary > > > firmware files couldn't be loaded. > > > > > > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212 > > > Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support") > > > Signed-off-by: Karol Herbst > > > --- > > > drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > > b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > > index 795f3a649b12..6388234c352c 100644 > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > > @@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev) > > > u64 falcons; > > > int ret, i; > > > > > > - if (list_empty(>hsfw)) { > > > + if (list_empty(>hsfw) || !acr->func->wpr_layout) { > > > > Now thinking about this, it should probably also check acr->func... > > with that fixed if you think you need it, I don't *think* you do. I believe modprobe will fail for any case it can be NULL. > > Reviewed-by: Dave Airlie > > > > > > nvkm_debug(subdev, "No HSFW(s)\n"); > > > nvkm_acr_cleanup(acr); > > > return 0; > > > -- > > > 2.40.1 > > > > >
Re: [Nouveau] [PATCH] drm/nouveau/acr: Abort loading ACR if no firmware was found
On Tue, 23 May 2023 at 19:37, Karol Herbst wrote: > > On Mon, May 22, 2023 at 10:18 PM Karol Herbst wrote: > > > > This fixes a NULL pointer access inside nvkm_acr_oneinit in case necessary > > firmware files couldn't be loaded. > > > > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/212 > > Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support") > > Signed-off-by: Karol Herbst > > --- > > drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > index 795f3a649b12..6388234c352c 100644 > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c > > @@ -224,7 +224,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev) > > u64 falcons; > > int ret, i; > > > > - if (list_empty(>hsfw)) { > > + if (list_empty(>hsfw) || !acr->func->wpr_layout) { > > Now thinking about this, it should probably also check acr->func... with that fixed if you think you need it, Reviewed-by: Dave Airlie > > > nvkm_debug(subdev, "No HSFW(s)\n"); > > nvkm_acr_cleanup(acr); > > return 0; > > -- > > 2.40.1 > > >
[Nouveau] [PATCH RFC v1 26/52] drm/nouveau: Use struct drm_crtc::drm_dev instead of struct drm_crtc::dev
Prepare dropping the alias "dev" for struct drm_crtc::drm_dev. "drm_dev" is the better name as "dev" is usually a struct device pointer. No semantic changes. Signed-off-by: Uwe Kleine-König --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 58 +++-- drivers/gpu/drm/nouveau/dispnv04/cursor.c | 10 ++-- drivers/gpu/drm/nouveau/dispnv50/atom.h | 2 +- drivers/gpu/drm/nouveau/dispnv50/crc.c | 30 +-- drivers/gpu/drm/nouveau/dispnv50/crc907d.c | 6 +-- drivers/gpu/drm/nouveau/dispnv50/crcc37d.c | 6 +-- drivers/gpu/drm/nouveau/dispnv50/crcc57d.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 5 +- drivers/gpu/drm/nouveau/dispnv50/head.c | 4 +- drivers/gpu/drm/nouveau/dispnv50/head507d.c | 26 - drivers/gpu/drm/nouveau/dispnv50/head827d.c | 10 ++-- drivers/gpu/drm/nouveau/dispnv50/head907d.c | 26 - drivers/gpu/drm/nouveau/dispnv50/head917d.c | 6 +-- drivers/gpu/drm/nouveau/dispnv50/headc37d.c | 18 +++ drivers/gpu/drm/nouveau/dispnv50/headc57d.c | 10 ++-- drivers/gpu/drm/nouveau/nouveau_connector.h | 2 +- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 17 files changed, 113 insertions(+), 110 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index a6f2e681bde9..fad5c6dc2cf7 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -56,18 +56,18 @@ nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, static void crtc_wr_cio_state(struct drm_crtc *crtc, struct nv04_crtc_reg *crtcstate, int index) { - NVWriteVgaCrtc(crtc->dev, nouveau_crtc(crtc)->index, index, + NVWriteVgaCrtc(crtc->drm_dev, nouveau_crtc(crtc)->index, index, crtcstate->CRTC[index]); } static void nv_crtc_set_digital_vibrance(struct drm_crtc *crtc, int level) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nv04_crtc_reg *regp = _display(dev)->mode_reg.crtc_reg[nv_crtc->index]; regp->CRTC[NV_CIO_CRE_CSB] = nv_crtc->saturation = level; - if (nv_crtc->saturation && nv_gf4_disp_arch(crtc->dev)) { + if (nv_crtc->saturation && nv_gf4_disp_arch(crtc->drm_dev)) { regp->CRTC[NV_CIO_CRE_CSB] = 0x80; regp->CRTC[NV_CIO_CRE_5B] = nv_crtc->saturation << 2; crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_5B); @@ -78,14 +78,15 @@ static void nv_crtc_set_digital_vibrance(struct drm_crtc *crtc, int level) static void nv_crtc_set_image_sharpening(struct drm_crtc *crtc, int level) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nv04_crtc_reg *regp = _display(dev)->mode_reg.crtc_reg[nv_crtc->index]; nv_crtc->sharpness = level; if (level < 0) /* blur is in hw range 0x3f -> 0x20 */ level += 0x40; regp->ramdac_634 = level; - NVWriteRAMDAC(crtc->dev, nv_crtc->index, NV_PRAMDAC_634, regp->ramdac_634); + NVWriteRAMDAC(crtc->drm_dev, nv_crtc->index, NV_PRAMDAC_634, + regp->ramdac_634); } #define PLLSEL_VPLL1_MASK \ @@ -116,7 +117,7 @@ static void nv_crtc_set_image_sharpening(struct drm_crtc *crtc, int level) static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mode * mode, int dot_clock) { - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_bios *bios = nvxx_bios(>client.device); struct nvkm_clk *clk = nvxx_clk(>client.device); @@ -175,7 +176,7 @@ static void nv_crtc_dpms(struct drm_crtc *crtc, int mode) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nouveau_drm *drm = nouveau_drm(dev); unsigned char seq1 = 0, crtc17 = 0; unsigned char crtc1A; @@ -236,7 +237,7 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) static void nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) { - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nv04_crtc_reg *regp = _display(dev)->mode_reg.crtc_reg[nv_crtc->index]; struct drm_framebuffer *fb = crtc->primary->fb; @@ -460,7 +461,7 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) static void nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) { - struct drm_device *dev = crtc->dev; + struct drm_device *dev = crtc->drm_dev; struct nouveau_drm *drm = nouveau_drm(dev); struct
[Nouveau] [PATCH] drm/nouveau: remove spaces after '*'
Fix four occurrences of the checkpatch.pl error: ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Ran Sun --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index a6f2e681bde9..5ef84f4749e1 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -114,7 +114,7 @@ static void nv_crtc_set_image_sharpening(struct drm_crtc *crtc, int level) * bits 28-31: related to single stage mode? (bit 8/12) */ -static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mode * mode, int dot_clock) +static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mode *mode, int dot_clock) { struct drm_device *dev = crtc->dev; struct nouveau_drm *drm = nouveau_drm(dev); @@ -458,7 +458,7 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) * be easily turned on/off after this. */ static void -nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) +nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode *mode) { struct drm_device *dev = crtc->dev; struct nouveau_drm *drm = nouveau_drm(dev);