Commit a143bc51 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge branch '00.06-gr-ampere' of https://gitlab.freedesktop.org/skeggsb/nouveau into drm-next



This is the pull request for a whole bunch of fixes and prep-work that
was done to support Ampere acceleration prior to GSP-RM being
available.  It uses the ACR firmware released by NVIDIA in
linux-firmware, as we do on earlier GPUs.  The work to support running
on top of GSP-RM also heavily depends on various pieces of this
series.

In addition to the new HW support, general stability of the driver
should be improved, especially around recovering HW from bugs that can
be generated by userspace driver components.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CABDvA==s+nZD0n7CuRWLPE=Pj+02CN13r+ZQJxoHQ_EmR+o=XQ@mail.gmail.com
parents 49e8e634 c4bdac75
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -54,10 +54,6 @@ nouveau-y += nouveau_bios.o
nouveau-y += nouveau_connector.o
nouveau-y += nouveau_display.o
nouveau-y += nouveau_dp.o
nouveau-y += nouveau_fbcon.o
nouveau-y += nv04_fbcon.o
nouveau-y += nv50_fbcon.o
nouveau-y += nvc0_fbcon.o
include $(src)/dispnv04/Kbuild
include $(src)/dispnv50/Kbuild

+16 −27
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
 * DEALINGS IN THE SOFTWARE.
 */
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_vblank.h>
@@ -37,7 +38,6 @@
#include "nouveau_crtc.h"
#include "hw.h"
#include "nvreg.h"
#include "nouveau_fbcon.h"
#include "disp.h"
#include "nouveau_dma.h"

@@ -761,7 +761,8 @@ static void nv_crtc_destroy(struct drm_crtc *crtc)
	nouveau_bo_unmap(nv_crtc->cursor.nvbo);
	nouveau_bo_unpin(nv_crtc->cursor.nvbo);
	nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo);
	nvif_notify_dtor(&nv_crtc->vblank);
	nvif_event_dtor(&nv_crtc->vblank);
	nvif_head_dtor(&nv_crtc->head);
	kfree(nv_crtc);
}

@@ -914,14 +915,6 @@ nv04_crtc_mode_set_base_atomic(struct drm_crtc *crtc,
			       struct drm_framebuffer *fb,
			       int x, int y, enum mode_set_atomic state)
{
	struct nouveau_drm *drm = nouveau_drm(crtc->dev);
	struct drm_device *dev = drm->dev;

	if (state == ENTER_ATOMIC_MODE_SET)
		nouveau_fbcon_accel_save_disable(dev);
	else
		nouveau_fbcon_accel_restore(dev);

	return nv04_crtc_do_mode_set_base(crtc, fb, x, y, true);
}

@@ -1080,10 +1073,10 @@ nv04_finish_page_flip(struct nouveau_channel *chan,
}

int
nv04_flip_complete(struct nvif_notify *notify)
nv04_flip_complete(struct nvif_event *event, void *argv, u32 argc)
{
	struct nouveau_cli *cli = (void *)notify->object->client;
	struct nouveau_drm *drm = cli->drm;
	struct nv04_display *disp = container_of(event, typeof(*disp), flip);
	struct nouveau_drm *drm = disp->drm;
	struct nouveau_channel *chan = drm->channel;
	struct nv04_page_flip_state state;

@@ -1094,7 +1087,7 @@ nv04_flip_complete(struct nvif_notify *notify)
				 state.bpp / 8);
	}

	return NVIF_NOTIFY_KEEP;
	return NVIF_EVENT_KEEP;
}

static int
@@ -1279,13 +1272,13 @@ static const struct drm_plane_funcs nv04_primary_plane_funcs = {
	DRM_PLANE_NON_ATOMIC_FUNCS,
};

static int nv04_crtc_vblank_handler(struct nvif_notify *notify)
static int
nv04_crtc_vblank_handler(struct nvif_event *event, void *repv, u32 repc)
{
	struct nouveau_crtc *nv_crtc =
		container_of(notify, struct nouveau_crtc, vblank);
	struct nouveau_crtc *nv_crtc = container_of(event, struct nouveau_crtc, vblank);

	drm_crtc_handle_vblank(&nv_crtc->base);
	return NVIF_NOTIFY_KEEP;
	return NVIF_EVENT_KEEP;
}

