From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH v2] DRM: Add DRM kms/fb cma helper Date: Mon, 04 Jun 2012 10:55:11 +0200 Message-ID: <4FCC77EF.2020404@metafoo.de> References: <1338391815-12050-1-git-send-email-lars@metafoo.de> <20120531081355.GP30400@pengutronix.de> <4FC73B2D.3020406@metafoo.de> <20120531181116.GW30400@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-out-111.synserver.de (smtp-out-111.synserver.de [212.40.185.111]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C17E9E7EB for ; Mon, 4 Jun 2012 01:51:50 -0700 (PDT) In-Reply-To: <20120531181116.GW30400@pengutronix.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Sascha Hauer Cc: kernel@pengutronix.de, Laurent Pinchart , dri-devel@lists.freedesktop.org, Rob Clark List-Id: dri-devel@lists.freedesktop.org On 05/31/2012 08:11 PM, Sascha Hauer wrote: > On Thu, May 31, 2012 at 11:34:37AM +0200, Lars-Peter Clausen wrote: >>>> + drm_helper_mode_fill_fb_struct(&fb_cma->fb, mode_cmd); >>>> + >>>> + for (i = 0; i < num_planes; i++) >>>> + fb_cma->obj[i] = obj[i]; >>> >>> Check for valid num_planes before this loop? >>> >> >> Hm, I think the callers already take care of this. drm_format_num_planes will >> always return a valid number and the other caller passes 1 unconditionally. > > As long as the array always is big enough to hold the maximum number of > planes I think it's fine. However, if there is some format with 5 planes > (don't know if there is, I only know yuv with multiple planes) it's not > obvious that this code does not support this. The DRM ABI limits the number of planes to 4. But adding a global DRM_MAX_PLANES is probably a good idea to avoid surprises if this ever changes.