On Monday, June 25, 2007 12:44:16 pm Jesse Barnes wrote:
> On Monday, June 25, 2007 11:46:59 Michel Dänzer wrote:
> > On Mon, 2007-06-25 at 08:43 -0700, Jesse Barnes wrote:
> > > On Monday, June 25, 2007 4:00:01 am Michel Dänzer wrote:
> > > > On Fri, 2007-06-22 at 11:13 -0700, Jesse Barnes wrote:
> > > > > diff-tree 97dcd7fd25c18d5148619254229f8d94efb55b44 (from
> > > > > 2d24455ed8b12df6d06d135cb70f02473d11f4b0) Author: Jesse Barnes
> > > > > <[EMAIL PROTECTED]>
> > > > > Date: Fri Jun 22 11:06:51 2007 -0700
> > > > >
> > > > > more vblank rework
> > > > > - use a timer for disabling vblank events to avoid
> > > > > enable/disable calls too often
> > > > > - make i915 work with pre-965 chips again (would like to
> > > > > structure this better, but this hack works on my test system)
> > > >
> > > > Can you elaborate on the latter? The previous code seemed to work
> > > > fine on my i915 system...
> > >
> > > Any app wanting to sync to vblank on 915 hung prior to these mods,
> > > since the vblank counter never incremented. Did you see that
> > > working [...]
> >
> > Yes, I consider sync-to-vblank the main feature for vblank-rework. :)
> >
> > How exactly did you test (vblank_mode=2 glxgears here), and did the
> > app(s) hang indefinitely or just initially for three seconds?
>
> IIRC my test app hung indefinitely. Main loop was something like:
>
> while (i++) {
> /* Wait for vsync */
> if (waitforsync)
> video_sync(2, (count + 1) % 2, &count);
>
> /* Alternate colors to make tearing obvious */
> if (i & 1)
> glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
> else
> glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
> glClear(GL_COLOR_BUFFER_BIT);
> glFlush();
> }
>
> If waitforsync == 0, I get obvious tearing (a kind of "rain" effect of
> the two colors I painted), while if waitforsync != 0, the app either
> hangs or alternates at the refresh rate, making kind of an orange
> color. But I'll retest (though I don't see how it could have worked
> for you unless 915 has these registers too in the same location).
>
> Does vblank_mode= work with the Intel driver too? The docs I found only
> mentioned radeon and mga...
Ok, I retested without the if (!IS_965) ... code in place, which was working
for you. On my box, I get a hard hang when I run the attached test program,
or any other gl program. I checked out some old docs though, apparently 845
didn't have the frame counters, but 945 does, and I'm guessing 915 does too
since it works for you. I'll keep debugging.
Thanks,
Jesse
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
void (*video_sync_get)();
void (*video_sync)();
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
pos = strstr(extensionsString, extension);
return pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0');
}
extern char *optarg;
extern int optind, opterr, optopt;
static char optstr[] = "w:h:s";
int main(int argc, char *argv[])
{
Display *disp;
XVisualInfo *pvi;
XSetWindowAttributes swa;
int attrib[]= { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
GLXContext context;
Window winGL;
unsigned int count;
int dummy;
Atom wmDelete;
int width = 500, height = 500, waitforsync = 0;
int c, i = 1;
opterr = 0;
while ((c = getopt(argc, argv, optstr)) != -1) {
switch (c) {
case 'w':
width = atoi(optarg);
break;
case 'h':
height = atoi(optarg);
break;
case 's':
waitforsync = 1;
break;
default:
fprintf(stderr, "unknown option %c\n", (char)c);
break;
}
}
disp = XOpenDisplay(NULL);
if (!disp) {
fprintf(stderr, "failed to open display\n");
return -1;
}
if (!glXQueryExtension(disp, &dummy, &dummy)) {
fprintf(stderr, "glXQueryExtension failed\n");
return -1;
}
if (!GLXExtensionSupported(disp, "GLX_SGI_video_sync")) {
fprintf(stderr, "GLX_SGI_video_sync not supported, exiting\n");
return -1;
}
pvi = glXChooseVisual(disp, DefaultScreen(disp), attrib);
if (!pvi) {
fprintf(stderr, "failed to choose visual, exiting\n");
return -1;
}
context = glXCreateContext(disp, pvi, None, GL_TRUE);
if (!context) {
fprintf(stderr, "failed to create glx context\n");
return -1;
}
pvi->screen = DefaultScreen(disp);
swa.colormap = XCreateColormap(disp, RootWindow(disp, pvi->screen),
pvi->visual, AllocNone);
swa.border_pixel = 0;
swa.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
StructureNotifyMask;
winGL = XCreateWindow(disp, RootWindow(disp, pvi->screen),
0, 0,
width, height,
0, pvi->depth, InputOutput, pvi->visual,
CWBorderPixel | CWColormap | CWEventMask, &swa);
if (!winGL) {
fprintf(stderr, "window creation failed\n");
return -1;
}
wmDelete = XInternAtom(disp, "WM_DELETE_WINDOW", True);
XSetWMProtocols(disp, winGL, &wmDelete, 1);
XSetStandardProperties(disp, winGL, "glsync test", "glsync text",
None, NULL, 0, NULL);
XMapRaised(disp, winGL);
glXMakeCurrent(disp, winGL, context);
video_sync_get = glXGetProcAddress("glXGetVideoSyncSGI");
video_sync = glXGetProcAddress("glXWaitVideoSyncSGI");
if (!video_sync_get || !video_sync) {
fprintf(stderr, "failed to get sync functions\n");
return -1;
}
while (i++) {
/* Wait for vsync */
if (waitforsync)
video_sync(2, (count + 1) % 2, &count);
/* Alternate colors to make tearing obvious */
if (i & 1)
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
else
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
XDestroyWindow(disp, winGL);
glXDestroyContext(disp, context);
XCloseDisplay(disp);
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel