From a74596be0e7e02b43fb0db844b71b68f384ab599 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Sun, 8 Jan 2012 08:50:41 +0800 Subject: [PATCH] Set filter to GL_NEAREST by default. This is the fastest filter and let's use it by default. Signed-off-by: Zhigang Gong --- glamor/glamor_pixmap.c | 17 +++++++++++++++++ glamor/glamor_putimage.c | 8 ++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index b56afc0b9..884dd83a7 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -243,6 +243,10 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format, row_length = (stride * 8) / pixmap->drawable.bitsPerPixel; dispatch->glBindTexture(GL_TEXTURE_2D, tex); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_NEAREST); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 4); @@ -584,6 +588,13 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format, temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap); dispatch->glBindTexture(GL_TEXTURE_2D, temp_pixmap_priv->tex); + dispatch->glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + dispatch->glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_MAG_FILTER, + GL_NEAREST); + dispatch->glTexImage2D(GL_TEXTURE_2D, 0, *format, source->drawable.width, source->drawable.height, 0, *format, *type, @@ -601,6 +612,12 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format, dispatch->glActiveTexture(GL_TEXTURE0); dispatch->glBindTexture(GL_TEXTURE_2D, source_priv->tex); + dispatch->glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + dispatch->glTexParameteri(GL_TEXTURE_2D, + GL_TEXTURE_MAG_FILTER, + GL_NEAREST); glamor_set_destination_pixmap_priv_nc(temp_pixmap_priv); diff --git a/glamor/glamor_putimage.c b/glamor/glamor_putimage.c index f4b174d5e..f285d957c 100644 --- a/glamor/glamor_putimage.c +++ b/glamor/glamor_putimage.c @@ -313,6 +313,10 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, dispatch->glGenTextures(1, &tex); dispatch->glActiveTexture(GL_TEXTURE0); dispatch->glBindTexture(GL_TEXTURE_2D, tex); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST); + dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_NEAREST); if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { iformat = format; @@ -323,10 +327,6 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, dispatch->glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); #ifndef GLAMOR_GLES2 dispatch->glEnable(GL_TEXTURE_2D);