From patchwork Tue Feb 27 08:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 776162 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp51449wro; Tue, 27 Feb 2024 00:40:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXcVwv1lNxDUTm1SiKUEuo7vGSUG1oxrA0Aw3yzbD3c2RnOs1ZobpqFv6ZFUxTX4aljMtCAMmDKIOIBmO+UQKyz X-Google-Smtp-Source: AGHT+IGsljJN7n/YpPKVgnRtZTRlC1T8BXG0Tez7kH3zU/6jAlRuyafuz3yAbGaI6kqB6Jqu0EiR X-Received: by 2002:a81:ad20:0:b0:604:9b50:e973 with SMTP id l32-20020a81ad20000000b006049b50e973mr1471992ywh.44.1709023239648; Tue, 27 Feb 2024 00:40:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709023239; cv=none; d=google.com; s=arc-20160816; b=pJ9Jrib7yFM4SLLW39AmRUjArzV1qG9nuQKWiwwGW0mObs9Pe3EyBsnMnhha0NasQI iyUFLEaNy6da8j+IGn+BmW0nqzBR/zPtvRfpirgxVqtHXsr2B0PpyviS1lFl8puyGCQY mcG0Ry2uy2fBbo8DGwaujeQu+0CWZi17pSHPxxOhIXbiEztH3fZs1gPFW04KBb/9fxoA jpDn+/N7zZhSdVJaBSz6aR3n6blHauKHEbJBybJZ7revqYSNUKf56ID2Yt+Gf4t7rHXr dmc+3ZQxhjcJuJtn08M2WfmxgwHkAvcWTP8h5QsDbhirO0l4NXcKCDgHTADHPmShdrBk mrZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VnEDXtHkt/194uNClzvCuVob3BL+zj1HTpnUIrcdYvs=; fh=RAilKXgZZSQ2VA604P7r8JOHd7UZMoG+TqHgVEWkduM=; b=b2iPc1rQQCs1cRr0tMDkUeAFMgPfwFwjUWWXE32v9fCeI2/DaeeiBlGMvoTBPDgMa2 o226CNnmdBpq6mjHkUi+D2j8/tQMBglA4C12t0Blcs6ts8YSnOg3czPXeCrKfqT8NioQ t+iwt96+I7Y3UudZvr3io7hExA2Z6RYrxd/5ZpmLZcFznRpoy2ueDDFaz4c+I6HzKoub zHjBYyJp4WKGHl5IiCuIm//l8A0CYRcDJBJhlywmAo4hph7T68iECpSqhNI2DxuE+ycE H3f5Ejjuk5IF4k5wh+VENiL0A8XmZdzCfM69xHnBEiDH9ajMRJbc/EvrEf5r2qV2a9Bh xmww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rf4ROqkT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d22-20020a05620a205600b00787d47364e6si3358280qka.599.2024.02.27.00.40.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 00:40:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rf4ROqkT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ret0V-0005uj-Tx; Tue, 27 Feb 2024 03:40:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ret0S-0005tU-Vi for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:40:09 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ret0P-0007TE-Qz for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:40:08 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33d6fe64a9bso3081052f8f.0 for ; Tue, 27 Feb 2024 00:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709023203; x=1709628003; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VnEDXtHkt/194uNClzvCuVob3BL+zj1HTpnUIrcdYvs=; b=Rf4ROqkTvbsei6T97sud1aTVhEN/7e3cdHwmJ1gfjSVtpm/lM0ZihaH/J/wkjWikdq 4aAJXNuzHCac9FF2XshYdabBcdTjEsDdUpLtK8fggCVO1REWdqfugiR8IKKeHm3dCflj JvtSFDqk2gZ5ZohW+fP+z+9OBfk6zfLXpmxYaUGSQyjrJGUXOV/tFi7/AxFpDaE1OGRR lSTD7PFcAEtRj4GsEYpY1fBjqS9QYfDIdrbxUmtyWaUIfwZbuhCPIUl5zi7kVmg+W/iK ZCJKiMBjBlElCePa20LgiH7qjSoKa8mwt3508thIllQ1KXDr6gC59zQiUSBU9JhR4LVV 9JxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709023203; x=1709628003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VnEDXtHkt/194uNClzvCuVob3BL+zj1HTpnUIrcdYvs=; b=YyImn58uNlQWliZsFwUZoU902nUx+rgXvVORGwpA7XaBCuaoLr9yWBzYiSusqPxKJo bLYux4tNvA4KZKsJ/UdR0SKQ1CjahKh0d/XlKXwdUzFn5T6JzymuQV+H188+zpDdbNny 1CE/fu8JGnAGSCrujeFVqWSLUqVO4dKsFOsR+QczvuHQ2EoMcbLm2D43xicvKrxq7CxT ihIx7ZqJJNStEitCPfhR+sMk9UGHW4G/9ENyLxBQWnbFkVH297rV4p1DHksHoo41Dv01 Car2nB2EP2WwHYVe8moIOPDKkVT1IrpTWbcz/ylbJ77QEaYCuYx3UjAc/TQmw8RD/ckR XSIQ== X-Gm-Message-State: AOJu0YwM7KnUMlWwluabtk2BRJr1tZ18J8Qnhg6ih8/pDyfDEnkEfdoF p/mf4t5AqIa7Hc2i8TB4Jl8LP6K5Y73B32HBp0qmh7Eyj/8usLi0MGj7qRoBRM/WAfSyavR04Dr e X-Received: by 2002:a05:6000:1816:b0:33d:f51f:2d9f with SMTP id m22-20020a056000181600b0033df51f2d9fmr146659wrh.44.1709023202800; Tue, 27 Feb 2024 00:40:02 -0800 (PST) Received: from m1x-phil.lan (mic92-h03-176-184-33-214.dsl.sta.abo.bbox.fr. [176.184.33.214]) by smtp.gmail.com with ESMTPSA id ay25-20020a5d6f19000000b0033da430f286sm10910899wrb.69.2024.02.27.00.40.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 27 Feb 2024 00:40:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 02/30] hw/display/pl110: Pass frame buffer memory region as link property Date: Tue, 27 Feb 2024 09:39:18 +0100 Message-ID: <20240227083948.5427-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240227083948.5427-1-philmd@linaro.org> References: <20240227083948.5427-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add the PL110::'framebuffer-memory' property. Have the different ARM boards set it. We don't need to call sysbus_address_space() anymore. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240226173805.289-3-philmd@linaro.org> --- hw/arm/integratorcp.c | 2 ++ hw/arm/realview.c | 2 ++ hw/arm/versatilepb.c | 2 ++ hw/arm/vexpress.c | 5 +++++ hw/display/pl110.c | 20 ++++++++++++++++---- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 5b002da350..feb0dd63df 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -671,6 +671,8 @@ static void integratorcp_init(MachineState *machine) } dev = qdev_new("pl110"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(address_space_mem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xc0000000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[22]); diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 77300e92e5..b186f965c6 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -239,6 +239,8 @@ static void realview_init(MachineState *machine, gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]); dev = qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[23]); diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 7e04b23af8..d48235453e 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -300,6 +300,8 @@ static void versatile_init(MachineState *machine, int board_id) /* The versatile/PB actually has a modified Color LCD controller that includes hardware cursor support from the PL111. */ dev = qdev_new("pl110_versatile"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10120000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[16]); diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 671986c21e..de815d84cc 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -299,6 +299,9 @@ static void a9_daughterboard_init(VexpressMachineState *vms, /* 0x10020000 PL111 CLCD (daughterboard) */ dev = qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[44]); @@ -654,6 +657,8 @@ static void vexpress_common_init(MachineState *machine) /* VE_COMPACTFLASH: not modelled */ dev = qdev_new("pl111"); + object_property_set_link(OBJECT(dev), "framebuffer-memory", + OBJECT(sysmem), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, map[VE_CLCD]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[14]); diff --git a/hw/display/pl110.c b/hw/display/pl110.c index 4b83db9322..7f145bbdba 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "ui/console.h" #include "framebuffer.h" @@ -17,6 +18,7 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "qemu/module.h" +#include "qapi/error.h" #include "qom/object.h" #define PL110_CR_EN 0x001 @@ -74,6 +76,7 @@ struct PL110State { uint32_t palette[256]; uint32_t raw_palette[128]; qemu_irq irq; + MemoryRegion *fbmem; }; static int vmstate_pl110_post_load(void *opaque, int version_id); @@ -210,7 +213,6 @@ static int pl110_enabled(PL110State *s) static void pl110_update_display(void *opaque) { PL110State *s = (PL110State *)opaque; - SysBusDevice *sbd; DisplaySurface *surface = qemu_console_surface(s->con); drawfn fn; int src_width; @@ -222,8 +224,6 @@ static void pl110_update_display(void *opaque) return; } - sbd = SYS_BUS_DEVICE(s); - if (s->cr & PL110_CR_BGR) bpp_offset = 0; else @@ -290,7 +290,7 @@ static void pl110_update_display(void *opaque) first = 0; if (s->invalidate) { framebuffer_update_memory_section(&s->fbsection, - sysbus_address_space(sbd), + s->fbmem, s->upbase, s->rows, src_width); } @@ -535,11 +535,22 @@ static const GraphicHwOps pl110_gfx_ops = { .gfx_update = pl110_update_display, }; +static Property pl110_properties[] = { + DEFINE_PROP_LINK("framebuffer-memory", PL110State, fbmem, + TYPE_MEMORY_REGION, MemoryRegion *), + DEFINE_PROP_END_OF_LIST(), +}; + static void pl110_realize(DeviceState *dev, Error **errp) { PL110State *s = PL110(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + if (!s->fbmem) { + error_setg(errp, "'framebuffer-memory' property was not set"); + return; + } + memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); @@ -577,6 +588,7 @@ static void pl110_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->vmsd = &vmstate_pl110; dc->realize = pl110_realize; + device_class_set_props(dc, pl110_properties); } static const TypeInfo pl110_info = {