int
@@ -1341,14 +1334,10 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)

	nv04_cursor_init(nv_crtc);

	ret = nvif_notify_ctor(&disp->disp.object, "kmsVbl", nv04_crtc_vblank_handler,
			       false, NV04_DISP_NTFY_VBLANK,
			       &(struct nvif_notify_head_req_v0) {
				    .head = nv_crtc->index,
			       },
			       sizeof(struct nvif_notify_head_req_v0),
			       sizeof(struct nvif_notify_head_rep_v0),
			       &nv_crtc->vblank);

	ret = nvif_head_ctor(&disp->disp, nv_crtc->base.name, nv_crtc->index, &nv_crtc->head);
	if (ret)
		return ret;

	return nvif_head_vblank_event_ctor(&nv_crtc->head, "kmsVbl", nv04_crtc_vblank_handler,
					   false, &nv_crtc->vblank);
}
+9 −6
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend)
	struct drm_crtc *crtc;

	/* Disable flip completion events. */
	nvif_notify_put(&disp->flip);
	nvif_event_block(&disp->flip);

	/* Disable vblank interrupts. */
	NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
@@ -121,7 +121,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime)
		encoder->enc_save(&encoder->base.base);

	/* Enable flip completion events. */
	nvif_notify_get(&disp->flip);
	nvif_event_allow(&disp->flip);

	if (!resume)
		return 0;
@@ -202,7 +202,7 @@ nv04_display_destroy(struct drm_device *dev)

	nouveau_hw_save_vga_fonts(dev, 0);

	nvif_notify_dtor(&disp->flip);
	nvif_event_dtor(&disp->flip);

	nouveau_display(dev)->priv = NULL;
	vfree(disp);
@@ -227,6 +227,8 @@ nv04_display_create(struct drm_device *dev)
	if (!disp)
		return -ENOMEM;

	disp->drm = drm;

	nvif_object_map(&drm->client.device.object, NULL, 0);

	nouveau_display(dev)->priv = disp;
@@ -239,9 +241,10 @@ nv04_display_create(struct drm_device *dev)

	/* Request page flip completion event. */
	if (drm->channel) {
		nvif_notify_ctor(&drm->channel->nvsw, "kmsFlip", nv04_flip_complete,
				 false, NV04_NVSW_NTFY_UEVENT,
				 NULL, 0, 0, &disp->flip);
		ret = nvif_event_ctor(&drm->channel->nvsw, "kmsFlip", 0, nv04_flip_complete,
				      true, NULL, 0, &disp->flip);
		if (ret)
			return ret;
	}

	nouveau_hw_save_vga_fonts(dev, 1);
+5 −2
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@

#include "nouveau_display.h"

#include <nvif/event.h>

struct nouveau_encoder;

enum nv04_fp_display_regs {
@@ -84,7 +86,8 @@ struct nv04_display {
	uint32_t saved_vga_font[4][16384];
	uint32_t dac_users[4];
	struct nouveau_bo *image[2];
	struct nvif_notify flip;
	struct nvif_event flip;
	struct nouveau_drm *drm;
};

static inline struct nv04_display *
@@ -179,5 +182,5 @@ nouveau_bios_run_init_table(struct drm_device *dev, u16 table,
	);
}

int nv04_flip_complete(struct nvif_notify *);
int nv04_flip_complete(struct nvif_event *, void *, u32);
#endif
+1 −1
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ void nv50_crc_atomic_set(struct nv50_head *head,
	if (!outp)
		return;

	func->set_src(head, outp->or, nv50_crc_source_type(outp, asyh->crc.src),
	func->set_src(head, outp->outp.or.id, nv50_crc_source_type(outp, asyh->crc.src),
		      &crc->ctx[crc->ctx_idx]);
}

Loading