コード例 #1
0
ファイル: evas_engine.c プロジェクト: wargio/EFL-PS3
/* internal engine routines */
static void *
_output_setup(int w, int h, int rot, int vt, int dev, int refresh)
{
   Render_Engine *re;

   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;
   /* if we haven't initialized - init (automatic abort if already done) */
   evas_common_cpu_init();

   evas_common_blend_init();
   evas_common_image_init();
   evas_common_convert_init();
   evas_common_scale_init();
   evas_common_rectangle_init();
   evas_common_polygon_init();
   evas_common_line_init();
   evas_common_font_init();
   evas_common_draw_init();
   evas_common_tilebuf_init();

   evas_fb_outbuf_fb_init();

   /* get any stored performance metrics from device (xserver) */
   re->ob = evas_fb_outbuf_fb_setup_fb(w, h, rot, OUTBUF_DEPTH_INHERIT, vt, dev, refresh);
   re->tb = evas_common_tilebuf_new(evas_fb_outbuf_fb_get_width(re->ob), evas_fb_outbuf_fb_get_height(re->ob));
   /* no backbuf! */
   evas_fb_outbuf_fb_set_have_backbuf(re->ob, 0);
   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
   return re;
}
コード例 #2
0
ファイル: evas_engine.c プロジェクト: wargio/EFL-PS3
/* local functions */
static void *
_output_setup(int w, int h, int rotation, void *dest) 
{
   Render_Engine *re = NULL;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;

   if (!(re->ob = evas_outbuf_setup(w, h, rotation, dest))) 
     {
        free(re);
        return NULL;
     }

   if (!(re->tb = evas_common_tilebuf_new(w, h))) 
     {
        evas_outbuf_free(re->ob);
        free(re);
        return NULL;
     }

   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
   return re;
}
コード例 #3
0
/* internal engine routines */
static void *
_output_setup(int w, int h)
{
   Render_Engine *re;
   int i;
   u16 width, height;
   DATA32 *image_data = NULL;
   int image_size;

   printf ("_output_setup called : %dx%d\n", w, h);
   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;

   /* Allocate a 1Mb buffer, alligned to a 1Mb boundary
    * to be our shared IO memory with the RSX. */
   re->host_addr = memalign (1024 * 1024, HOST_SIZE);
   if (re->host_addr == NULL)
     {
        free (re);
        return NULL;
     }
   re->context = initScreen (re->host_addr, HOST_SIZE);
   if (re->context == NULL)
     {
        free (re->host_addr);
        free (re);
        return NULL;
     }
   width = w;
   height = h;
   setResolution (re->context, &width, &height);
   re->currentBuffer = 0;
   re->width = width;
   re->height = height;

   for (i = 0; i < MAX_BUFFERS; i++)
     makeBuffer (&re->buffers[i], width, height, i);

   flipBuffer(re->context, MAX_BUFFERS - 1);

   re->tb = evas_common_tilebuf_new(w, h);

   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);

   /* Allocate our memaligned backbuffer */
   image_size = ((w * h * sizeof(u32)) + 0xfffff) & - 0x100000;
   image_data = memalign (1024 * 1024, image_size);
   re->rgba_image = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
                                                        w, h, image_data, 1, EVAS_COLORSPACE_ARGB8888);
   gcmMapMainMemory(image_data, image_size, &re->rgba_image_offset);

   return re;
}
コード例 #4
0
static void
eng_output_resize(void *data, int width, int height)
{
    Render_Engine *re;

    re = (Render_Engine *)data;
    evas_software_ddraw_outbuf_reconfigure(re->ob,
                                           width,
                                           height,
                                           evas_software_ddraw_outbuf_rot_get(re->ob),
                                           OUTBUF_DEPTH_INHERIT);
    evas_common_tilebuf_free(re->tb);
    re->tb = evas_common_tilebuf_new(width, height);
    if (re->tb)
        evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
}
コード例 #5
0
ファイル: evas_engine.c プロジェクト: jigpu/efl
/* local functions */
static void *
_output_setup(int w, int h, unsigned int rotation, unsigned int depth, Eina_Bool alpha, int swap)
{
   Render_Engine *re;

   /* try to allocate space for our render engine structure */
   if (!(re = calloc(1, sizeof(Render_Engine))))
     return NULL;

   /* try to create a new tilebuffer */
   if (!(re->tb = evas_common_tilebuf_new(w, h)))
     {
        free(re);
        return NULL;
     }

   /* set tilesize */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);

   if (swap)
     {
        /* free any existing outbuf */
        if (re->ob) evas_outbuf_free(re->ob);

        /* try to create new outbuf */
        if (!(re->ob = evas_outbuf_setup(w, h, rotation, depth, alpha)))
          {
             if (re->tb) evas_common_tilebuf_free(re->tb);
             free(re);
             return NULL;
          }
     }

   /* return the allocated render_engine structure */
   return re;
}
コード例 #6
0
ファイル: evas_engine.c プロジェクト: Limsik/e17
/* internal engine routines */
static void *
_output_setup(int w,
	      int h,
	      void *dest_buffer,
	      int dest_buffer_row_bytes,
	      int depth_type,
	      int use_color_key,
	      int alpha_threshold,
	      int color_key_r,
	      int color_key_g,
	      int color_key_b,
	      void *(*new_update_region) (int x, int y, int w, int h, int *row_bytes),
	      void (*free_update_region) (int x, int y, int w, int h, void *data),
              void *(*switch_buffer) (void *data, void *dest_buffer),
              void *switch_data
	      )
{
   Render_Engine *re;

   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;
   /* if we haven't initialized - init (automatic abort if already done) */
   evas_common_cpu_init();

   evas_common_blend_init();
   evas_common_image_init();
   evas_common_convert_init();
   evas_common_scale_init();
   evas_common_rectangle_init();
   evas_common_polygon_init();
   evas_common_line_init();
   evas_common_font_init();
   evas_common_draw_init();
   evas_common_tilebuf_init();

   evas_buffer_outbuf_buf_init();

     {
	Outbuf_Depth dep;
	DATA32 color_key = 0;

	dep = OUTBUF_DEPTH_BGR_24BPP_888_888;
	if      (depth_type == EVAS_ENGINE_BUFFER_DEPTH_ARGB32)
	  dep = OUTBUF_DEPTH_ARGB_32BPP_8888_8888;
	else if (depth_type == EVAS_ENGINE_BUFFER_DEPTH_RGB32)
	  dep = OUTBUF_DEPTH_RGB_32BPP_888_8888;
	else if (depth_type == EVAS_ENGINE_BUFFER_DEPTH_BGRA32)
	  dep = OUTBUF_DEPTH_BGRA_32BPP_8888_8888;
	else if (depth_type == EVAS_ENGINE_BUFFER_DEPTH_RGB24)
	  dep = OUTBUF_DEPTH_RGB_24BPP_888_888;
	else if (depth_type == EVAS_ENGINE_BUFFER_DEPTH_BGR24)
	  dep = OUTBUF_DEPTH_BGR_24BPP_888_888;
	R_VAL(&color_key) = color_key_r;
	G_VAL(&color_key) = color_key_g;
	B_VAL(&color_key) = color_key_b;
	A_VAL(&color_key) = 0;
	re->ob = evas_buffer_outbuf_buf_setup_fb(w,
						 h,
						 dep,
						 dest_buffer,
						 dest_buffer_row_bytes,
						 use_color_key,
						 color_key,
						 alpha_threshold,
						 new_update_region,
						 free_update_region,
                                                 switch_buffer,
                                                 switch_data);
     }
   re->tb = evas_common_tilebuf_new(w, h);
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
   eina_inarray_step_set(&re->previous_rects, sizeof (Eina_Inarray), sizeof (Eina_Rectangle), 8);
   return re;
}
コード例 #7
0
ファイル: evas_engine.c プロジェクト: wjhendr/enlightenment
static void *
_output_setup(int          width,
              int          height,
              int          rot,
              HWND         window,
              int          depth,
              unsigned int borderless,
              unsigned int fullscreen,
              unsigned int region)
{
   Render_Engine *re;

   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;

   /* if we haven't initialized - init (automatic abort if already done) */
   evas_common_cpu_init();

   evas_common_blend_init();
   evas_common_image_init();
   evas_common_convert_init();
   evas_common_scale_init();
   evas_common_rectangle_init();
   evas_common_polygon_init();
   evas_common_line_init();
   evas_common_font_init();
   evas_common_draw_init();
   evas_common_tilebuf_init();

   evas_software_gdi_outbuf_init();

   if (width <= 0)
     width = 1;
   if (height <= 0)
     height = 1;

   re->ob = evas_software_gdi_outbuf_setup(width, height, rot,
                                           OUTBUF_DEPTH_INHERIT,
                                           window, depth, borderless, fullscreen, region,
                                           0, 0);
   if (!re->ob)
     {
	free(re);
	return NULL;
     }

   /* for updates return 1 big buffer, but only use portions of it, also cache
    it and keep it around until an idle_flush */
   /* disable for now - i am hunting down why some expedite tests are slower,
    * as well as shaped stuff is broken and probable non-32bpp is broken as
    * convert funcs dont do the right thing
    *
   re->ob->onebuf = 1;
    */

   re->tb = evas_common_tilebuf_new(width, height);
   if (!re->tb)
     {
	evas_software_gdi_outbuf_free(re->ob);
	free(re);
	return NULL;
     }
   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);

   return re;
}
コード例 #8
0
static void *
_output_xcb_setup(int               w,
                  int               h,
                  int               rot,
                  xcb_connection_t *conn,
                  xcb_screen_t     *screen,
                  xcb_drawable_t    draw,
                  xcb_visualtype_t *vis,
                  xcb_colormap_t    cmap,
                  int               depth,
                  int               debug,
                  int               grayscale,
                  int               max_colors,
                  xcb_drawable_t    mask,
                  int               shape_dither,
                  int               destination_alpha)
{
   Render_Engine *re;

   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;

   evas_software_xcb_x_init();
   evas_software_xcb_x_color_init();
   evas_software_xcb_outbuf_init();

   // FIXME: re->xrdb
   
   re->ob = evas_software_xcb_outbuf_setup_x(w,
                                             h,
                                             rot,
					     OUTBUF_DEPTH_INHERIT,
					     conn,
                                             screen,
					     draw,
					     vis,
					     cmap,
					     depth,
					     grayscale,
					     max_colors,
					     mask,
                                             shape_dither,
                                             destination_alpha);
   if (!re->ob)
     {
	free(re);
	return NULL;
     }

   /* for updates return 1 big buffer, but only use portions of it, also cache
    it and keepit around until an idle_flush */
   /* disable for now - i am hunting down why some expedite tests are slower,
    * as well as shaped stuff is broken and probable non-32bpp is broken as
    * convert funcs dont do the right thing
    *
   re->ob->onebuf = 1;
    */

   evas_software_xcb_outbuf_debug_set(re->ob, debug);
   re->tb = evas_common_tilebuf_new(w, h);
   if (!re->tb)
     {
	evas_software_xcb_outbuf_free(re->ob);
	free(re);
	return NULL;
     }
   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
   return re;
}
コード例 #9
0
static void *
_output_xlib_setup(int      w,
                   int      h,
                   int      rot,
                   Display *disp,
                   Drawable draw,
                   Visual  *vis,
                   Colormap cmap,
                   int      depth,
                   int      debug,
                   int      grayscale,
                   int      max_colors,
                   Pixmap   mask,
                   int      shape_dither,
                   int      destination_alpha)
{
   Render_Engine *re;

   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;

   evas_software_xlib_x_init();
   evas_software_xlib_x_color_init();
   evas_software_xlib_outbuf_init();

     {
        int status;
        char *type = NULL;
        XrmValue val;
        
        re->xr.dpi = 75000; // dpy * 1000

	status = xrdb_user_query("Xft.dpi", "Xft.Dpi", &type, &val);
	if ((!status) || (!type))
	  {
	     if (!re->xrdb) re->xrdb = XrmGetDatabase(disp);
	     if (re->xrdb)
	       status = XrmGetResource(re->xrdb,
				       "Xft.dpi", "Xft.Dpi", &type, &val);
	  }

        if ((status) && (type))
          {
             if (!strcmp(type, "String"))
               {
                  const char *str, *dp;
                  
                  str = val.addr;
                  dp = strchr(str, '.');
                  if (!dp) dp = strchr(str, ',');
                  
                  if (dp)
                    {
                       int subdpi, len, i;
                       char *buf;
                       
                       buf = alloca(dp - str + 1);
                       strncpy(buf, str, dp - str);
                       buf[dp - str] = 0;
                       len = strlen(dp + 1);
                       subdpi = atoi(dp + 1);
                       
                       if (len < 3)
                         {
                            for (i = len; i < 3; i++) subdpi *= 10;
                         }
                       else if (len > 3)
                         {
                            for (i = len; i > 3; i--) subdpi /= 10;
                         }
                       re->xr.dpi = atoi(buf) * 1000;
                    }
                  else
                    re->xr.dpi = atoi(str) * 1000;
                  evas_common_font_dpi_set(re->xr.dpi / 1000);
               }
          }
     }
   
   re->ob = evas_software_xlib_outbuf_setup_x(w,
                                              h,
                                              rot,
                                              OUTBUF_DEPTH_INHERIT,
                                              disp,
                                              draw,
                                              vis,
                                              cmap,
                                              depth,
                                              grayscale,
                                              max_colors,
                                              mask,
                                              shape_dither,
                                              destination_alpha);
   if (!re->ob)
     {
	free(re);
	return NULL;
     }

   /* for updates return 1 big buffer, but only use portions of it, also cache
    it and keepit around until an idle_flush */
   /* disable for now - i am hunting down why some expedite tests are slower,
    * as well as shaped stuff is broken and probable non-32bpp is broken as
    * convert funcs dont do the right thing
    *
   re->ob->onebuf = 1;
    */

   evas_software_xlib_outbuf_debug_set(re->ob, debug);
   re->tb = evas_common_tilebuf_new(w, h);
   if (!re->tb)
     {
	evas_software_xlib_outbuf_free(re->ob);
	free(re);
	return NULL;
     }
   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
   return re;
}