From patchwork Tue Sep 9 06:28:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 4866391 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2AD21C033A for ; Tue, 9 Sep 2014 06:28:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CA21200ED for ; Tue, 9 Sep 2014 06:28:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7256E20160 for ; Tue, 9 Sep 2014 06:28:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A51666E3AD; Mon, 8 Sep 2014 23:28:37 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 415F26E3AF; Mon, 8 Sep 2014 23:28:36 -0700 (PDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s896SZk9030944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 Sep 2014 02:28:36 -0400 Received: from tyrion-bne-redhat-com.bne.redhat.com (dhcp-41-68.bne.redhat.com [10.64.41.68]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s896SIP3023257; Tue, 9 Sep 2014 02:28:35 -0400 From: Dave Airlie To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Tue, 9 Sep 2014 16:28:16 +1000 Message-Id: <1410244096-9854-12-git-send-email-airlied@gmail.com> In-Reply-To: <1410244096-9854-1-git-send-email-airlied@gmail.com> References: <1410244096-9854-1-git-send-email-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Subject: [Intel-gfx] [PATCH 11/11] drm/tiled: vague attempt at waving at cursors. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Airlie This is going to be a bit of a reference counting nightmare, Since when we moved from one tile to the other, we need to transfer the framebuffer over between them. Also only universal is tackled here. Signed-off-by: Dave Airlie --- drivers/gpu/drm/drm_crtc.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index dd0649a0..55c9ad7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2919,7 +2919,8 @@ out: */ static int drm_mode_cursor_universal(struct drm_crtc *crtc, struct drm_mode_cursor2 *req, - struct drm_file *file_priv) + struct drm_file *file_priv, + bool draw) { struct drm_device *dev = crtc->dev; struct drm_framebuffer *fb = NULL; @@ -2970,7 +2971,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, crtc_y = crtc->cursor_y; } - if (fb) { + if (fb && draw) { crtc_w = fb->width; crtc_h = fb->height; src_w = fb->width << 16; @@ -2981,7 +2982,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, * setplane_internal will take care of deref'ing either the old or new * framebuffer depending on success. */ - ret = setplane_internal(crtc->cursor, crtc, fb, + ret = setplane_internal(crtc->cursor, crtc, draw ? fb : NULL, crtc_x, crtc_y, crtc_w, crtc_h, 0, 0, src_w, src_h); @@ -3017,8 +3018,30 @@ static int drm_mode_cursor_common(struct drm_device *dev, * If this crtc has a universal cursor plane, call that plane's update * handler rather than using legacy cursor handlers. */ - if (crtc->cursor) - return drm_mode_cursor_universal(crtc, req, file_priv); + if (crtc->cursor) { + struct drm_mode_cursor2 req2; + struct drm_crtc *tile_crtc; + list_for_each_entry(tile_crtc, &crtc->tile_crtc_list, tile) { + req2 = *req; + + /* TODO broken for > 2 tiles */ + if (req->flags & DRM_MODE_CURSOR_MOVE) { + bool do_move = false; + if (req->x > crtc->mode.hdisplay) { + do_move = true; + req2.x = req->x - crtc->mode.hdisplay; + } + if (req->y > crtc->mode.vdisplay) { + do_move = true; + req2.y = req->y - crtc->mode.vdisplay; + } + if (do_move) + ret = drm_mode_cursor_universal(tile_crtc, &req2, file_priv, true); + } else + ret = drm_mode_cursor_universal(tile_crtc, &req2, file_priv, true); + } + return drm_mode_cursor_universal(crtc, req, file_priv, true); + } drm_modeset_lock(&crtc->mutex, NULL); if (req->flags & DRM_MODE_CURSOR_BO) {