Re: [Nouveau] [PATCH v2] drm/nouveau: bring back blit subchannel for pre nv50 GPUs

2023-05-26 Thread Ilia Mirkin
On Fri, May 26, 2023 at 5:11 AM 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 
> ---
>  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) {

Can you double-check that this is needed on NV15? IIRC there's some
non-linearity of chipsets here which is why we had (some long time
ago, not sure if it's still there), a chip class which would simplify
such checks.

Cheers,

  -ilia


[Nouveau] [PATCH v2] drm/nouveau: bring back blit subchannel for pre nv50 GPUs

2023-05-26 Thread Karol Herbst
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 
---
 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: Remove unnecessary (void*) conversions

2023-05-26 Thread Christian König

Am 26.05.23 um 05:32 schrieb Su Hui:

Pointer variables of (void*) type do not require type cast.


Please split that up by subsystem/driver. Taking it through the misc 
tree might just cause merge conflicts.


Christian.



Signed-off-by: Su Hui 
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +-
  drivers/gpu/drm/amd/pm/amdgpu_pm.c| 2 +-
  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 ++--
  drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +-
  drivers/gpu/drm/omapdrm/omap_debugfs.c| 6 +++---
  drivers/gpu/drm/pl111/pl111_debugfs.c | 2 +-
  drivers/gpu/drm/qxl/qxl_debugfs.c | 4 ++--
  drivers/gpu/drm/tiny/arcpgu.c | 2 +-
  drivers/gpu/drm/ttm/ttm_resource.c| 3 +--
  drivers/gpu/drm/virtio/virtgpu_debugfs.c  | 6 +++---
  drivers/gpu/drm/vmwgfx/ttm_object.c   | 5 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_gem.c   | 2 +-
  12 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 827fcb4fb3b3..8a2c39927167 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -3312,7 +3312,7 @@ static ssize_t dtn_log_write(
  
  static int mst_topo_show(struct seq_file *m, void *unused)

  {
-   struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+   struct amdgpu_device *adev = m->private;
struct drm_device *dev = adev_to_drm(adev);
struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 58c2246918fd..e6c870bd307b 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -3671,7 +3671,7 @@ static void amdgpu_parse_cg_state(struct seq_file *m, u64 
flags)
  
  static int amdgpu_debugfs_pm_info_show(struct seq_file *m, void *unused)

  {
-   struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
+   struct amdgpu_device *adev = m->private;
struct drm_device *dev = adev_to_drm(adev);
u64 flags = 0;
int r;
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 31a7f59ccb49..dd57f7164e9a 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -198,7 +198,7 @@ static int etnaviv_ring_show(struct etnaviv_gpu *gpu, 
struct seq_file *m)
  
  static int show_unlocked(struct seq_file *m, void *arg)

  {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
+   struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
int (*show)(struct drm_device *dev, struct seq_file *m) =
node->info_ent->data;
@@ -208,7 +208,7 @@ static int show_unlocked(struct seq_file *m, void *arg)
  
  static int show_each_gpu(struct seq_file *m, void *arg)

  {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
+   struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
struct etnaviv_drm_private *priv = dev->dev_private;
struct etnaviv_gpu *gpu;
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c 
b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 2a36d1ca8fda..96b59d5d68ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -37,7 +37,7 @@
  static int
  nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
  {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
+   struct drm_info_node *node = m->private;
struct nouveau_drm *drm = nouveau_drm(node->minor->dev);
int i;
  
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c

index a3d470468e5b..a94ce502e152 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -19,7 +19,7 @@
  
  static int gem_show(struct seq_file *m, void *arg)

  {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
+   struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
struct omap_drm_private *priv = dev->dev_private;
  
@@ -33,7 +33,7 @@ static int gem_show(struct seq_file *m, void *arg)
  
  static int mm_show(struct seq_file *m, void *arg)

  {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
+   struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
struct drm_printer p = drm_seq_file_printer(m);
  
@@ -45,7 +45,7 @@ static int mm_show(struct seq_file *m, void *arg)

  #ifdef