qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-devel@nongnu.org, "Eric Blake" <eblake@redhat.com>,
	qemu-arm@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-ppc@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Dr. David Alan Gilbert" <dave@treblig.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v3 16/18] hw/sm501: allow compiling without PIXMAN
Date: Tue, 10 Oct 2023 17:43:01 +0400	[thread overview]
Message-ID: <CAMxuvawusdxuc-Ck5wCmj-XisbuosJVSdXnSuxtbOwrCvY1M9Q@mail.gmail.com> (raw)
In-Reply-To: <6365e1f5-bffe-ef11-7e9e-55077e66c4d0@eik.bme.hu>

Hi

On Tue, Oct 10, 2023 at 3:59 PM BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> On Tue, 10 Oct 2023, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Drop the "x-pixman" property and use fallback path in such case.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > hw/display/sm501.c | 46 +++++++++++++++++++++++++++++++++++++---------
> > 1 file changed, 37 insertions(+), 9 deletions(-)
> >
> > diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> > index 0eecd00701..bc5faa19f0 100644
> > --- a/hw/display/sm501.c
> > +++ b/hw/display/sm501.c
> > @@ -438,6 +438,12 @@
> > #define SM501_HWC_WIDTH                 64
> > #define SM501_HWC_HEIGHT                64
> >
> > +#ifdef CONFIG_PIXMAN
> > +#define DEFAULT_X_PIXMAN 7
> > +#else
> > +#define DEFAULT_X_PIXMAN 0
> > +#endif
> > +
> > /* SM501 local memory size taken from "linux/drivers/mfd/sm501.c" */
> > static const uint32_t sm501_mem_local_size[] = {
> >     [0] = 4 * MiB,
> > @@ -730,7 +736,6 @@ static void sm501_2d_operation(SM501State *s)
> >     switch (cmd) {
> >     case 0: /* BitBlt */
> >     {
> > -        static uint32_t tmp_buf[16384];
> >         unsigned int src_x = (s->twoD_source >> 16) & 0x01FFF;
> >         unsigned int src_y = s->twoD_source & 0xFFFF;
> >         uint32_t src_base = s->twoD_source_base & 0x03FFFFFF;
> > @@ -828,9 +833,11 @@ static void sm501_2d_operation(SM501State *s)
> >                 de = db + (width + (height - 1) * dst_pitch) * bypp;
> >                 overlap = (db < se && sb < de);
> >             }
> > +#ifdef CONFIG_PIXMAN
> >             if (overlap && (s->use_pixman & BIT(2))) {
> >                 /* pixman can't do reverse blit: copy via temporary */
> >                 int tmp_stride = DIV_ROUND_UP(width * bypp, sizeof(uint32_t));
> > +                static uint32_t tmp_buf[16384];
> >                 uint32_t *tmp = tmp_buf;
> >
> >                 if (tmp_stride * sizeof(uint32_t) * height > sizeof(tmp_buf)) {
> > @@ -860,9 +867,12 @@ static void sm501_2d_operation(SM501State *s)
> >                                        dst_pitch * bypp / sizeof(uint32_t),
> >                                        8 * bypp, 8 * bypp, src_x, src_y,
> >                                        dst_x, dst_y, width, height);
> > -            } else {
> > +            } else
> > +#else
> > +            {
> >                 fallback = true;
> >             }
> > +#endif
> >             if (fallback) {
> >                 uint8_t *sp = s->local_mem + src_base;
> >                 uint8_t *d = s->local_mem + dst_base;
> > @@ -894,10 +904,13 @@ static void sm501_2d_operation(SM501State *s)
> >             color = cpu_to_le16(color);
> >         }
> >
> > +#ifdef CONFIG_PIXMAN
> >         if (!(s->use_pixman & BIT(0)) || (width == 1 && height == 1) ||
> >             !pixman_fill((uint32_t *)&s->local_mem[dst_base],
> >                          dst_pitch * bypp / sizeof(uint32_t), 8 * bypp,
> > -                         dst_x, dst_y, width, height, color)) {
> > +                         dst_x, dst_y, width, height, color))
> > +#endif
> > +        {
> >             /* fallback when pixman failed or we don't want to call it */
> >             uint8_t *d = s->local_mem + dst_base;
> >             unsigned int x, y, i;
> > @@ -1875,9 +1888,16 @@ static void sm501_reset(SM501State *s)
> >     s->twoD_wrap = 0;
> > }
> >
> > -static void sm501_init(SM501State *s, DeviceState *dev,
> > -                       uint32_t local_mem_bytes)
> > +static bool sm501_init(SM501State *s, DeviceState *dev,
> > +                       uint32_t local_mem_bytes, Error **errp)
> > {
> > +#ifndef CONFIG_PIXMAN
> > +    if (s->use_pixman != 0) {
> > +        error_setg(errp, "x-pixman!=0, however PIXMAN is not available");
> > +        return false;
> > +    }
> > +#endif
>
> I think this should be just a warning saying that x-pixman != 0 is not
> effective without pixman and not a hard error. The goal is to keep command
> lines working the same not to annoy users unnecesarily.

ok

>
> > +
> >     s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes);
> >
> >     /* local memory */
> > @@ -1916,6 +1936,7 @@ static void sm501_init(SM501State *s, DeviceState *dev,
> >
> >     /* create qemu graphic console */
> >     s->con = graphic_console_init(dev, 0, &sm501_ops, s);
> > +    return true;
> > }
> >
> > static const VMStateDescription vmstate_sm501_state = {
> > @@ -2014,7 +2035,9 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
> >     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> >     MemoryRegion *mr;
> >
> > -    sm501_init(&s->state, dev, s->vram_size);
> > +    if (!sm501_init(&s->state, dev, s->vram_size, errp)) {
> > +        return;
> > +    }
> >     if (get_local_mem_size(&s->state) != s->vram_size) {
> >         error_setg(errp, "Invalid VRAM size, nearest valid size is %" PRIu32,
> >                    get_local_mem_size(&s->state));
> > @@ -2038,7 +2061,8 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
> >
> > static Property sm501_sysbus_properties[] = {
> >     DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0),
> > -    DEFINE_PROP_UINT8("x-pixman", SM501SysBusState, state.use_pixman, 7),
> > +    /* TODO: consider PROP_BIT instead */
>
> I don't think a comment is needed here but don't mind it you think it
> helps to note this here too but I'd keep the single value instead of
> separate BIT properties.

yes, that will avoid someone else proposing the same change again.

thanks



  parent reply	other threads:[~2023-10-10 13:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10  7:38 [PATCH v3 00/18] Make Pixman an optional dependency marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 01/18] build-sys: add a "pixman" feature marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 02/18] ui: compile out some qemu-pixman functions when !PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 03/18] ui: add pixman-compat.h marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 04/18] ui/console: allow to override the default VC marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 05/18] ui/vc: console-vc requires PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 06/18] qmp/hmp: disable screendump if PIXMAN is missing marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 07/18] virtio-gpu: replace PIXMAN for region/rect test marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 08/18] ui/console: when PIXMAN is unavailable, don't draw placeholder msg marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 09/18] vhost-user-gpu: skip VHOST_USER_GPU_UPDATE when !PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 10/18] ui/gl: opengl doesn't require PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 11/18] ui/vnc: VNC requires PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 12/18] ui/spice: SPICE/QXL " marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 13/18] ui/gtk: -display gtk " marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 14/18] ui/dbus: do not require PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 15/18] arm/kconfig: XLNX_ZYNQMP_ARM depends on PIXMAN marcandre.lureau
2023-10-10  7:38 ` [PATCH v3 16/18] hw/sm501: allow compiling without PIXMAN marcandre.lureau
2023-10-10 11:58   ` BALATON Zoltan
2023-10-10 12:29     ` BALATON Zoltan
2023-10-10 13:40       ` Marc-André Lureau
2023-10-10 13:43     ` Marc-André Lureau [this message]
2023-10-10  7:38 ` [PATCH v3 17/18] hw/display: make ATI_VGA depend on PIXMAN marcandre.lureau
2023-10-10 11:51   ` BALATON Zoltan
2023-10-10  7:38 ` [PATCH v3 18/18] build-sys: make pixman actually optional marcandre.lureau

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=CAMxuvawusdxuc-Ck5wCmj-XisbuosJVSdXnSuxtbOwrCvY1M9Q@mail.gmail.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=dave@treblig.org \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).