Commit c4b27bc8 authored by Ben Skeggs's avatar Ben Skeggs

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

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent ff37116e
...@@ -50,7 +50,7 @@ struct nv50_crc_atom { ...@@ -50,7 +50,7 @@ struct nv50_crc_atom {
}; };
struct nv50_crc_func { struct nv50_crc_func {
void (*set_src)(struct nv50_head *, int or, enum nv50_crc_source_type, int (*set_src)(struct nv50_head *, int or, enum nv50_crc_source_type,
struct nv50_crc_notifier_ctx *, u32 wndw); struct nv50_crc_notifier_ctx *, u32 wndw);
void (*set_ctx)(struct nv50_head *, struct nv50_crc_notifier_ctx *); void (*set_ctx)(struct nv50_head *, struct nv50_crc_notifier_ctx *);
u32 (*get_entry)(struct nv50_head *, struct nv50_crc_notifier_ctx *, u32 (*get_entry)(struct nv50_head *, struct nv50_crc_notifier_ctx *,
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "disp.h" #include "disp.h"
#include "head.h" #include "head.h"
#include <nvif/push507c.h>
#define CRC907D_MAX_ENTRIES 255 #define CRC907D_MAX_ENTRIES 255
struct crc907d_notifier { struct crc907d_notifier {
...@@ -18,16 +20,16 @@ struct crc907d_notifier { ...@@ -18,16 +20,16 @@ struct crc907d_notifier {
} entries[CRC907D_MAX_ENTRIES]; } entries[CRC907D_MAX_ENTRIES];
} __packed; } __packed;
static void static int
crc907d_set_src(struct nv50_head *head, int or, crc907d_set_src(struct nv50_head *head, int or,
enum nv50_crc_source_type source, enum nv50_crc_source_type source,
struct nv50_crc_notifier_ctx *ctx, u32 wndw) struct nv50_crc_notifier_ctx *ctx, u32 wndw)
{ {
struct drm_crtc *crtc = &head->base.base; struct drm_crtc *crtc = &head->base.base;
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
const u32 hoff = head->base.index * 0x300; const int i = head->base.index;
u32 *push;
u32 crc_args = 0xfff00000; u32 crc_args = 0xfff00000;
int ret;
switch (source) { switch (source) {
case NV50_CRC_SOURCE_TYPE_SOR: case NV50_CRC_SOURCE_TYPE_SOR:
...@@ -50,22 +52,18 @@ crc907d_set_src(struct nv50_head *head, int or, ...@@ -50,22 +52,18 @@ crc907d_set_src(struct nv50_head *head, int or,
break; break;
} }
push = evo_wait(core, 4); if ((ret = PUSH_WAIT(push, 4)))
if (!push) return ret;
return;
if (source) { if (source) {
evo_mthd(push, 0x0438 + hoff, 1); PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), ctx->ntfy.handle);
evo_data(push, ctx->ntfy.handle); PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args);
evo_mthd(push, 0x0430 + hoff, 1);
evo_data(push, crc_args);
} else { } else {
evo_mthd(push, 0x0430 + hoff, 1); PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args);
evo_data(push, crc_args); PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), 0);
evo_mthd(push, 0x0438 + hoff, 1);
evo_data(push, 0);
} }
evo_kick(push, core);
return 0;
} }
static void crc907d_set_ctx(struct nv50_head *head, static void crc907d_set_ctx(struct nv50_head *head,
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "disp.h" #include "disp.h"
#include "head.h" #include "head.h"
#include <nvif/push507c.h>
#define CRCC37D_MAX_ENTRIES 2047 #define CRCC37D_MAX_ENTRIES 2047
struct crcc37d_notifier { struct crcc37d_notifier {
...@@ -30,15 +32,15 @@ struct crcc37d_notifier { ...@@ -30,15 +32,15 @@ struct crcc37d_notifier {
} entries[CRCC37D_MAX_ENTRIES]; } entries[CRCC37D_MAX_ENTRIES];
} __packed; } __packed;
static void static int
crcc37d_set_src(struct nv50_head *head, int or, crcc37d_set_src(struct nv50_head *head, int or,
enum nv50_crc_source_type source, enum nv50_crc_source_type source,
struct nv50_crc_notifier_ctx *ctx, u32 wndw) struct nv50_crc_notifier_ctx *ctx, u32 wndw)
{ {
struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
const u32 hoff = head->base.index * 0x400; const int i = head->base.index;
u32 *push;
u32 crc_args; u32 crc_args;
int ret;
switch (source) { switch (source) {
case NV50_CRC_SOURCE_TYPE_SOR: case NV50_CRC_SOURCE_TYPE_SOR:
...@@ -55,23 +57,18 @@ crcc37d_set_src(struct nv50_head *head, int or, ...@@ -55,23 +57,18 @@ crcc37d_set_src(struct nv50_head *head, int or,
break; break;
} }
push = evo_wait(core, 4); if ((ret = PUSH_WAIT(push, 4)))
if (!push) return ret;
return;
if (source) { if (source) {
evo_mthd(push, 0x2180 + hoff, 1); PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), ctx->ntfy.handle);
evo_data(push, ctx->ntfy.handle); PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), crc_args | wndw);
evo_mthd(push, 0x2184 + hoff, 1);
evo_data(push, crc_args | wndw);
} else { } else {
evo_mthd(push, 0x2184 + hoff, 1); PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), 0);
evo_data(push, 0); PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), 0);
evo_mthd(push, 0x2180 + hoff, 1);
evo_data(push, 0);
} }
evo_kick(push, core); return 0;
} }
static void crcc37d_set_ctx(struct nv50_head *head, static void crcc37d_set_ctx(struct nv50_head *head,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment