Merge "VirtGL: remove device" into tizen_qemu_2.0
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 29 Apr 2014 10:58:21 +0000 (03:58 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 29 Apr 2014 10:58:21 +0000 (03:58 -0700)
tizen/src/Makefile
tizen/src/hw/maru_board.c
tizen/src/hw/maru_camera_common_pci.c
tizen/src/maru_sdl.c

index 5d5824f..0c5505b 100644 (file)
@@ -86,7 +86,7 @@ install: all
                echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\
                cp -pP ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\
                echo "Copying bioses to $(EMUL_DIR)/data/bios" ;\
-               cp -pP ../../pc-bios/bios.bin $(EMUL_DIR)/data/bios ;\
+               cp -pP ../../pc-bios/bios-256k.bin $(EMUL_DIR)/data/bios ;\
                cp -pP ../../pc-bios/linuxboot.bin $(EMUL_DIR)/data/bios ;\
                cp -pP ../../pc-bios/efi-virtio.rom $(EMUL_DIR)/data/bios ;\
                cp -pP ../../pc-bios/acpi-dsdt.aml $(EMUL_DIR)/data/bios ;\
@@ -191,7 +191,7 @@ install_dibs: all_dibs
                echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(DIBS_X86__DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\
                cp ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(DIBS_X86_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\
                echo "Copying bioses to $(DIBS_X86_DIR)/data/bios" ;\
-               cp -pP ../../pc-bios/bios.bin $(DIBS_X86_DIR)/data/bios ;\
+               cp -pP ../../pc-bios/bios-256k.bin $(DIBS_X86_DIR)/data/bios ;\
                cp -pP ../../pc-bios/linuxboot.bin $(DIBS_X86_DIR)/data/bios ;\
                cp -pP ../../pc-bios/efi-virtio.rom $(DIBS_X86_DIR)/data/bios ;\
                cp -pP ../../pc-bios/acpi-dsdt.aml $(DIBS_X86_DIR)/data/bios ;\
index 884176b..9dbc7e6 100644 (file)
@@ -154,6 +154,7 @@ static QEMUMachine maru_x86_machine = {
     .desc = "Maru Board (x86)",
     .init = maru_x86_board_init,
     .hot_add_cpu = pc_hot_add_cpu,
+    .default_machine_opts = "firmware=bios-256k.bin"
 };
 
 static void maru_machine_init(void)
index e5dd3ce..4774e6f 100644 (file)
@@ -270,13 +270,15 @@ static void marucam_resetfn(DeviceState *d)
 {
     MaruCamState *s = (MaruCamState *)d;
 
-    marucam_device_close(s);
-    qemu_mutex_lock(&s->thread_mutex);
-    s->isr = s->streamon = s->req_frame = s->buf_size = 0;
-    qemu_mutex_unlock(&s->thread_mutex);
-    memset(s->vaddr, 0, MARUCAM_MEM_SIZE);
-    memset(s->param, 0x00, sizeof(MaruCamParam));
-    INFO("[%s]\n", __func__);
+    if (s->initialized) {
+        marucam_device_close(s);
+        qemu_mutex_lock(&s->thread_mutex);
+        s->isr = s->streamon = s->req_frame = s->buf_size = 0;
+        qemu_mutex_unlock(&s->thread_mutex);
+        memset(s->vaddr, 0, MARUCAM_MEM_SIZE);
+        memset(s->param, 0x00, sizeof(MaruCamParam));
+        TRACE("[%s] This device has been reset\n", __func__);
+    }
 }
 
 int maru_camera_pci_init(PCIBus *bus)
index 7405981..ed02c0f 100644 (file)
@@ -466,6 +466,57 @@ static SDL_Surface *get_blank_guide_image(void)
     return surface_guide;
 }
 
+static void draw_image(SDL_Surface *image)
+{
+    if (image == NULL || get_emul_skin_enable() == 0) {
+        return;
+    }
+
+    int dst_x = 0; int dst_y = 0;
+    int dst_w = 0; int dst_h = 0;
+
+    const unsigned int screen_width =
+            get_emul_resolution_width() * current_scale_factor;
+    const unsigned int screen_height =
+            get_emul_resolution_height() * current_scale_factor;
+
+    int margin_w = screen_width - image->w;
+    int margin_h = screen_height - image->h;
+
+    if (margin_w < 0 || margin_h < 0) {
+        /* guide image scaling */
+        int margin = (margin_w < margin_h)? margin_w : margin_h;
+        dst_w = image->w + margin;
+        dst_h = image->h + margin;
+
+        SDL_Surface *scaled_image = SDL_CreateRGBSurface(
+                SDL_SWSURFACE, dst_w, dst_h, get_emul_sdl_bpp(),
+                image->format->Rmask, image->format->Gmask,
+                image->format->Bmask, image->format->Amask);
+
+        scaled_image = maru_do_pixman_scale(
+                image, scaled_image, PIXMAN_FILTER_BEST);
+
+        dst_x = (surface_screen->w - dst_w) / 2;
+        dst_y = (surface_screen->h - dst_h) / 2;
+        SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h };
+
+        SDL_BlitSurface(scaled_image, NULL, surface_screen, &dst_rect);
+        SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
+
+        SDL_FreeSurface(scaled_image);
+    } else {
+        dst_w = image->w;
+        dst_h = image->h;
+        dst_x = (surface_screen->w - dst_w) / 2;
+        dst_y = (surface_screen->h - dst_h) / 2;
+        SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h };
+
+        SDL_BlitSurface(image, NULL, surface_screen, &dst_rect);
+        SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
+    }
+}
+
 static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
 {
     if (sdl_alteration == 1) {
@@ -474,67 +525,25 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
         sdl_skip_count = 0;
     }
 
-    /* If the display is turned off,
-       the screen does not update until the display is turned on */
+    /* draw cover image */
     if (sdl_skip_update && brightness_off) {
         if (blank_cnt > MAX_BLANK_FRAME_CNT) {
-            /* do nothing */
+#ifdef CONFIG_WIN32
+            if (sdl_invalidate) {
+                draw_image(get_blank_guide_image());
+            }
+#endif
+
             return;
         } else if (blank_cnt == MAX_BLANK_FRAME_CNT) {
             if (blank_guide_enable == true) {
                 INFO("draw a blank guide image\n");
 
-                SDL_Surface *guide = get_blank_guide_image();
-                if (guide != NULL && get_emul_skin_enable() == 1) {
-                    /* draw guide image */
-                    int dst_x = 0; int dst_y = 0;
-                    int dst_w = 0; int dst_h = 0;
-
-                    unsigned int screen_width =
-                        get_emul_resolution_width() * current_scale_factor;
-                    unsigned int screen_height =
-                        get_emul_resolution_height() * current_scale_factor;
-
-                    int margin_w = screen_width - guide->w;
-                    int margin_h = screen_height - guide->h;
-
-                    if (margin_w < 0 || margin_h < 0) {
-                        /* guide image scaling */
-                        int margin = (margin_w < margin_h)? margin_w : margin_h;
-                        dst_w = guide->w + margin;
-                        dst_h = guide->h + margin;
-
-                        SDL_Surface *scaled_guide = SDL_CreateRGBSurface(
-                            SDL_SWSURFACE, dst_w, dst_h, get_emul_sdl_bpp(),
-                            guide->format->Rmask, guide->format->Gmask,
-                            guide->format->Bmask, guide->format->Amask);
-
-                        scaled_guide = maru_do_pixman_scale(
-                            guide, scaled_guide, PIXMAN_FILTER_BEST);
-
-                        dst_x = (surface_screen->w - dst_w) / 2;
-                        dst_y = (surface_screen->h - dst_h) / 2;
-                        SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h };
-
-                        SDL_BlitSurface(scaled_guide, NULL,
-                            surface_screen, &dst_rect);
-                        SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
-
-                        SDL_FreeSurface(scaled_guide);
-                    } else {
-                        dst_w = guide->w;
-                        dst_h = guide->h;
-                        dst_x = (surface_screen->w - dst_w) / 2;
-                        dst_y = (surface_screen->h - dst_h) / 2;
-                        SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h };
-
-                        SDL_BlitSurface(guide, NULL,
-                            surface_screen, &dst_rect);
-                        SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
-                    }
-                }
+                draw_image(get_blank_guide_image());
             }
         } else if (blank_cnt == 0) {
+            /* If the display is turned off,
+            the screen does not update until the display is turned on */
             INFO("skipping of the display updating is started\n");
         }
 
@@ -548,6 +557,7 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
         }
     }
 
+    /* draw framebuffer */
     if (sdl_invalidate) {
         graphic_hw_invalidate(NULL);
     }
@@ -790,8 +800,6 @@ static void maru_sdl_resize_bh(void *opaque)
 
 static void maru_sdl_init_bh(void *opaque)
 {
-    SDL_SysWMinfo info;
-
     INFO("SDL_Init\n");
 
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
@@ -799,7 +807,8 @@ static void maru_sdl_init_bh(void *opaque)
         // TODO:
     }
 
-#ifndef _WIN32
+#ifndef CONFIG_WIN32
+    SDL_SysWMinfo info;
     SDL_VERSION(&info.version);
     SDL_GetWMInfo(&info);
 #endif
@@ -813,8 +822,7 @@ static void maru_sdl_init_bh(void *opaque)
         INFO("sdl update thread create\n");
 
         pthread_t thread_id;
-        if (pthread_create(
-            &thread_id, NULL, run_qemu_update, NULL) != 0) {
+        if (pthread_create(&thread_id, NULL, run_qemu_update, NULL) != 0) {
             ERR("pthread_create fail\n");
             return;
         }