[Title] lcd dimm problem after backlight time is expired.
authorSon Hyunjun <hj79.son@samsung.com>
Mon, 27 Feb 2012 07:41:36 +0000 (16:41 +0900)
committerSon Hyunjun <hj79.son@samsung.com>
Mon, 27 Feb 2012 07:41:36 +0000 (16:41 +0900)
[Type] Bugfix
[Module] Emulator / Display
[Priority] Minor
[CQ#]
[Redmine#]
[Problem] lcd off instead of lcd dimm after backlight time is expired.
[Cause]
[Solution]

hw/vga.c
tizen/src/hw/brightness.c

index 3d38efe..59443a7 100755 (executable)
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1631,9 +1631,10 @@ extern uint8_t* overlay_ptr;     // pointer in qemu space
 
 /* brightness level :              0,   1,   2,   3,   4,   5,   6,   7,   8,   9 */
 //static const uint8_t brightness_tbl[] = {20, 100, 120, 140, 160, 180, 200, 220, 230, 240};
-static const uint8_t brightness_tbl[] = {0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120,
+static const uint8_t brightness_tbl[] = {20, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120,
                                                                                130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240};
 extern uint32_t brightness_level;
+extern uint32_t brightness_off;
 #endif
 
 static void vga_draw_graphic(VGACommonState *s, int full_update)
@@ -1868,17 +1869,21 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
                 }
             }
             
-            if (brightness_level < 24) {
-                dst_sub = s->ds->surface->data + addr;
-                dst = (uint32_t*)(s->ds->surface->data + addr);
+            if( brightness_off ) {
+               alpha = 0x00;
+            }else if (brightness_level < 24) {
+               alpha = brightness_tbl[brightness_level];
+            }
 
-                alpha = brightness_tbl[brightness_level];
+            if ( brightness_off || brightness_level < 24 ) {
+               dst_sub = s->ds->surface->data + addr;
+               dst = (uint32_t*)(s->ds->surface->data + addr);
 
-                for (i=0; i < disp_width; i++, dst_sub += 4, dst++) {
-                       *dst = ((alpha * dst_sub[0]) >> 8) |
-                                       ((alpha * dst_sub[1]) & 0xFF00) |
-                                       (((alpha * dst_sub[2]) & 0xFF00) << 8);
-                }
+               for (i=0; i < disp_width; i++, dst_sub += 4, dst++) {
+                       *dst = ((alpha * dst_sub[0]) >> 8) |
+                                       ((alpha * dst_sub[1]) & 0xFF00) |
+                                       (((alpha * dst_sub[2]) & 0xFF00) << 8);
+               }
             }
 #endif /* TARGET_I386 */
 
index 0509879..a13db03 100644 (file)
@@ -61,10 +61,12 @@ typedef struct BrightnessState {
 
 enum {
        BRIGHTNESS_LEVEL        = 0x00,
+       BRIGHTNESS_OFF    = 0x04,
 };
 
 //uint8_t* brightness_ptr;     // pointer in qemu space
 uint32_t brightness_level = 24;
+uint32_t brightness_off = 0;
 
 //#define DEBUG_BRIGHTNESS
 
@@ -100,13 +102,17 @@ static void brightness_reg_write(void *opaque, target_phys_addr_t addr, uint32_t
                fprintf(stderr, "brightness_reg_write: Invalide brightness level.\n");
        }
 
-    switch (addr & 0xFF) {
-    case BRIGHTNESS_LEVEL:
-       brightness_level = val;
-        return;
-    default:
-        fprintf(stderr, "wrong brightness register write - addr : %d\n", addr);
-    }
+       switch (addr & 0xFF) {
+       case BRIGHTNESS_LEVEL:
+               brightness_level = val;
+               return;
+       case BRIGHTNESS_OFF:
+               DEBUG_PRINT(("Brightness off : %d\n", val));
+               brightness_off = val;
+               return;
+       default:
+               fprintf(stderr, "wrong brightness register write - addr : %d\n", addr);
+       }
 }
 
 static CPUReadMemoryFunc * const brightness_reg_readfn[3] = {