Call glamor_create_pixmap directly in glamor rendering path.
When glamor is rendering pixmaps, and needs to create some temporary pixmap, it's better to use glamor version create pixmap directly. As if goes to external DDX's create pixmap, it may create a external DRM buffer which is not necessary. All the case within glamor scope is to create a texture only pixmap or a in memory pixmap. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
10ad332ded
commit
36d424feae
|
@ -114,14 +114,10 @@ glamor_set_screen_pixmap_texture(ScreenPtr screen, int w, int h,
|
||||||
glamor_priv->screen_fbo = pixmap_priv->fb;
|
glamor_priv->screen_fbo = pixmap_priv->fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define GLAMOR_PIXMAP_MEMORY 0
|
#define GLAMOR_PIXMAP_MEMORY 0
|
||||||
#define GLAMOR_PIXMAP_TEXTURE 1
|
#define GLAMOR_PIXMAP_TEXTURE 1
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
|
||||||
static PixmapPtr
|
|
||||||
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
unsigned int usage)
|
unsigned int usage)
|
||||||
{
|
{
|
||||||
|
@ -163,8 +159,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
pixmap_priv->container = pixmap;
|
pixmap_priv->container = pixmap;
|
||||||
pixmap_priv->glamor_priv = glamor_priv;
|
pixmap_priv->glamor_priv = glamor_priv;
|
||||||
|
|
||||||
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY)
|
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY) {
|
||||||
return pixmap;
|
return pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
switch (depth) {
|
switch (depth) {
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -218,7 +215,7 @@ glamor_destroy_textured_pixmap(PixmapPtr pixmap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
Bool
|
||||||
glamor_destroy_pixmap(PixmapPtr pixmap)
|
glamor_destroy_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_destroy_textured_pixmap(pixmap);
|
glamor_destroy_textured_pixmap(pixmap);
|
||||||
|
|
|
@ -360,7 +360,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
||||||
src_pixmap->drawable.width *
|
src_pixmap->drawable.width *
|
||||||
src_pixmap->drawable.height))) {
|
src_pixmap->drawable.height))) {
|
||||||
|
|
||||||
temp_pixmap = (*screen->CreatePixmap) (screen,
|
temp_pixmap = glamor_create_pixmap(screen,
|
||||||
bound.x2 - bound.x1,
|
bound.x2 - bound.x1,
|
||||||
bound.y2 - bound.y1,
|
bound.y2 - bound.y1,
|
||||||
src_pixmap->
|
src_pixmap->
|
||||||
|
@ -430,9 +430,8 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
||||||
done:
|
done:
|
||||||
glamor_clear_delayed_fallbacks(src->pScreen);
|
glamor_clear_delayed_fallbacks(src->pScreen);
|
||||||
glamor_clear_delayed_fallbacks(dst->pScreen);
|
glamor_clear_delayed_fallbacks(dst->pScreen);
|
||||||
if (temp_src != src) {
|
if (temp_src != src)
|
||||||
(*screen->DestroyPixmap) (temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ glamor_get_spans(DrawablePtr drawable,
|
||||||
PixmapBytePad(widths[i], drawable->depth);
|
PixmapBytePad(widths[i], drawable->depth);
|
||||||
}
|
}
|
||||||
if (temp_pixmap)
|
if (temp_pixmap)
|
||||||
pixmap->drawable.pScreen->DestroyPixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -172,7 +172,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
/* Now allocate the pixmap and picture */
|
/* Now allocate the pixmap and picture */
|
||||||
pixmap = pScreen->CreatePixmap(pScreen,
|
pixmap = glamor_create_pixmap(pScreen,
|
||||||
CACHE_PICTURE_SIZE,
|
CACHE_PICTURE_SIZE,
|
||||||
CACHE_PICTURE_SIZE, depth,
|
CACHE_PICTURE_SIZE, depth,
|
||||||
0);
|
0);
|
||||||
|
@ -184,7 +184,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
||||||
CPComponentAlpha, &component_alpha,
|
CPComponentAlpha, &component_alpha,
|
||||||
serverClient, &error);
|
serverClient, &error);
|
||||||
|
|
||||||
pScreen->DestroyPixmap(pixmap);
|
glamor_destroy_pixmap(pixmap);
|
||||||
if (!picture)
|
if (!picture)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ glamor_glyph_cache_upload_glyph(ScreenPtr screen,
|
||||||
y);
|
y);
|
||||||
|
|
||||||
if (scratch != pGlyphPixmap)
|
if (scratch != pGlyphPixmap)
|
||||||
screen->DestroyPixmap(scratch);
|
glamor_destroy_pixmap(scratch);
|
||||||
|
|
||||||
FreeScratchGC(gc);
|
FreeScratchGC(gc);
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ glamor_glyphs_via_mask(CARD8 op,
|
||||||
mask_format = a8Format;
|
mask_format = a8Format;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask_pixmap = screen->CreatePixmap(screen, width, height,
|
mask_pixmap = glamor_create_pixmap(screen, width, height,
|
||||||
mask_format->depth,
|
mask_format->depth,
|
||||||
CREATE_PIXMAP_USAGE_SCRATCH);
|
CREATE_PIXMAP_USAGE_SCRATCH);
|
||||||
if (!mask_pixmap)
|
if (!mask_pixmap)
|
||||||
|
@ -638,7 +638,7 @@ glamor_glyphs_via_mask(CARD8 op,
|
||||||
mask_format, CPComponentAlpha,
|
mask_format, CPComponentAlpha,
|
||||||
&component_alpha, serverClient, &error);
|
&component_alpha, serverClient, &error);
|
||||||
if (!mask) {
|
if (!mask) {
|
||||||
screen->DestroyPixmap(mask_pixmap);
|
glamor_destroy_pixmap(mask_pixmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gc = GetScratchGC(mask_pixmap->drawable.depth, screen);
|
gc = GetScratchGC(mask_pixmap->drawable.depth, screen);
|
||||||
|
@ -695,7 +695,7 @@ glamor_glyphs_via_mask(CARD8 op,
|
||||||
x_src + x - x_dst,
|
x_src + x - x_dst,
|
||||||
y_src + y - y_dst, 0, 0, x, y, width, height);
|
y_src + y - y_dst, 0, 0, x, y, width, height);
|
||||||
FreePicture(mask, 0);
|
FreePicture(mask, 0);
|
||||||
screen->DestroyPixmap(mask_pixmap);
|
glamor_destroy_pixmap(mask_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -576,7 +576,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
temp_pixmap = (*screen->CreatePixmap) (screen,
|
temp_pixmap = glamor_create_pixmap (screen,
|
||||||
source->drawable.width,
|
source->drawable.width,
|
||||||
source->drawable.height,
|
source->drawable.height,
|
||||||
source->drawable.depth, 0);
|
source->drawable.depth, 0);
|
||||||
|
@ -658,7 +658,6 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixmap_priv->access_mode = access;
|
|
||||||
glamor_debug_output(GLAMOR_DEBUG_TEXTURE_DOWNLOAD,
|
glamor_debug_output(GLAMOR_DEBUG_TEXTURE_DOWNLOAD,
|
||||||
"Downloading pixmap %p %dx%d depth%d\n",
|
"Downloading pixmap %p %dx%d depth%d\n",
|
||||||
pixmap,
|
pixmap,
|
||||||
|
@ -789,9 +788,8 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||||
done:
|
done:
|
||||||
pixmap->devPrivate.ptr = data;
|
pixmap->devPrivate.ptr = data;
|
||||||
|
|
||||||
if (temp_pixmap) {
|
if (temp_pixmap)
|
||||||
(*screen->DestroyPixmap) (temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
y_max = points[i].y;
|
y_max = points[i].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_pixmap = drawable->pScreen->CreatePixmap(drawable->pScreen,
|
temp_pixmap = glamor_create_pixmap(drawable->pScreen,
|
||||||
x_max - x_min + 1,
|
x_max - x_min + 1,
|
||||||
y_max - y_min + 1,
|
y_max - y_min + 1,
|
||||||
drawable->depth, 0);
|
drawable->depth, 0);
|
||||||
|
@ -164,7 +164,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
0, 0,
|
0, 0,
|
||||||
x_max - x_min + 1,
|
x_max - x_min + 1,
|
||||||
y_max - y_min + 1, x_min, y_min);
|
y_max - y_min + 1, x_min, y_min);
|
||||||
drawable->pScreen->DestroyPixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
points[i].x += x_min;
|
points[i].x += x_min;
|
||||||
points[i].y += y_min;
|
points[i].y += y_min;
|
||||||
|
|
|
@ -231,6 +231,7 @@ typedef union _glamor_pending_op {
|
||||||
* @container: The corresponding pixmap's pointer.
|
* @container: The corresponding pixmap's pointer.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
typedef struct glamor_pixmap_private {
|
typedef struct glamor_pixmap_private {
|
||||||
unsigned char gl_fbo:1;
|
unsigned char gl_fbo:1;
|
||||||
unsigned char gl_tex:1;
|
unsigned char gl_tex:1;
|
||||||
|
@ -298,6 +299,10 @@ PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
|
||||||
|
|
||||||
Bool glamor_close_screen(int idx, ScreenPtr screen);
|
Bool glamor_close_screen(int idx, ScreenPtr screen);
|
||||||
|
|
||||||
|
PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
|
unsigned int usage);
|
||||||
|
|
||||||
|
Bool glamor_destroy_pixmap(PixmapPtr pixmap);
|
||||||
|
|
||||||
/* glamor_copyarea.c */
|
/* glamor_copyarea.c */
|
||||||
RegionPtr
|
RegionPtr
|
||||||
|
|
|
@ -1161,7 +1161,7 @@ glamor_convert_gradient_picture(ScreenPtr screen,
|
||||||
else
|
else
|
||||||
format = source->format;
|
format = source->format;
|
||||||
|
|
||||||
pixmap = screen->CreatePixmap(screen,
|
pixmap = glamor_create_pixmap(screen,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
PIXMAN_FORMAT_DEPTH(format),
|
PIXMAN_FORMAT_DEPTH(format),
|
||||||
|
@ -1442,7 +1442,7 @@ glamor_create_mask_picture(ScreenPtr screen,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixmap = screen->CreatePixmap(screen, 0, 0,
|
pixmap = glamor_create_pixmap(screen, 0, 0,
|
||||||
pict_format->depth,
|
pict_format->depth,
|
||||||
GLAMOR_CREATE_PIXMAP_CPU);
|
GLAMOR_CREATE_PIXMAP_CPU);
|
||||||
if (!pixmap)
|
if (!pixmap)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user