From: "Wang, Zhi A" <zhi.a.wang@intel.com>
To: Rikard Falkeborn <rikard.falkeborn@gmail.com>,
Zhenyu Wang <zhenyuw@linux.intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"intel-gvt-dev@lists.freedesktop.org"
<intel-gvt-dev@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 7/9] drm/i915/gvt: Constify formats
Date: Fri, 10 Dec 2021 08:20:22 +0000 [thread overview]
Message-ID: <6e73f014-730c-3334-c0e6-7e0665f47fec@intel.com> (raw)
In-Reply-To: <20211204105527.15741-8-rikard.falkeborn@gmail.com>
On 12/4/2021 12:55 PM, Rikard Falkeborn wrote:
> These are never modified, so make them const to allow the compiler to
> put them in read-only memory. WHile at it, make the description const
> char* since it is never modified.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
> drivers/gpu/drm/i915/gvt/fb_decoder.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> index 11a8baba6822..3c8736ae8fed 100644
> --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
> +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> @@ -40,12 +40,12 @@
>
> #define PRIMARY_FORMAT_NUM 16
> struct pixel_format {
> - int drm_format; /* Pixel format in DRM definition */
> - int bpp; /* Bits per pixel, 0 indicates invalid */
> - char *desc; /* The description */
> + int drm_format; /* Pixel format in DRM definition */
> + int bpp; /* Bits per pixel, 0 indicates invalid */
> + const char *desc; /* The description */
> };
Thanks so much for this. According to the code of i915, we prefer using
one space as seperator.
>
> -static struct pixel_format bdw_pixel_formats[] = {
> +static const struct pixel_format bdw_pixel_formats[] = {
> {DRM_FORMAT_C8, 8, "8-bit Indexed"},
> {DRM_FORMAT_RGB565, 16, "16-bit BGRX (5:6:5 MSB-R:G:B)"},
> {DRM_FORMAT_XRGB8888, 32, "32-bit BGRX (8:8:8:8 MSB-X:R:G:B)"},
> @@ -58,7 +58,7 @@ static struct pixel_format bdw_pixel_formats[] = {
> {0, 0, NULL},
> };
>
> -static struct pixel_format skl_pixel_formats[] = {
> +static const struct pixel_format skl_pixel_formats[] = {
> {DRM_FORMAT_YUYV, 16, "16-bit packed YUYV (8:8:8:8 MSB-V:Y2:U:Y1)"},
> {DRM_FORMAT_UYVY, 16, "16-bit packed UYVY (8:8:8:8 MSB-Y2:V:Y1:U)"},
> {DRM_FORMAT_YVYU, 16, "16-bit packed YVYU (8:8:8:8 MSB-U:Y2:V:Y1)"},
> @@ -278,14 +278,14 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
>
> #define CURSOR_FORMAT_NUM (1 << 6)
> struct cursor_mode_format {
> - int drm_format; /* Pixel format in DRM definition */
> - u8 bpp; /* Bits per pixel; 0 indicates invalid */
> - u32 width; /* In pixel */
> - u32 height; /* In lines */
> - char *desc; /* The description */
> + int drm_format; /* Pixel format in DRM definition */
> + u8 bpp; /* Bits per pixel; 0 indicates invalid */
> + u32 width; /* In pixel */
> + u32 height; /* In lines */
> + const char *desc; /* The description */
> };
The same comment as above.
> -static struct cursor_mode_format cursor_pixel_formats[] = {
> +static const struct cursor_mode_format cursor_pixel_formats[] = {
> {DRM_FORMAT_ARGB8888, 32, 128, 128, "128x128 32bpp ARGB"},
> {DRM_FORMAT_ARGB8888, 32, 256, 256, "256x256 32bpp ARGB"},
> {DRM_FORMAT_ARGB8888, 32, 64, 64, "64x64 32bpp ARGB"},
> @@ -391,7 +391,7 @@ int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,
>
> #define SPRITE_FORMAT_NUM (1 << 3)
>
> -static struct pixel_format sprite_pixel_formats[SPRITE_FORMAT_NUM] = {
> +static const struct pixel_format sprite_pixel_formats[SPRITE_FORMAT_NUM] = {
> [0x0] = {DRM_FORMAT_YUV422, 16, "YUV 16-bit 4:2:2 packed"},
> [0x1] = {DRM_FORMAT_XRGB2101010, 32, "RGB 32-bit 2:10:10:10"},
> [0x2] = {DRM_FORMAT_XRGB8888, 32, "RGB 32-bit 8:8:8:8"},
The rest of the patch looks good to me.
next prev parent reply other threads:[~2021-12-10 8:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 10:55 [Intel-gfx] [PATCH 0/9] drm/i915/gvt: Constify static structs Rikard Falkeborn
2021-12-04 10:55 ` [Intel-gfx] [PATCH 1/9] drm/i915/gvt: Constify intel_gvt_gtt_pte_ops Rikard Falkeborn
2021-12-10 8:59 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 2/9] " Rikard Falkeborn
2021-12-10 8:11 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 3/9] drm/i915/gvt: Constify intel_gvt_irq_ops Rikard Falkeborn
2021-12-10 8:11 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 4/9] drm/i915/gvt: Constify intel_gvt_sched_policy_ops Rikard Falkeborn
2021-12-10 8:11 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 5/9] drm/i915/gvt: Constify gvt_mmio_block Rikard Falkeborn
2021-12-10 8:12 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 6/9] drm/i915/gvt: Constify cmd_interrupt_events Rikard Falkeborn
2021-12-10 8:12 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 7/9] drm/i915/gvt: Constify formats Rikard Falkeborn
2021-12-10 8:20 ` Wang, Zhi A [this message]
2021-12-12 13:21 ` Rikard Falkeborn
2021-12-04 10:55 ` [Intel-gfx] [PATCH 8/9] drm/i915/gvt: Constify gtt_type_table_entry Rikard Falkeborn
2021-12-10 8:20 ` Wang, Zhi A
2021-12-04 10:55 ` [Intel-gfx] [PATCH 9/9] drm/i915/gvt: Constify vgpu_types Rikard Falkeborn
2021-12-10 8:20 ` Wang, Zhi A
2021-12-06 13:42 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: Constify static structs Patchwork
2021-12-06 14:19 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-12-10 9:00 ` [Intel-gfx] [PATCH 0/9] " Wang, Zhi A
2021-12-12 13:25 ` Rikard Falkeborn
2021-12-16 19:21 ` Wang, Zhi A
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=6e73f014-730c-3334-c0e6-7e0665f47fec@intel.com \
--to=zhi.a.wang@intel.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rikard.falkeborn@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=zhenyuw@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox