Commit dc4ff116 authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Daniel Vetter

drm/nouveau: replace legacy vblank helpers

Replace the legacy drm_send_vblank_event(), drm_arm_vblank_event() and
drm_vblank_{get,put}() with the new helper functions.

v2: add crtc to nouveau_page_flip_state (comment from Mario Kleiner)
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465308482-15104-1-git-send-email-gustavo@padovan.org
parent bd6e2732
...@@ -760,12 +760,11 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -760,12 +760,11 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
/* Initialize a page flip struct */ /* Initialize a page flip struct */
*s = (struct nouveau_page_flip_state) *s = (struct nouveau_page_flip_state)
{ { }, event, nouveau_crtc(crtc)->index, { { }, event, crtc, fb->bits_per_pixel, fb->pitches[0],
fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y,
new_bo->bo.offset }; new_bo->bo.offset };
/* Keep vblanks on during flip, for the target crtc of this flip */ /* Keep vblanks on during flip, for the target crtc of this flip */
drm_vblank_get(dev, nouveau_crtc(crtc)->index); drm_crtc_vblank_get(crtc);
/* Emit a page flip */ /* Emit a page flip */
if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA) { if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
...@@ -810,7 +809,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -810,7 +809,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
return 0; return 0;
fail_unreserve: fail_unreserve:
drm_vblank_put(dev, nouveau_crtc(crtc)->index); drm_crtc_vblank_put(crtc);
ttm_bo_unreserve(&old_bo->bo); ttm_bo_unreserve(&old_bo->bo);
fail_unpin: fail_unpin:
mutex_unlock(&cli->mutex); mutex_unlock(&cli->mutex);
...@@ -842,17 +841,17 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, ...@@ -842,17 +841,17 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
if (s->event) { if (s->event) {
if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
drm_arm_vblank_event(dev, s->crtc, s->event); drm_crtc_arm_vblank_event(s->crtc, s->event);
} else { } else {
drm_send_vblank_event(dev, s->crtc, s->event); drm_crtc_send_vblank_event(s->crtc, s->event);
/* Give up ownership of vblank for page-flipped crtc */ /* Give up ownership of vblank for page-flipped crtc */
drm_vblank_put(dev, s->crtc); drm_crtc_vblank_put(s->crtc);
} }
} }
else { else {
/* Give up ownership of vblank for page-flipped crtc */ /* Give up ownership of vblank for page-flipped crtc */
drm_vblank_put(dev, s->crtc); drm_crtc_vblank_put(s->crtc);
} }
list_del(&s->head); list_del(&s->head);
...@@ -873,9 +872,10 @@ nouveau_flip_complete(struct nvif_notify *notify) ...@@ -873,9 +872,10 @@ nouveau_flip_complete(struct nvif_notify *notify)
if (!nouveau_finish_page_flip(chan, &state)) { if (!nouveau_finish_page_flip(chan, &state)) {
if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
nv_set_crtc_base(drm->dev, state.crtc, state.offset + nv_set_crtc_base(drm->dev, drm_crtc_index(state.crtc),
state.y * state.pitch + state.offset + state.crtc->y *
state.x * state.bpp / 8); state.pitch + state.crtc->x *
state.bpp / 8);
} }
} }
......
...@@ -28,7 +28,8 @@ int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *, ...@@ -28,7 +28,8 @@ int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *,
struct nouveau_page_flip_state { struct nouveau_page_flip_state {
struct list_head head; struct list_head head;
struct drm_pending_vblank_event *event; struct drm_pending_vblank_event *event;
int crtc, bpp, pitch, x, y; struct drm_crtc *crtc;
int bpp, pitch;
u64 offset; u64 offset;
}; };
......
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