From patchwork Mon Jun 11 06:23:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 164078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 079141007D1 for ; Mon, 11 Jun 2012 16:46:48 +1000 (EST) Received: from localhost ([::1]:44550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sdy3W-00066f-KN for incoming@patchwork.ozlabs.org; Mon, 11 Jun 2012 02:24:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sdy2q-0004OH-UT for qemu-devel@nongnu.org; Mon, 11 Jun 2012 02:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sdy2p-0005Bv-1q for qemu-devel@nongnu.org; Mon, 11 Jun 2012 02:24:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sdy2o-0005Bg-QA for qemu-devel@nongnu.org; Mon, 11 Jun 2012 02:24:06 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5B6O4of002510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 11 Jun 2012 02:24:04 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5B6O1VV023220; Mon, 11 Jun 2012 02:24:03 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 11 Jun 2012 09:23:59 +0300 Message-Id: <1339395841-31413-2-git-send-email-alevy@redhat.com> In-Reply-To: <1339395841-31413-1-git-send-email-alevy@redhat.com> References: <1339395841-31413-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH 1/3] qxl: add fb_size_mb and fb_size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In preperation for supporting a larger framebuffer for multiple monitors on a single card, add a property to qxl fb_size_mb, and corresponding byte sized fb_size, and use instead of VGA_RAM_SIZE. Signed-off-by: Alon Levy --- hw/qxl.c | 31 ++++++++++++++++++++----------- hw/qxl.h | 2 ++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index b5e53ce..a9b4fd1 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -114,20 +114,16 @@ static QXLMode qxl_modes[] = { QXL_MODE_EX(1600, 1200), QXL_MODE_EX(1680, 1050), QXL_MODE_EX(1920, 1080), -#if VGA_RAM_SIZE >= (16 * 1024 * 1024) /* these modes need more than 8 MB video memory */ QXL_MODE_EX(1920, 1200), QXL_MODE_EX(1920, 1440), QXL_MODE_EX(2048, 1536), QXL_MODE_EX(2560, 1440), QXL_MODE_EX(2560, 1600), -#endif -#if VGA_RAM_SIZE >= (32 * 1024 * 1024) /* these modes need more than 16 MB video memory */ QXL_MODE_EX(2560, 2048), QXL_MODE_EX(2800, 2100), QXL_MODE_EX(3200, 2400), -#endif }; static PCIQXLDevice *qxl0; @@ -284,6 +280,7 @@ static inline uint32_t msb_mask(uint32_t val) static ram_addr_t qxl_rom_size(void) { uint32_t rom_size = sizeof(QXLRom) + sizeof(QXLModes) + sizeof(qxl_modes); + rom_size = MAX(rom_size, TARGET_PAGE_SIZE); rom_size = msb_mask(rom_size * 2 - 1); return rom_size; @@ -296,8 +293,9 @@ static void init_qxl_rom(PCIQXLDevice *d) uint32_t ram_header_size; uint32_t surface0_area_size; uint32_t num_pages; - uint32_t fb, maxfb = 0; + uint32_t fb; int i; + int n_modes = 0; memset(rom, 0, d->rom_size); @@ -312,11 +310,13 @@ static void init_qxl_rom(PCIQXLDevice *d) rom->slots_end = NUM_MEMSLOTS - 1; rom->n_surfaces = cpu_to_le32(NUM_SURFACES); - modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes)); for (i = 0; i < modes->n_modes; i++) { fb = qxl_modes[i].y_res * qxl_modes[i].stride; - if (maxfb < fb) { - maxfb = fb; + if (d->fb_size < fb) { + d->fb_size = fb; + } + if (fb <= d->fb_size) { + n_modes++; } modes->modes[i].id = cpu_to_le32(i); modes->modes[i].x_res = cpu_to_le32(qxl_modes[i].x_res); @@ -327,11 +327,13 @@ static void init_qxl_rom(PCIQXLDevice *d) modes->modes[i].y_mili = cpu_to_le32(qxl_modes[i].y_mili); modes->modes[i].orientation = cpu_to_le32(qxl_modes[i].orientation); } - if (maxfb < VGA_RAM_SIZE && d->id == 0) - maxfb = VGA_RAM_SIZE; + if (d->fb_size < VGA_RAM_SIZE && d->id == 0) { + d->fb_size = VGA_RAM_SIZE; + } + modes->n_modes = cpu_to_le32(n_modes); ram_header_size = ALIGN(sizeof(QXLRam), 4096); - surface0_area_size = ALIGN(maxfb, 4096); + surface0_area_size = ALIGN(d->fb_size, 4096); num_pages = d->vga.vram_size; num_pages -= ram_header_size; num_pages -= surface0_area_size; @@ -1720,6 +1722,12 @@ static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb) if (qxl->vga.vram_size < ram_min_mb * 1024 * 1024) { qxl->vga.vram_size = ram_min_mb * 1024 * 1024; } + if (qxl->fb_size_mb != -1 && + qxl->fb_size_mb * 1024 * 1024 < qxl->vga.vram_size) { + qxl->fb_size = qxl->fb_size_mb * 1024 * 1024; + } else { + qxl->fb_size = VGA_RAM_SIZE; + } /* vram32 (surfaces, 32bit, bar 1) */ if (qxl->vram32_size_mb != -1) { @@ -2052,6 +2060,7 @@ static Property qxl_properties[] = { DEFINE_PROP_UINT32("ram_size_mb", PCIQXLDevice, ram_size_mb, -1), DEFINE_PROP_UINT32("vram_size_mb", PCIQXLDevice, vram32_size_mb, -1), DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -1), + DEFINE_PROP_UINT32("fb_size_mb", PCIQXLDevice, fb_size_mb, -1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/qxl.h b/hw/qxl.h index a4ab7cc..1b4ec16 100644 --- a/hw/qxl.h +++ b/hw/qxl.h @@ -84,6 +84,7 @@ typedef struct PCIQXLDevice { QXLReleaseInfo *last_release; uint32_t last_release_offset; uint32_t oom_running; + uint32_t fb_size; /* rom pci bar */ QXLRom shadow_rom; @@ -105,6 +106,7 @@ typedef struct PCIQXLDevice { uint32_t ram_size_mb; uint32_t vram_size_mb; uint32_t vram32_size_mb; + uint32_t fb_size_mb; /* qxl_render_update state */ int render_update_cookie_num;