From patchwork Thu Nov 26 18:52:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 7708531 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7396BBF90C for ; Thu, 26 Nov 2015 18:52:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A862520640 for ; Thu, 26 Nov 2015 18:52:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C98D62063D for ; Thu, 26 Nov 2015 18:52:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 550696E12A; Thu, 26 Nov 2015 10:52:54 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id D9F816E12A for ; Thu, 26 Nov 2015 10:52:52 -0800 (PST) Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 5ADDD28F10; Thu, 26 Nov 2015 10:52:49 -0800 (PST) Received: from EX13-CAS-003.vmware.com (ex13-cas-003.vmware.com [10.113.191.53]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 0BF4EB053D; Thu, 26 Nov 2015 10:52:50 -0800 (PST) Received: from ubuntu.localdomain (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Thu, 26 Nov 2015 10:52:48 -0800 From: Thomas Hellstrom To: Subject: [PATCH 1/2] drm: Avoid calling the cursor_set2 callback from the drm_mode_cursor ioctl Date: Thu, 26 Nov 2015 10:52:14 -0800 Message-ID: <1448563935-3157-1-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) Cc: airlied@redhat.com, Thomas Hellstrom 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, 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 If the drm_mode_cursor_ioctl is called and the cursor_set2 callback is implemented, the cursor hotspot is set to (0,0) which is incompatible with vmwgfx where the hotspot should instead remain unchanged. So if the driver implements both cursor_set2 and cursor_set, prefer calling the latter from the drm_mode_cursor ioctl. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/drm_crtc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 24c5434..93f80a5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2874,7 +2874,8 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, static int drm_mode_cursor_common(struct drm_device *dev, struct drm_mode_cursor2 *req, - struct drm_file *file_priv) + struct drm_file *file_priv, + bool from_2) { struct drm_crtc *crtc; int ret = 0; @@ -2907,7 +2908,8 @@ static int drm_mode_cursor_common(struct drm_device *dev, goto out; } /* Turns off the cursor if handle is 0 */ - if (crtc->funcs->cursor_set2) + if (crtc->funcs->cursor_set2 && + (from_2 || !crtc->funcs->cursor_set)) ret = crtc->funcs->cursor_set2(crtc, file_priv, req->handle, req->width, req->height, req->hot_x, req->hot_y); else @@ -2953,7 +2955,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, memcpy(&new_req, req, sizeof(struct drm_mode_cursor)); new_req.hot_x = new_req.hot_y = 0; - return drm_mode_cursor_common(dev, &new_req, file_priv); + return drm_mode_cursor_common(dev, &new_req, file_priv, false); } /** @@ -2976,7 +2978,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, { struct drm_mode_cursor2 *req = data; - return drm_mode_cursor_common(dev, req, file_priv); + return drm_mode_cursor_common(dev, req, file_priv, true); } /**