From: Alon Levy <alevy@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: spice-devel@lists.freedesktop.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Spice-devel] [PATCH 2/4] qxl: move ram size init to new function
Date: Fri, 17 Feb 2012 21:29:59 +0200 [thread overview]
Message-ID: <20120217192959.GG23926@garlic.redhat.com> (raw)
In-Reply-To: <1329491433-31446-3-git-send-email-kraxel@redhat.com>
On Fri, Feb 17, 2012 at 04:10:31PM +0100, Gerd Hoffmann wrote:
> Factor memory bar sizing bits out to a separate function.
ACK.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/qxl.c | 41 ++++++++++++++++++++++-------------------
> 1 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/hw/qxl.c b/hw/qxl.c
> index 4de4b8d..38bb90e 100644
> --- a/hw/qxl.c
> +++ b/hw/qxl.c
> @@ -1554,6 +1554,25 @@ static DisplayChangeListener display_listener = {
> .dpy_refresh = display_refresh,
> };
>
> +static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb)
> +{
> + /* vga ram (bar 0) */
> + if (qxl->vga.vram_size < ram_min_mb * 1024 * 1024) {
> + qxl->vga.vram_size = ram_min_mb * 1024 * 1024;
> + }
> +
> + /* vram (surfaces, bar 1) */
> + if (qxl->vram_size < 4096) {
> + qxl->vram_size = 4096;
> + }
> + if (qxl->revision == 1) {
> + qxl->vram_size = 4096;
> + }
> +
> + qxl->vga.vram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
> + qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
> +}
> +
> static int qxl_init_common(PCIQXLDevice *qxl)
> {
> uint8_t* config = qxl->pci.config;
> @@ -1592,13 +1611,6 @@ static int qxl_init_common(PCIQXLDevice *qxl)
> init_qxl_rom(qxl);
> init_qxl_ram(qxl);
>
> - if (qxl->vram_size < 4096) {
> - qxl->vram_size = 4096;
> - }
> - if (qxl->revision == 1) {
> - qxl->vram_size = 4096;
> - }
> - qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
> memory_region_init_ram(&qxl->vram_bar, "qxl.vram", qxl->vram_size);
> vmstate_register_ram(&qxl->vram_bar, &qxl->pci.qdev);
>
> @@ -1641,15 +1653,11 @@ static int qxl_init_primary(PCIDevice *dev)
> {
> PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
> VGACommonState *vga = &qxl->vga;
> - ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
> PortioList *qxl_vga_port_list = g_new(PortioList, 1);
>
> qxl->id = 0;
> -
> - if (ram_size < 32 * 1024 * 1024) {
> - ram_size = 32 * 1024 * 1024;
> - }
> - vga_common_init(vga, ram_size);
> + qxl_init_ramsize(qxl, 32);
> + vga_common_init(vga, qxl->vga.vram_size);
> vga_init(vga, pci_address_space(dev), pci_address_space_io(dev), false);
> portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
> portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
> @@ -1668,14 +1676,9 @@ static int qxl_init_secondary(PCIDevice *dev)
> {
> static int device_id = 1;
> PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
> - ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
>
> qxl->id = device_id++;
> -
> - if (ram_size < 16 * 1024 * 1024) {
> - ram_size = 16 * 1024 * 1024;
> - }
> - qxl->vga.vram_size = ram_size;
> + qxl_init_ramsize(qxl, 16);
> memory_region_init_ram(&qxl->vga.vram, "qxl.vgavram", qxl->vga.vram_size);
> vmstate_register_ram(&qxl->vga.vram, &qxl->pci.qdev);
> qxl->vga.vram_ptr = memory_region_get_ram_ptr(&qxl->vga.vram);
> --
> 1.7.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
next prev parent reply other threads:[~2012-02-17 19:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 15:10 [Qemu-devel] [PATCH 0/4] qxl: memory config patches Gerd Hoffmann
2012-02-17 15:10 ` [Qemu-devel] [PATCH 1/4] qxl: drop vram bar minimum size Gerd Hoffmann
2012-02-17 19:27 ` Alon Levy
2012-02-17 19:28 ` Alon Levy
2012-02-17 15:10 ` [Qemu-devel] [PATCH 2/4] qxl: move ram size init to new function Gerd Hoffmann
2012-02-17 19:29 ` Alon Levy [this message]
2012-02-17 15:10 ` [Qemu-devel] [PATCH 3/4] qxl: add user-friendly bar size properties Gerd Hoffmann
2012-02-17 19:39 ` [Qemu-devel] [Spice-devel] " Alon Levy
2012-02-17 15:10 ` [Qemu-devel] [PATCH 4/4] [experimental] add optinal 64bit vram bar to qxl Gerd Hoffmann
2012-02-17 19:39 ` [Qemu-devel] [Spice-devel] " Alon Levy
2012-02-20 8:00 ` Gerd Hoffmann
2012-02-20 8:19 ` Alon Levy
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=20120217192959.GG23926@garlic.redhat.com \
--to=alevy@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=spice-devel@lists.freedesktop.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).