prepare_access: Don't use fbo after it was downloaded.

We add a new gl_fbo status GLAMOR_FBO_DOWNLOADED to indicate
the fbo was already downloaded to CPU. Then latter the access
to this pixmap will be treated as pure CPU access. In glamor,
if we fallback to DDX/fbXXX, then we fallback everything
currently. We don't support to jump into glamor acceleration
layer between a prepare_access/finish_access. Actually, fbCopyPlane
is such a function which may call to acceleration function within
it. Then we must mark the downloaded pixmap to another state
rather than a normal fbo textured pixmap, and then stick to use
it as a in-memory pixmap.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Peng Li <peng.li@intel.com>
This commit is contained in:
Zhigang Gong 2012-02-03 11:21:37 +08:00 committed by Eric Anholt
parent 1817b6c0cf
commit 39d9e6c693
4 changed files with 36 additions and 16 deletions

View File

@ -263,8 +263,6 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
dispatch->glDeleteProgram(glamor_priv->finish_access_prog[1]);
}
void
glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
{
@ -275,7 +273,7 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
glamor_get_screen_private(drawable->pScreen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
return;
if (access_mode != GLAMOR_ACCESS_RO) {
@ -293,6 +291,9 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
free(pixmap->devPrivate.ptr);
}
if (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED)
pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL;
pixmap->devPrivate.ptr = NULL;
}

View File

@ -641,7 +641,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format,
* If successfully download a fbo to cpu then return TRUE.
* Otherwise return FALSE.
**/
Bool
glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
{
@ -794,6 +793,8 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0);
done:
pixmap_priv->gl_fbo = GLAMOR_FBO_DOWNLOADED;
pixmap->devPrivate.ptr = data;
if (temp_pixmap)

View File

@ -243,19 +243,23 @@ typedef union _glamor_pending_op {
glamor_pending_fill fill;
} glamor_pending_op;
/*
* glamor_pixmap_private - glamor pixmap's private structure.
* @gl_fbo: The pixmap is attached to a fbo originally.
* @gl_tex: The pixmap is in a gl texture originally.
#define GLAMOR_FBO_NORMAL 1
#define GLAMOR_FBO_DOWNLOADED 2
/* glamor_pixmap_fbo:
* @list: to be used to link to the cache pool list.
* @expire: when push to cache pool list, set a expire count.
* will be freed when glamor_priv->tick is equal or
* larger than this expire count in block handler.
* @pbo_valid: The pbo has a valid copy of the pixmap's data.
* @is_picture: The drawable is attached to a picture.
* @tex: attached texture.
* @fb: attached fbo.
* @pbo: attached pbo.
* @pict_format: the corresponding picture's format.
* #pending_op: currently only support pending filling.
* @container: The corresponding pixmap's pointer.
**/
* @width: width of this fbo.
* @height: height of this fbo.
* @format: internal format of this fbo's texture.
* @type: internal type of this fbo's texture.
* @glamor_priv: point to glamor private data.
*/
typedef struct glamor_pixmap_fbo {
struct list list;
unsigned int expire;
@ -270,9 +274,22 @@ typedef struct glamor_pixmap_fbo {
glamor_screen_private *glamor_priv;
} glamor_pixmap_fbo;
/*
* glamor_pixmap_private - glamor pixmap's private structure.
* @gl_fbo:
* 0 - The pixmap doesn't has a fbo attached to it.
* GLAMOR_FBO_NORMAL - The pixmap has a fbo and can be accessed normally.
* GLAMOR_FBO_DOWNLOADED - The pixmap has a fbo and already downloaded to
* CPU, so it can only be treated as a in-memory pixmap
* if this bit is set.
* @gl_tex: The pixmap is in a gl texture originally.
* @is_picture: The drawable is attached to a picture.
* @pict_format: the corresponding picture's format.
* #pending_op: currently only support pending filling.
* @container: The corresponding pixmap's pointer.
**/
typedef struct glamor_pixmap_private {
unsigned char gl_fbo:1;
unsigned char gl_fbo:2;
unsigned char is_picture:1;
unsigned char gl_tex:1;
glamor_pixmap_type_t type;

View File

@ -175,7 +175,8 @@ glamor_transform_boxes(BoxPtr boxes, int nbox, int dx, int dy)
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == 1)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED))
#define GLAMOR_PIXMAP_PRIV_NEED_VALIDATE(pixmap_priv) \
(GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) \