From: Thierry Reding <thierry.reding@gmail.com>
To: Boris BREZILLON <boris.brezillon@free-electrons.com>
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org,
Mauro Carvalho Chehab <m.chehab@samsung.com>
Subject: Re: [PATCH 3/5] drm: add bus_formats and nbus_formats fields to drm_display_info
Date: Tue, 23 Sep 2014 16:04:40 +0200 [thread overview]
Message-ID: <20140923140439.GA5982@ulmo> (raw)
In-Reply-To: <1406031827-12432-4-git-send-email-boris.brezillon@free-electrons.com>
[-- Attachment #1.1: Type: text/plain, Size: 2924 bytes --]
On Tue, Jul 22, 2014 at 02:23:45PM +0200, Boris BREZILLON wrote:
> Add bus_formats and nbus_formats fields and
> drm_display_info_set_bus_formats helper function to specify the bus
> formats supported by a given display.
>
> This information can be used by display controller drivers to configure
> the output interface appropriately (i.e. RGB565, RGB666 or RGB888 on raw
> RGB or LVDS busses).
>
> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 28 ++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 8 ++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index c808a09..50c8395 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -825,6 +825,34 @@ static void drm_mode_remove(struct drm_connector *connector,
> drm_mode_destroy(connector->dev, mode);
> }
>
> +/*
> + * drm_display_info_set_bus_formats - set the supported bus formats
> + * @info: display info to store bus formats in
> + * @fmts: array containing the supported bus formats
> + * @nfmts: the number of entries in the fmts array
> + *
> + * Store the suppported bus formats in display info structure.
> + */
> +int drm_display_info_set_bus_formats(struct drm_display_info *info,
> + const enum video_bus_format *fmts,
> + int nfmts)
Can you make nfmts unsigned please?
> +{
> + enum video_bus_format *formats = NULL;
> +
> + if (fmts && nfmts) {
> + formats = kmemdup(fmts, sizeof(*fmts) * nfmts, GFP_KERNEL);
> + if (!formats)
> + return -ENOMEM;
> + }
> +
> + kfree(info->bus_formats);
> + info->bus_formats = formats;
> + info->nbus_formats = formats ? nfmts : 0;
And perhaps check for formats == NULL && nfmts != 0 since that's not a
valid pair of values. Then you can simply assign this directly without
relying on the value of formats.
Also other variable names use "num_" as a prefix instead of "n", so if
you're going to respin anyway might as well make the names more
consistent.
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_display_info_set_bus_formats);
> +
> /**
> * drm_connector_init - Init a preallocated connector
> * @dev: DRM device
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index e529b68..957729b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -31,6 +31,7 @@
> #include <linux/idr.h>
> #include <linux/fb.h>
> #include <linux/hdmi.h>
> +#include <linux/video-bus-format.h>
> #include <drm/drm_mode.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_modeset_lock.h>
> @@ -121,6 +122,9 @@ struct drm_display_info {
> enum subpixel_order subpixel_order;
> u32 color_formats;
>
> + const enum video_bus_format *bus_formats;
> + int nbus_formats;
unsigned int here too, please.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Boris BREZILLON <boris.brezillon@free-electrons.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org,
Mauro Carvalho Chehab <m.chehab@samsung.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH 3/5] drm: add bus_formats and nbus_formats fields to drm_display_info
Date: Tue, 23 Sep 2014 16:04:40 +0200 [thread overview]
Message-ID: <20140923140439.GA5982@ulmo> (raw)
In-Reply-To: <1406031827-12432-4-git-send-email-boris.brezillon@free-electrons.com>
[-- Attachment #1: Type: text/plain, Size: 2924 bytes --]
On Tue, Jul 22, 2014 at 02:23:45PM +0200, Boris BREZILLON wrote:
> Add bus_formats and nbus_formats fields and
> drm_display_info_set_bus_formats helper function to specify the bus
> formats supported by a given display.
>
> This information can be used by display controller drivers to configure
> the output interface appropriately (i.e. RGB565, RGB666 or RGB888 on raw
> RGB or LVDS busses).
>
> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 28 ++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 8 ++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index c808a09..50c8395 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -825,6 +825,34 @@ static void drm_mode_remove(struct drm_connector *connector,
> drm_mode_destroy(connector->dev, mode);
> }
>
> +/*
> + * drm_display_info_set_bus_formats - set the supported bus formats
> + * @info: display info to store bus formats in
> + * @fmts: array containing the supported bus formats
> + * @nfmts: the number of entries in the fmts array
> + *
> + * Store the suppported bus formats in display info structure.
> + */
> +int drm_display_info_set_bus_formats(struct drm_display_info *info,
> + const enum video_bus_format *fmts,
> + int nfmts)
Can you make nfmts unsigned please?
> +{
> + enum video_bus_format *formats = NULL;
> +
> + if (fmts && nfmts) {
> + formats = kmemdup(fmts, sizeof(*fmts) * nfmts, GFP_KERNEL);
> + if (!formats)
> + return -ENOMEM;
> + }
> +
> + kfree(info->bus_formats);
> + info->bus_formats = formats;
> + info->nbus_formats = formats ? nfmts : 0;
And perhaps check for formats == NULL && nfmts != 0 since that's not a
valid pair of values. Then you can simply assign this directly without
relying on the value of formats.
Also other variable names use "num_" as a prefix instead of "n", so if
you're going to respin anyway might as well make the names more
consistent.
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_display_info_set_bus_formats);
> +
> /**
> * drm_connector_init - Init a preallocated connector
> * @dev: DRM device
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index e529b68..957729b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -31,6 +31,7 @@
> #include <linux/idr.h>
> #include <linux/fb.h>
> #include <linux/hdmi.h>
> +#include <linux/video-bus-format.h>
> #include <drm/drm_mode.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_modeset_lock.h>
> @@ -121,6 +122,9 @@ struct drm_display_info {
> enum subpixel_order subpixel_order;
> u32 color_formats;
>
> + const enum video_bus_format *bus_formats;
> + int nbus_formats;
unsigned int here too, please.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-09-23 14:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 12:23 [PATCH 0/5] video: describe data bus formats Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 1/5] video: move mediabus format definition to a more standard place Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-09-23 12:33 ` Guennadi Liakhovetski
2014-09-23 16:09 ` Boris BREZILLON
2014-09-23 16:09 ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 2/5] video: add RGB444_1X12 and RGB565_1X16 bus formats Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 3/5] drm: add bus_formats and nbus_formats fields to drm_display_info Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-09-23 14:04 ` Thierry Reding [this message]
2014-09-23 14:04 ` Thierry Reding
2014-09-23 14:15 ` Boris BREZILLON
2014-09-23 14:15 ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 4/5] drm: panel: simple-panel: add support for bus_format retrieval Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 5/5] drm: panel: simple-panel: add bus format information for foxlink panel Boris BREZILLON
2014-07-22 12:23 ` Boris BREZILLON
2014-09-23 14:06 ` Thierry Reding
2014-09-23 14:06 ` Thierry Reding
2014-09-23 14:13 ` Boris BREZILLON
2014-09-23 14:13 ` Boris BREZILLON
[not found] ` <1406031827-12432-1-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-08-12 11:02 ` [PATCH 0/5] video: describe data bus formats Boris BREZILLON
2014-08-12 11:02 ` Boris BREZILLON
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140923140439.GA5982@ulmo \
--to=thierry.reding@gmail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.