glamor: Use software fb for 1bpp pixmap.
For 1bpp pixmap, software fb get better performance than GL surface. The main reason is that fbo doesn't support 1bpp texture as internal format, so we have to translate a 1bpp bitmap to a 8bit alpha format each time which is very inefficient. And the previous implementation is not supported by the latest OpenGL 4.0, the GL_BITMAP was deprecated. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
3c44e3e0ce
commit
ac0589c916
|
@ -108,7 +108,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
if (w > 32767 || h > 32767)
|
if (w > 32767 || h > 32767)
|
||||||
return NullPixmap;
|
return NullPixmap;
|
||||||
|
|
||||||
if (w > MAX_WIDTH || h > MAX_HEIGHT) {
|
if (w > MAX_WIDTH || h > MAX_HEIGHT || ( depth == 1 && w != 0 && h != 0)) {
|
||||||
/* MESA can only support upto MAX_WIDTH*MAX_HEIGHT fbo.
|
/* MESA can only support upto MAX_WIDTH*MAX_HEIGHT fbo.
|
||||||
If we exceed such limitation, we have to use framebuffer.*/
|
If we exceed such limitation, we have to use framebuffer.*/
|
||||||
type = GLAMOR_FB;
|
type = GLAMOR_FB;
|
||||||
|
@ -117,7 +117,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
(((w * pixmap->drawable.bitsPerPixel +
|
(((w * pixmap->drawable.bitsPerPixel +
|
||||||
7) / 8) + 3) & ~3,
|
7) / 8) + 3) & ~3,
|
||||||
NULL);
|
NULL);
|
||||||
ErrorF("fallback to software fb for pixmap %p , %d x %d \n", pixmap, w, h);
|
|
||||||
|
glamor_fallback("fallback to software fb for pixmap %p , %d x %d depth %d\n", pixmap, w, h, depth);
|
||||||
} else
|
} else
|
||||||
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
|
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
|
||||||
|
|
||||||
|
|
|
@ -309,13 +309,8 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
|
||||||
stride = pixmap->devKind;
|
stride = pixmap->devKind;
|
||||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||||
|
|
||||||
|
assert(drawable->depth != 1);
|
||||||
switch (drawable->depth) {
|
switch (drawable->depth) {
|
||||||
case 1:
|
|
||||||
format = GL_ALPHA;
|
|
||||||
type = GL_UNSIGNED_BYTE;
|
|
||||||
row_length = stride;
|
|
||||||
break;
|
|
||||||
case 8:
|
case 8:
|
||||||
format = GL_ALPHA;
|
format = GL_ALPHA;
|
||||||
type = GL_UNSIGNED_BYTE;
|
type = GL_UNSIGNED_BYTE;
|
||||||
|
@ -485,14 +480,10 @@ glamor_load_texture_pixmap(PixmapPtr pixmap)
|
||||||
else
|
else
|
||||||
ptexcoords = texcoords;
|
ptexcoords = texcoords;
|
||||||
|
|
||||||
|
assert(pixmap->drawable.depth != 1);
|
||||||
stride = pixmap->devKind;
|
stride = pixmap->devKind;
|
||||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||||
switch (pixmap->drawable.depth) {
|
switch (pixmap->drawable.depth) {
|
||||||
case 1:
|
|
||||||
format = GL_COLOR_INDEX;
|
|
||||||
type = GL_BITMAP;
|
|
||||||
row_length = stride;
|
|
||||||
break;
|
|
||||||
case 8:
|
case 8:
|
||||||
format = GL_ALPHA;
|
format = GL_ALPHA;
|
||||||
type = GL_UNSIGNED_BYTE;
|
type = GL_UNSIGNED_BYTE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user