Commit 5e691222 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/kms/nv50-: convert core init() to new push macros



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 3afb4db7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
void nv50_core_del(struct nv50_core **);

struct nv50_core_func {
	void (*init)(struct nv50_core *);
	int (*init)(struct nv50_core *);
	void (*ntfy_init)(struct nouveau_bo *, u32 offset);
	int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
	int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
@@ -42,7 +42,7 @@ struct nv50_core_func {
int core507d_new(struct nouveau_drm *, s32, struct nv50_core **);
int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
		  struct nv50_core **);
void core507d_init(struct nv50_core *);
int core507d_init(struct nv50_core *);
void core507d_ntfy_init(struct nouveau_bo *, u32);
int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
+10 −7
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "head.h"

#include <nvif/cl507d.h>
#include <nvif/push507c.h>
#include <nvif/timer.h>

#include "nouveau_bo.h"
@@ -76,15 +77,17 @@ core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
	return 0;
}

void
int
core507d_init(struct nv50_core *core)
{
	u32 *push;
	if ((push = evo_wait(&core->chan, 2))) {
		evo_mthd(push, 0x0088, 1);
		evo_data(push, core->chan.sync.handle);
		evo_kick(push, &core->chan);
	}
	struct nvif_push *push = core->chan.push;
	int ret;

	if ((ret = PUSH_WAIT(push, 2)))
		return ret;

	PUSH_NVSQ(push, NV507D, 0x0088, core->chan.sync.handle);
	return PUSH_KICK(push);
}

static const struct nv50_core_func
+19 −16
Original line number Diff line number Diff line
@@ -23,10 +23,11 @@
#include "head.h"

#include <nvif/class.h>
#include <nouveau_bo.h>

#include <nvif/pushc37b.h>
#include <nvif/timer.h>

#include <nouveau_bo.h>

void
corec37d_wndw_owner(struct nv50_core *core)
{
@@ -112,24 +113,26 @@ int corec37d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
	return 0;
}

static void
static int
corec37d_init(struct nv50_core *core)
{
	struct nvif_push *push = core->chan.push;
	const u32 windows = 8; /*XXX*/
	u32 *push, i;
	if ((push = evo_wait(&core->chan, 2 + 5 * windows))) {
		evo_mthd(push, 0x0208, 1);
		evo_data(push, core->chan.sync.handle);
	int ret, i;

	if ((ret = PUSH_WAIT(push, 2 + windows * 5)))
		return ret;

	PUSH_NVSQ(push, NVC37D, 0x0208, core->chan.sync.handle);

	for (i = 0; i < windows; i++) {
			evo_mthd(push, 0x1004 + (i * 0x080), 2);
			evo_data(push, 0x0000001f);
			evo_data(push, 0x00000000);
			evo_mthd(push, 0x1010 + (i * 0x080), 1);
			evo_data(push, 0x00127fff);
		PUSH_NVSQ(push, NVC37D, 0x1004 + (i * 0x080), 0x0000001f,
					0x1008 + (i * 0x080), 0x00000000);
		PUSH_NVSQ(push, NVC37D, 0x1010 + (i * 0x080), 0x00127fff);
	}
		evo_kick(push, &core->chan);

	core->assign_windows = true;
	}
	return PUSH_KICK(push);
}

static const struct nv50_core_func
+18 −14
Original line number Diff line number Diff line
@@ -22,24 +22,28 @@
#include "core.h"
#include "head.h"

static void
#include <nvif/pushc37b.h>

static int
corec57d_init(struct nv50_core *core)
{
	struct nvif_push *push = core->chan.push;
	const u32 windows = 8; /*XXX*/
	u32 *push, i;
	if ((push = evo_wait(&core->chan, 2 + 5 * windows))) {
		evo_mthd(push, 0x0208, 1);
		evo_data(push, core->chan.sync.handle);
	int ret, i;

	if ((ret = PUSH_WAIT(push, 2 + windows * 5)))
		return ret;

	PUSH_NVSQ(push, NVC57D, 0x0208, core->chan.sync.handle);

	for (i = 0; i < windows; i++) {
			evo_mthd(push, 0x1004 + (i * 0x080), 2);
			evo_data(push, 0x0000000f);
			evo_data(push, 0x00000000);
			evo_mthd(push, 0x1010 + (i * 0x080), 1);
			evo_data(push, 0x00117fff);
		PUSH_NVSQ(push, NVC57D, 0x1004 + (i * 0x080), 0x0000000f,
					0x1008 + (i * 0x080), 0x00000000);
		PUSH_NVSQ(push, NVC57D, 0x1010 + (i * 0x080), 0x00117fff);
	}
		evo_kick(push, &core->chan);

	core->assign_windows = true;
	}
	return PUSH_KICK(push);
}

static const struct nv50_core_func