Commit 9b667ffd authored by Zhigang Gong's avatar Zhigang Gong
Browse files

glamor: Use small internal texture format if possible.



Reduce some texture memory requirement and also save
some bandwidth.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 01489f9d
......@@ -151,10 +151,10 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY)
return pixmap;
/* We should probably take advantage of ARB_fbo's allowance of GL_ALPHA.
* FBOs, which EXT_fbo forgot to do.
*/
switch (depth) {
case 8:
format = GL_ALPHA;
break;
case 24:
format = GL_RGB;
break;
......
......@@ -199,7 +199,20 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format, GLenum type,
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
unsigned int stride, row_length;
void *texels;
GLenum iformat = GL_RGBA;
GLenum iformat;
switch (pixmap->drawable.depth) {
case 8:
iformat = GL_ALPHA;
break;
case 24:
iformat = GL_RGB;
break;
default:
iformat = GL_RGBA;
break;
}
stride = pixmap->devKind;
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
......
Supports Markdown
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