qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32
@ 2016-03-14 15:04 Pooja Dhannawat
  2016-03-14 15:22 ` Peter Maydell
  2016-03-14 17:56 ` [Qemu-devel] [PATCH v3] " Pooja Dhannawat
  0 siblings, 2 replies; 5+ messages in thread
From: Pooja Dhannawat @ 2016-03-14 15:04 UTC (permalink / raw)
  To: qemu-devel

Removing support for DEPTH != 32 from blizzard template header
and file that includes it, as macro DEPTH == 32 only used.

Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
---
 hw/display/blizzard.c          | 24 ------------------------
 hw/display/blizzard_template.h | 30 +-----------------------------
 2 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c
index c231960..a72e789 100644
--- a/hw/display/blizzard.c
+++ b/hw/display/blizzard.c
@@ -925,14 +925,6 @@ static void blizzard_update_display(void *opaque)
     s->my[1] = 0;
 }
 
-#define DEPTH 8
-#include "blizzard_template.h"
-#define DEPTH 15
-#include "blizzard_template.h"
-#define DEPTH 16
-#include "blizzard_template.h"
-#define DEPTH 24
-#include "blizzard_template.h"
 #define DEPTH 32
 #include "blizzard_template.h"
 
@@ -956,22 +948,6 @@ void *s1d13745_init(qemu_irq gpio_int)
         s->line_fn_tab[0] = s->line_fn_tab[1] =
                 g_malloc0(sizeof(blizzard_fn_t) * 0x10);
         break;
-    case 8:
-        s->line_fn_tab[0] = blizzard_draw_fn_8;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_8;
-        break;
-    case 15:
-        s->line_fn_tab[0] = blizzard_draw_fn_15;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_15;
-        break;
-    case 16:
-        s->line_fn_tab[0] = blizzard_draw_fn_16;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_16;
-        break;
-    case 24:
-        s->line_fn_tab[0] = blizzard_draw_fn_24;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_24;
-        break;
     case 32:
         s->line_fn_tab[0] = blizzard_draw_fn_32;
         s->line_fn_tab[1] = blizzard_draw_fn_r_32;
diff --git a/hw/display/blizzard_template.h b/hw/display/blizzard_template.h
index b7ef27c..bc38d7a 100644
--- a/hw/display/blizzard_template.h
+++ b/hw/display/blizzard_template.h
@@ -19,31 +19,7 @@
  */
 
 #define SKIP_PIXEL(to)         (to += deststep)
-#if DEPTH == 8
-# define PIXEL_TYPE            uint8_t
-# define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
-# define COPY_PIXEL1(to, from) (*to++ = from)
-#elif DEPTH == 15 || DEPTH == 16
-# define PIXEL_TYPE            uint16_t
-# define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
-# define COPY_PIXEL1(to, from) (*to++ = from)
-#elif DEPTH == 24
-# define PIXEL_TYPE            uint8_t
-# define COPY_PIXEL(to, from) \
-    do {                      \
-        to[0] = from;         \
-        to[1] = (from) >> 8;  \
-        to[2] = (from) >> 16; \
-        SKIP_PIXEL(to);       \
-    } while (0)
-
-# define COPY_PIXEL1(to, from) \
-    do {                       \
-        *to++ = from;          \
-        *to++ = (from) >> 8;   \
-        *to++ = (from) >> 16;  \
-    } while (0)
-#elif DEPTH == 32
+#if DEPTH == 32
 # define PIXEL_TYPE            uint32_t
 # define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
 # define COPY_PIXEL1(to, from) (*to++ = from)
@@ -58,9 +34,6 @@
 static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
                 const uint16_t *src, unsigned int width)
 {
-#if !defined(SWAP_WORDS) && DEPTH == 16
-    memcpy(dest, src, width);
-#else
     uint16_t data;
     unsigned int r, g, b;
     const uint16_t *end = (const void *) src + width;
@@ -74,7 +47,6 @@ static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
         data >>= 5;
         COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
     }
