From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Courbot Subject: Re: [PATCH V2] video: implement a simple framebuffer driver Date: Sat, 18 May 2013 19:29:53 +0900 Message-ID: References: <1365043183-28905-1-git-send-email-swarren@wwwdotorg.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1365043183-28905-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Stephen Warren Cc: "linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" , Rob Clark , linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Andrew Morton , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org On Thu, Apr 4, 2013 at 11:39 AM, Stephen Warren wrote: > +struct simplefb_format { > + const char *name; > + u32 bits_per_pixel; > + struct fb_bitfield red; > + struct fb_bitfield green; > + struct fb_bitfield blue; > + struct fb_bitfield transp; > +}; > + > +struct simplefb_format simplefb_formats[] = { > + { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} }, > +}; I have been adding a few extra formats to this list, and I wonder if this could not simply be turned into a function that would directly convert the name string into the corresponding right format. The mapping between name and format seems to be a 1:1 and this would probably avoid errors in the future. I'm especially thinking about color order here - I started adding a mode that reads { "r8g8b8a8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8} }, while it should probably be called "a8b8g8r8" as the order of colors is not the same as your r5g6b5. I can submit a patch if there is no issue with that idea. Alex.