diff options
author | Zhigang Gong <zhigang.gong@linux.intel.com> | 2012-01-31 18:16:58 +0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-12-18 11:23:48 -0800 |
commit | bf7d79dc0ac2e97ed97e22c1d2c95e77bf959327 (patch) | |
tree | b718309f5714d01a8ce592bed535bd5e6081298b /glamor/glamor.h | |
parent | 97efbd25fed0f86338853d81b974b7f4deb9f1b4 (diff) |
Refine CloseScreen and FreeScreen processes.
This commit move the calling to glamor_close_screen from
glamor_egl_free_screen to glamor_egl_close_screen, as this
is the right place to do this.
We should detach screen fbo and destroy the corresponding
KHR image at glamor_egl_close_screen stage. As latter
DDX driver will call DestroyPixmap to destroy screen pixmap,
if the fbo and image are still there but glamor screen private
data pointer has been freed, then it causes segfault.
This commit also introduces a new flag GLAMOR_USE_EGL_SCREEN.
if DDX driver is using EGL layer then should set this bit
when call to glamor_init and then both glamor_close_screen
and glamor_egl_close_screen will be registered correctly,
DDX layer will not need to call these two functions manually.
This way is also the preferred method within Xorg domain.
As interfaces changed, bump the version to 0.3.0.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Peng Li <peng.li@intel.com>
Diffstat (limited to 'glamor/glamor.h')
-rw-r--r-- | glamor/glamor.h | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/glamor/glamor.h b/glamor/glamor.h index fe1570022..e29a3e43f 100644 --- a/glamor/glamor.h +++ b/glamor/glamor.h @@ -41,36 +41,6 @@ #endif /* GLAMOR_H */ -/* @GLAMOR_INVERTED_Y_AXIS: - * set 1 means the GL env's origin (0,0) is at top-left. - * EGL/DRM platform is an example need to set this bit. - * glx platform's origin is at bottom-left thus need to - * clear this bit.*/ - -#define GLAMOR_INVERTED_Y_AXIS 1 - -/* @GLAMOR_USE_SCREEN: - * If want to let glamor to do everything including the - * create/destroy pixmap and handle the gc ops. need to - * set this bit. Standalone glamor DDX driver need to set - * this bit. - * Otherwise, need to clear this bit, as the intel video - * driver with glamor enabled. - * */ -#define GLAMOR_USE_SCREEN 2 -/* @GLAMOR_USE_PICTURE_SCREEN: - * If want to let glamor to do all the composition related - * things, need to set this bit. Just as standalone glamor - * DDX driver. - * Otherwise, need to clear this bit, as the intel video - * driver with glamor enabled. - */ -#define GLAMOR_USE_PICTURE_SCREEN 4 - -#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \ - | GLAMOR_USE_SCREEN \ - | GLAMOR_USE_PICTURE_SCREEN) - /* * glamor_pixmap_type : glamor pixmap's type. * @MEMORY: pixmap is in memory. @@ -90,15 +60,49 @@ typedef enum glamor_pixmap_type { } glamor_pixmap_type_t; #define GLAMOR_EGL_EXTERNAL_BUFFER 3 +#define GLAMOR_INVERTED_Y_AXIS 1 +#define GLAMOR_USE_SCREEN (1 << 1) +#define GLAMOR_USE_PICTURE_SCREEN (1 << 2) +#define GLAMOR_USE_EGL_SCREEN (1 << 3) +#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \ + | GLAMOR_USE_SCREEN \ + | GLAMOR_USE_PICTURE_SCREEN \ + | GLAMOR_USE_EGL_SCREEN) + /* @glamor_init: Initialize glamor internal data structure. * * @screen: Current screen pointer. * @flags: Please refer the flags description above. * + * @GLAMOR_INVERTED_Y_AXIS: + * set 1 means the GL env's origin (0,0) is at top-left. + * EGL/DRM platform is an example need to set this bit. + * glx platform's origin is at bottom-left thus need to + * clear this bit. + * + * @GLAMOR_USE_SCREEN: + * If running in an pre-existing X environment, and the + * gl context is GLX, then you should set this bit and + * let the glamor to handle all the screen related + * functions such as GC ops and CreatePixmap/DestroyPixmap. + * + * @GLAMOR_USE_PICTURE_SCREEN: + * If don't use any other underlying DDX driver to handle + * the picture related rendering functions, please set this + * bit on. Otherwise, clear this bit. And then it is the DDX + * driver's responsibility to determine how/when to jump to + * glamor's picture compositing path. + * + * @GLAMOR_USE_EGL_SCREEN: + * If you are using EGL layer, then please set this bit + * on, otherwise, clear it. + * * This function initializes necessary internal data structure * for glamor. And before calling into this function, the OpenGL * environment should be ready. Should be called before any real - * glamor rendering or texture allocation functions. + * glamor rendering or texture allocation functions. And should + * be called after the DDX's screen initialization or at the last + * step of the DDX's screen initialization. */ extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags); extern _X_EXPORT void glamor_fini(ScreenPtr screen); @@ -139,6 +143,8 @@ extern _X_EXPORT void glamor_block_handler(ScreenPtr screen); extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, unsigned int usage); +extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen); + #ifdef GLAMOR_FOR_XORG /* @glamor_egl_init: Initialize EGL environment. * @@ -173,7 +179,6 @@ extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen); extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride); - /* * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from * a BO handle. @@ -191,10 +196,6 @@ extern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int stride); extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap); - -extern _X_EXPORT Bool glamor_egl_close_screen(ScreenPtr screen); -extern _X_EXPORT void glamor_egl_free_screen(int scrnIndex, int flags); - #endif extern _X_EXPORT int glamor_create_gc(GCPtr gc); |