#endif
}
-DisplaySurface* get_qemu_display_surface(void) {
-#ifndef CONFIG_USE_SHM
- return maruskin_sdl_get_display();
-#else
- //TODO:
-#endif
-
- return NULL;
-}
-
-MaruScreenshot* get_maru_screenshot(void) {
+MaruScreenshot *get_maru_screenshot(void)
+{
return maru_screenshot;
}
-
+/* set_maru_screenshot() implemented in maruskin_operation.c */
void maru_display_init(DisplayState *ds);
void maru_display_fini(void);
-void maruskin_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize);
-DisplaySurface* get_qemu_display_surface(void);
-MaruScreenshot* get_maru_screenshot(void);
+void maruskin_init(uint64 swt_handle, int lcd_size_width,
+ int lcd_size_height, bool is_resize);
+
+MaruScreenshot *get_maru_screenshot(void);
+void set_maru_screenshot(DisplaySurface *surface);
#endif /* __MARU_DISPLAY_H__ */
MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
-DisplaySurface *qemu_display_surface = NULL;
+static DisplaySurface *dpy_surface;
static SDL_Surface *surface_screen;
static SDL_Surface *surface_qemu;
static int sdl_thread_initialized;
#endif
-extern pthread_mutex_t mutex_screenshot;
-extern pthread_cond_t cond_screenshot;
-
#define SDL_FLAGS (SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_NOFRAME)
#define SDL_BPP 32
/* Image processing functions using the pixman library */
-static void maru_do_pixman_sdl(pixman_image_t *dst_image)
+static void maru_do_pixman_dpy_surface(pixman_image_t *dst_image)
{
/* overlay0 */
if (overlay0_power) {
#else
qemu_update();
#endif
-
- /* for screenshot */
- pthread_mutex_lock(&mutex_screenshot);
-
- MaruScreenshot* maru_screenshot = get_maru_screenshot();
- if (maru_screenshot) {
- maru_screenshot->isReady = 1;
-
- if (maru_screenshot->request_screenshot == 1) {
- memcpy(maru_screenshot->pixel_data,
- surface_data(qemu_display_surface),
- surface_stride(qemu_display_surface) *
- surface_height(qemu_display_surface));
- maru_screenshot->request_screenshot = 0;
-
- pthread_cond_signal(&cond_screenshot);
- }
- }
-
- pthread_mutex_unlock(&mutex_screenshot);
}
static void qemu_ds_sdl_switch(DisplayChangeListener *dcl,
return;
}
- qemu_display_surface = new_surface;
+ dpy_surface = new_surface;
w = surface_width(new_surface);
h = surface_height(new_surface);
INFO("create SDL screen = (%d, %d)\n",
get_emul_lcd_width(), get_emul_lcd_height());
surface_qemu = SDL_CreateRGBSurfaceFrom(
- surface_data(qemu_display_surface),
+ surface_data(dpy_surface),
w, h,
- surface_bits_per_pixel(qemu_display_surface),
- surface_stride(qemu_display_surface),
- qemu_display_surface->pf.rmask,
- qemu_display_surface->pf.gmask,
- qemu_display_surface->pf.bmask,
- qemu_display_surface->pf.amask);
+ surface_bits_per_pixel(dpy_surface),
+ surface_stride(dpy_surface),
+ dpy_surface->pf.rmask,
+ dpy_surface->pf.gmask,
+ dpy_surface->pf.bmask,
+ dpy_surface->pf.amask);
} else {
INFO("create blank screen = (%d, %d)\n",
get_emul_lcd_width(), get_emul_lcd_height());
surface_qemu = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
- surface_bits_per_pixel(qemu_display_surface), 0, 0, 0, 0);
+ surface_bits_per_pixel(dpy_surface), 0, 0, 0, 0);
}
#ifdef SDL_THREAD
else
{ //sdl surface
#endif
- maru_do_pixman_sdl(qemu_display_surface->image);
+ maru_do_pixman_dpy_surface(dpy_surface->image);
+ set_maru_screenshot(dpy_surface);
if (current_scale_factor != 1.0) {
rotated_screen = maru_do_pixman_rotate(
surface_qemu, rotated_screen,
and can be called from other threads safely. */
SDL_PushEvent(&ev);
}
-
-DisplaySurface *maruskin_sdl_get_display(void) {
- return qemu_display_surface;
-}
-
void maruskin_sdl_resize(void);
void maruskin_sdl_quit(void);
-DisplaySurface* maruskin_sdl_get_display(void);
-
#endif /* MARU_SDL_H_ */
MULTI_DEBUG_CHANNEL(tizen, maru_shm);
-static DisplaySurface *shm_surface;
-static void *shared_memory = (void*) 0;
+static DisplaySurface *dpy_surface;
+static void *shared_memory = (void *) 0;
static int skin_shmid;
static int shm_skip_update;
static unsigned int drop_frame;
#endif
-static void maru_do_pixman_shm(void)
+/* Image processing functions using the pixman library */
+static void maru_do_pixman_dpy_surface(pixman_image_t *dst_image)
{
/* overlay0 */
if (overlay0_power) {
pixman_image_composite(PIXMAN_OP_OVER,
- overlay0_image, NULL, shm_surface->image,
+ overlay0_image, NULL, dst_image,
0, 0, 0, 0, overlay0_left, overlay0_top,
overlay0_width, overlay0_height);
}
/* overlay1 */
if (overlay1_power) {
pixman_image_composite(PIXMAN_OP_OVER,
- overlay1_image, NULL, shm_surface->image,
+ overlay1_image, NULL, dst_image,
0, 0, 0, 0, overlay1_left, overlay1_top,
overlay1_width, overlay1_height);
}
/* apply the brightness level */
if (brightness_level < BRIGHTNESS_MAX) {
pixman_image_composite(PIXMAN_OP_OVER,
- brightness_image, NULL, shm_surface->image,
+ brightness_image, NULL, dst_image,
0, 0, 0, 0, 0, 0,
- surface_width(shm_surface),
- surface_height(shm_surface));
+ pixman_image_get_width(dst_image),
+ pixman_image_get_height(dst_image));
}
}
if (draw_display_state == 0) {
draw_display_state = 1;
pthread_mutex_unlock(&mutex_draw_display);
- maru_do_pixman_shm();
+ maru_do_pixman_dpy_surface(dpy_surface->image);
memcpy(shared_memory,
- surface_data(shm_surface),
- surface_stride(shm_surface) *
- surface_height(shm_surface));
+ surface_data(dpy_surface),
+ surface_stride(dpy_surface) *
+ surface_height(dpy_surface));
#ifdef INFO_FRAME_DROP_RATE
draw_frame++;
#endif
TRACE("qemu_ds_shm_switch\n");
if (new_surface) {
- shm_surface = new_surface;
+ dpy_surface = new_surface;
}
shm_skip_update = 0;
send_to_emuld( "sensor\n\n\n\n", 10, send_buf, 32 );
}
-QemuSurfaceInfo* get_screenshot_info(void)
+void set_maru_screenshot(DisplaySurface *surface)
{
-#if 0
- DisplaySurface* qemu_display_surface = get_qemu_display_surface();
+ pthread_mutex_lock(&mutex_screenshot);
- if ( !qemu_display_surface ) {
- ERR( "qemu surface is NULL.\n" );
- return NULL;
+ MaruScreenshot *maru_screenshot = get_maru_screenshot();
+ if (maru_screenshot) {
+ maru_screenshot->isReady = 1;
+ if (maru_screenshot->request_screenshot == 1) {
+ memcpy(maru_screenshot->pixel_data,
+ surface_data(surface),
+ surface_stride(surface) *
+ surface_height(surface));
+ maru_screenshot->request_screenshot = 0;
+
+ pthread_cond_signal(&cond_screenshot);
+ }
}
-#endif
+ pthread_mutex_unlock(&mutex_screenshot);
+}
- QemuSurfaceInfo* info = (QemuSurfaceInfo*) g_malloc0( sizeof(QemuSurfaceInfo) );
- if ( !info ) {
- ERR( "Fail to malloc for QemuSurfaceInfo.\n");
+QemuSurfaceInfo *get_screenshot_info(void)
+{
+ QemuSurfaceInfo *info =
+ (QemuSurfaceInfo *)g_malloc0(sizeof(QemuSurfaceInfo));
+ if (!info) {
+ ERR("Fail to malloc for QemuSurfaceInfo.\n");
return NULL;
}
int length = get_emul_lcd_width() * get_emul_lcd_height() * 4;
- INFO( "screenshot data length:%d\n", length );
+ INFO("screenshot data length:%d\n", length);
- if ( 0 >= length ) {
- g_free( info );
- ERR( "screenshot data ( 0 >=length ). length:%d\n", length );
+ if (0 >= length) {
+ g_free(info);
+ ERR("screenshot data ( 0 >=length ). length:%d\n", length);
return NULL;
}
- info->pixel_data = (unsigned char*) g_malloc0( length );
- if ( !info->pixel_data ) {
- g_free( info );
+ info->pixel_data = (unsigned char *)g_malloc0(length);
+ if (!info->pixel_data) {
+ g_free(info);
ERR("Fail to malloc for pixel data.\n");
return NULL;
}
return info;
}
-void free_screenshot_info(QemuSurfaceInfo* info)
+void free_screenshot_info(QemuSurfaceInfo *info)
{
if (info) {
if(info->pixel_data) {