From patchwork Fri Oct 23 20:39:57 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: 11854521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A35EC5517A for ; Fri, 23 Oct 2020 20:40:04 +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 AEE8020878 for ; Fri, 23 Oct 2020 20:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEE8020878 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=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F1556E823; Fri, 23 Oct 2020 20:40:02 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 778186E823; Fri, 23 Oct 2020 20:40:01 +0000 (UTC) IronPort-SDR: /AafczF3owKnhh13c+aG9EnEnAsOSsyY/u9wjOQB/WLXwiweneXHeAOgW2fya4Gu134fqap+n0 5u8jmtCvWBlw== X-IronPort-AV: E=McAfee;i="6000,8403,9783"; a="231920964" X-IronPort-AV: E=Sophos;i="5.77,409,1596524400"; d="scan'208";a="231920964" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2020 13:40:00 -0700 IronPort-SDR: xpqGVB7Nlr5ymj9xZcxRPT6JQsOqTlH5910zgpYNMGZQtLziAmg9pkw3ww4orwob0T9RIPXz76 YrBPA0e1TH7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,409,1596524400"; d="scan'208";a="360339594" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga007.jf.intel.com with SMTP; 23 Oct 2020 13:39:58 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 23 Oct 2020 23:39:57 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Don't create the IN_FORMATS blob when the driver does not provide .format_mod_supported() Date: Fri, 23 Oct 2020 23:39:57 +0300 Message-Id: <20201023203957.3255-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä The code responsible for creating the IN_FORMATS blob is broken when the driver doesn't provide a .format_mod_supported() hook. It just copies in the format list, but leaves all the modifier information zeroed. That would indicate (in a very silly way) that there are in fact no supported format+modifier combinations. That is utter nonsense. Let's just not create the blob at all in that case. The alternative would be to assume all format+mod combos will work and populate it accordingly. But I'm not convinced we can make that promise to userspace for all the drivers. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_plane.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index e6231947f987..202a2b680947 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -124,10 +124,6 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane memcpy(formats_ptr(blob_data), plane->format_types, formats_size); - /* If we can't determine support, just bail */ - if (!plane->funcs->format_mod_supported) - goto done; - mod = modifiers_ptr(blob_data); for (i = 0; i < plane->modifier_count; i++) { for (j = 0; j < plane->format_count; j++) { @@ -145,7 +141,6 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane mod++; } -done: drm_object_attach_property(&plane->base, config->modifiers_property, blob->base.id); @@ -281,7 +276,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config->prop_src_h, 0); } - if (config->allow_fb_modifiers) + if (config->allow_fb_modifiers && funcs->format_mod_supported) create_in_format_blob(dev, plane); return 0;