qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/4 v3] vmware_vga: Return a value for FB_SIZE before the device is enabled
Date: Sat, 6 Oct 2012 20:35:02 +0200 (CEST)	[thread overview]
Message-ID: <alpine.GSO.2.00.1210062034240.13558@mono> (raw)
In-Reply-To: <alpine.GSO.2.00.1210031114580.19707@mono>

According to the documentation drivers using this device should read
FB_SIZE before enabling the device to know what memory to map. This
would not work if we return 0 before enabled. The docs also mention
reading SVGA_REG_DEPTH but not writing it. (Only SVGA_REG_BITS_PER_PIXEL
can be written but we don't really support that either.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
  hw/vmware_vga.c |   19 +++++++++----------
  1 file changed, 9 insertions(+), 10 deletions(-)

  v3: Changes to address comments from Paolo Bonzini (Thanks for the review!)

diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index c5a8909..c3ef924 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -32,13 +32,14 @@
  #define HW_FILL_ACCEL
  #define HW_MOUSE_ACCEL

-# include "vga_int.h"
+#include "vga_int.h"
+
+/* See http://vmware-svga.sf.net/ for some documentation on VMWare SVGA */

  struct vmsvga_state_s {
      VGACommonState vga;

      int invalidated;
-    int depth;
      int enable;
      int config;
      struct {
@@ -56,7 +57,6 @@ struct vmsvga_state_s {
      uint32_t guest;
      uint32_t svgaid;
      int syncing;
-    int fb_size;

      MemoryRegion fifo_ram;
      uint8_t *fifo_ptr;
@@ -759,10 +759,10 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
          return 0x0;

      case SVGA_REG_VRAM_SIZE:
-        return s->vga.vram_size;
+        return s->vga.vram_size; /* No physical VRAM besides the framebuffer */

      case SVGA_REG_FB_SIZE:
-        return s->fb_size;
+        return s->vga.vram_size;

      case SVGA_REG_CAPABILITIES:
          caps = SVGA_CAP_NONE;
@@ -851,7 +851,6 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
          s->invalidated = 1;
          s->vga.invalidate(&s->vga);
          if (s->enable) {
-            s->fb_size = ((s->depth + 7) >> 3) * s->new_width * s->new_height;
              vga_dirty_log_stop(&s->vga);
          } else {
              vga_dirty_log_start(&s->vga);
@@ -876,10 +875,9 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
          }
          break;

-    case SVGA_REG_DEPTH:
      case SVGA_REG_BITS_PER_PIXEL:
          if (value != ds_get_bits_per_pixel(s->vga.ds)) {
-            printf("%s: Bad colour depth: %i bits\n", __func__, value);
+            printf("%s: Bad bits per pixel: %i bits\n", __func__, value);
              s->config = 0;
          }
          break;
@@ -942,6 +940,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
  #endif
          break;

+    case SVGA_REG_DEPTH:
      case SVGA_REG_MEM_REGS:
      case SVGA_REG_NUM_DISPLAYS:
      case SVGA_REG_PITCHLOCK:
@@ -1080,7 +1079,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = {
      .minimum_version_id_old = 0,
      .post_load = vmsvga_post_load,
      .fields      = (VMStateField[]) {
-        VMSTATE_INT32_EQUAL(depth, struct vmsvga_state_s),
+        VMSTATE_UNUSED(4), /* was depth */
          VMSTATE_INT32(enable, struct vmsvga_state_s),
          VMSTATE_INT32(config, struct vmsvga_state_s),
          VMSTATE_INT32(cursor.id, struct vmsvga_state_s),
@@ -1095,7 +1094,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = {
          VMSTATE_UINT32(guest, struct vmsvga_state_s),
          VMSTATE_UINT32(svgaid, struct vmsvga_state_s),
          VMSTATE_INT32(syncing, struct vmsvga_state_s),
-        VMSTATE_INT32(fb_size, struct vmsvga_state_s),
+        VMSTATE_UNUSED(4), /* was fb_size */
          VMSTATE_END_OF_LIST()
      }
  };
-- 
1.7.10

  parent reply	other threads:[~2012-10-06 18:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03  9:22 [Qemu-devel] [PATCH 0/3] vmware_vga: Cleanup and allow simple drivers to work without the fifo BALATON Zoltan
2012-10-03  9:30 ` [Qemu-devel] [PATCH 1/3 v2] vmware_vga: Cleanup and remove duplicated info from local state BALATON Zoltan
2012-10-03  9:42   ` Paolo Bonzini
2012-10-03  9:30 ` [Qemu-devel] [PATCH 2/3 v2] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-10-03  9:43   ` Paolo Bonzini
2012-10-03  9:31 ` [Qemu-devel] [PATCH 3/3 v2] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-10-03  9:46   ` Paolo Bonzini
2012-10-06 18:33 ` [Qemu-devel] [PATCH 1/4 v3] vmware_vga: Coding style cleanup BALATON Zoltan
2012-10-18 19:07   ` BALATON Zoltan
2012-10-29 10:38     ` BALATON Zoltan
2012-10-30 18:50       ` Blue Swirl
2012-10-31  1:08         ` [Qemu-devel] [PATCH 1/4 v4] " BALATON Zoltan
2012-11-02  1:20           ` [Qemu-devel] [PATCH 1/4 v5] " BALATON Zoltan
2012-11-02  1:20             ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-02  1:21               ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-02  1:21                 ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03  9:51             ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup Blue Swirl
2012-11-03 12:51               ` BALATON Zoltan
2012-11-03 10:58             ` BALATON Zoltan
2012-11-03 10:58             ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-04  6:39               ` Jan Kiszka
2012-11-04 10:20                 ` BALATON Zoltan
2012-11-04 17:58                 ` BALATON Zoltan
2012-11-03 10:58             ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 10:59             ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 11:47             ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup BALATON Zoltan
2012-11-03 15:20               ` Blue Swirl
2012-10-31  1:08         ` [Qemu-devel] [PATCH 2/4 v4] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-10-31  1:09         ` [Qemu-devel] [PATCH 3/4 v4] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-10-31  1:10         ` [Qemu-devel] [PATCH 4/4 v4] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-10-31  1:12         ` [Qemu-devel] [PATCH 1/4 v3] vmware_vga: Coding style cleanup BALATON Zoltan
2012-10-06 18:34 ` [Qemu-devel] [PATCH 2/4 v3] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-10-06 18:35 ` BALATON Zoltan [this message]
2012-10-06 18:35 ` [Qemu-devel] [PATCH 4/4 v3] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan

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=alpine.GSO.2.00.1210062034240.13558@mono \
    --to=balaton@eik.bme.hu \
    --cc=qemu-devel@nongnu.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).