~linaro-graphics-wg/+junk/spandex-package

« back to all changes in this revision

Viewing changes to bd/lib/targets/gles1linux.py

  • Committer: Alexandros Frantzis
  • Date: 2011-07-22 13:15:32 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: alexandros.frantzis@linaro.org-20110722131532-5dgl45sqwexjz5xn
* New upstream release 1.1.4.
* debian/control:
  - Update Standards-Version to 3.9.2.
* debian/rules:
  - Change build commands to match updated file/directory names in
    upstream sources.
  - Don't process openvg_functional directory, which was removed upstream.
  - Remove unwanted '*.pyc' files after installing.
  - Remove execute permissions of files under /usr/share.
* spandex-benchmarks-vg.install:
  - Don't install openvg_functional directory, which was removed upstream.
* debian/spandex-benchmarks-common.install:
  - Change directory location from spandex/bd/python to spandex/python/.
* debian/*.README.Debian:
  - Install README.Debian for spandex-gles1, spandex-gles2 and spandex-vg.
* debian/patches/linux_targets.patch:
  - Update for new API.
* debian/patches/add_lib_rt.patch:
  - Dropped: applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# along with this framework; if not, see <http://www.gnu.org/licenses/>.
19
19
#
20
20
 
21
 
######################################################################
22
 
from lib.common.common  import *
23
 
from lib.egl.egl        import *
24
 
 
25
 
######################################################################
26
 
def getConfig( apis, surfaces, attributes = {} ):
27
 
    return getEglConfig( apis, surfaces, attributes )
28
 
 
29
 
######################################################################
 
21
# ----------------------------------------------------------------------
 
22
from lib.common import *
 
23
from lib.egl    import *
 
24
 
 
25
# ----------------------------------------------------------------------
 
26
def supportFeature( features ):
 
27
    return set( [ 'EGL' ] ).issuperset( features )
 
28
 
 
29
# ----------------------------------------------------------------------
30
30
def getScreenSize():
31
 
    return ( 800, 600, )
 
31
    return [ 800, 600, ]
32
32
 
33
 
######################################################################
 
33
# ----------------------------------------------------------------------
34
34
def getScreenFormat():
35
35
    return 'SCT_COLOR_FORMAT_DEFAULT'
36
36
 
37
 
######################################################################
38
 
def initializeWindow( modules, indexTracker, config, size, format ):
 
37
# ----------------------------------------------------------------------
 
38
def initialize( modules, indexTracker, api, attributes = {} ):
39
39
    Egl = modules[ 'Egl' ]
40
 
    
41
 
    windowSurfaceConfig = EGLWindowSurfaceConfig( [ 0, 0 ],
42
 
                                                  size,
43
 
                                                  format,
44
 
                                                  'EGL_BACK_BUFFER',
45
 
                                                  'EGL_NONE',
46
 
                                                  'EGL_NONE' )
47
 
    
48
 
    state = eglInitialize( Egl,
49
 
                           indexTracker,
50
 
                           config,
51
 
                           windowSurfaceConfig )
52
 
 
 
40
 
 
41
    if not attributes:
 
42
        attributes = getDefaultAttributes( api )
 
43
 
 
44
    colorSpace  = 'EGL_NONE'
 
45
    alphaFormat = 'EGL_NONE'
 
46
    if api == API_OPENVG:
 
47
        colorSpace  = 'EGL_VG_COLORSPACE_sRGB'
 
48
        alphaFormat = 'EGL_ALPHA_FORMAT_PRE'
 
49
        
 
50
    a = getEglAttributes( api, SURFACE_WINDOW, attributes )
 
51
    s = [ 0, 0 ] + getScreenSize() + [ getScreenFormat() ] + [ 'EGL_BACK_BUFFER', colorSpace, alphaFormat ]
 
52
        
 
53
    state = eglInitializeWindow( Egl, indexTracker, api, s, a )
 
54
    Egl.SwapInterval( state[ 'displayIndex' ], 0 )
 
55
    
53
56
    return state
54
57
 
55
 
######################################################################
56
 
def swapInterval( state, swapInterval ):
57
 
    eglSwapInterval( state, swapInterval )
58
 
 
59
 
######################################################################
60
 
def terminateWindow( modules, state ):
61
 
    pass
62
 
 
63
 
######################################################################
 
58
# ----------------------------------------------------------------------
 
59
def swapInterval( state, interval ):
 
60
    Egl = state[ 'Egl' ]
 
61
    Egl.SwapInterval( state[ 'displayIndex' ], interval )
 
62
 
 
63
# ----------------------------------------------------------------------    
64
64
def swapBuffers( state ):
65
65
    eglSwapBuffers( state )
66
66
 
67
 
######################################################################
68
 
def getDefaultSurfaceAttributes( api, surface ):
 
67
# ----------------------------------------------------------------------        
 
68
def getDefaultAttributes( api, surface  = SURFACE_WINDOW ):
69
69
    attributes = {}
70
70
 
71
 
    attributes[ BD_CONFIG_BUFFERSIZE ]     = 32
72
 
    attributes[ BD_CONFIG_REDSIZE ]        = 8
73
 
    attributes[ BD_CONFIG_GREENSIZE ]      = 8
74
 
    attributes[ BD_CONFIG_BLUESIZE ]       = 8
75
 
    attributes[ BD_CONFIG_ALPHASIZE ]      = 8
76
 
    attributes[ BD_CONFIG_DEPTHSIZE ]      = 24
77
 
    attributes[ BD_CONFIG_ALPHAMASKSIZE ]  = -1
78
 
    attributes[ BD_CONFIG_SAMPLE_BUFFERS ] = 0
79
 
 
 
71
    if api != API_OPENGLES1:
 
72
        raise 'Unsupported'
 
73
    
 
74
    attributes[ CONFIG_BUFFERSIZE ]     = 32
 
75
    attributes[ CONFIG_REDSIZE ]        = 8
 
76
    attributes[ CONFIG_GREENSIZE ]      = 8
 
77
    attributes[ CONFIG_BLUESIZE ]       = 8
 
78
    attributes[ CONFIG_ALPHASIZE ]      = 8
 
79
    attributes[ CONFIG_DEPTHSIZE ]      = '>=16'
 
80
    attributes[ CONFIG_ALPHAMASKSIZE ]  = '-'
 
81
    attributes[ CONFIG_SAMPLE_BUFFERS ] = 0
 
82
 
80
83
    return attributes
 
84