glamor: Remove remaining support for FBOs not matching pixmap size
The core rendering code already requires that FBOs be allocated at exactly the pixmap size so that tiling and stippling work correctly. Remove the allocation support for that, along with the render code. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
adb847faeb
commit
1eb954c383
|
@ -72,7 +72,7 @@ cache_hbucket(int size)
|
|||
|
||||
static glamor_pixmap_fbo *
|
||||
glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
||||
int w, int h, GLenum format, int flag)
|
||||
int w, int h, GLenum format)
|
||||
{
|
||||
struct xorg_list *cache;
|
||||
glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL;
|
||||
|
@ -87,33 +87,18 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
|||
cache = &glamor_priv->fbo_cache[n_format]
|
||||
[cache_wbucket(w)]
|
||||
[cache_hbucket(h)];
|
||||
if (!(flag & GLAMOR_CACHE_EXACT_SIZE)) {
|
||||
xorg_list_for_each_entry(fbo_entry, cache, list) {
|
||||
if (fbo_entry->width >= w && fbo_entry->height >= h) {
|
||||
|
||||
DEBUGF("Request w %d h %d format %x \n", w, h, format);
|
||||
DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
|
||||
fbo_entry, fbo_entry->width, fbo_entry->height,
|
||||
fbo_entry->fb, fbo_entry->tex);
|
||||
xorg_list_del(&fbo_entry->list);
|
||||
ret_fbo = fbo_entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
xorg_list_for_each_entry(fbo_entry, cache, list) {
|
||||
if (fbo_entry->width == w && fbo_entry->height == h) {
|
||||
xorg_list_for_each_entry(fbo_entry, cache, list) {
|
||||
if (fbo_entry->width == w && fbo_entry->height == h) {
|
||||
|
||||
DEBUGF("Request w %d h %d format %x \n", w, h, format);
|
||||
DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
|
||||
fbo_entry, fbo_entry->width, fbo_entry->height,
|
||||
fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
|
||||
assert(format == fbo_entry->format);
|
||||
xorg_list_del(&fbo_entry->list);
|
||||
ret_fbo = fbo_entry;
|
||||
break;
|
||||
}
|
||||
DEBUGF("Request w %d h %d format %x \n", w, h, format);
|
||||
DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
|
||||
fbo_entry, fbo_entry->width, fbo_entry->height,
|
||||
fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
|
||||
assert(format == fbo_entry->format);
|
||||
xorg_list_del(&fbo_entry->list);
|
||||
ret_fbo = fbo_entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,18 +340,11 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
|||
{
|
||||
glamor_pixmap_fbo *fbo;
|
||||
GLint tex = 0;
|
||||
int cache_flag;
|
||||
|
||||
if (flag == GLAMOR_CREATE_FBO_NO_FBO)
|
||||
goto new_fbo;
|
||||
|
||||
/* Tiling from textures requires exact pixmap sizes. As we don't
|
||||
* know which pixmaps will be used as tiles, just allocate
|
||||
* everything at the requested size
|
||||
*/
|
||||
cache_flag = GLAMOR_CACHE_EXACT_SIZE;
|
||||
|
||||
fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag);
|
||||
fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format);
|
||||
if (fbo)
|
||||
return fbo;
|
||||
new_fbo:
|
||||
|
|
|
@ -1132,62 +1132,3 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
return temp_fbo;
|
||||
}
|
||||
|
||||
/* fixup a fbo to the exact size as the pixmap. */
|
||||
/* XXX LARGE pixmap? */
|
||||
Bool
|
||||
glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
glamor_pixmap_fbo *old_fbo;
|
||||
glamor_pixmap_fbo *new_fbo = NULL;
|
||||
PixmapPtr scratch = NULL;
|
||||
glamor_pixmap_private *scratch_priv;
|
||||
DrawablePtr drawable;
|
||||
GCPtr gc = NULL;
|
||||
int ret = FALSE;
|
||||
|
||||
drawable = &pixmap_priv->base.pixmap->drawable;
|
||||
|
||||
if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))
|
||||
return TRUE;
|
||||
|
||||
old_fbo = pixmap_priv->base.fbo;
|
||||
|
||||
if (!old_fbo)
|
||||
return FALSE;
|
||||
|
||||
gc = GetScratchGC(drawable->depth, screen);
|
||||
if (!gc)
|
||||
goto fail;
|
||||
|
||||
scratch = glamor_create_pixmap(screen, drawable->width, drawable->height,
|
||||
drawable->depth, GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||
|
||||
scratch_priv = glamor_get_pixmap_private(scratch);
|
||||
|
||||
if (!scratch_priv->base.fbo)
|
||||
goto fail;
|
||||
|
||||
ValidateGC(&scratch->drawable, gc);
|
||||
glamor_copy_area(drawable,
|
||||
&scratch->drawable,
|
||||
gc, 0, 0, drawable->width, drawable->height, 0, 0);
|
||||
old_fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||
new_fbo = glamor_pixmap_detach_fbo(scratch_priv);
|
||||
glamor_pixmap_attach_fbo(pixmap_priv->base.pixmap, new_fbo);
|
||||
glamor_pixmap_attach_fbo(scratch, old_fbo);
|
||||
|
||||
DEBUGF("old %dx%d type %d\n",
|
||||
drawable->width, drawable->height, pixmap_priv->type);
|
||||
DEBUGF("copy tex %d %dx%d to tex %d %dx%d \n",
|
||||
old_fbo->tex, old_fbo->width, old_fbo->height, new_fbo->tex,
|
||||
new_fbo->width, new_fbo->height);
|
||||
ret = TRUE;
|
||||
fail:
|
||||
if (gc)
|
||||
FreeScratchGC(gc);
|
||||
if (scratch)
|
||||
glamor_destroy_pixmap(scratch);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -895,10 +895,6 @@ void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap);
|
|||
|
||||
void glamor_destroy_picture(PicturePtr picture);
|
||||
|
||||
/* fixup a fbo to the exact size as the pixmap. */
|
||||
Bool glamor_fixup_pixmap_priv(ScreenPtr screen,
|
||||
glamor_pixmap_private *pixmap_priv);
|
||||
|
||||
void glamor_picture_format_fixup(PicturePtr picture,
|
||||
glamor_pixmap_private *pixmap_priv);
|
||||
|
||||
|
|
|
@ -542,8 +542,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
|||
repeat_type += RepeatFix;
|
||||
else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||
|| pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
if (picture->transform
|
||||
|| (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)))
|
||||
if (picture->transform)
|
||||
repeat_type += RepeatFix;
|
||||
}
|
||||
if (repeat_type >= RepeatFix) {
|
||||
|
@ -1040,23 +1039,6 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
/*Before enter the rendering stage, we need to fixup
|
||||
* transformed source and mask, if the transform is not int translate. */
|
||||
if (key.source != SHADER_SOURCE_SOLID
|
||||
&& source->transform
|
||||
&& !pixman_transform_is_int_translate(source->transform)
|
||||
&& source_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (!glamor_fixup_pixmap_priv(screen, source_pixmap_priv))
|
||||
goto fail;
|
||||
}
|
||||
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID
|
||||
&& mask->transform
|
||||
&& !pixman_transform_is_int_translate(mask->transform)
|
||||
&& mask_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (!glamor_fixup_pixmap_priv(screen, mask_pixmap_priv))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!glamor_set_composite_op(screen, op, op_info, dest, mask))
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -55,10 +55,6 @@
|
|||
*(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
|
||||
} while(0)
|
||||
|
||||
#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv) \
|
||||
(priv->base.fbo->width != priv->base.pixmap->drawable.width \
|
||||
|| priv->base.fbo->height != priv->base.pixmap->drawable.height) \
|
||||
|
||||
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
|
|
Loading…
Reference in New Issue
Block a user