qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Pooja Dhannawat <dhannawatpooja1@gmail.com>, qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4] blizzard: Remove support for DEPTH != 32
Date: Thu, 24 Mar 2016 13:03:34 -0600	[thread overview]
Message-ID: <56F43A06.9090700@redhat.com> (raw)
In-Reply-To: <1458843489-14104-1-git-send-email-dhannawatpooja1@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2128 bytes --]

On 03/24/2016 12:18 PM, Pooja Dhannawat wrote:
> Removing support for DEPTH != 32 from blizzard template header
> and file that includes it, as macro DEPTH == 32 only used.
> 
> Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
> ---

>  #define DEPTH 32
>  #include "blizzard_template.h"
>  

> +    assert(surface_bits_per_pixel(surface) == 32)

So this confirms that we only ever cared about DEPTH == 32.

> +
> +    s->line_fn_tab[0] = blizzard_draw_fn_32;
> +    s->line_fn_tab[1] = blizzard_draw_fn_r_32;

But now we are in the situation of having to look in the
blizzard_template.h file...

> +++ b/hw/display/blizzard_template.h
> @@ -19,31 +19,7 @@
>   */
>  
>  #define SKIP_PIXEL(to)         (to += deststep)

> +#if DEPTH == 32
>  # define PIXEL_TYPE            uint32_t
>  # define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
>  # define COPY_PIXEL1(to, from) (*to++ = from)
> @@ -58,9 +34,6 @@
>  static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
>                  const uint16_t *src, unsigned int width)

...and to reconstruct the results of the glue() macros to find the
actual function definitions that we are using.  I think this patch is
okay as a first step, but I think we can go one step further in a
followup patch: remove the glue() magic, delete blizzard_template.h, and
just declare the used functions directly in blizzard.c.

> @@ -74,7 +47,6 @@ static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
>          data >>= 5;
>          COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));

And even without getting rid of the .h, there are some cleanups you can
do now that DEPTH is a constant.  For example, this line can shorten to:

COPY_PIXEL1(dest, rgb_to_pixel32(r, g, b));

which in turn becomes a bit more legible as:

*dest++ = rgb_to_pixel32(r, g, b);

Since what you have is incrementally better, I'm fine if you add:
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-03-24 19:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 18:18 [Qemu-devel] [PATCH v4] blizzard: Remove support for DEPTH != 32 Pooja Dhannawat
2016-03-24 19:03 ` Eric Blake [this message]
2016-03-25  3:09 ` Fam Zheng
2016-03-25  6:06   ` Pooja Dhannawat
  -- strict thread matches above, loose matches on Subject: below --
2016-03-26  5:57 Pooja Dhannawat
2016-04-05  6:54 ` Pooja Dhannawat
2016-05-04 14:13 ` Peter Maydell

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=56F43A06.9090700@redhat.com \
    --to=eblake@redhat.com \
    --cc=dhannawatpooja1@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).