From patchwork Tue Jan 21 10:53:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 11343539 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 0EE9B6C1 for ; Tue, 21 Jan 2020 10:53:46 +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 EB75320882 for ; Tue, 21 Jan 2020 10:53:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB75320882 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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 3E42E6EC5B; Tue, 21 Jan 2020 10:53:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0BC96EC59; Tue, 21 Jan 2020 10:53:37 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 02:53:37 -0800 X-IronPort-AV: E=Sophos;i="5.70,345,1574150400"; d="scan'208";a="399629440" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 02:53:35 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Date: Tue, 21 Jan 2020 12:53:30 +0200 Message-Id: <20200121105331.6825-1-jani.nikula@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH 1/2] drm: support feature masks in drm_core_check_feature() 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: Jani Nikula , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Allow a mask of features to be passed to drm_core_check_feature(). All features in the mask are required. Signed-off-by: Jani Nikula Reviewed-by: Ville Syrjälä --- include/drm/drm_drv.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index cf13470810a5..51b486d1ee81 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -826,16 +826,18 @@ static inline bool drm_dev_is_unplugged(struct drm_device *dev) /** * drm_core_check_feature - check driver feature flags * @dev: DRM device to check - * @feature: feature flag + * @feature: feature flag(s) * * This checks @dev for driver features, see &drm_driver.driver_features, * &drm_device.driver_features, and the various &enum drm_driver_feature flags. * - * Returns true if the @feature is supported, false otherwise. + * Returns true if all features in the @feature mask are supported, false + * otherwise. */ -static inline bool drm_core_check_feature(const struct drm_device *dev, u32 feature) +static inline bool drm_core_check_feature(const struct drm_device *dev, u32 features) { - return dev->driver->driver_features & dev->driver_features & feature; + return features && (dev->driver->driver_features & dev->driver_features & + features) == features; } /**