From patchwork Tue Mar 18 21:22:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 3849471 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 8F36D9F370 for ; Tue, 18 Mar 2014 21:23:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCC132038E for ; Tue, 18 Mar 2014 21:23:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DCE742038F for ; Tue, 18 Mar 2014 21:23:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34B196F53F; Tue, 18 Mar 2014 14:23:35 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f171.google.com (mail-qc0-f171.google.com [209.85.216.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E5966F4D7 for ; Tue, 18 Mar 2014 14:23:33 -0700 (PDT) Received: by mail-qc0-f171.google.com with SMTP id c9so2794541qcz.2 for ; Tue, 18 Mar 2014 14:23:33 -0700 (PDT) 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=GyRzAIbQRdTV3wtGyg7f8TTZTCVhZ2tk/oQzi/30yKo=; b=U8BsNbX0cF2gikY+wvYhOSMhety0Gd0VzhplviK7XTQNN4pWjr7SssffRlD/M6l6BX UAwqNYuRlWPGnwvS+1Cnczbng04OjgTDoHftgWfm7AMruVEj/IJgg5ms2xQdDSemZMCB QpIlB/zZmbsWYdA6xLt7clvrgmvs5u4WQMv5s308PcFYEdzZoS7cUl+PZbEZHh/3+K5W gxpDbsmF2OJ59Ohzf6FwQx/gr7UkYmaOzHnk0MSOqfeLOVvE1eIUT+KhhQ3r/ZZUheUU Ax2rhtEVqcRiT6z7S/MjOb03zIOtViUwIDA/xA8lO45qNG1CXxpEtig5oR2g4case5sC BLxg== X-Received: by 10.140.43.228 with SMTP id e91mr4611241qga.35.1395177813580; Tue, 18 Mar 2014 14:23:33 -0700 (PDT) Received: from localhost (pool-108-20-254-15.bstnma.east.verizon.net. [108.20.254.15]) by mx.google.com with ESMTPSA id r110sm27898825qgd.1.2014.03.18.14.23.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Mar 2014 14:23:32 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 08/16] drm: Allow drm_mode_object_find() to look up an object of any type Date: Tue, 18 Mar 2014 17:22:45 -0400 Message-Id: <1395177773-800-9-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1395177773-800-1-git-send-email-robdclark@gmail.com> References: <1395177773-800-1-git-send-email-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 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 88b9a8d..a8d99be 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -479,7 +479,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 15200b4..ec21952 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -53,6 +53,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;