qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Helge Deller <deller@gmx.de>, qemu-devel@nongnu.org
Cc: Sven Schnelle <svens@stackframe.org>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 6/7] hw/display/artist: Fix artist screen resolution
Date: Tue, 1 Sep 2020 14:49:07 -0700	[thread overview]
Message-ID: <65284ae3-f0fe-336e-a205-0494abb20f08@linaro.org> (raw)
In-Reply-To: <20200901183452.24967-7-deller@gmx.de>

On 9/1/20 11:34 AM, Helge Deller wrote:
> Artist screen size is limited to 2048 x 2048 pixels and x/y coordination
> addressing needs to be done by OS via an uint32 value which is based on
> a 2048 byte line length, independend of the real screen size.
> 
> Since HP-UX seems to ideally need at least 640 pixels in width, this
> patch ensures that the screen size stays between 640x480 and 2048x2048
> pixels and fixes some pixel glitches were visible before on STI text
> consoles due to the 2048 line length limitation.
> 
> Cc: Sven Schnelle <svens@stackframe.org>
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>  hw/display/artist.c | 37 +++++++++++++++++++++++--------------
>  1 file changed, 23 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/display/artist.c b/hw/display/artist.c
> index 71982559c6..98bee6d61c 100644
> --- a/hw/display/artist.c
> +++ b/hw/display/artist.c
> @@ -192,6 +192,10 @@ static const char *artist_reg_name(uint64_t addr)
>  }
>  #undef REG_NAME
> 
> +/* artist has a fixed line length of 2048 bytes. */
> +#define ADDR_TO_Y(addr) (((addr) >> 11) & 0x7ff)
> +#define ADDR_TO_X(addr) ((addr) & 0x7ff)

extract32()

> +
>  static int16_t artist_get_x(uint32_t reg)
>  {
>      return reg >> 16;
> @@ -348,13 +352,13 @@ static void artist_invalidate_cursor(ARTISTState *s)
>                              y, s->cursor_height);
>  }
> 
> -static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
> +static void vram_bit_write(ARTISTState *s, int posy, bool incr_x,
>                             int size, uint32_t data)
>  {
>      struct vram_buffer *buf;
>      uint32_t vram_bitmask = s->vram_bitmask;
>      int mask, i, pix_count, pix_length;
> -    unsigned int offset, width;
> +    unsigned int posx, offset, width;
>      uint8_t *data8, *p;
> 
>      pix_count = vram_write_pix_per_transfer(s);
> @@ -366,6 +370,8 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
>      if (s->cmap_bm_access) {
>          offset = s->vram_pos;
>      } else {
> +        posx = ADDR_TO_X(s->vram_pos >> 2);
> +        posy += ADDR_TO_Y(s->vram_pos >> 2);

Do you in fact want to fold the >> 2 into the ADDR_TO_X/Y, like

#define ADDR_TO_X(POS)  extract32(POS, 2, 11)

?

> @@ -881,16 +886,12 @@ static void artist_reg_write(void *opaque, hwaddr addr, uint64_t val,
>          break;
> 
>      case VRAM_WRITE_INCR_Y:
> -        posx = (s->vram_pos >> 2) & 0x7ff;
> -        posy = (s->vram_pos >> 13) & 0x3ff;
...
>      case VRAM_WRITE_INCR_X:
>      case VRAM_WRITE_INCR_X2:
> -        posx = (s->vram_pos >> 2) & 0x7ff;
> -        posy = (s->vram_pos >> 13) & 0x3ff;
...
> -    int posy = (addr >> 11) & 0x3ff;

Is it a bug that these Y were using 0x3ff and not 0x7ff?
Because it's pretty consistent...

You should make that a separate change, for sure.

> @@ -1374,6 +1377,12 @@ static void artist_realizefn(DeviceState *dev, Error **errp)
>      struct vram_buffer *buf;
>      hwaddr offset = 0;
> 
> +    /* Screen on artist can not be greater than 2048x2048 pixels. */
> +    s->width = MAX(s->width, 640);
> +    s->width = MIN(s->width, 2048);
> +    s->height = MAX(s->height, 480);
> +    s->height = MIN(s->height, 2048);

Was the original values chosen by the user?  Should we be giving some sort of
error for out-of-range values?


r~


  reply	other threads:[~2020-09-01 21:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 18:34 [PATCH 0/7] hppa power button support, graphics updates and firmware fixes Helge Deller
2020-09-01 18:34 ` [PATCH 1/7] seabios-hppa: Update SeaBIOS to hppa-qemu-5.2-2 tag Helge Deller
2020-09-01 18:34 ` [PATCH 2/7] hw/hppa: Make number of TLB and BTLB entries configurable Helge Deller
2020-09-01 21:36   ` Richard Henderson
2020-09-02 11:16     ` Helge Deller
2020-09-02 16:52       ` Richard Henderson
2020-09-02 19:36         ` Helge Deller
2020-09-01 18:34 ` [PATCH 3/7] hw/hppa: Store boot device in fw_cfg section Helge Deller
2020-09-01 21:37   ` Richard Henderson
2020-09-01 18:34 ` [PATCH 4/7] hw/hppa: Inform SeaBIOS about fw_cfg port address Helge Deller
2020-09-01 21:39   ` Richard Henderson
2020-09-02 11:24     ` Helge Deller
2020-09-02 16:46       ` Richard Henderson
2020-09-02 19:37         ` Helge Deller
2020-09-01 18:34 ` [PATCH 5/7] hw/hppa: Add power button emulation Helge Deller
2020-09-01 21:42   ` Richard Henderson
2020-09-01 18:34 ` [PATCH 6/7] hw/display/artist: Fix artist screen resolution Helge Deller
2020-09-01 21:49   ` Richard Henderson [this message]
2020-09-02 21:48     ` Helge Deller
2020-09-02 22:09       ` Richard Henderson
2020-09-03  6:07         ` Helge Deller
2020-09-03  6:08         ` Helge Deller
2020-09-03  6:09         ` Helge Deller
2020-09-03 15:09           ` Richard Henderson
2020-09-01 18:34 ` [PATCH 7/7] target/hppa: Fix boot with old Linux installation CDs Helge Deller
2020-09-01 19:37 ` [PATCH 0/7] hppa power button support, graphics updates and firmware fixes Philippe Mathieu-Daudé
2020-09-01 19:49   ` Helge Deller

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=65284ae3-f0fe-336e-a205-0494abb20f08@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=deller@gmx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=svens@stackframe.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).