From patchwork Thu Apr 16 17:04:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 11493555 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D67A81 for ; Thu, 16 Apr 2020 17:04:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1350C2078E for ; Thu, 16 Apr 2020 17:04:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1350C2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A2E136E4E8; Thu, 16 Apr 2020 17:04:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 89D956E4A5; Thu, 16 Apr 2020 17:04:24 +0000 (UTC) IronPort-SDR: AtwD1cv02VZT5EinOBMNs/HOInwby06hlHwlCIOpP2L4z07JXkTH74RBugRY81RXr1c55nggK2 sFTAl8uOyR3A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 10:04:23 -0700 IronPort-SDR: CHlCpPPTn0wP84hCQFbtidgGiD3xrJB8aLRxv3YCNK+vUaNWxQe/io2+hmePQGg7C1FALNcyqo SKp8Y1qqAmWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,391,1580803200"; d="scan'208";a="277385993" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga008.jf.intel.com with SMTP; 16 Apr 2020 10:04:20 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 16 Apr 2020 20:04:20 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Date: Thu, 16 Apr 2020 20:04:20 +0300 Message-Id: <20200416170420.23657-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm: Fix page flip ioctl format check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, Laurent Pinchart , stable@vger.kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Revert back to comparing fb->format->format instead fb->format for the page flip ioctl. This check was originally only here to disallow pixel format changes, but when we changed it to do the pointer comparison we potentially started to reject some (but definitely not all) modifier changes as well. In fact the current behaviour depends on whether the driver overrides the format info for a specific format+modifier combo. Eg. on i915 this now rejects compression vs. no compression changes but does not reject any other tiling changes. That's just inconsistent nonsense. The main reason we have to go back to the old behaviour is to fix page flipping with Xorg. At some point Xorg got its atomic rights taken away and since then we can't page flip between compressed and non-compressed fbs on i915. Currently we get no page flipping for any games pretty much since Mesa likes to use compressed buffers. Not sure how compositors are working around this (don't use one myself). I guess they must be doing something to get non-compressed buffers instead. Either that or somehow no one noticed the tearing from the blit fallback. Looking back at the original discussion on this change we pretty much just did it in the name of skipping a few extra pointer dereferences. However, I've decided not to revert the whole thing in case someone has since started to depend on these changes. None of the other checks are relevant for i915 anyways. Cc: stable@vger.kernel.org Cc: Laurent Pinchart Fixes: dbd4d5761e1f ("drm: Replace 'format->format' comparisons to just 'format' comparisons") Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index d6ad60ab0d38..f2ca5315f23b 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -1153,7 +1153,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, if (ret) goto out; - if (old_fb->format != fb->format) { + if (old_fb->format->format != fb->format->format) { DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n"); ret = -EINVAL; goto out;