forked from enlightenment/efl
evas sw x11: formatting
This commit is contained in:
parent
736c63be34
commit
9a56b267cd
|
@ -39,7 +39,8 @@ struct _Render_Engine
|
|||
Render_Engine_Software_Generic generic;
|
||||
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
void *disp;
|
||||
void *config;
|
||||
void *surface;
|
||||
|
@ -414,10 +415,12 @@ eng_image_native_init(void *engine EINA_UNUSED, Evas_Native_Surface_Type type)
|
|||
#ifdef GL_GLES
|
||||
case EVAS_NATIVE_SURFACE_TBM:
|
||||
return _evas_native_tbm_init();
|
||||
|
||||
#endif
|
||||
case EVAS_NATIVE_SURFACE_X11:
|
||||
case EVAS_NATIVE_SURFACE_EVASGL:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
ERR("Native surface type %d not supported!", type);
|
||||
return 0;
|
||||
|
@ -433,10 +436,12 @@ eng_image_native_shutdown(void *engine EINA_UNUSED, Evas_Native_Surface_Type typ
|
|||
case EVAS_NATIVE_SURFACE_TBM:
|
||||
_evas_native_tbm_shutdown();
|
||||
return;
|
||||
|
||||
#endif
|
||||
case EVAS_NATIVE_SURFACE_X11:
|
||||
case EVAS_NATIVE_SURFACE_OPENGL:
|
||||
return;
|
||||
|
||||
default:
|
||||
ERR("Native surface type %d not supported!", type);
|
||||
return;
|
||||
|
@ -562,7 +567,6 @@ eng_image_native_get(void *engine EINA_UNUSED, void *image)
|
|||
return &(n->ns);
|
||||
}
|
||||
|
||||
|
||||
/* module advertising code */
|
||||
static int
|
||||
module_open(Evas_Module *em)
|
||||
|
|
|
@ -56,7 +56,8 @@
|
|||
static int egl_found = -1;
|
||||
static void *egl_lib = NULL;
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
void * (*GetProcAddress)(const char *name);
|
||||
void * (*GetDisplay)(void *d);
|
||||
unsigned int (*Initialize)(void *ed, int *vmaj, int *vmin);
|
||||
|
@ -86,7 +87,8 @@ _egl_find(void)
|
|||
}
|
||||
if (!(egl.GetProcAddress = dlsym(egl_lib, "eglGetProcAddress"))) goto err;
|
||||
|
||||
#define SYM(x, y) if (!(egl.x = egl.GetProcAddress(y))) goto err
|
||||
#define SYM(x, y) if (!(egl.x = egl.GetProcAddress(y))) \
|
||||
goto err
|
||||
// core syms used
|
||||
SYM(GetDisplay, "eglGetDisplay");
|
||||
SYM(Initialize, "eglInitialize");
|
||||
|
@ -118,6 +120,7 @@ err:
|
|||
egl_lib = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void *
|
||||
|
@ -202,6 +205,7 @@ _egl_x_win_surf_new(void *ed, Window win, void *config)
|
|||
if (!_egl_find()) return NULL;
|
||||
return egl.CreateWindowSurface(ed, config, win, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -310,4 +314,5 @@ evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
|||
(void)vis;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -445,3 +445,4 @@ evas_software_xlib_x_output_buffer_bit_order(X_Output_Buffer *xob)
|
|||
{
|
||||
return xob->xim->bitmap_bit_order;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
|
|||
DATA8 *color_lut;
|
||||
int sig_mask = 0, delt = 0;
|
||||
|
||||
for (i = 0; i < v->bits_per_rgb; i++) sig_mask |= (0x1 << i);
|
||||
for (i = 0; i < v->bits_per_rgb; i++)
|
||||
sig_mask |= (0x1 << i);
|
||||
sig_mask <<= (16 - v->bits_per_rgb);
|
||||
i = 0;
|
||||
color_lut = malloc((nr) * (ng) * (nb));
|
||||
|
@ -125,7 +126,8 @@ x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
|
|||
DATA8 *color_lut;
|
||||
int sig_mask = 0;
|
||||
|
||||
for (i = 0; i < v->bits_per_rgb; i++) sig_mask |= (0x1 << i);
|
||||
for (i = 0; i < v->bits_per_rgb; i++)
|
||||
sig_mask |= (0x1 << i);
|
||||
sig_mask <<= (16 - v->bits_per_rgb);
|
||||
i = 0;
|
||||
color_lut = malloc(ng);
|
||||
|
@ -373,3 +375,4 @@ evas_software_xlib_x_color_deallocate(Display *disp,
|
|||
palettes = eina_list_remove(palettes, pal);
|
||||
free(pal);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
# include <sys/stat.h>
|
||||
# include <fcntl.h>
|
||||
|
||||
|
||||
static Eina_Bool tried = EINA_FALSE;
|
||||
////////////////////////////////////
|
||||
//libdrm.so.2
|
||||
|
@ -27,7 +26,6 @@ static int (*sym_drmGetMagic) (int fd, drm_magic_t *magic) = NULL;
|
|||
#define TBM_OPTION_WRITE (1 << 1)
|
||||
static void *lib_tbm = NULL;
|
||||
|
||||
|
||||
static tbm_bo (*sym_tbm_bo_import)(tbm_bufmgr bufmgr, unsigned int key) = NULL;
|
||||
static tbm_bo_handle (*sym_tbm_bo_map)(tbm_bo bo, int device, int opt) = NULL;
|
||||
static int (*sym_tbm_bo_unmap)(tbm_bo bo) = NULL;
|
||||
|
@ -64,7 +62,6 @@ static Status (*sym_XFixesQueryVersion) (Display *display, int *major_version_re
|
|||
static XID (*sym_XFixesCreateRegion)(Display *display, XRectangle *rectangles, int nrectangles) = NULL;
|
||||
static void (*sym_XFixesDestroyRegion)(Display *dpy, XID region) = NULL;
|
||||
|
||||
|
||||
static int inits = 0;
|
||||
static int xfixes_ev_base = 0, xfixes_err_base = 0;
|
||||
static int xfixes_major = 0, xfixes_minor = 0;
|
||||
|
@ -171,7 +168,6 @@ _drm_init(Display *disp, int scr)
|
|||
}
|
||||
sym_XFixesQueryVersion(disp, &xfixes_major, &xfixes_minor);
|
||||
|
||||
|
||||
if (!sym_DRI2QueryExtension(disp, &dri2_ev_base, &dri2_err_base))
|
||||
{
|
||||
if (exim_debug) ERR("DRI2 extension not in xserver");
|
||||
|
@ -184,7 +180,8 @@ _drm_init(Display *disp, int scr)
|
|||
}
|
||||
if (dri2_minor < 99)
|
||||
{
|
||||
if (exim_debug) ERR("Not supported by DRI2 version(%i.%i)",
|
||||
if (exim_debug)
|
||||
ERR("Not supported by DRI2 version(%i.%i)",
|
||||
dri2_major, dri2_minor);
|
||||
goto err;
|
||||
}
|
||||
|
@ -475,7 +472,6 @@ evas_xlib_image_get_buffers(RGBA_Image *im)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
evas_xlib_image_dri_free(Evas_DRI_Image *exim)
|
||||
{
|
||||
|
|
|
@ -109,3 +109,4 @@ evas_xlib_image_native_set(void *data EINA_UNUSED, void *image, void *native)
|
|||
}
|
||||
return im;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,3 +5,4 @@ void
|
|||
evas_software_xlib_x_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -130,21 +130,31 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
|||
if (grayscale)
|
||||
{
|
||||
if (max_colors >= 256) pm = PAL_MODE_GRAY256;
|
||||
else if (max_colors >= 64) pm = PAL_MODE_GRAY64;
|
||||
else if (max_colors >= 16) pm = PAL_MODE_GRAY16;
|
||||
else if (max_colors >= 4) pm = PAL_MODE_GRAY4;
|
||||
else if (max_colors >= 64)
|
||||
pm = PAL_MODE_GRAY64;
|
||||
else if (max_colors >= 16)
|
||||
pm = PAL_MODE_GRAY16;
|
||||
else if (max_colors >= 4)
|
||||
pm = PAL_MODE_GRAY4;
|
||||
else pm = PAL_MODE_MONO;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (max_colors >= 256) pm = PAL_MODE_RGB332;
|
||||
else if (max_colors >= 216) pm = PAL_MODE_RGB666;
|
||||
else if (max_colors >= 128) pm = PAL_MODE_RGB232;
|
||||
else if (max_colors >= 64) pm = PAL_MODE_RGB222;
|
||||
else if (max_colors >= 32) pm = PAL_MODE_RGB221;
|
||||
else if (max_colors >= 16) pm = PAL_MODE_RGB121;
|
||||
else if (max_colors >= 8) pm = PAL_MODE_RGB111;
|
||||
else if (max_colors >= 4) pm = PAL_MODE_GRAY4;
|
||||
else if (max_colors >= 216)
|
||||
pm = PAL_MODE_RGB666;
|
||||
else if (max_colors >= 128)
|
||||
pm = PAL_MODE_RGB232;
|
||||
else if (max_colors >= 64)
|
||||
pm = PAL_MODE_RGB222;
|
||||
else if (max_colors >= 32)
|
||||
pm = PAL_MODE_RGB221;
|
||||
else if (max_colors >= 16)
|
||||
pm = PAL_MODE_RGB121;
|
||||
else if (max_colors >= 8)
|
||||
pm = PAL_MODE_RGB111;
|
||||
else if (max_colors >= 4)
|
||||
pm = PAL_MODE_GRAY4;
|
||||
else pm = PAL_MODE_MONO;
|
||||
}
|
||||
/* FIXME: only alloc once per display+cmap */
|
||||
|
@ -160,7 +170,6 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
|||
d = evas_xlib_swapper_depth_get(buf->priv.swapper);
|
||||
if (buf->priv.pal)
|
||||
{
|
||||
|
||||
if (buf->rot == 0 || buf->rot == 180)
|
||||
conv_func = evas_common_convert_func_get(0, buf->w, buf->h, d,
|
||||
buf->priv.mask.r,
|
||||
|
@ -601,3 +610,4 @@ evas_software_xlib_swapbuf_buffer_state_get(Outbuf *buf)
|
|||
mode = evas_xlib_swapper_buffer_state_get(buf->priv.swapper);
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
|
|
@ -273,8 +273,10 @@ evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
|
|||
if (count == swp->buf_num)
|
||||
{
|
||||
if (count == 1) return MODE_COPY;
|
||||
else if (count == 2) return MODE_DOUBLE;
|
||||
else if (count == 3) return MODE_TRIPLE;
|
||||
else if (count == 2)
|
||||
return MODE_DOUBLE;
|
||||
else if (count == 3)
|
||||
return MODE_TRIPLE;
|
||||
}
|
||||
return MODE_FULL;
|
||||
}
|
||||
|
@ -299,7 +301,6 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp)
|
|||
|
||||
#else
|
||||
|
||||
|
||||
// DRM/DRI buffer swapping+access (driver specific) /////////////////////
|
||||
|
||||
static Eina_Bool tried = EINA_FALSE;
|
||||
|
@ -329,7 +330,6 @@ typedef union _tbm_bo_handle
|
|||
uint64_t u64;
|
||||
} tbm_bo_handle;
|
||||
|
||||
|
||||
static tbm_bo (*sym_tbm_bo_import)(tbm_bufmgr bufmgr, unsigned int key) = NULL;
|
||||
static tbm_bo_handle (*sym_tbm_bo_map)(tbm_bo bo, int device, int opt) = NULL;
|
||||
static int (*sym_tbm_bo_unmap)(tbm_bo bo) = NULL;
|
||||
|
@ -543,7 +543,8 @@ _drm_init(Display *disp, int scr)
|
|||
}
|
||||
if (dri2_minor < 99)
|
||||
{
|
||||
if (swap_debug) ERR("Not supported by DRI2 version(%i.%i)",
|
||||
if (swap_debug)
|
||||
ERR("Not supported by DRI2 version(%i.%i)",
|
||||
dri2_major, dri2_minor);
|
||||
goto err;
|
||||
}
|
||||
|
@ -680,8 +681,8 @@ evas_xlib_swapper_new(Display *disp, Drawable draw, Visual *vis,
|
|||
free(swp);
|
||||
return NULL;
|
||||
}
|
||||
if (swp->depth == 24)
|
||||
{ // need to adjust to 32bpp?? have to check
|
||||
if (swp->depth == 24) // need to adjust to 32bpp?? have to check
|
||||
{
|
||||
swp->depth = 32;
|
||||
}
|
||||
if (swap_debug) printf("Swapper allocated OK\n");
|
||||
|
@ -868,10 +869,14 @@ evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
|
|||
}
|
||||
if (swap_debug) printf("Swap state idx_reuse = %i (0=FULL, 1=COPY, 2=DOUBLE, 3=TRIPLE, 4=QUAD)\n", flags->data.idx_reuse);
|
||||
if (flags->data.idx_reuse == 0) return MODE_FULL;
|
||||
else if (flags->data.idx_reuse == 1) return MODE_COPY;
|
||||
else if (flags->data.idx_reuse == 2) return MODE_DOUBLE;
|
||||
else if (flags->data.idx_reuse == 3) return MODE_TRIPLE;
|
||||
else if (flags->data.idx_reuse == 4) return MODE_QUADRUPLE;
|
||||
else if (flags->data.idx_reuse == 1)
|
||||
return MODE_COPY;
|
||||
else if (flags->data.idx_reuse == 2)
|
||||
return MODE_DOUBLE;
|
||||
else if (flags->data.idx_reuse == 3)
|
||||
return MODE_TRIPLE;
|
||||
else if (flags->data.idx_reuse == 4)
|
||||
return MODE_QUADRUPLE;
|
||||
return MODE_FULL;
|
||||
}
|
||||
|
||||
|
@ -897,43 +902,6 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp EINA_UNUSED)
|
|||
|
||||
#else
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
X_Swapper *
|
||||
evas_xlib_swapper_new(Display *disp EINA_UNUSED, Drawable draw EINA_UNUSED,
|
||||
Visual *vis EINA_UNUSED, int depth EINA_UNUSED,
|
||||
|
@ -986,4 +954,5 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp EINA_UNUSED)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue