Changeset 3680

Show
Ignore:
Timestamp:
30/11/08 20:36:42 (6 weeks ago)
Author:
dmeyer
Message:

Remove evas and DirectFB support. The evas support is outdated and may not
even work with the latest version of evas, kaa.candy is based on clutter and
not on evas anymore. The DirectFB support only worked when using evas, so no
need for it anymore. This leaves X11, Framebuffer, and SDL support based on
imlib2 and basic X11 window handling.

Location:
trunk/display
Files:
3 removed
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/display/README

    r1151 r3680  
    22framebuffer. Provides X11Display and X11Window classes for managing 
    33X11 windows, with optional support for Imlib2 (render Imlib2 images to 
    4 X11 windows), Evas (both software and OpenGL canvases), and pygame 
    5 (render Imlib2 images to pygame surfaces). 
     4X11 windows), and pygame (render Imlib2 images to pygame surfaces). 
    65 
    76See http://www.freevo.org/kaa for more information 
  • trunk/display/TODO

    r1152 r3680  
    33inside. 
    44 
    5 Better opengl check. If EvasGL is used but the device is broken or the 
    6 user has no permission, the code will use the GL software renderer 
    7 which is _much_ slower than the evas x11 software render. 
    8  
    95Maybe remove that bad pygame hack 
    10  
    11 Add more (evas based) displays like streaming the display as mpeg 
    12 stream. This could be done by using a buffer output and convert it to 
    13 mpeg2. This display can also be used to make it work with a DXR3 or 
    14 other mpeg decoder based cards. 
    15  
    16 Fix DirectFB Evas display. Please check if there is still a bug in 
    17 evas and help fixing it. 
    186 
    197Create a REAME 
  • trunk/display/setup.py

    r3678 r3680  
    77# ----------------------------------------------------------------------------- 
    88# kaa.display - Display module 
    9 # Copyright (C) 2005, 2006 Dirk Meyer, Jason Tackaberry 
     9# Copyright (C) 2005, 2006, 2008 Dirk Meyer, Jason Tackaberry 
    1010# 
    1111# First Edition: Dirk Meyer <dmeyer@tzi.de> 
     
    5555check_library('X11', ['<X11/Xlib.h>'], '') 
    5656check_library('imlib2', '1.1.1') 
    57 evas = check_library('evas', '0.9.9.010') 
    58 check_library('directfb', '0.9.20') 
    5957 
    6058print 'checking for pygame', '...', 
     
    6967    if not os.path.isdir(inc): 
    7068        raise ImportError 
    71  
    7269    print 'ok' 
    7370    check_library('sdl', '1.2.5') 
     
    8279if get_library('imlib2'): 
    8380    config.define('USE_IMLIB2') 
    84 if get_library('evas'): 
    85     config.define('USE_EVAS') 
    8681 
    8782if get_library('X11'): 
     
    9994        x11.add_library('XComposite') 
    10095 
    101     features = { 'with': [], 'without': [] } 
    10296    imlib2 = get_library('imlib2') 
    10397    if 'imlib2-x11' in disable or 'imlib2' in disable: 
    104         features['without'].append('imlib2') 
     98        print '+ X11 (no imlib2)' 
    10599    elif imlib2 and imlib2.compile(['<Imlib2.h>'], 'imlib_context_set_display(NULL);'): 
    106100        config.define('USE_IMLIB2_X11') 
    107101        x11.add_library('imlib2') 
    108         features['with'].append('imlib2') 
     102        print '+ X11 (imlib2)' 
    109103    elif imlib2: 
    110104        print 
     
    121115        print 
    122116        sys.exit(1) 
    123     if evas and evas.compile(['<Evas.h>', '<Evas_Engine_Software_X11.h>']): 
    124         features['with'].append('evas') 
    125         x11.add_library('evas') 
    126         config.define('ENABLE_ENGINE_SOFTWARE_X11') 
    127     else: 
    128         features['without'].append('evas') 
    129  
    130     if evas and evas.compile(['<Evas.h>', '<Evas_Engine_GL_X11.h>']): 
    131         features['with'].append('evasGL') 
    132         x11.add_library('evas') 
    133         x11.libraries.append("GL") 
    134         config.define('ENABLE_ENGINE_GL_X11') 
    135     else: 
    136         features['without'].append('evasGL') 
    137  
    138     features = ', '.join(features['with'] + [ 'no %s' % x for x in features['without'] ]) 
    139     print '+ X11 (%s)' % features 
    140117    modules.append(x11) 
    141118else: 
     
    147124    fb = Extension('kaa.display._FBmodule', [ 'src/fb.c', 'src/common.c']) 
    148125    fb.add_library('imlib2') 
    149     if evas and evas.compile(['<Evas.h>', '<Evas_Engine_FB.h>']): 
    150         fb.add_library('evas') 
    151         config.define('ENABLE_ENGINE_FB') 
    152         print "+ Framebuffer (imlib2, evas)" 
    153     else: 
    154         print "+ Framebuffer (imlib2, no evas)" 
     126    print "+ Framebuffer (imlib2)" 
    155127    modules.append(fb) 
    156128else: 
    157129    print "- Framebuffer" 
    158  
    159  
    160 if get_library('directfb'): 
    161  
    162     # the dfb so module 
    163     dfb = Extension('kaa.display._DFBmodule', [ 'src/dfb.c', 'src/common.c'] ) 
    164     dfb.add_library('directfb') 
    165     if evas and evas.compile(['<Evas.h>', '<Evas_Engine_DirectFB.h>'], extra_libraries = ['directfb']): 
    166         print "+ DirectFB (evas)" 
    167         dfb.add_library('evas') 
    168         config.define('ENABLE_ENGINE_DIRECTFB') 
    169     else: 
    170         print "+ DirectFB" 
    171     modules.append(dfb) 
    172 else: 
    173     print "- DirectFB" 
    174130 
    175131 
     
    188144 
    189145requires_common       = 'python-kaa-base >= 0.1.2, pygame >= 1.6.0, python-kaa-imlib2 >= 0.2.0,' \ 
    190                         'imlib2 >= 1.2.1, python-kaa-evas >= 0.1.0, evas >= 0.9.9.032' 
     146                        'imlib2 >= 1.2.1' 
    191147build_requires_common = 'python-kaa-base >= 0.1.2, pygame-devel >= 1.6.0, python-kaa-imlib2 >= 0.2.0,' \ 
    192                         'imlib2-devel >= 1.2.1, python-kaa-evas >= 0.1.0, evas-devel >= 0.9.9.032' 
     148                        'imlib2-devel >= 1.2.1' 
    193149 
    194150setup(module  = 'display', 
  • trunk/display/src/__init__.py

    r2600 r3680  
    4343# import X11 support 
    4444try: 
    45     from x11 import X11Display, X11Window, EvasX11Window 
     45    from x11 import X11Display, X11Window 
    4646    displays.append('x11') 
    4747except ImportError, e: 
    48     X11Display = X11Window = EvasX11Window = ImportErrorWrapper('X11') 
     48    X11Display = X11Window = ImportErrorWrapper('X11') 
    4949 
    5050# import GTK support 
     
    5757# import Framebuffer support 
    5858try: 
    59     from fb import Framebuffer, EvasFramebuffer, PAL_768x576, PAL_800x600, \ 
     59    from fb import Framebuffer, PAL_768x576, PAL_800x600, \ 
    6060         NTSC_640x480, NTSC_768x576, NTSC_800x600 
    6161    displays.append('framebuffer') 
    6262except ImportError, e: 
    63     Framebuffer = EvasFramebuffer = ImportErrorWrapper('framebuffer') 
    64  
    65 # import DirectFB support 
    66 try: 
    67     from dfb import DirectFB, EvasDirectFB 
    68     displays.append('directfb') 
    69 except ImportError, e: 
    70     DirectFB = EvasDirectFB = ImportErrorWrapper('directfb') 
     63    Framebuffer = ImportErrorWrapper('framebuffer') 
    7164 
    7265# import SDL support 
  • trunk/display/src/common.h

    r2217 r3680  
    3232void **get_module_api(char *module); 
    3333 
    34 #define CHECK_EVAS_PYOBJECT \ 
    35     if (!Evas_PyObject_Type) { \ 
    36         PyErr_Format(PyExc_SystemError, "kaa.evas is required but is not available."); \ 
    37         return NULL; \ 
    38     } 
    39  
    40  
    4134#define CHECK_IMAGE_PYOBJECT \ 
    4235    if (!Image_PyObject_Type) { \ 
  • trunk/display/src/fb.c

    r2217 r3680  
    5454 
    5555 
    56 #ifdef ENABLE_ENGINE_FB 
    57 #include <Evas.h> 
    58 #include <Evas_Engine_FB.h> 
    59 PyTypeObject *Evas_PyObject_Type = NULL; 
    60 Evas *(*evas_object_from_pyobject)(PyObject *pyevas); 
    61 #endif 
    62  
    6356int fb_fd = 0; 
    6457int *fb_mem = 0; 
     
    246239} 
    247240 
    248 #ifdef ENABLE_ENGINE_FB 
    249 PyObject * 
    250 new_evas_fb(PyObject *self, PyObject *args, PyObject *kwargs) 
    251 { 
    252     Evas_Engine_Info_FB *einfo; 
    253     PyObject *evas_pyobject; 
    254     Evas *evas; 
    255  
    256     CHECK_EVAS_PYOBJECT 
    257  
    258     if (!PyArg_ParseTuple(args, "O!", Evas_PyObject_Type, &evas_pyobject)) 
    259         return NULL; 
    260  
    261     evas = evas_object_from_pyobject(evas_pyobject); 
    262  
    263     evas_output_method_set(evas, evas_render_method_lookup("fb")); 
    264     einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(evas); 
    265     if (!einfo) { 
    266         PyErr_Format(PyExc_SystemError, "Evas is not built with FB support."); 
    267         return NULL; 
    268     } 
    269  
    270     /* the following is specific to the engine */ 
    271     einfo->info.virtual_terminal = 0; 
    272     einfo->info.device_number = 0; 
    273     einfo->info.refresh = 0; 
    274     einfo->info.rotation = 0; 
    275  
    276     evas_output_size_set(evas, fb_var.xres, fb_var.yres); 
    277     evas_output_viewport_set(evas, 0, 0, fb_var.xres, fb_var.yres); 
    278  
    279     evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); 
    280     Py_INCREF(Py_None); 
    281     return Py_None; 
    282 } 
    283 #endif  // ENABLE_ENGINE_FB 
    284241 
    285242PyMethodDef fb_methods[] = { 
     
    290247    { "depth", (PyCFunction) fb_depth, METH_VARARGS }, 
    291248    { "info", (PyCFunction) fb_info, METH_VARARGS }, 
    292 #ifdef ENABLE_ENGINE_FB 
    293     { "new_evas_fb", (PyCFunction) new_evas_fb, METH_VARARGS | METH_KEYWORDS }, 
    294 #endif 
    295249    { NULL } 
    296250}; 
     
    308262    } else  
    309263        PyErr_Clear(); 
    310  
    311 #ifdef ENABLE_ENGINE_FB 
    312 { 
    313     // Import kaa-evas's C api 
    314     void **evas_api_ptrs = get_module_api("kaa.evas._evas"); 
    315     if (evas_api_ptrs != NULL) { 
    316         evas_object_from_pyobject = evas_api_ptrs[0]; 
    317         Evas_PyObject_Type = evas_api_ptrs[1]; 
    318     } else 
    319         PyErr_Clear(); 
    320 } 
    321  
    322 #endif 
    323  
    324 } 
     264} 
  • trunk/display/src/fb.py

    r1958 r3680  
    3131 
    3232__all__ = [ 'PAL_768x576', 'PAL_800x600', 'NTSC_640x480', 'NTSC_768x576', 
    33             'NTSC_800x600', 'Framebuffer', 'EvasFramebuffer' ] 
     33            'NTSC_800x600', 'Framebuffer' ] 
    3434 
    3535import _FBmodule as fb 
     
    138138        """ 
    139139        fb.update(self.image._image) 
    140  
    141  
    142 class EvasFramebuffer(_Framebuffer): 
    143     """ 
    144     Frambuffer using evas for drawing 
    145     The 'mode' argument can either be a size (width, height) matching one of 
    146     the specified framebuffer resolutions, a list for fbset or None. If set to 
    147     None, the current framebuffer size will be used. 
    148     """ 
    149     def __init__(self, mode=None): 
    150         _Framebuffer.__init__(self, mode) 
    151         import kaa.evas 
    152         self._evas = kaa.evas.Evas() 
    153         fb.new_evas_fb(self._evas._evas) 
    154  
    155  
    156     def get_evas(self): 
    157         """ 
    158         Return evas object. 
    159         """ 
    160         return self._evas 
  • trunk/display/src/x11.c

    r3408 r3680  
    3838 
    3939 
    40 #if defined(ENABLE_ENGINE_SOFTWARE_X11) || defined(ENABLE_ENGINE_GL_X11) 
    41 #include <Evas.h> 
    42 Evas *(*evas_object_from_pyobject)(PyObject *pyevas); 
    43 PyTypeObject *Evas_PyObject_Type = NULL; 
    44 #endif 
    45  
    46 #ifdef ENABLE_ENGINE_SOFTWARE_X11 
    47 #include <Evas_Engine_Software_X11.h> 
    48 #endif 
    49  
    50 #ifdef ENABLE_ENGINE_GL_X11 
    51 #include <Evas_Engine_GL_X11.h> 
    52 #include <GL/gl.h> 
    53 #include <GL/glx.h> 
    54 #endif 
    55  
    5640#if defined(USE_IMLIB2_X11) && !defined(X_DISPLAY_MISSING) 
    5741#include <X11/Xlib.h> 
     
    6044PyTypeObject *Image_PyObject_Type = NULL; 
    6145#endif 
    62  
    63  
    64  
    65 #if defined(ENABLE_ENGINE_SOFTWARE_X11) || defined(ENABLE_ENGINE_GL_X11) 
    66 X11Window_PyObject * 
    67 engine_common_x11_setup(Evas *evas, PyObject *kwargs, 
    68                         X11Display_PyObject *disp, 
    69     Visual *(*best_visual_get)(Display *, int), 
    70     Colormap (*best_colormap_get)(Display *, int), 
    71     int (*best_depth_get)(Display *, int), 
    72     Display **ei_display, Drawable *ei_drawable, Visual **ei_visual, 
    73     Colormap *ei_colormap, int *ei_depth) 
    74 { 
    75     X11Window_PyObject *win_object, *py_parent; 
    76     Window win, parent; 
    77     XSetWindowAttributes attr; 
    78     int screen, w, h; 
    79     char *title = NULL; 
    80  
    81     if (!PyArg_ParseTuple(PyDict_GetItemString(kwargs, "size"), "ii", &w, &h)) 
    82         return NULL; 
    83     py_parent = (X11Window_PyObject *)PyDict_GetItemString(kwargs, "parent"); 
    84     if (PyMapping_HasKeyString(kwargs, "title")) 
    85         title = PyString_AsString(PyDict_GetItemString(kwargs, "title")); 
    86  
    87     if (py_parent) { 
    88         parent = py_parent->window; 
    89     } 
    90     else 
    91         parent = DefaultRootWindow(disp->display); 
    92  
    93     attr.backing_store = NotUseful; 
    94     attr.border_pixel = 0; 
    95     attr.background_pixmap = None; 
    96     attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | 
    97         StructureNotifyMask | PointerMotionMask | KeyPressMask | FocusChangeMask; 
    98     attr.bit_gravity = ForgetGravity; 
    99  
    100     *ei_display = disp->display; 
    101     XLockDisplay(*ei_display); 
    102     screen = DefaultScreen(*ei_display); 
    103  
    104     *ei_visual = best_visual_get(*ei_display, screen); 
    105     *ei_colormap = attr.colormap = best_colormap_get(*ei_display, screen); 
    106     *ei_depth = best_depth_get(*ei_display, screen); 
    107  
    108     win = XCreateWindow(*ei_display, parent, 0, 0, 
    109                         w, h, 0, *ei_depth, InputOutput, *ei_visual, 
    110                         CWBackingStore | CWColormap | CWBackPixmap | 
    111                         CWBitGravity | CWEventMask, &attr); 
    112  
    113     *ei_drawable = win; 
    114     if (title) 
    115         XStoreName(*ei_display, win, title); 
    116     XUnlockDisplay(*ei_display); 
    117  
    118     win_object = X11Window_PyObject__wrap((PyObject *)disp, win); 
    119     return win_object; 
    120 } 
    121  
    122 #define ENGINE_COMMON_X11_SETUP(evas, kwargs, display, func, info) \ 
    123     engine_common_x11_setup(evas, kwargs, display, \ 
    124         func.best_visual_get, func.best_colormap_get, func.best_depth_get, \ 
    125         &info.display, &info.drawable, &info.visual, &info.colormap, \ 
    126         &info.depth); 
    127  
    128  
    129 #ifdef ENABLE_ENGINE_SOFTWARE_X11 
    130 X11Window_PyObject * 
    131 new_evas_software_x11(PyObject *self, PyObject *args, PyObject *kwargs) 
    132 { 
    133     Evas_Engine_Info_Software_X11 *einfo; 
    134     X11Window_PyObject *x11; 
    135     X11Display_PyObject *display; 
    136     PyObject *evas_pyobject; 
    137     Evas *evas; 
    138  
    139     CHECK_EVAS_PYOBJECT 
    140  
    141     if (!PyArg_ParseTuple(args, "O!O!", Evas_PyObject_Type, &evas_pyobject, 
    142                         &X11Display_PyObject_Type, &display)) 
    143         return NULL; 
    144  
    145     evas = evas_object_from_pyobject(evas_pyobject); 
    146     evas_output_method_set(evas, evas_render_method_lookup("software_x11")); 
    147     einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); 
    148     if (!einfo) { 
    149         PyErr_Format(PyExc_SystemError, "Evas is not built with Software X11 support."); 
    150         return NULL; 
    151     } 
    152  
    153     x11 = ENGINE_COMMON_X11_SETUP(evas, kwargs, display, einfo->func, 
    154                                   einfo->info); 
    155  
    156     einfo->info.rotation = 0; 
    157     einfo->info.debug = 0; 
    158  
    159     evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); 
    160     return x11; 
    161 } 
    162 #endif 
    163  
    164 #ifdef ENABLE_ENGINE_GL_X11 
    165 X11Window_PyObject * 
    166 new_evas_gl_x11(PyObject *self, PyObject *args, PyObject *kwargs) 
    167 { 
    168     Evas_Engine_Info_GL_X11 *einfo; 
    169     X11Window_PyObject *x11; 
    170     X11Display_PyObject *display; 
    171     PyObject *evas_pyobject; 
    172     Evas *evas; 
    173  
    174     CHECK_EVAS_PYOBJECT 
    175  
    176     if (!PyArg_ParseTuple(args, "O!O!", Evas_PyObject_Type, &evas_pyobject, 
    177                         &X11Display_PyObject_Type, &display)) 
    178         return NULL; 
    179  
    180     evas = evas_object_from_pyobject(evas_pyobject); 
    181  
    182     evas_output_method_set(evas, evas_render_method_lookup("gl_x11")); 
    183     einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(evas); 
    184     if (!einfo) { 
    185         PyErr_Format(PyExc_SystemError, "Evas is not built with GLX support."); 
    186         return NULL; 
    187     } 
    188  
    189     x11 = ENGINE_COMMON_X11_SETUP(evas, kwargs, display, einfo->func, einfo->info); 
    190     evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); 
    191     return x11; 
    192 } 
    193 #endif 
    194  
    195 #endif  /* defined(ENABLE_ENGINE_GL_X11) || 
    196            defined (ENABLE_ENGINE_SOFTWARE_X11) */ 
    19746 
    19847 
     
    293142    { "render_imlib2_image", (PyCFunction) render_imlib2_image, METH_VARARGS }, 
    294143    { "set_shape_mask_from_imlib2_image", (PyCFunction) set_shape_mask_from_imlib2_image, METH_VARARGS }, 
    295 #ifdef ENABLE_ENGINE_SOFTWARE_X11 
    296     { "new_evas_software_x11", (PyCFunction) new_evas_software_x11, METH_VARARGS | METH_KEYWORDS }, 
    297 #endif 
    298 #ifdef ENABLE_ENGINE_GL_X11 
    299     { "new_evas_gl_x11", (PyCFunction) new_evas_gl_x11, METH_VARARGS | METH_KEYWORDS }, 
    300 #endif 
    301144    { NULL } 
    302145}; 
     
    339182#endif 
    340183 
    341 #if defined(ENABLE_ENGINE_SOFTWARE_X11) || defined(ENABLE_ENGINE_GL_X11) 
    342 { 
    343     // Import kaa-evas's C api 
    344     void **evas_api_ptrs = get_module_api("kaa.evas._evas"); 
    345     if (evas_api_ptrs != NULL) { 
    346         evas_object_from_pyobject = evas_api_ptrs[0]; 
    347         Evas_PyObject_Type = evas_api_ptrs[1]; 
    348     } else 
    349         PyErr_Clear(); 
    350 } 
    351 #endif 
    352  
    353184    if (!XInitThreads()) 
    354185        PyErr_Format(PyExc_SystemError, "Unable to initialize X11 threads."); 
  • trunk/display/src/x11.py

    r3379 r3680  
    523523        """ 
    524524        self._window.set_decorated(setting) 
    525      
    526  
    527 class EvasX11Window(X11Window): 
    528     def __init__(self, gl = False, display = None, size = (640, 480), 
    529                  title = "Evas", **kwargs): 
    530         import kaa.evas 
    531  
    532         if not gl: 
    533             f = _X11.new_evas_software_x11 
    534         else: 
    535             f = _X11.new_evas_gl_x11 
    536  
    537         if "parent" in kwargs: 
    538             assert(isinstance(kwargs["parent"], X11Window)) 
    539             kwargs["parent"] = kwargs["parent"]._window 
    540  
    541         assert(type(size) in (list, tuple)) 
    542         display = _get_display(display) 
    543         self._evas = kaa.evas.Evas() 
    544         window = f(self._evas._evas, display._display, size = size, 
    545                    title = title, **kwargs) 
    546         self._evas.output_size_set(size) 
    547         self._evas.viewport_set((0, 0), size) 
    548  
    549         # Ensures the display remains alive until after Evas gets deallocated 
    550         # during garbage collection. 
    551         self._evas._dependencies.append(display._display) 
    552         self._evas._dependencies.append(window) 
    553         if "parent" in kwargs: 
    554             self._evas._dependencies.append(kwargs["parent"]) 
    555         super(EvasX11Window, self).__init__(display, window) 
    556  
    557  
    558     def handle_events(self, events): 
    559         needs_render = False 
    560         for event, data in events: 
    561             if event == X11Display.XEVENT_EXPOSE: 
    562                 self._evas.damage_rectangle_add((data["pos"], data["size"])) 
    563                 needs_render = True 
    564             #elif event == X11Display.XEVENT_CONFIGURE_NOTIFY: 
    565             #    if data["size"] != self._evas.output_size_get(): 
    566             #        # This doesn't act right for gl. 
    567             #        self._evas.output_size_set(data["size"]) 
    568             #        #self._evas.viewport_set((0, 0), data["size"]) 
    569             #        needs_render = True 
    570  
    571         super(EvasX11Window, self).handle_events(events) 
    572  
    573         if needs_render: 
    574             self._evas.render() 
    575             self._display.handle_events() 
    576  
    577  
    578     def get_evas(self): 
    579         return self._evas