|
Hans de Goede |
56753f |
From 619c68418809149d56025e5b4e7a9828eef90ea8 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
Date: Fri, 17 Feb 2012 15:02:40 +0100
|
|
Hans de Goede |
56753f |
Subject: [PATCH 410/434] qxl: move ram size init to new function
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Factor memory bar sizing bits out to a separate function.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Conflicts:
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
hw/qxl.c
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
hw/qxl.c | 41 ++++++++++++++++++++++-------------------
|
|
Hans de Goede |
56753f |
1 file changed, 22 insertions(+), 19 deletions(-)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/hw/qxl.c b/hw/qxl.c
|
|
Hans de Goede |
56753f |
index d71c94d..df8efbc 100644
|
|
Hans de Goede |
56753f |
--- a/hw/qxl.c
|
|
Hans de Goede |
56753f |
+++ b/hw/qxl.c
|
|
Hans de Goede |
56753f |
@@ -1557,6 +1557,25 @@ static DisplayChangeListener display_listener = {
|
|
Hans de Goede |
56753f |
.dpy_refresh = display_refresh,
|
|
Hans de Goede |
56753f |
};
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
+static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb)
|
|
Hans de Goede |
56753f |
+{
|
|
Hans de Goede |
56753f |
+ /* vga ram (bar 0) */
|
|
Hans de Goede |
56753f |
+ if (qxl->vga.vram_size < ram_min_mb * 1024 * 1024) {
|
|
Hans de Goede |
56753f |
+ qxl->vga.vram_size = ram_min_mb * 1024 * 1024;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ /* vram (surfaces, bar 1) */
|
|
Hans de Goede |
56753f |
+ if (qxl->vram_size < 4096) {
|
|
Hans de Goede |
56753f |
+ qxl->vram_size = 4096;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+ if (qxl->revision == 1) {
|
|
Hans de Goede |
56753f |
+ qxl->vram_size = 4096;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ qxl->vga.vram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
|
|
Hans de Goede |
56753f |
+ qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
|
|
Hans de Goede |
56753f |
+}
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
static int qxl_init_common(PCIQXLDevice *qxl)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
uint8_t* config = qxl->pci.config;
|
|
Hans de Goede |
56753f |
@@ -1595,13 +1614,6 @@ static int qxl_init_common(PCIQXLDevice *qxl)
|
|
Hans de Goede |
56753f |
init_qxl_rom(qxl);
|
|
Hans de Goede |
56753f |
init_qxl_ram(qxl);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
- if (qxl->vram_size < 4096) {
|
|
Hans de Goede |
56753f |
- qxl->vram_size = 4096;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- if (qxl->revision == 1) {
|
|
Hans de Goede |
56753f |
- qxl->vram_size = 4096;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
|
|
Hans de Goede |
56753f |
memory_region_init_ram(&qxl->vram_bar, &qxl->pci.qdev, "qxl.vram",
|
|
Hans de Goede |
56753f |
qxl->vram_size);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
@@ -1644,15 +1656,11 @@ static int qxl_init_primary(PCIDevice *dev)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
|
|
Hans de Goede |
56753f |
VGACommonState *vga = &qxl->vga;
|
|
Hans de Goede |
56753f |
- ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
|
|
Hans de Goede |
56753f |
PortioList *qxl_vga_port_list = g_new(PortioList, 1);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
qxl->id = 0;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- if (ram_size < 32 * 1024 * 1024) {
|
|
Hans de Goede |
56753f |
- ram_size = 32 * 1024 * 1024;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- vga_common_init(vga, ram_size);
|
|
Hans de Goede |
56753f |
+ qxl_init_ramsize(qxl, 32);
|
|
Hans de Goede |
56753f |
+ vga_common_init(vga, qxl->vga.vram_size);
|
|
Hans de Goede |
56753f |
vga_init(vga, pci_address_space(dev), pci_address_space_io(dev), false);
|
|
Hans de Goede |
56753f |
portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
|
|
Hans de Goede |
56753f |
portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
|
|
Hans de Goede |
56753f |
@@ -1671,14 +1679,9 @@ static int qxl_init_secondary(PCIDevice *dev)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
static int device_id = 1;
|
|
Hans de Goede |
56753f |
PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
|
|
Hans de Goede |
56753f |
- ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
qxl->id = device_id++;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- if (ram_size < 16 * 1024 * 1024) {
|
|
Hans de Goede |
56753f |
- ram_size = 16 * 1024 * 1024;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- qxl->vga.vram_size = ram_size;
|
|
Hans de Goede |
56753f |
+ qxl_init_ramsize(qxl, 16);
|
|
Hans de Goede |
56753f |
memory_region_init_ram(&qxl->vga.vram, &qxl->pci.qdev, "qxl.vgavram",
|
|
Hans de Goede |
56753f |
qxl->vga.vram_size);
|
|
Hans de Goede |
56753f |
qxl->vga.vram_ptr = memory_region_get_ram_ptr(&qxl->vga.vram);
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|