-#endif
 }
 
 static void glue(blizzard_draw_line24mode1_, DEPTH)(PIXEL_TYPE *dest,
-- 
2.5.0

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

* Re: [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32
  2016-03-14 15:04 [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32 Pooja Dhannawat
@ 2016-03-14 15:22 ` Peter Maydell
  2016-03-18  8:30   ` Gerd Hoffmann
  2016-03-14 17:56 ` [Qemu-devel] [PATCH v3] " Pooja Dhannawat
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2016-03-14 15:22 UTC (permalink / raw)
  To: Pooja Dhannawat; +Cc: QEMU Developers, Gerd Hoffmann

On 14 March 2016 at 15:04, Pooja Dhannawat <dhannawatpooja1@gmail.com> wrote:
> Removing support for DEPTH != 32 from blizzard template header
> and file that includes it, as macro DEPTH == 32 only used.
>
> Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
> ---
>  hw/display/blizzard.c          | 24 ------------------------
>  hw/display/blizzard_template.h | 30 +-----------------------------
>  2 files changed, 1 insertion(+), 53 deletions(-)

> @@ -956,22 +948,6 @@ void *s1d13745_init(qemu_irq gpio_int)
>          s->line_fn_tab[0] = s->line_fn_tab[1] =
>                  g_malloc0(sizeof(blizzard_fn_t) * 0x10);
>          break;
> -    case 8:
> -        s->line_fn_tab[0] = blizzard_draw_fn_8;
> -        s->line_fn_tab[1] = blizzard_draw_fn_r_8;
> -        break;
> -    case 15:
> -        s->line_fn_tab[0] = blizzard_draw_fn_15;
> -        s->line_fn_tab[1] = blizzard_draw_fn_r_15;
> -        break;
> -    case 16:
> -        s->line_fn_tab[0] = blizzard_draw_fn_16;
> -        s->line_fn_tab[1] = blizzard_draw_fn_r_16;
> -        break;
> -    case 24:
> -        s->line_fn_tab[0] = blizzard_draw_fn_24;
> -        s->line_fn_tab[1] = blizzard_draw_fn_r_24;
> -        break;
>      case 32:
>          s->line_fn_tab[0] = blizzard_draw_fn_32;
>          s->line_fn_tab[1] = blizzard_draw_fn_r_32;

So are there any cases now when
surface_bits_per_pixel(qemu_console_surface(c)) can return
zero? (I don't understand the 'case 0' code in this switch
at all...)

thanks
-- PMM

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

* [Qemu-devel] [PATCH v3] blizzard: Remove support for DEPTH != 32
  2016-03-14 15:04 [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32 Pooja Dhannawat
  2016-03-14 15:22 ` Peter Maydell
@ 2016-03-14 17:56 ` Pooja Dhannawat
  1 sibling, 0 replies; 5+ messages in thread
From: Pooja Dhannawat @ 2016-03-14 17:56 UTC (permalink / raw)
  To: qemu-devel

Removing support for DEPTH != 32 from blizzard template header
and file that includes it, as macro DEPTH == 32 only used.

Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
---
 hw/display/blizzard.c          | 24 ------------------------
 hw/display/blizzard_template.h | 30 +-----------------------------
 2 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c
index c231960..a72e789 100644
--- a/hw/display/blizzard.c
+++ b/hw/display/blizzard.c
@@ -925,14 +925,6 @@ static void blizzard_update_display(void *opaque)
     s->my[1] = 0;
 }
 
-#define DEPTH 8
-#include "blizzard_template.h"
-#define DEPTH 15
-#include "blizzard_template.h"
-#define DEPTH 16
-#include "blizzard_template.h"
-#define DEPTH 24
-#include "blizzard_template.h"
 #define DEPTH 32
 #include "blizzard_template.h"
 
@@ -956,22 +948,6 @@ void *s1d13745_init(qemu_irq gpio_int)
         s->line_fn_tab[0] = s->line_fn_tab[1] =
                 g_malloc0(sizeof(blizzard_fn_t) * 0x10);
         break;
-    case 8:
-        s->line_fn_tab[0] = blizzard_draw_fn_8;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_8;
-        break;
-    case 15:
-        s->line_fn_tab[0] = blizzard_draw_fn_15;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_15;
-        break;
-    case 16:
-        s->line_fn_tab[0] = blizzard_draw_fn_16;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_16;
-        break;
-    case 24:
-        s->line_fn_tab[0] = blizzard_draw_fn_24;
-        s->line_fn_tab[1] = blizzard_draw_fn_r_24;
-        break;
     case 32:
         s->line_fn_tab[0] = blizzard_draw_fn_32;
         s->line_fn_tab[1] = blizzard_draw_fn_r_32;
diff --git a/hw/display/blizzard_template.h b/hw/display/blizzard_template.h
index b7ef27c..bc38d7a 100644
--- a/hw/display/blizzard_template.h
+++ b/hw/display/blizzard_template.h
@@ -19,31 +19,7 @@
  */
 
 #define SKIP_PIXEL(to)         (to += deststep)
-#if DEPTH == 8
-# define PIXEL_TYPE            uint8_t
-# define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
-# define COPY_PIXEL1(to, from) (*to++ = from)
-#elif DEPTH == 15 || DEPTH == 16
-# define PIXEL_TYPE            uint16_t
-# define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
-# define COPY_PIXEL1(to, from) (*to++ = from)
-#elif DEPTH == 24
-# define PIXEL_TYPE            uint8_t
-# define COPY_PIXEL(to, from) \
-    do {                      \
-        to[0] = from;         \
-        to[1] = (from) >> 8;  \
-        to[2] = (from) >> 16; \
-        SKIP_PIXEL(to);       \
-    } while (0)
-
-# define COPY_PIXEL1(to, from) \
-    do {                       \
-        *to++ = from;          \
-        *to++ = (from) >> 8;   \
-        *to++ = (from) >> 16;  \
-    } while (0)
-#elif DEPTH == 32
+#if DEPTH == 32
 # define PIXEL_TYPE            uint32_t
 # define COPY_PIXEL(to, from)  do { *to = from; SKIP_PIXEL(to); } while (0)
 # define COPY_PIXEL1(to, from) (*to++ = from)
@@ -58,9 +34,6 @@
 static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
                 const uint16_t *src, unsigned int width)
 {
-#if !defined(SWAP_WORDS) && DEPTH == 16
-    memcpy(dest, src, width);
-#else
     uint16_t data;
     unsigned int r, g, b;
     const uint16_t *end = (const void *) src + width;
@@ -74,7 +47,6 @@ static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
         data >>= 5;
         COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
     }
-#endif
 }
 
 static void glue(blizzard_draw_line24mode1_, DEPTH)(PIXEL_TYPE *dest,
-- 
2.5.0

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

* Re: [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32
  2016-03-14 15:22 ` Peter Maydell
@ 2016-03-18  8:30   ` Gerd Hoffmann
  2016-03-18 15:46     ` Pooja Dhannawat
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2016-03-18  8:30 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Pooja Dhannawat

On Mo, 2016-03-14 at 15:22 +0000, Peter Maydell wrote:
> On 14 March 2016 at 15:04, Pooja Dhannawat <dhannawatpooja1@gmail.com> wrote:
> > Removing support for DEPTH != 32 from blizzard template header
> > and file that includes it, as macro DEPTH == 32 only used.
> >
> > Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
> > ---
> >  hw/display/blizzard.c          | 24 ------------------------
> >  hw/display/blizzard_template.h | 30 +-----------------------------
> >  2 files changed, 1 insertion(+), 53 deletions(-)

> So are there any cases now when
> surface_bits_per_pixel(qemu_console_surface(c)) can return
> zero? (I don't understand the 'case 0' code in this switch
> at all...)

Looks like a somewhat strange way to zero-fill the function pointer
array.  Looks like a historical leftover.

As blizzard uses qemu_console_resize() you will always get a surface
with the default depth (32bpp).  So dropping the whole "switch { ... }"
block (except for the "case 32:" lines) and adding an
"assert(surface_bits_per_pixel(surface)==32)" should work just fine.

cheers,
  Gerd

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

* [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32
  2016-03-18  8:30   ` Gerd Hoffmann
@ 2016-03-18 15:46     ` Pooja Dhannawat
  0 siblings, 0 replies; 5+ messages in thread
From: Pooja Dhannawat @ 2016-03-18 15:46 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Peter Maydell, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

On Friday, March 18, 2016, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Mo, 2016-03-14 at 15:22 +0000, Peter Maydell wrote:
> > On 14 March 2016 at 15:04, Pooja Dhannawat <dhannawatpooja1@gmail.com>
wrote:
> > > Removing support for DEPTH != 32 from blizzard template header
> > > and file that includes it, as macro DEPTH == 32 only used.
> > >
> > > Signed-off-by: Pooja Dhannawat <dhannawatpooja1@gmail.com>
> > > ---
> > >  hw/display/blizzard.c          | 24 ------------------------
> > >  hw/display/blizzard_template.h | 30 +-----------------------------
> > >  2 files changed, 1 insertion(+), 53 deletions(-)
>
> > So are there any cases now when
> > surface_bits_per_pixel(qemu_console_surface(c)) can return
> > zero? (I don't understand the 'case 0' code in this switch
> > at all...)
>
> Looks like a somewhat strange way to zero-fill the function pointer
> array.  Looks like a historical leftover.
>
> As blizzard uses qemu_console_resize() you will always get a surface
> with the default depth (32bpp).  So dropping the whole "switch { ... }"
> block (except for the "case 32:" lines) and adding an
> "assert(surface_bits_per_pixel(surface)==32)" should work just fine.
>
Thank you Gerd, for clearing and helping with  above question.

>
> cheers,
>   Gerd
>

[-- Attachment #2: Type: text/html, Size: 1739 bytes --]

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

end of thread, other threads:[~2016-03-18 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14 15:04 [Qemu-devel] [Patch v2 1/1] blizzard: Remove support for DEPTH != 32 Pooja Dhannawat
2016-03-14 15:22 ` Peter Maydell
2016-03-18  8:30   ` Gerd Hoffmann
2016-03-18 15:46     ` Pooja Dhannawat
2016-03-14 17:56 ` [Qemu-devel] [PATCH v3] " Pooja Dhannawat

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