glamor: Get testing code using small FBOs working again
Glamor has a mode where pixmaps will be constructed from numerous small FBOs. This allows testing of the tiled pixmap code without needing to create huge pixmaps. However, the render glyph code assumed that it could create a pixmap large enough for the glyph atlas. Instead of attempting to fix that (which would be disruptive and not helpful), I've added a new pixmap creation usage, GLAMOR_CREATE_NO_LARGE which forces allocation of a single large FBO. Now that we have pixmaps with varying FBO sizes, I then went around and fixed the few places using the global FBO max size and replaced that with the per-pixmap FBO tiling sizes, which were already present in each large pixmap. Xephyr has been changed to pass GLAMOR_CREATE_NO_LARGE when it creates the screen pixmap as it doesn't want to deal with tiling either. 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
11e2f0de71
commit
82f91433e2
|
@ -178,7 +178,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
|||
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
|
||||
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
|
||||
|
||||
if (type == GLAMOR_MEMORY_MAP || glamor_check_fbo_size(glamor_priv, w, h)) {
|
||||
if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
|
||||
glamor_check_fbo_size(glamor_priv, w, h))
|
||||
{
|
||||
pixmap_priv->type = type;
|
||||
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
|
||||
}
|
||||
|
|
|
@ -140,9 +140,16 @@ extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap,
|
|||
glamor_pixmap_type_t type);
|
||||
extern _X_EXPORT void glamor_destroy_textured_pixmap(PixmapPtr pixmap);
|
||||
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);
|
||||
|
||||
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
|
||||
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
|
||||
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
|
||||
#define GLAMOR_CREATE_PIXMAP_MAP 0x104
|
||||
#define GLAMOR_CREATE_NO_LARGE 0x105
|
||||
|
||||
/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
|
||||
*
|
||||
* @front: front pixmap.
|
||||
|
|
|
@ -361,9 +361,6 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
|||
GLint tex = 0;
|
||||
int cache_flag;
|
||||
|
||||
if (!glamor_check_fbo_size(glamor_priv, w, h))
|
||||
return NULL;
|
||||
|
||||
if (flag == GLAMOR_CREATE_FBO_NO_FBO)
|
||||
goto new_fbo;
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
|||
pixmap = pScreen->CreatePixmap(pScreen,
|
||||
CACHE_PICTURE_SIZE,
|
||||
CACHE_PICTURE_SIZE + MASK_CACHE_MAX_SIZE,
|
||||
depth, 0);
|
||||
depth, GLAMOR_CREATE_NO_LARGE);
|
||||
if (!pixmap)
|
||||
goto bail;
|
||||
|
||||
|
|
|
@ -1015,7 +1015,6 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
INT16 x_dest, INT16 y_dest,
|
||||
CARD16 width, CARD16 height)
|
||||
{
|
||||
glamor_screen_private *glamor_priv;
|
||||
glamor_pixmap_clipped_regions *clipped_dest_regions;
|
||||
glamor_pixmap_clipped_regions *clipped_source_regions;
|
||||
glamor_pixmap_clipped_regions *clipped_mask_regions;
|
||||
|
@ -1044,9 +1043,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
else
|
||||
mask_repeat_type = RepeatNone;
|
||||
|
||||
glamor_priv = dest_pixmap_priv->base.glamor_priv;
|
||||
fixed_block_width = glamor_priv->max_fbo_size;
|
||||
fixed_block_height = glamor_priv->max_fbo_size;
|
||||
fixed_block_width = dest_pixmap_priv->large.block_w;
|
||||
fixed_block_height = dest_pixmap_priv->large.block_h;
|
||||
/* If we got an totally out-of-box region for a source or mask
|
||||
* region without repeat, we need to set it as null_source and
|
||||
* give it a solid color (0,0,0,0). */
|
||||
|
@ -1112,8 +1110,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
|
||||
/*compute the correct block width and height whose transformed source/mask
|
||||
*region can fit into one texture.*/
|
||||
if (force_clip || fixed_block_width < glamor_priv->max_fbo_size
|
||||
|| fixed_block_height < glamor_priv->max_fbo_size)
|
||||
if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
|
||||
|| fixed_block_height < dest_pixmap_priv->large.block_h)
|
||||
clipped_dest_regions =
|
||||
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
|
||||
&n_dest_regions,
|
||||
|
|
|
@ -1013,10 +1013,9 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
|||
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,
|
||||
pixmap_priv->large.block_w,
|
||||
pixmap_priv->large.block_h,
|
||||
0,
|
||||
0);
|
||||
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
|
||||
for (i = 0; i < n_region; i++) {
|
||||
|
@ -1374,10 +1373,9 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
|
|||
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,
|
||||
pixmap_priv->large.block_w,
|
||||
pixmap_priv->large.block_h,
|
||||
0,
|
||||
0);
|
||||
|
||||
DEBUGF("start download large pixmap %p %dx%d \n", pixmap, w, h);
|
||||
|
|
|
@ -153,13 +153,6 @@ enum glamor_gl_flavor {
|
|||
GLAMOR_GL_ES2 // OPENGL ES2.0 API
|
||||
};
|
||||
|
||||
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
|
||||
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
|
||||
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
|
||||
#define GLAMOR_CREATE_PIXMAP_MAP 0x104
|
||||
|
||||
#define GLAMOR_CREATE_TEXTURE_EXACT_SIZE 0x104
|
||||
|
||||
#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2
|
||||
|
||||
#define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024)
|
||||
|
|
|
@ -1260,7 +1260,9 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
|
|||
screen_pixmap = pScreen->CreatePixmap(pScreen,
|
||||
pScreen->width,
|
||||
pScreen->height,
|
||||
pScreen->rootDepth, 0);
|
||||
pScreen->rootDepth,
|
||||
GLAMOR_CREATE_NO_LARGE);
|
||||
|
||||
pScreen->SetScreenPixmap(screen_pixmap);
|
||||
|
||||
/* Tell the GLX code what to GL texture to read from. */
|
||||
|
|
Loading…
Reference in New Issue
Block a user