background image

1

void

 DisplayHardware

::

init

(

uint32_t

 dpy

)

2

{

3

    mNativeWindow 

=

 

new

 FramebufferNativeWindow

();

4

    framebuffer_device_t 

const

 

*

 fbDev 

=

 mNatveiWindow

->

getDevice

();

5

    mOverlayEngine 

=

 

NULL

;

6

    hw_module_t 

const*

 module

;

7

    

if

 

(

hw_get_module

(

OVERLAY_HARDWARE_MODULE_ID

,

 

&

module

)

 

==

 0

)

8

    

{

9

        overlay_control_open

(

module

,

 

&

mOverlayEngine

);

10

    

}

11

    

12

    

//initialize EGL

13

    EGLint attrbs

[]

 

=

14

    

{

15

        EGL_SURFACE_TYPE

,

16

        EGL_WINDOW_BIT

,

17

        EGL_NONE

,

18

        0

,

19

        EGL_NONE

20

    

};

21
22

    

//debug: disable h/w rendering

23

    

char

 property

[

PROPERTY_VALUE_MAX

];

24

    

if

 

(

property_get

(

"debug.sf.hw"

,

 property

,

 

NULL

)

 

>

 0

)

25

    

{

26

        

if

 

(

atoi

(

property

)

 

==

 0

)

27

        

{

28

            LOGW

(

"H/W composition disabled"

);

29

            attribs

[

2

]

 

=

 EGL_CONFIG_CAVEAT

;

30

            attribs

[

3

]

 

=

 EGL_SLOW_CONFIG

;

31

        

}

32

    

}

33
34

    EGLint w

,

 h

,

 dummy

;

35

    EGLint numConfigs 

=

 0

;

36

    EGLSurface surface

;

37

    EGLContext context

;

38

    mFlags 

=

 CACHED_BUFFERS

39
40

    

//TODO: all the extensions below should be queried through

41

    

// eglGetProcAddress().