diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index d1099365bfc1..c95decf543e9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -72,11 +72,25 @@ module_param_named(modeset, nouveau_modeset, int, 0400); | |||
72 | static struct drm_driver driver; | 72 | static struct drm_driver driver; |
73 | 73 | ||
74 | static int | 74 | static int |
75 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | ||
76 | { | ||
77 | struct nouveau_drm *drm = | ||
78 | container_of(event, struct nouveau_drm, vblank[head]); | ||
79 | drm_handle_vblank(drm->dev, head); | ||
80 | return NVKM_EVENT_KEEP; | ||
81 | } | ||
82 | |||
83 | static int | ||
75 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) | 84 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) |
76 | { | 85 | { |
77 | struct nouveau_drm *drm = nouveau_drm(dev); | 86 | struct nouveau_drm *drm = nouveau_drm(dev); |
78 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
79 | nouveau_event_get(pdisp->vblank, head, &drm->vblank); | 88 | |
89 | if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank))) | ||
90 | return -EIO; | ||
91 | WARN_ON_ONCE(drm->vblank[head].func); | ||
92 | drm->vblank[head].func = nouveau_drm_vblank_handler; | ||
93 | nouveau_event_get(pdisp->vblank, head, &drm->vblank[head]); | ||
80 | return 0; | 94 | return 0; |
81 | } | 95 | } |
82 | 96 | ||
@@ -85,16 +99,11 @@ nouveau_drm_vblank_disable(struct drm_device *dev, int head) | |||
85 | { | 99 | { |
86 | struct nouveau_drm *drm = nouveau_drm(dev); | 100 | struct nouveau_drm *drm = nouveau_drm(dev); |
87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 101 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
88 | nouveau_event_put(pdisp->vblank, head, &drm->vblank); | 102 | if (drm->vblank[head].func) |
89 | } | 103 | nouveau_event_put(pdisp->vblank, head, &drm->vblank[head]); |
90 | 104 | else | |
91 | static int | 105 | WARN_ON_ONCE(1); |
92 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | 106 | drm->vblank[head].func = NULL; |
93 | { | ||
94 | struct nouveau_drm *drm = | ||
95 | container_of(event, struct nouveau_drm, vblank); | ||
96 | drm_handle_vblank(drm->dev, head); | ||
97 | return NVKM_EVENT_KEEP; | ||
98 | } | 107 | } |
99 | 108 | ||
100 | static u64 | 109 | static u64 |
@@ -292,7 +301,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
292 | 301 | ||
293 | dev->dev_private = drm; | 302 | dev->dev_private = drm; |
294 | drm->dev = dev; | 303 | drm->dev = dev; |
295 | drm->vblank.func = nouveau_drm_vblank_handler; | ||
296 | 304 | ||
297 | INIT_LIST_HEAD(&drm->clients); | 305 | INIT_LIST_HEAD(&drm->clients); |
298 | spin_lock_init(&drm->tile.lock); | 306 | spin_lock_init(&drm->tile.lock); |