From patchwork Wed Nov 20 20:48:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 3215431 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4EB619F26C for ; Wed, 20 Nov 2013 20:48:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43DF620752 for ; Wed, 20 Nov 2013 20:48:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 43CD92074B for ; Wed, 20 Nov 2013 20:48:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7197A105951; Wed, 20 Nov 2013 12:48:49 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f46.google.com (mail-qe0-f46.google.com [209.85.128.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 19548FD43A for ; Wed, 20 Nov 2013 12:48:43 -0800 (PST) Received: by mail-qe0-f46.google.com with SMTP id s14so6708296qeb.33 for ; Wed, 20 Nov 2013 12:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=F4KhvWIXICKNsSWeRcXDMn4cuBpVZFrrHKB11hfp1b4=; b=V5Tj/wFC78hWTWyXMmhncJ6/dwHMjdYV/wG19g76h1axOqQJ2fBoubs7nVVW0h4BIv v41yixITaRCrSeGbfTQ3TB/SXj4E+VnPnYzwZs+hNwnsQXeXvo28PQCm9qNIWJGE2zOW EVEB1oGvbV4OiZmvvBjhncYWV2xtULd8CjZlFTUlB4PbADq6NalOifI9yzbAXZBvsPSj A+Ndg4fHJHGbd5Aqb4sQC29l4ca5BnOnS5q+ENuO6RjZ5Wg4oI4wofLWQ8m+AOCKyhBw MFTb0TrugT5iadkOCDapSiWHSNwGdXy7+hkYHpU4Zda1/HWeW+viwUXEjAUVl74MtjM6 P6mQ== X-Received: by 10.224.47.3 with SMTP id l3mr5092319qaf.25.1384980522620; Wed, 20 Nov 2013 12:48:42 -0800 (PST) Received: from localhost (pool-108-20-250-166.bstnma.east.verizon.net. [108.20.250.166]) by mx.google.com with ESMTPSA id f10sm18245541qej.1.2013.11.20.12.48.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 12:48:41 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFCv3 08/14] drm: Allow drm_mode_object_find() to look up an object of any type Date: Wed, 20 Nov 2013 15:48:07 -0500 Message-Id: <1384980493-25499-9-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1384980493-25499-1-git-send-email-robdclark@gmail.com> References: <1384980493-25499-1-git-send-email-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Ville Syrjälä To avoid having to pass object types from userspace for atomic mode setting ioctl, allow drm_mode_object_find() to look up an object of any type. This will only work as long as the all object types share the ID space. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_crtc.c | 3 ++- include/drm/drm_crtc.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index b81baae..8fc2ab4 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -362,7 +362,8 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, mutex_lock(&dev->mode_config.idr_mutex); obj = idr_find(&dev->mode_config.crtc_idr, id); - if (!obj || (obj->type != type) || (obj->id != id)) + if (!obj || (type != DRM_MODE_OBJECT_ANY && obj->type != type) || + (obj->id != id)) obj = NULL; mutex_unlock(&dev->mode_config.idr_mutex); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a18d240..0bdb8af 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -52,6 +52,7 @@ struct drm_object_property_values; #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee #define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd +#define DRM_MODE_OBJECT_ANY 0 struct drm_mode_object { uint32_t id;