[Glamor] [PATCH 3/9] Set filter to GL_NEAREST by default.
zhigang.gong at linux.intel.com
zhigang.gong at linux.intel.com
Sun Jan 8 21:36:05 PST 2012
From: Zhigang Gong <zhigang.gong at linux.intel.com>
This is the fastest filter and let's use it by default.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
src/glamor_pixmap.c | 17 +++++++++++++++++
src/glamor_putimage.c | 8 ++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c
index b56afc0..884dd83 100644
--- a/src/glamor_pixmap.c
+++ b/src/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/src/glamor_putimage.c b/src/glamor_putimage.c
index f4b174d..f285d95 100644
--- a/src/glamor_putimage.c
+++ b/src/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);
--
1.7.4.4
More information about the Glamor
mailing list