qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Cc: flier_m@outlook.com, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/2] vga: move access helpers to separate include file
Date: Tue, 17 Sep 2019 18:35:41 +0200	[thread overview]
Message-ID: <1d75be76-93b4-c14c-0347-bdaacf31b1f5@redhat.com> (raw)
In-Reply-To: <20190917111441.27405-2-kraxel@redhat.com>

On 9/17/19 1:14 PM, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/display/vga-access.h  | 49 ++++++++++++++++++++++++++++++++++++++++
>  hw/display/vga-helpers.h | 26 ---------------------
>  hw/display/vga.c         |  1 +
>  3 files changed, 50 insertions(+), 26 deletions(-)
>  create mode 100644 hw/display/vga-access.h
> 
> diff --git a/hw/display/vga-access.h b/hw/display/vga-access.h
> new file mode 100644
> index 000000000000..c0fbd9958b2e
> --- /dev/null
> +++ b/hw/display/vga-access.h
> @@ -0,0 +1,49 @@
> +/*
> + * QEMU VGA Emulator templates
> + *
> + * Copyright (c) 2003 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a copy
> + * of this software and associated documentation files (the "Software"), to deal
> + * in the Software without restriction, including without limitation the rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> + * THE SOFTWARE.
> + */
> +
> +static inline uint8_t vga_read_byte(VGACommonState *vga, uint32_t addr)
> +{
> +    return vga->vram_ptr[addr & vga->vbe_size_mask];
> +}
> +
> +static inline uint16_t vga_read_word_le(VGACommonState *vga, uint32_t addr)
> +{
> +    uint32_t offset = addr & vga->vbe_size_mask & ~1;
> +    uint16_t *ptr = (uint16_t *)(vga->vram_ptr + offset);
> +    return lduw_le_p(ptr);
> +}
> +
> +static inline uint16_t vga_read_word_be(VGACommonState *vga, uint32_t addr)
> +{
> +    uint32_t offset = addr & vga->vbe_size_mask & ~1;
> +    uint16_t *ptr = (uint16_t *)(vga->vram_ptr + offset);
> +    return lduw_be_p(ptr);
> +}
> +
> +static inline uint32_t vga_read_dword_le(VGACommonState *vga, uint32_t addr)
> +{
> +    uint32_t offset = addr & vga->vbe_size_mask & ~3;
> +    uint32_t *ptr = (uint32_t *)(vga->vram_ptr + offset);
> +    return ldl_le_p(ptr);
> +}
> diff --git a/hw/display/vga-helpers.h b/hw/display/vga-helpers.h
> index 5a752b3f9efd..10e9cfd40a04 100644
> --- a/hw/display/vga-helpers.h
> +++ b/hw/display/vga-helpers.h
> @@ -95,32 +95,6 @@ static void vga_draw_glyph9(uint8_t *d, int linesize,
>      } while (--h);
>  }
>  
> -static inline uint8_t vga_read_byte(VGACommonState *vga, uint32_t addr)
> -{
> -    return vga->vram_ptr[addr & vga->vbe_size_mask];
> -}
> -
> -static inline uint16_t vga_read_word_le(VGACommonState *vga, uint32_t addr)
> -{
> -    uint32_t offset = addr & vga->vbe_size_mask & ~1;
> -    uint16_t *ptr = (uint16_t *)(vga->vram_ptr + offset);
> -    return lduw_le_p(ptr);
> -}
> -
> -static inline uint16_t vga_read_word_be(VGACommonState *vga, uint32_t addr)
> -{
> -    uint32_t offset = addr & vga->vbe_size_mask & ~1;
> -    uint16_t *ptr = (uint16_t *)(vga->vram_ptr + offset);
> -    return lduw_be_p(ptr);
> -}
> -
> -static inline uint32_t vga_read_dword_le(VGACommonState *vga, uint32_t addr)
> -{
> -    uint32_t offset = addr & vga->vbe_size_mask & ~3;
> -    uint32_t *ptr = (uint32_t *)(vga->vram_ptr + offset);
> -    return ldl_le_p(ptr);
> -}
> -
>  /*
>   * 4 color mode
>   */
> diff --git a/hw/display/vga.c b/hw/display/vga.c
> index 573d223d46f0..82ebe5361096 100644
> --- a/hw/display/vga.c
> +++ b/hw/display/vga.c
> @@ -1009,6 +1009,7 @@ void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
>  typedef void vga_draw_line_func(VGACommonState *s1, uint8_t *d,
>                                  uint32_t srcaddr, int width);
>  
> +#include "vga-access.h"
>  #include "vga-helpers.h"
>  
>  /* return true if the palette was modified */
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  reply	other threads:[~2019-09-17 16:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 11:14 [Qemu-devel] [PATCH v3 0/2] ati: fix ati_cursor_define bug Gerd Hoffmann
2019-09-17 11:14 ` [Qemu-devel] [PATCH v3 1/2] vga: move access helpers to separate include file Gerd Hoffmann
2019-09-17 16:35   ` Philippe Mathieu-Daudé [this message]
2019-09-17 11:14 ` [Qemu-devel] [PATCH v3 2/2] ati: use vga_read_byte in ati_cursor_define Gerd Hoffmann
2019-09-17 13:48   ` BALATON Zoltan
2019-09-17 16:37   ` Philippe Mathieu-Daudé
2019-09-17 16:22 ` [Qemu-devel] [PATCH v3 0/2] ati: fix ati_cursor_define bug no-reply
2019-09-17 16:23 ` no-reply

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=1d75be76-93b4-c14c-0347-bdaacf31b1f5@redhat.com \
    --to=philmd@redhat.com \
    --cc=flier_m@outlook.com \
    --cc=kraxel@redhat.com \
    --cc=mst@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).