From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 58AAFC433E6 for ; Wed, 3 Feb 2021 08:14: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 ED5C864F67 for ; Wed, 3 Feb 2021 08:14:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED5C864F67 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lagfreegames.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 047A86EA03; Wed, 3 Feb 2021 08:13:13 +0000 (UTC) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3203C6E08E for ; Tue, 2 Feb 2021 23:25:04 +0000 (UTC) Received: by mail-ed1-x52a.google.com with SMTP id df22so8905347edb.1 for ; Tue, 02 Feb 2021 15:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lagfreegames.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xE2EhQE7qr1T56mKx4U2nzoMU82bVzA5Q7RBjAWlWmk=; b=H/tkCIM++E+tp7Wr0Id4M0B3oqXjtiel74rj0C48W+DoMD91Per5+ubMYx0gNp8aPq DFRZ0OeT/NVLmFrOm+nb+xbFypMGY04b94F0fGlOIwNU5QWyImI2Ys9Xyvsyoo9JJxZD xPbh5B/u3dBsEXhdODqhRkIN2lRWT+fL2Uuj9VXiGV6dbII9LZuI31LQmJunxTlPNDGz Gj0HcscG9x6AjBaFEdC14aV7QJOFkPjly/Bi2B42DDnzUCzimTye/caCJvHZTVxyivyk gmIhuUNpHuFRFGFqHMG6wg7IVkgJBSM7DposUwWoBMUgSHAZ4lgLCdBwo4oqJuKWWrRS JfDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xE2EhQE7qr1T56mKx4U2nzoMU82bVzA5Q7RBjAWlWmk=; b=ibaAcSobLgMSVH05NqUWvIWca8XqOGLIBno8Yn33AtxXsv1AN6/kFKdiqC6K4HGu7z XdvI4JdEQOBkjliEGoYiwzNuqmHUo8n22QT3fJ14ekPEGCQezTWXSMRI6d4MyqM7kcEm Br3CaNbOGaLeTPddIfR66mJG/xabftU3pB9vQODEIJ3T7AedyFNHI0uyEiy4akjP+Viz ZYPtX2YoHiTSsgOCmkncfG8tl00ZR4nC49iHxJ7km7shH5pNEWpDR84UyEnq0qpTuVzw Uvv0KVP2XcqSRjsNlX1onBYe0eCKA3m6WF+zlH/JdNpJD/OBu80m2noVR0IydjnkG1wL v2fg== X-Gm-Message-State: AOAM531lJfVv+xzzqYOskX+edjJ1G/hM7AnCrDIXIQI5zoXm6QjbB6/p rNLX7KQ2GEZp7Lc1gW4aFmpPYLudjHNXgR9J36CWXQ== X-Google-Smtp-Source: ABdhPJzTFbwQdSXBzUzk+ptvfbN472UPRCdvsn/NNZRbX96Gn+fL0L5sOn7fsLwJS0mpBBx+b6jTJKg6WaBfMlDX+og= X-Received: by 2002:a05:6402:1291:: with SMTP id w17mr456888edv.112.1612308302793; Tue, 02 Feb 2021 15:25:02 -0800 (PST) MIME-Version: 1.0 References: <20210202224704.2794318-1-emil.l.velikov@gmail.com> In-Reply-To: <20210202224704.2794318-1-emil.l.velikov@gmail.com> From: James Park Date: Tue, 2 Feb 2021 15:24:51 -0800 Message-ID: Subject: Re: [PATCH] drm/fourcc: introduce DRM_FOURCC_STANDALONE guard To: Emil Velikov X-Mailman-Approved-At: Wed, 03 Feb 2021 08:13:07 +0000 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: Pekka Paalanen , dri-devel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Feb 2, 2021 at 2:47 PM Emil Velikov wrote: > > Currently, the drm_fourcc.h header depends on drm.h for __u32 and __u64. > At the same time drm.h pulls a lot of unneeded symbols. > > Add new guard DRM_FOURCC_STANDALONE, which when set will use local > declaration of said symbols. > > When used on linux - this is a trivial but only when building in strict c99 > mode. One is welcome to ignore the warning, silence it or use c11. If neither > of the three is an option, then do _not_ set the new guard. > > Cc: James Park > Cc: Pekka Paalanen > Cc: Simon Ser > Signed-off-by: Emil Velikov > --- > As mentioned before - there's little point in having yet another header > since keeping those in sync has been a PITA in the past. > --- > include/uapi/drm/drm_fourcc.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h > index 6f0628eb13a6..c1522902f6c9 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -24,7 +24,26 @@ > #ifndef DRM_FOURCC_H > #define DRM_FOURCC_H > > +/* > + * Define DRM_FOURCC_STANDALONE you're interested only FOURCC and do not want > + * to pull drm.h into your application. > + */ > +#ifdef DRM_FOURCC_STANDALONE > +#if defined(__linux__) > + > +#include > + > +#else /* One of the BSDs */ > + > +#include > +typedef uint32_t __u32; > +typedef uint64_t __u64; > + > +#endif /* __linux __ */ > + > +#else > #include "drm.h" > +#endif /* DRM_FOURCC_STANDALONE */ > > #if defined(__cplusplus) > extern "C" { > -- > 2.30.0 > One of my earlier solutions similarly would have forced people to deal with duplicate typedefs, and we arrived at the current solution because we didn't want to burden anyone with that. I feel like having the extra include-guarded file is the lesser of evils. If it helps the patch go through, then I'd drop my preference but I really think the current solution is better. - James _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel