From patchwork Fri Jul 21 04:20:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 9856023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E5897601C0 for ; Fri, 21 Jul 2017 04:20:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C59C928733 for ; Fri, 21 Jul 2017 04:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B74F128744; Fri, 21 Jul 2017 04:20:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3327528733 for ; Fri, 21 Jul 2017 04:20:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FE316E738; Fri, 21 Jul 2017 04:20:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (zangief.bwidawsk.net [107.170.211.233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 711346E168; Fri, 21 Jul 2017 04:20:39 +0000 (UTC) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id 076D11200DF; Thu, 20 Jul 2017 21:20:39 -0700 (PDT) Received: from mail.bwidawsk.net (c-73-37-61-163.hsd1.or.comcast.net [73.37.61.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.bwidawsk.net (Postfix) with ESMTPSA id 7964412000A; Thu, 20 Jul 2017 21:20:33 -0700 (PDT) Date: Thu, 20 Jul 2017 21:20:32 -0700 From: Ben Widawsky To: Ville =?utf-8?B?U3lyasOkbMOk?= Message-ID: <20170721042032.GA15342@mail.bwidawsk.net> References: <20170623164544.7362-1-ben@bwidawsk.net> <20170623164544.7362-3-ben@bwidawsk.net> <20170629194944.GG12629@intel.com> <20170714184149.GA18441@mail.bwidawsk.net> <20170714191015.GS12629@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170714191015.GS12629@intel.com> User-Agent: Mutt/1.8.3 (2017-05-23) Cc: Liviu Dudau , Intel GFX , "Kristian H . Kristensen" , Daniel Stone , DRI Development Subject: Re: [Intel-gfx] [PATCH 2/4] drm: Create a format/modifier blob X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On 17-07-14 22:10:15, Ville Syrjälä wrote: >On Fri, Jul 14, 2017 at 11:41:49AM -0700, Ben Widawsky wrote: >> On 17-06-29 22:49:44, Ville Syrjälä wrote: >> >> [snip] >> >> > >> >... but here it's ALIGN(formats_offset+formats_size). I think we should >> >be aligning the same thing in both cases, or we add a BUILD_BUG_ON to >> >make sure the header size always stays a multiple of 8 bytes. >> > >> >That's mainly because the design of the structure seems geared towards >> >expanding the header in the future (as in why else would you have the >> >offsets?). >> > >> >> I guess I don't quite understand what you're asking for. The first thing is >> determining a size, the second is finding an offset into the blob. > >If I remember my thinking correctly, then what I was trying to say was > >ALIGN(multiple_of_4, 8) + ALIGN(multiple_of_4, 8) != ALIGN(multiple_of_4 + multiple_of_4, 8) > >but the code was assuming that it's true, or that at least one of those >things is a multiple of 8 already. > Going with this and calling it sufficient. >> I don't mind changing this, but tell me what you want. >> >> BUILD_BUG_ON sounds good to me regardless. >> >> [snip] >> >> -- >> Ben Widawsky, Intel Open Source Technology Center > >-- >Ville Syrjälä >Intel OTC diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 0da6707a8cf7..5c14beee52ff 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -96,6 +96,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane /* Modifiers offset is a pointer to a struct with a 64 bit field so it * should be naturally aligned to 8B. */ + BUILD_BUG_ON(sizeof(struct drm_format_modifier_blob) % 8); blob_size += ALIGN(formats_size, 8); blob_size += modifiers_size;