Commit 801bc858 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp: expose page flip event class

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 773eb04d
...@@ -1081,10 +1081,10 @@ nv04_finish_page_flip(struct nouveau_channel *chan, ...@@ -1081,10 +1081,10 @@ nv04_finish_page_flip(struct nouveau_channel *chan,
} }
int 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 nv04_display *disp = container_of(event, typeof(*disp), flip);
struct nouveau_drm *drm = cli->drm; struct nouveau_drm *drm = disp->drm;
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
struct nv04_page_flip_state state; struct nv04_page_flip_state state;
...@@ -1095,7 +1095,7 @@ nv04_flip_complete(struct nvif_notify *notify) ...@@ -1095,7 +1095,7 @@ nv04_flip_complete(struct nvif_notify *notify)
state.bpp / 8); state.bpp / 8);
} }
return NVIF_NOTIFY_KEEP; return NVIF_EVENT_KEEP;
} }
static int static int
......
...@@ -61,7 +61,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend) ...@@ -61,7 +61,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend)
struct drm_crtc *crtc; struct drm_crtc *crtc;
/* Disable flip completion events. */ /* Disable flip completion events. */
nvif_notify_put(&disp->flip); nvif_event_block(&disp->flip);
/* Disable vblank interrupts. */ /* Disable vblank interrupts. */
NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0); NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
...@@ -121,7 +121,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime) ...@@ -121,7 +121,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime)
encoder->enc_save(&encoder->base.base); encoder->enc_save(&encoder->base.base);
/* Enable flip completion events. */ /* Enable flip completion events. */
nvif_notify_get(&disp->flip); nvif_event_allow(&disp->flip);
if (!resume) if (!resume)
return 0; return 0;
...@@ -202,7 +202,7 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -202,7 +202,7 @@ nv04_display_destroy(struct drm_device *dev)
nouveau_hw_save_vga_fonts(dev, 0); nouveau_hw_save_vga_fonts(dev, 0);
nvif_notify_dtor(&disp->flip); nvif_event_dtor(&disp->flip);
nouveau_display(dev)->priv = NULL; nouveau_display(dev)->priv = NULL;
vfree(disp); vfree(disp);
...@@ -227,6 +227,8 @@ nv04_display_create(struct drm_device *dev) ...@@ -227,6 +227,8 @@ nv04_display_create(struct drm_device *dev)
if (!disp) if (!disp)
return -ENOMEM; return -ENOMEM;
disp->drm = drm;
nvif_object_map(&drm->client.device.object, NULL, 0); nvif_object_map(&drm->client.device.object, NULL, 0);
nouveau_display(dev)->priv = disp; nouveau_display(dev)->priv = disp;
...@@ -239,9 +241,10 @@ nv04_display_create(struct drm_device *dev) ...@@ -239,9 +241,10 @@ nv04_display_create(struct drm_device *dev)
/* Request page flip completion event. */ /* Request page flip completion event. */
if (drm->channel) { if (drm->channel) {
nvif_notify_ctor(&drm->channel->nvsw, "kmsFlip", nv04_flip_complete, ret = nvif_event_ctor(&drm->channel->nvsw, "kmsFlip", 0, nv04_flip_complete,
false, NV04_NVSW_NTFY_UEVENT, true, NULL, 0, &disp->flip);
NULL, 0, 0, &disp->flip); if (ret)
return ret;
} }
nouveau_hw_save_vga_fonts(dev, 1); nouveau_hw_save_vga_fonts(dev, 1);
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "nouveau_display.h" #include "nouveau_display.h"
#include <nvif/event.h>
struct nouveau_encoder; struct nouveau_encoder;
enum nv04_fp_display_regs { enum nv04_fp_display_regs {
...@@ -84,7 +86,8 @@ struct nv04_display { ...@@ -84,7 +86,8 @@ struct nv04_display {
uint32_t saved_vga_font[4][16384]; uint32_t saved_vga_font[4][16384];
uint32_t dac_users[4]; uint32_t dac_users[4];
struct nouveau_bo *image[2]; struct nouveau_bo *image[2];
struct nvif_notify flip; struct nvif_event flip;
struct nouveau_drm *drm;
}; };
static inline struct nv04_display * static inline struct nv04_display *
...@@ -179,5 +182,5 @@ nouveau_bios_run_init_table(struct drm_device *dev, u16 table, ...@@ -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 #endif
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
#ifndef __NVIF_IF0004_H__ #ifndef __NVIF_IF0004_H__
#define __NVIF_IF0004_H__ #define __NVIF_IF0004_H__
#define NV04_NVSW_NTFY_UEVENT 0x00 union nv04_nvsw_event_args {
struct nv04_nvsw_event_vn {
} vn;
};
#define NV04_NVSW_GET_REF 0x00 #define NV04_NVSW_GET_REF 0x00
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
*/ */
#include "chan.h" #include "chan.h"
#include <core/notify.h>
#include <engine/fifo.h> #include <engine/fifo.h>
#include <nvif/event.h> #include <nvif/event.h>
...@@ -36,7 +35,7 @@ nvkm_sw_chan_mthd(struct nvkm_sw_chan *chan, int subc, u32 mthd, u32 data) ...@@ -36,7 +35,7 @@ nvkm_sw_chan_mthd(struct nvkm_sw_chan *chan, int subc, u32 mthd, u32 data)
case 0x0000: case 0x0000:
return true; return true;
case 0x0500: case 0x0500:
nvkm_event_send(&chan->event, 1, 0, NULL, 0); nvkm_event_send(&chan->event, NVKM_SW_CHAN_EVENT_PAGE_FLIP, 0, NULL, 0);
return true; return true;
default: default:
if (chan->func->mthd) if (chan->func->mthd)
...@@ -46,27 +45,8 @@ nvkm_sw_chan_mthd(struct nvkm_sw_chan *chan, int subc, u32 mthd, u32 data) ...@@ -46,27 +45,8 @@ nvkm_sw_chan_mthd(struct nvkm_sw_chan *chan, int subc, u32 mthd, u32 data)
return false; return false;
} }
static int
nvkm_sw_chan_event_ctor(struct nvkm_object *object, void *data, u32 size,
struct nvkm_notify *notify)
{
union {
struct nvif_notify_uevent_req none;
} *req = data;
int ret = -ENOSYS;
if (!(ret = nvif_unvers(ret, &data, &size, req->none))) {
notify->size = sizeof(struct nvif_notify_uevent_rep);
notify->types = 1;
notify->index = 0;
}
return ret;
}
static const struct nvkm_event_func static const struct nvkm_event_func
nvkm_sw_chan_event = { nvkm_sw_chan_event = {
.ctor = nvkm_sw_chan_event_ctor,
}; };
static void * static void *
......
...@@ -14,6 +14,7 @@ struct nvkm_sw_chan { ...@@ -14,6 +14,7 @@ struct nvkm_sw_chan {
struct nvkm_fifo_chan *fifo; struct nvkm_fifo_chan *fifo;
struct list_head head; struct list_head head;
#define NVKM_SW_CHAN_EVENT_PAGE_FLIP BIT(0)
struct nvkm_event event; struct nvkm_event event;
}; };
......
...@@ -27,33 +27,34 @@ ...@@ -27,33 +27,34 @@
#include <nvif/if0004.h> #include <nvif/if0004.h>
static int static int
nvkm_nvsw_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) nvkm_nvsw_uevent(struct nvkm_object *object, void *argv, u32 argc, struct nvkm_uevent *uevent)
{ {
struct nvkm_nvsw *nvsw = nvkm_nvsw(object); union nv04_nvsw_event_args *args = argv;
if (nvsw->func->mthd)
return nvsw->func->mthd(nvsw, mthd, data, size); if (!uevent)
return -ENODEV; return 0;
if (argc != sizeof(args->vn))
return -ENOSYS;
return nvkm_uevent_add(uevent, &nvkm_nvsw(object)->chan->event, 0,
NVKM_SW_CHAN_EVENT_PAGE_FLIP, NULL);
} }
static int static int
nvkm_nvsw_ntfy_(struct nvkm_object *object, u32 mthd, nvkm_nvsw_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
struct nvkm_event **pevent)
{ {
struct nvkm_nvsw *nvsw = nvkm_nvsw(object); struct nvkm_nvsw *nvsw = nvkm_nvsw(object);
switch (mthd) {
case NV04_NVSW_NTFY_UEVENT: if (nvsw->func->mthd)
*pevent = &nvsw->chan->event; return nvsw->func->mthd(nvsw, mthd, data, size);
return 0;
default: return -ENODEV;
break;
}
return -EINVAL;
} }
static const struct nvkm_object_func static const struct nvkm_object_func
nvkm_nvsw_ = { nvkm_nvsw_ = {
.mthd = nvkm_nvsw_mthd_, .mthd = nvkm_nvsw_mthd,
.ntfy = nvkm_nvsw_ntfy_, .uevent = nvkm_nvsw_uevent,
}; };
int int
......
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