From patchwork Tue Jun 7 14:07:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9161417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AD2460572 for ; Tue, 7 Jun 2016 14:08:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A33628236 for ; Tue, 7 Jun 2016 14:08:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C6F12834F; Tue, 7 Jun 2016 14:08:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F7728352 for ; Tue, 7 Jun 2016 14:08:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D1166E765; Tue, 7 Jun 2016 14:08:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34CDF6E765; Tue, 7 Jun 2016 14:08:10 +0000 (UTC) Received: by mail-yw0-f195.google.com with SMTP id y6so23025361ywe.0; Tue, 07 Jun 2016 07:08:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GlZY6s/JxW3RVD6/CK2DxoTVZmxbWCFb1rN9Xk4wxk4=; b=FOWcbfp43Ii4MaFET2irEyuclrGLhDVvhU06/LnqIfWJr3XfZ1DcqfEV6UZw6sFpul mgUT0RFFSqXchxt7nGnzc1C2RfKJ5bTSmE4eIJVaclJ57uEU8Ja3842d8cGVAXZi1s2W Gy72T49yEHENdNDNH+U5CrWWkrr/kyaT7XWjxxUYfNFP784ijwNaY1dF26hO5vMORXaD d3DVGvvudA3DRm2PL8Ijd0yWhPopI/JUXn86bsCzVGzM+TWOYDgo3h/X1GzwZVIJZ7O8 1IDf95vQfDWl1QsCxyBAbfMYko8R/gyWxTcIkuWdFWG8ku7onbaaZCffeR3m8m0z/cd6 nkRg== X-Gm-Message-State: ALyK8tIKUbjs2Z+RO/QSFbllRNXrW1uLZ4xnTY8SBjxOtdhujeSW08Vgrgdj6aNM4H9pMw== X-Received: by 10.37.231.81 with SMTP id e78mr13726481ybh.7.1465308488954; Tue, 07 Jun 2016 07:08:08 -0700 (PDT) Received: from jade.localdomain ([201.82.24.203]) by smtp.gmail.com with ESMTPSA id m204sm14495205ywb.54.2016.06.07.07.08.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jun 2016 07:08:08 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH 01/10] drm/nouveau: replace legacy vblank helpers Date: Tue, 7 Jun 2016 11:07:53 -0300 Message-Id: <1465308482-15104-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 Cc: "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , Gustavo Padovan , Ben Skeggs , open list X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan 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: Gustavo Padovan Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/nouveau/nouveau_display.c | 22 +++++++++++----------- drivers/gpu/drm/nouveau/nouveau_display.h | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 7c77f96..6072fe2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -760,12 +760,11 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Initialize a page flip struct */ *s = (struct nouveau_page_flip_state) - { { }, event, nouveau_crtc(crtc)->index, - fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y, + { { }, event, crtc, fb->bits_per_pixel, fb->pitches[0], new_bo->bo.offset }; /* 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 */ 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, return 0; fail_unreserve: - drm_vblank_put(dev, nouveau_crtc(crtc)->index); + drm_crtc_vblank_put(crtc); ttm_bo_unreserve(&old_bo->bo); fail_unpin: mutex_unlock(&cli->mutex); @@ -842,17 +841,17 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); if (s->event) { 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 { - 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 */ - drm_vblank_put(dev, s->crtc); + drm_crtc_vblank_put(s->crtc); } } else { /* 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); @@ -873,9 +872,10 @@ nouveau_flip_complete(struct nvif_notify *notify) if (!nouveau_finish_page_flip(chan, &state)) { if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { - nv_set_crtc_base(drm->dev, state.crtc, state.offset + - state.y * state.pitch + - state.x * state.bpp / 8); + nv_set_crtc_base(drm->dev, drm_crtc_index(state.crtc), + state.offset + state.crtc->y * + state.pitch + state.crtc->x * + state.bpp / 8); } } diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index 24273ba..0420ee8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h @@ -28,7 +28,8 @@ int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *, struct nouveau_page_flip_state { struct list_head head; struct drm_pending_vblank_event *event; - int crtc, bpp, pitch, x, y; + struct drm_crtc *crtc; + int bpp, pitch; u64 offset; };