On Thu, Dec 23, 2010 at 8:05 AM, Zack Weinberg <zackw@panix.com> wrote: > On Thu, Dec 23, 2010 at 3:34 AM, Julien Cristau <jcristau@debian.org> wrote: >> On Wed, Dec 22, 2010 at 18:14:05 -0800, Zack Weinberg wrote: >> >>> * screen doesn't turn back on after suspend-to-ram with 2.6.36 from experimental With everything relevant from experimental as of just now (kernel 2.6.37-rc7, xserver-xorg-core 1.9.2.902-1, xserver-xorg-video-nouveau 0.0.16+git20101210+8bb8231-1) the screen does turn back on after suspend-to-ram. Yay. I still see the other problem (bad image stretching). I'm attaching a small test program that reproduces this problem without needing to build development Firefox with patches applied -- compile with gcc `pkg-config --cflags --libs cairo` single-pixel-stretch.c, run it, and then compare the .png files it drops in the cwd. r-image-24.png should be identical to r-xlib-24.png, and r-image-32.png should be identical to r-xlib-32.png. I'm also attaching the files as produced by my system. Will try updating xserver-xorg-video-nouveau to the latest upstream sources next. zw
Attachment:
r-image-24.png
Description: PNG image
Attachment:
r-image-32.png
Description: PNG image
Attachment:
r-xlib-24.png
Description: PNG image
Attachment:
r-xlib-32.png
Description: PNG image
#include <cairo.h>
#include <cairo-xlib.h>
#include <X11/Xutil.h>
#include <stdlib.h>
#define WS 1
#define WD 500
#define H 2
static void
test_surfaces(cairo_surface_t *src, cairo_surface_t *dst, const char *name)
{
/* Fill in src */
{
cairo_t *cs = cairo_create(src);
cairo_set_source_rgb(cs, 1, 1, 1);
cairo_paint(cs);
cairo_new_path(cs);
cairo_rectangle(cs, 0, 0, WS, H/2);
cairo_set_source_rgb(cs, 0, 1, 0);
cairo_fill(cs);
cairo_destroy(cs);
}
/* Blit to destination, stretching */
{
cairo_matrix_t mat;
cairo_pattern_t *ps = cairo_pattern_create_for_surface(src);
cairo_pattern_set_extend(ps, CAIRO_EXTEND_PAD);
cairo_pattern_set_filter(ps, CAIRO_FILTER_BILINEAR);
cairo_matrix_init_scale(&mat, ((double)WS)/WD, 1.);
cairo_pattern_set_matrix(ps, &mat);
cairo_t *cd = cairo_create(dst);
cairo_set_source(cd, ps);
cairo_paint(cd);
cairo_destroy(cd);
cairo_pattern_destroy(ps);
}
cairo_surface_write_to_png(dst, name);
cairo_surface_destroy(dst);
cairo_surface_destroy(src);
}
static void
test_xlib(void)
{
Display *dpy = XOpenDisplay(0);
int scr = DefaultScreen(dpy);
Window rw = RootWindow(dpy, scr);
XVisualInfo vinf24, vinf32;
if (!XMatchVisualInfo(dpy, scr, 24, TrueColor, &vinf24))
abort();
if (!XMatchVisualInfo(dpy, scr, 32, TrueColor, &vinf32))
abort();
Pixmap pm24s = XCreatePixmap(dpy, rw, WS, H, vinf24.depth);
Pixmap pm24d = XCreatePixmap(dpy, rw, WD, H, vinf24.depth);
test_surfaces(cairo_xlib_surface_create(dpy, pm24s, vinf24.visual, WS, H),
cairo_xlib_surface_create(dpy, pm24d, vinf24.visual, WD, H),
"r-xlib-24.png");
XFreePixmap(dpy, pm24s);
XFreePixmap(dpy, pm24d);
Pixmap pm32s = XCreatePixmap(dpy, rw, WS, H, vinf32.depth);
Pixmap pm32d = XCreatePixmap(dpy, rw, WD, H, vinf32.depth);
test_surfaces(cairo_xlib_surface_create(dpy, pm32s, vinf32.visual, WS, H),
cairo_xlib_surface_create(dpy, pm32d, vinf32.visual, WD, H),
"r-xlib-32.png");
XFreePixmap(dpy, pm32s);
XFreePixmap(dpy, pm32d);
XCloseDisplay(dpy);
}
int
main(void)
{
test_surfaces(cairo_image_surface_create(CAIRO_FORMAT_RGB24, WS, H),
cairo_image_surface_create(CAIRO_FORMAT_RGB24, WD, H),
"r-image-24.png");
test_surfaces(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, WS, H),
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, WD, H),
"r-image-32.png");
test_xlib();
return 0;
}