gles2_largepixmap: force clip for a non-large pixmap.
One case we need force clip when download/upload a drm_texture pixmap. Actually, this is only meaningful for testing purpose. As we may set the max_fbo_size to a very small value, but the drm texture may exceed this value but the drm texture pixmap is not largepixmap. This is not a problem with OpenGL. But for GLES2, we may need to call glamor_es2_pixmap_read_prepare to create a temporary fbo to do the color conversion. Then we have to force clip the drm pixmap here to avoid large pixmap handling at glamor_es2_pixmap_read_prepare. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
c41d5c79e7
commit
6ed418d17b
|
@ -684,6 +684,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, int h
|
|||
GLenum format, type;
|
||||
int no_alpha, revert, swap_rb;
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
Bool force_clip;
|
||||
|
||||
if (glamor_get_tex_format_type_from_pixmap(pixmap,
|
||||
&format,
|
||||
|
@ -699,7 +700,10 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, int h
|
|||
return FALSE;
|
||||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||
&& !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
|
||||
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
|
||||
RegionRec region;
|
||||
BoxRec box;
|
||||
int n_region;
|
||||
|
@ -715,7 +719,12 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, int h
|
|||
box.x2 = x + w;
|
||||
box.y2 = y + h;
|
||||
RegionInitBoxes(®ion, &box, 1);
|
||||
clipped_regions = glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, 0, 0, 0);
|
||||
if (!force_clip)
|
||||
clipped_regions = glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, 0, 0, 0);
|
||||
else
|
||||
clipped_regions = glamor_compute_clipped_regions_ext(pixmap_priv, ®ion, &n_region,
|
||||
pixmap_priv->base.glamor_priv->max_fbo_size,
|
||||
pixmap_priv->base.glamor_priv->max_fbo_size, 0, 0);
|
||||
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
|
||||
for(i = 0; i < n_region; i++)
|
||||
{
|
||||
|
@ -1058,13 +1067,14 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
|
|||
GLenum format, type;
|
||||
int no_alpha, revert, swap_rb;
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
Bool force_clip;
|
||||
|
||||
if (glamor_get_tex_format_type_from_pixmap(pixmap,
|
||||
&format,
|
||||
&type,
|
||||
&no_alpha,
|
||||
&revert,
|
||||
&swap_rb, 1)) {
|
||||
&swap_rb, 0)) {
|
||||
glamor_fallback("Unknown pixmap depth %d.\n",
|
||||
pixmap->drawable.depth);
|
||||
return NULL;
|
||||
|
@ -1074,7 +1084,10 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
return NULL;
|
||||
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||
&& !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
|
||||
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
|
||||
|
||||
RegionRec region;
|
||||
BoxRec box;
|
||||
|
@ -1091,7 +1104,14 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
|
|||
box.x2 = x + w;
|
||||
box.y2 = y + h;
|
||||
RegionInitBoxes(®ion, &box, 1);
|
||||
clipped_regions = glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, 0, 0, 0);
|
||||
|
||||
if (!force_clip)
|
||||
clipped_regions = glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, 0, 0, 0);
|
||||
else
|
||||
clipped_regions = glamor_compute_clipped_regions_ext(pixmap_priv, ®ion, &n_region,
|
||||
pixmap_priv->base.glamor_priv->max_fbo_size,
|
||||
pixmap_priv->base.glamor_priv->max_fbo_size, 0, 0);
|
||||
|
||||
DEBUGF("start download large pixmap %p %dx%d \n", pixmap, w, h);
|
||||
for(i = 0; i < n_region; i++)
|
||||
{
|
||||
|
|
|
@ -602,8 +602,10 @@ glamor_set_composite_texture(ScreenPtr screen, int unit,
|
|||
#ifndef GLAMOR_GLES2
|
||||
dispatch->glEnable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
/* XXX may be we can eaxctly check whether we need to touch
|
||||
* the out-of-box area then determine whether we need to fix.
|
||||
|
||||
/*
|
||||
* GLES2 doesn't support RepeatNone. We need to fix it anyway.
|
||||
*
|
||||
**/
|
||||
if (repeat_type != RepeatNone)
|
||||
repeat_type += RepeatFix;
|
||||
|
@ -615,7 +617,9 @@ glamor_set_composite_texture(ScreenPtr screen, int unit,
|
|||
}
|
||||
if (repeat_type >= RepeatFix) {
|
||||
glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv);
|
||||
if (wh[0] != 1.0 || wh[1] != 1.0)
|
||||
if ((wh[0] != 1.0 || wh[1] != 1.0 )
|
||||
|| (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||
&& repeat_type == RepeatFix))
|
||||
dispatch->glUniform4fv(wh_location, 1, wh);
|
||||
else
|
||||
repeat_type -= RepeatFix;
|
||||
|
|
Loading…
Reference in New Issue
Block a user