From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix g364fb video emulation
Date: Sat, 16 Aug 2008 18:14:52 +0200 [thread overview]
Message-ID: <48A6FCFC.2090001@reactos.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
Hi,
Attached patches fixes screen resolution handling for g364 graphic card.
It removes last_scr_width/last_scr_height whose role was not very clear,
and uses qemu_console_resize(), added in r4812.
Hervé
[-- Attachment #2: g364fb.diff --]
[-- Type: text/plain, Size: 3443 bytes --]
Index: hw/g364fb.c
===================================================================
--- hw/g364fb.c (revision 5013)
+++ hw/g364fb.c (working copy)
@@ -36,7 +36,6 @@
QEMUConsole *console;
int graphic_mode;
uint32_t scr_width, scr_height; /* in pixels */
- uint32_t last_scr_width, last_scr_height; /* in pixels */
} G364State;
/*
@@ -73,9 +72,6 @@
static void g364fb_draw_graphic(G364State *s, int full_update)
{
- if (s->scr_width == 0 || s->scr_height == 0)
- return;
-
switch (s->ds->depth) {
case 8:
g364fb_draw_graphic8(s, full_update);
@@ -94,7 +90,7 @@
return;
}
- dpy_update(s->ds, 0, 0, s->last_scr_width, s->last_scr_height);
+ dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
}
static void g364fb_draw_blank(G364State *s, int full_update)
@@ -104,17 +100,15 @@
if (!full_update)
return;
- if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
- return;
- w = s->last_scr_width * ((s->ds->depth + 7) >> 3);
+ w = s->scr_width * ((s->ds->depth + 7) >> 3);
d = s->ds->data;
- for(i = 0; i < s->last_scr_height; i++) {
+ for(i = 0; i < s->scr_height; i++) {
memset(d, 0, w);
d += s->ds->linesize;
}
- dpy_update(s->ds, 0, 0,
- s->last_scr_width, s->last_scr_height);
+
+ dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
}
#define GMODE_GRAPH 0
@@ -125,6 +119,9 @@
G364State *s = opaque;
int full_update, graphic_mode;
+ if (s->scr_width == 0 || s->scr_height == 0)
+ return;
+
if (s->ctla & CTLA_FORCE_BLANK)
graphic_mode = GMODE_BLANK;
else
@@ -134,6 +131,10 @@
s->graphic_mode = graphic_mode;
full_update = 1;
}
+ if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) {
+ qemu_console_resize(s->console, s->scr_width, s->scr_height);
+ full_update = 1;
+ }
switch(graphic_mode) {
case GMODE_GRAPH:
g364fb_draw_graphic(s, full_update);
@@ -158,7 +159,6 @@
memset(s->palette, 0, sizeof(s->palette));
s->scr_width = s->scr_height = 0;
- s->last_scr_width = s->last_scr_height = 0;
memset(s->vram_buffer, 0, s->vram_size);
s->graphic_mode = -1; /* force full update */
}
@@ -266,8 +266,6 @@
#endif
break;
}
- if (s->scr_width && s->scr_height)
- qemu_console_resize(s->console, s->scr_width, s->scr_height);
}
s->graphic_mode = -1; /* force full update */
}
Index: hw/g364fb_template.h
===================================================================
--- hw/g364fb_template.h (revision 5013)
+++ hw/g364fb_template.h (working copy)
@@ -27,11 +27,11 @@
uint8_t *data_display, *dd;
data_buffer = s->vram_buffer;
- w_display = s->last_scr_width * PIXEL_WIDTH / 8;
+ w_display = s->scr_width * PIXEL_WIDTH / 8;
data_display = s->ds->data;
- for(i = 0; i < s->last_scr_height; i++) {
+ for(i = 0; i < s->scr_height; i++) {
dd = data_display;
- for (j = 0; j < s->last_scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
+ for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
uint8_t index = *data_buffer;
*((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)(
s->palette[index][0],
next reply other threads:[~2008-08-16 16:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 16:14 Hervé Poussineau [this message]
2008-08-17 1:45 ` [Qemu-devel] [PATCH] Fix g364fb video emulation Aurelien Jarno
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=48A6FCFC.2090001@reactos.org \
--to=hpoussin@reactos.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.