From patchwork Wed May 16 09:07:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 8673 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BDD4223E61 for ; Wed, 16 May 2012 09:07:30 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 77C58A1835E for ; Wed, 16 May 2012 09:07:30 +0000 (UTC) Received: by yhpp61 with SMTP id p61so501394yhp.11 for ; Wed, 16 May 2012 02:07:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=OyTigIDJISl1nxr48fxzN/cepDnNj6W8QvZY/QH9BJ4=; b=cC3ne9DRyUyT8lW8J8Hb2lUExlP+30fvo4Ldj8kM6z5lSJbaSCijzgXtvqI1e1rw9C H4vDiSKoIe61MPofdEcrNHaF51vp9n04DuVuKIqtIODoHvO0+pnQTwKspVLAoytI6Djp wkQopw6hmd1FodlaCEehq7ue5jvj1xzTt5vIj7xC0FQJrw2DDxl84Mr5b62c87PV5ylO 7AD5n50+7go0rgFn2DeLuQ5/baLOLi8zaqGt/g6F3YK0stQVIuGj1PI2JQ5S7o9ED+hx aSt7ZAM+sEkY2pRkmi3hTAuJ/52JrxFCLBDI4d5Zs1IscRmjbfdfHssK7f5cFCflfEHF LgNA== Received: by 10.50.195.234 with SMTP id ih10mr1413730igc.0.1337159249769; Wed, 16 May 2012 02:07:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp479059ibd; Wed, 16 May 2012 02:07:29 -0700 (PDT) Received: by 10.60.14.169 with SMTP id q9mr2116251oec.19.1337159249252; Wed, 16 May 2012 02:07:29 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id k10si712655oeb.57.2012.05.16.02.07.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 May 2012 02:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id eq6so1116990obc.37 for ; Wed, 16 May 2012 02:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=OyTigIDJISl1nxr48fxzN/cepDnNj6W8QvZY/QH9BJ4=; b=yteWo185T4syV9keLlap/b+MIIsrxAiy0TVaeoQvV3g1iJnCKkf3S4oGj18T0igb8v QoAcxfwn7Ce8xWwHkZo8Sw+QE69JsFfOb5aud7nc+MUeJ9e5DFR77zGiQFJFOBt6EoiI 7/n1+b6kyF+nThsh1ie6nPUIIspEZGTn1Ks0XW31ah/k2rqMMpm5ilulYVDBzlDaQYuj Ujc5mOEQUcQ1qXvsKd0daFWZ4aKNOu12CXN8uGWfWY9u+TZmZWsBTpMckcUDaLsth8Zt OihhoiKUNUsPoPLFcFrGADcfdU0GDVMeF2Qo+7cioYAlau9FecYBUzRW/pES5piqfeqN O+dw== Received: by 10.60.169.146 with SMTP id ae18mr1998949oec.36.1337159249119; Wed, 16 May 2012 02:07:29 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id a6sm1402759oeg.7.2012.05.16.02.07.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 May 2012 02:07:28 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Paulo Zanoni , Rob Clark Subject: [PATCH libdrm 1/3] Add support for bitmask properties Date: Wed, 16 May 2012 03:07:13 -0600 Message-Id: <1337159235-32741-2-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337159235-32741-1-git-send-email-rob.clark@linaro.org> References: <1337159235-32741-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQnpEIfG8zfOpA3g6IB8Kj/RY7Z/INg5S3JnwwoStPSXTmK0lSqg2EPm1Q7BlrVwzxEgYGtp From: Rob Clark A bitmask property is similar to an enum. The enum value is a bit position (0-63), and valid property values consist of a mask of zero or more of (1 << enum_val[n]). Signed-off-by: Rob Clark --- include/drm/drm_mode.h | 1 + xf86drmMode.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index f303d94..62ba997 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -226,6 +226,7 @@ struct drm_mode_get_connector { #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ #define DRM_MODE_PROP_BLOB (1<<4) +#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ struct drm_mode_property_enum { __u64 value; diff --git a/xf86drmMode.c b/xf86drmMode.c index a60c7cb..04fdf1f 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -575,7 +575,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id) if (prop.count_values) prop.values_ptr = VOID2U64(drmMalloc(prop.count_values * sizeof(uint64_t))); - if (prop.count_enum_blobs && (prop.flags & DRM_MODE_PROP_ENUM)) + if (prop.count_enum_blobs && (prop.flags & (DRM_MODE_PROP_ENUM | DRM_MODE_PROP_BITMASK))) prop.enum_blob_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(struct drm_mode_property_enum))); if (prop.count_enum_blobs && (prop.flags & DRM_MODE_PROP_BLOB)) { @@ -597,7 +597,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id) r->flags = prop.flags; if (prop.count_values) r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_values, sizeof(uint64_t)); - if (prop.flags & DRM_MODE_PROP_ENUM) { + if (prop.flags & (DRM_MODE_PROP_ENUM | DRM_MODE_PROP_BITMASK)) { r->count_enums = prop.count_enum_blobs; r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum)); } else if (prop.flags & DRM_MODE_PROP_BLOB) {