qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1 of 7] few more accessors
@ 2008-11-26 17:47 Stefano Stabellini
  2008-12-02 19:25 ` Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Stabellini @ 2008-11-26 17:47 UTC (permalink / raw)
  To: qemu-devel

This patch introduces few more DisplayState accessors in hw/sm501.c.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff -r d8ccc2d27955 hw/sm501.c
--- a/hw/sm501.c	Mon Nov 24 20:21:41 2008 +0000
+++ b/hw/sm501.c	Wed Nov 26 16:33:07 2008 +0000
@@ -955,7 +955,7 @@
 
 static inline int get_depth_index(DisplayState *s)
 {
-    switch(s->depth) {
+    switch(ds_get_bits_per_pixel(s)) {
     default:
     case 8:
 	return 0;
@@ -985,7 +985,7 @@
 
     uint8_t  * src = s->local_mem;
     int src_bpp = 0;
-    int dst_bpp = s->ds->depth / 8 + (s->ds->depth % 8 ? 1 : 0);
+    int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0);
     uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE
 						    - SM501_DC_PANEL_PALETTE];
     int ds_depth_index = get_depth_index(s->ds);
@@ -1039,7 +1039,7 @@
 
 	/* draw line and change status */
 	if (update) {
-	    draw_line(&s->ds->data[y * width * dst_bpp], src, width, palette);
+	    draw_line(&(ds_get_data(s->ds)[y * width * dst_bpp]), src, width, palette);
 	    if (y_start < 0)
 		y_start = y;
 	    if (page0 < page_min)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1 of 7] few more accessors
  2008-11-26 17:47 Stefano Stabellini
@ 2008-12-02 19:25 ` Anthony Liguori
  2008-12-11 11:20   ` Stefano Stabellini
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2008-12-02 19:25 UTC (permalink / raw)
  To: qemu-devel

Stefano Stabellini wrote:
> This patch introduces few more DisplayState accessors in hw/sm501.c.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff -r d8ccc2d27955 hw/sm501.c
> --- a/hw/sm501.c	Mon Nov 24 20:21:41 2008 +0000
> +++ b/hw/sm501.c	Wed Nov 26 16:33:07 2008 +0000
> @@ -955,7 +955,7 @@
>  
>  static inline int get_depth_index(DisplayState *s)
>  {
> -    switch(s->depth) {
> +    switch(ds_get_bits_per_pixel(s)) {
>      default:
>      case 8:
>  	return 0;
> @@ -985,7 +985,7 @@
>  
>      uint8_t  * src = s->local_mem;
>      int src_bpp = 0;
> -    int dst_bpp = s->ds->depth / 8 + (s->ds->depth % 8 ? 1 : 0);
> +    int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0);
>   

There isn't a ds_get_bytes_per_pixel in console.h so this breaks the 
build.  Is your patch missing something perhaps?

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1 of 7] few more accessors
  2008-12-02 19:25 ` Anthony Liguori
@ 2008-12-11 11:20   ` Stefano Stabellini
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Stabellini @ 2008-12-11 11:20 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori wrote:

> There isn't a ds_get_bytes_per_pixel in console.h so this breaks the
> build.  Is your patch missing something perhaps?
> 

I created ds_get_bytes_per_pixel only in the third patch.
I'll fix this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1 of 7] few more accessors
@ 2008-12-18 19:12 Stefano Stabellini
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Stabellini @ 2008-12-18 19:12 UTC (permalink / raw)
  To: qemu-devel

This patch introduces few more DisplayState accessors in hw/sm501.c.

Added the declaration of ds_get_bytes_per_pixel that was missing last
time.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff -r 20597e3d2632 console.h
--- a/console.h	Thu Dec 11 00:14:30 2008 +0000
+++ b/console.h	Thu Dec 11 11:00:50 2008 +0000
@@ -139,6 +139,11 @@
     return ds->depth;
 }
 
+static inline int ds_get_bytes_per_pixel(DisplayState *ds)
+{
+    return (ds->depth / 8);
+}
+
 typedef unsigned long console_ch_t;
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
diff -r 20597e3d2632 hw/sm501.c
--- a/hw/sm501.c	Thu Dec 11 00:14:30 2008 +0000
+++ b/hw/sm501.c	Thu Dec 11 11:00:50 2008 +0000
@@ -940,7 +940,7 @@
 
 static inline int get_depth_index(DisplayState *s)
 {
-    switch(s->depth) {
+    switch(ds_get_bits_per_pixel(s)) {
     default:
     case 8:
 	return 0;
@@ -970,7 +970,7 @@
 
     uint8_t  * src = s->local_mem;
     int src_bpp = 0;
-    int dst_bpp = s->ds->depth / 8 + (s->ds->depth % 8 ? 1 : 0);
+    int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0);
     uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE
 						    - SM501_DC_PANEL_PALETTE];
     int ds_depth_index = get_depth_index(s->ds);
@@ -1024,7 +1024,7 @@
 
 	/* draw line and change status */
 	if (update) {
-	    draw_line(&s->ds->data[y * width * dst_bpp], src, width, palette);
+	    draw_line(&(ds_get_data(s->ds)[y * width * dst_bpp]), src, width, palette);
 	    if (y_start < 0)
 		y_start = y;
 	    if (page0 < page_min)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-18 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 19:12 [Qemu-devel] [PATCH 1 of 7] few more accessors Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2008-11-26 17:47 Stefano Stabellini
2008-12-02 19:25 ` Anthony Liguori
2008-12-11 11:20   ` Stefano Stabellini

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).