Commit ac0589c9 authored by Zhigang Gong's avatar Zhigang Gong

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: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 3c44e3e0
......@@ -108,7 +108,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (w > 32767 || h > 32767)
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.
If we exceed such limitation, we have to use framebuffer.*/
type = GLAMOR_FB;
......@@ -117,7 +117,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
(((w * pixmap->drawable.bitsPerPixel +
7) / 8) + 3) & ~3,
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
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
......
......@@ -309,13 +309,8 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
stride = pixmap->devKind;
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
assert(drawable->depth != 1);
switch (drawable->depth) {
case 1:
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
row_length = stride;
break;
case 8:
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
......@@ -485,14 +480,10 @@ glamor_load_texture_pixmap(PixmapPtr pixmap)
else
ptexcoords = texcoords;
assert(pixmap->drawable.depth != 1);
stride = pixmap->devKind;
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
switch (pixmap->drawable.depth) {
case 1:
format = GL_COLOR_INDEX;
type = GL_BITMAP;
row_length = stride;
break;
case 8:
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment