drm/nouveau: store vblank event handler data in nv_crtc
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
8a42364701
commit
b12f0ae9e8
|
@ -31,6 +31,7 @@ struct nouveau_crtc {
|
||||||
struct drm_crtc base;
|
struct drm_crtc base;
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
|
struct nouveau_eventh *vblank;
|
||||||
|
|
||||||
uint32_t dpms_saved_fp_control;
|
uint32_t dpms_saved_fp_control;
|
||||||
uint32_t fp_users;
|
uint32_t fp_users;
|
||||||
|
|
|
@ -44,28 +44,36 @@
|
||||||
static int
|
static int
|
||||||
nouveau_display_vblank_handler(void *data, u32 type, int head)
|
nouveau_display_vblank_handler(void *data, u32 type, int head)
|
||||||
{
|
{
|
||||||
struct nouveau_drm *drm = data;
|
struct nouveau_crtc *nv_crtc = data;
|
||||||
drm_handle_vblank(drm->dev, head);
|
drm_handle_vblank(nv_crtc->base.dev, nv_crtc->index);
|
||||||
return NVKM_EVENT_KEEP;
|
return NVKM_EVENT_KEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_display_vblank_enable(struct drm_device *dev, int head)
|
nouveau_display_vblank_enable(struct drm_device *dev, int head)
|
||||||
{
|
{
|
||||||
struct nouveau_display *disp = nouveau_display(dev);
|
struct drm_crtc *crtc;
|
||||||
if (disp) {
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
nouveau_event_get(disp->vblank[head]);
|
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||||
return 0;
|
if (nv_crtc->index == head) {
|
||||||
|
nouveau_event_get(nv_crtc->vblank);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -EIO;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nouveau_display_vblank_disable(struct drm_device *dev, int head)
|
nouveau_display_vblank_disable(struct drm_device *dev, int head)
|
||||||
{
|
{
|
||||||
struct nouveau_display *disp = nouveau_display(dev);
|
struct drm_crtc *crtc;
|
||||||
if (disp)
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
nouveau_event_put(disp->vblank[head]);
|
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||||
|
if (nv_crtc->index == head) {
|
||||||
|
nouveau_event_put(nv_crtc->vblank);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -151,36 +159,29 @@ nouveau_display_vblstamp(struct drm_device *dev, int head, int *max_error,
|
||||||
static void
|
static void
|
||||||
nouveau_display_vblank_fini(struct drm_device *dev)
|
nouveau_display_vblank_fini(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct nouveau_display *disp = nouveau_display(dev);
|
struct drm_crtc *crtc;
|
||||||
int i;
|
|
||||||
|
|
||||||
drm_vblank_cleanup(dev);
|
drm_vblank_cleanup(dev);
|
||||||
|
|
||||||
if (disp->vblank) {
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
for (i = 0; i < dev->mode_config.num_crtc; i++)
|
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||||
nouveau_event_ref(NULL, &disp->vblank[i]);
|
nouveau_event_ref(NULL, &nv_crtc->vblank);
|
||||||
kfree(disp->vblank);
|
|
||||||
disp->vblank = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_display_vblank_init(struct drm_device *dev)
|
nouveau_display_vblank_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct nouveau_display *disp = nouveau_display(dev);
|
|
||||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||||
struct nouveau_disp *pdisp = nouveau_disp(drm->device);
|
struct nouveau_disp *pdisp = nouveau_disp(drm->device);
|
||||||
int ret, i;
|
struct drm_crtc *crtc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
disp->vblank = kzalloc(dev->mode_config.num_crtc *
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
sizeof(*disp->vblank), GFP_KERNEL);
|
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||||
if (!disp->vblank)
|
ret = nouveau_event_new(pdisp->vblank, 1, nv_crtc->index,
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
for (i = 0; i < dev->mode_config.num_crtc; i++) {
|
|
||||||
ret = nouveau_event_new(pdisp->vblank, 1, i,
|
|
||||||
nouveau_display_vblank_handler,
|
nouveau_display_vblank_handler,
|
||||||
drm, &disp->vblank[i]);
|
nv_crtc, &nv_crtc->vblank);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
nouveau_display_vblank_fini(dev);
|
nouveau_display_vblank_fini(dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -40,8 +40,6 @@ struct nouveau_display {
|
||||||
void (*fb_dtor)(struct drm_framebuffer *);
|
void (*fb_dtor)(struct drm_framebuffer *);
|
||||||
|
|
||||||
struct nouveau_object *core;
|
struct nouveau_object *core;
|
||||||
struct nouveau_eventh **vblank;
|
|
||||||
|
|
||||||
|
|
||||||
struct drm_property *dithering_mode;
|
struct drm_property *dithering_mode;
|
||||||
struct drm_property *dithering_depth;
|
struct drm_property *dithering_depth;
|
||||||
|
|
Loading…
Reference in New Issue