diff mbox

Fwd: [PATCH] sm501: Remove support for DEPTH != 32

Message ID CADrGP6D9Gnan4=JfvgbQNbjKVGhxMmH__XEfzcjbUnA-di1eRw@mail.gmail.com
State New
Headers show

Commit Message

Sagar Ghuge April 28, 2016, 9:54 a.m. UTC
Forgot to CCing Paolo Bonzini.

Added.

---------- Forwarded message ----------
From: Sagar Ghuge <ghugesss@gmail.com>
Date: Thu, Apr 28, 2016 at 3:20 PM
Subject: [PATCH] sm501: Remove support for DEPTH != 32
To: qemu-devel@nongnu.org


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

Signed-off-by: Sagar Ghuge <ghugesss@gmail.com>
---
 hw/display/sm501.c          | 55
+++++----------------------------------------
 hw/display/sm501_template.h |  8 +------
 2 files changed, 6 insertions(+), 57 deletions(-)

--
2.5.0

Comments

Sagar Ghuge May 4, 2016, 6:42 a.m. UTC | #1
Gentle Reminder !

Any comments on patch ?

On Thu, Apr 28, 2016 at 3:24 PM, Sagar Ghuge <ghugesss@gmail.com> wrote:

> Forgot to CCing Paolo Bonzini.
>
> Added.
>
> ---------- Forwarded message ----------
> From: Sagar Ghuge <ghugesss@gmail.com>
> Date: Thu, Apr 28, 2016 at 3:20 PM
> Subject: [PATCH] sm501: Remove support for DEPTH != 32
> To: qemu-devel@nongnu.org
>
>
> Removing support for DEPTH != 32 from sm501 template header
> and file that includes it, as macro DEPTH == 32 only used.
>
> Signed-off-by: Sagar Ghuge <ghugesss@gmail.com>
> ---
>  hw/display/sm501.c          | 55
> +++++----------------------------------------
>  hw/display/sm501_template.h |  8 +------
>  2 files changed, 6 insertions(+), 57 deletions(-)
>
> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> index 5f71012..b165280 100644
> --- a/hw/display/sm501.c
> +++ b/hw/display/sm501.c
> @@ -1173,23 +1173,6 @@ typedef void draw_line_func(uint8_t *d, const
> uint8_t *s,
>  typedef void draw_hwc_line_func(SM501State * s, int crt, uint8_t *
> palette,
>                                  int c_y, uint8_t *d, int width);
>
> -#define DEPTH 8
> -#include "sm501_template.h"
> -
> -#define DEPTH 15
> -#include "sm501_template.h"
> -
> -#define BGR_FORMAT
> -#define DEPTH 15
> -#include "sm501_template.h"
> -
> -#define DEPTH 16
> -#include "sm501_template.h"
> -
> -#define BGR_FORMAT
> -#define DEPTH 16
> -#include "sm501_template.h"
> -
>  #define DEPTH 32
>  #include "sm501_template.h"
>
> @@ -1198,61 +1181,33 @@ typedef void draw_hwc_line_func(SM501State * s,
> int crt, uint8_t * palette,
>  #include "sm501_template.h"
>
>  static draw_line_func * draw_line8_funcs[] = {
> -    draw_line8_8,
> -    draw_line8_15,
> -    draw_line8_16,
>      draw_line8_32,
>      draw_line8_32bgr,
> -    draw_line8_15bgr,
> -    draw_line8_16bgr,
>  };
>
>  static draw_line_func * draw_line16_funcs[] = {
> -    draw_line16_8,
> -    draw_line16_15,
> -    draw_line16_16,
>      draw_line16_32,
>      draw_line16_32bgr,
> -    draw_line16_15bgr,
> -    draw_line16_16bgr,
>  };
>
>  static draw_line_func * draw_line32_funcs[] = {
> -    draw_line32_8,
> -    draw_line32_15,
> -    draw_line32_16,
>      draw_line32_32,
>      draw_line32_32bgr,
> -    draw_line32_15bgr,
> -    draw_line32_16bgr,
>  };
>
>  static draw_hwc_line_func * draw_hwc_line_funcs[] = {
> -    draw_hwc_line_8,
> -    draw_hwc_line_15,
> -    draw_hwc_line_16,
>      draw_hwc_line_32,
>      draw_hwc_line_32bgr,
> -    draw_hwc_line_15bgr,
> -    draw_hwc_line_16bgr,
>  };
>
>  static inline int get_depth_index(DisplaySurface *surface)
>  {
> -    switch (surface_bits_per_pixel(surface)) {
> -    default:
> -    case 8:
> -       return 0;
> -    case 15:
> +    assert(surface_bits_per_pixel(surface) == 32);
> +
> +    if (is_surface_bgr(surface)) {
>          return 1;
> -    case 16:
> -        return 2;
> -    case 32:
> -        if (is_surface_bgr(surface)) {
> -            return 4;
> -        } else {
> -            return 3;
> -        }
> +    } else {
> +        return 0;
>      }
>  }
>
> diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
> index f33e499..4e5801e 100644
> --- a/hw/display/sm501_template.h
> +++ b/hw/display/sm501_template.h
> @@ -22,13 +22,7 @@
>   * THE SOFTWARE.
>   */
>
> -#if DEPTH == 8
> -#define BPP 1
> -#define PIXEL_TYPE uint8_t
> -#elif DEPTH == 15 || DEPTH == 16
> -#define BPP 2
> -#define PIXEL_TYPE uint16_t
> -#elif DEPTH == 32
> +#if DEPTH == 32
>  #define BPP 4
>  #define PIXEL_TYPE uint32_t
>  #else
> --
> 2.5.0
>
>
>
>
> --
>
> *Regards,Sagar*
>
Sagar Ghuge May 10, 2016, 9:49 a.m. UTC | #2
Gentle Reminder !!!

is this correct patch or need to change anything ?

On Wed, May 4, 2016 at 12:12 PM, Sagar Ghuge <ghugesss@gmail.com> wrote:

> Gentle Reminder !
>
> Any comments on patch ?
>
> On Thu, Apr 28, 2016 at 3:24 PM, Sagar Ghuge <ghugesss@gmail.com> wrote:
>
>> Forgot to CCing Paolo Bonzini.
>>
>> Added.
>>
>> ---------- Forwarded message ----------
>> From: Sagar Ghuge <ghugesss@gmail.com>
>> Date: Thu, Apr 28, 2016 at 3:20 PM
>> Subject: [PATCH] sm501: Remove support for DEPTH != 32
>> To: qemu-devel@nongnu.org
>>
>>
>> Removing support for DEPTH != 32 from sm501 template header
>> and file that includes it, as macro DEPTH == 32 only used.
>>
>> Signed-off-by: Sagar Ghuge <ghugesss@gmail.com>
>> ---
>>  hw/display/sm501.c          | 55
>> +++++----------------------------------------
>>  hw/display/sm501_template.h |  8 +------
>>  2 files changed, 6 insertions(+), 57 deletions(-)
>>
>> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
>> index 5f71012..b165280 100644
>> --- a/hw/display/sm501.c
>> +++ b/hw/display/sm501.c
>> @@ -1173,23 +1173,6 @@ typedef void draw_line_func(uint8_t *d, const
>> uint8_t *s,
>>  typedef void draw_hwc_line_func(SM501State * s, int crt, uint8_t *
>> palette,
>>                                  int c_y, uint8_t *d, int width);
>>
>> -#define DEPTH 8
>> -#include "sm501_template.h"
>> -
>> -#define DEPTH 15
>> -#include "sm501_template.h"
>> -
>> -#define BGR_FORMAT
>> -#define DEPTH 15
>> -#include "sm501_template.h"
>> -
>> -#define DEPTH 16
>> -#include "sm501_template.h"
>> -
>> -#define BGR_FORMAT
>> -#define DEPTH 16
>> -#include "sm501_template.h"
>> -
>>  #define DEPTH 32
>>  #include "sm501_template.h"
>>
>> @@ -1198,61 +1181,33 @@ typedef void draw_hwc_line_func(SM501State * s,
>> int crt, uint8_t * palette,
>>  #include "sm501_template.h"
>>
>>  static draw_line_func * draw_line8_funcs[] = {
>> -    draw_line8_8,
>> -    draw_line8_15,
>> -    draw_line8_16,
>>      draw_line8_32,
>>      draw_line8_32bgr,
>> -    draw_line8_15bgr,
>> -    draw_line8_16bgr,
>>  };
>>
>>  static draw_line_func * draw_line16_funcs[] = {
>> -    draw_line16_8,
>> -    draw_line16_15,
>> -    draw_line16_16,
>>      draw_line16_32,
>>      draw_line16_32bgr,
>> -    draw_line16_15bgr,
>> -    draw_line16_16bgr,
>>  };
>>
>>  static draw_line_func * draw_line32_funcs[] = {
>> -    draw_line32_8,
>> -    draw_line32_15,
>> -    draw_line32_16,
>>      draw_line32_32,
>>      draw_line32_32bgr,
>> -    draw_line32_15bgr,
>> -    draw_line32_16bgr,
>>  };
>>
>>  static draw_hwc_line_func * draw_hwc_line_funcs[] = {
>> -    draw_hwc_line_8,
>> -    draw_hwc_line_15,
>> -    draw_hwc_line_16,
>>      draw_hwc_line_32,
>>      draw_hwc_line_32bgr,
>> -    draw_hwc_line_15bgr,
>> -    draw_hwc_line_16bgr,
>>  };
>>
>>  static inline int get_depth_index(DisplaySurface *surface)
>>  {
>> -    switch (surface_bits_per_pixel(surface)) {
>> -    default:
>> -    case 8:
>> -       return 0;
>> -    case 15:
>> +    assert(surface_bits_per_pixel(surface) == 32);
>> +
>> +    if (is_surface_bgr(surface)) {
>>          return 1;
>> -    case 16:
>> -        return 2;
>> -    case 32:
>> -        if (is_surface_bgr(surface)) {
>> -            return 4;
>> -        } else {
>> -            return 3;
>> -        }
>> +    } else {
>> +        return 0;
>>      }
>>  }
>>
>> diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
>> index f33e499..4e5801e 100644
>> --- a/hw/display/sm501_template.h
>> +++ b/hw/display/sm501_template.h
>> @@ -22,13 +22,7 @@
>>   * THE SOFTWARE.
>>   */
>>
>> -#if DEPTH == 8
>> -#define BPP 1
>> -#define PIXEL_TYPE uint8_t
>> -#elif DEPTH == 15 || DEPTH == 16
>> -#define BPP 2
>> -#define PIXEL_TYPE uint16_t
>> -#elif DEPTH == 32
>> +#if DEPTH == 32
>>  #define BPP 4
>>  #define PIXEL_TYPE uint32_t
>>  #else
>> --
>> 2.5.0
>>
>>
>>
>>
>> --
>>
>> *Regards,Sagar*
>>
>
>
>
> --
>
> *Regards,Sagar*
>
diff mbox

Patch

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 5f71012..b165280 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1173,23 +1173,6 @@  typedef void draw_line_func(uint8_t *d, const
uint8_t *s,
 typedef void draw_hwc_line_func(SM501State * s, int crt, uint8_t * palette,
                                 int c_y, uint8_t *d, int width);

-#define DEPTH 8
-#include "sm501_template.h"
-
-#define DEPTH 15
-#include "sm501_template.h"
-
-#define BGR_FORMAT
-#define DEPTH 15
-#include "sm501_template.h"
-
-#define DEPTH 16
-#include "sm501_template.h"
-
-#define BGR_FORMAT
-#define DEPTH 16
-#include "sm501_template.h"
-
 #define DEPTH 32
 #include "sm501_template.h"

@@ -1198,61 +1181,33 @@  typedef void draw_hwc_line_func(SM501State * s, int
crt, uint8_t * palette,
 #include "sm501_template.h"

 static draw_line_func * draw_line8_funcs[] = {
-    draw_line8_8,
-    draw_line8_15,
-    draw_line8_16,
     draw_line8_32,
     draw_line8_32bgr,
-    draw_line8_15bgr,
-    draw_line8_16bgr,
 };

 static draw_line_func * draw_line16_funcs[] = {
-    draw_line16_8,
-    draw_line16_15,
-    draw_line16_16,
     draw_line16_32,
     draw_line16_32bgr,
-    draw_line16_15bgr,
-    draw_line16_16bgr,
 };

 static draw_line_func * draw_line32_funcs[] = {
-    draw_line32_8,
-    draw_line32_15,
-    draw_line32_16,
     draw_line32_32,
     draw_line32_32bgr,
-    draw_line32_15bgr,
-    draw_line32_16bgr,
 };

 static draw_hwc_line_func * draw_hwc_line_funcs[] = {
-    draw_hwc_line_8,
-    draw_hwc_line_15,
-    draw_hwc_line_16,
     draw_hwc_line_32,
     draw_hwc_line_32bgr,
-    draw_hwc_line_15bgr,
-    draw_hwc_line_16bgr,
 };

 static inline int get_depth_index(DisplaySurface *surface)
 {
-    switch (surface_bits_per_pixel(surface)) {
-    default:
-    case 8:
-       return 0;
-    case 15:
+    assert(surface_bits_per_pixel(surface) == 32);
+
+    if (is_surface_bgr(surface)) {
         return 1;
-    case 16:
-        return 2;
-    case 32:
-        if (is_surface_bgr(surface)) {
-            return 4;
-        } else {
-            return 3;
-        }
+    } else {
+        return 0;
     }
 }

diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
index f33e499..4e5801e 100644
--- a/hw/display/sm501_template.h
+++ b/hw/display/sm501_template.h
@@ -22,13 +22,7 @@ 
  * THE SOFTWARE.
  */

-#if DEPTH == 8
-#define BPP 1
-#define PIXEL_TYPE uint8_t
-#elif DEPTH == 15 || DEPTH == 16
-#define BPP 2
-#define PIXEL_TYPE uint16_t
-#elif DEPTH == 32
+#if DEPTH == 32
 #define BPP 4
 #define PIXEL_TYPE uint32_t
 #else