[cairo-commit] glitz/src glitz_glx_context.c, 1.2, 1.3 glitz_glx_extension.c, 1.4, 1.5 glitz_glx_format.c, 1.2, 1.3 glitz_glxint.h, 1.3, 1.4

David Reveman commit at pdx.freedesktop.org
Sun May 2 07:11:11 PDT 2004


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv17543/src

Modified Files:
	glitz_glx_context.c glitz_glx_extension.c glitz_glx_format.c 
	glitz_glxint.h 
Log Message:
Better pbuffer detection

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glx_context.c	3 Apr 2004 17:53:54 -0000	1.2
--- b/glitz_glx_context.c	2 May 2004 14:11:09 -0000	1.3
***************
*** 87,93 ****
    
    if (vinfo) {
!     context->context =
!       context->context = glXCreateContext (screen_info->display_info->display,
!                                            vinfo, share_list, 1);    
      context->id = fbconfigid;
      context->fbconfig = fbconfigs[i];
--- 87,92 ----
    
    if (vinfo) {
!     context->context = glXCreateContext (screen_info->display_info->display,
!                                          vinfo, share_list, 1);
      context->id = fbconfigid;
      context->fbconfig = fbconfigs[i];
***************
*** 102,105 ****
--- 101,142 ----
  }
  
+ int
+ glitz_glx_ensure_pbuffer_support (glitz_glx_screen_info_t *screen_info,
+                                   XID fbconfigid)
+ {
+   GLXFBConfig *fbconfigs;
+   int i, n_fbconfigs;
+   
+   fbconfigs = _glitz_glx_proc_address.get_fbconfigs
+     (screen_info->display_info->display, screen_info->screen, &n_fbconfigs);
+   for (i = 0; i < n_fbconfigs; i++) {
+     int value;
+     
+     _glitz_glx_proc_address.get_fbconfig_attrib
+       (screen_info->display_info->display, fbconfigs[i],
+        GLX_FBCONFIG_ID, &value);
+     if (value == (int) fbconfigid)
+       break;
+   }
+   
+   if (i < n_fbconfigs) {
+     GLXPbuffer pbuffer;
+     glitz_texture_t texture;
+     
+     texture.width = texture.height = 1;
+     pbuffer =
+       glitz_glx_pbuffer_create (screen_info->display_info->display,
+                                 fbconfigs[i],
+                                 &texture);
+     if (pbuffer) {
+       glitz_glx_pbuffer_destroy (screen_info->display_info->display, pbuffer);
+       
+       return 0;
+     }
+   }
+   
+   return 1;
+ }
+ 
  glitz_glx_context_t *
  glitz_glx_context_get (glitz_glx_screen_info_t *screen_info,

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_glx_extension.c	1 May 2004 20:36:34 -0000	1.4
--- b/glitz_glx_extension.c	2 May 2004 14:11:09 -0000	1.5
***************
*** 96,103 ****
        screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
-     screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
      char *renderer = (char *) glGetString (GL_RENDERER);
      if (renderer) {
- 
        /* All geforce and quadro cards seems to support multisample with
           pbuffers */
--- 96,104 ----
        screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
      char *renderer = (char *) glGetString (GL_RENDERER);
+     
+     screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
+     
      if (renderer) {
        /* All geforce and quadro cards seems to support multisample with
           pbuffers */

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glx_format.c	1 May 2004 20:36:34 -0000	1.2
--- b/glitz_glx_format.c	2 May 2004 14:11:09 -0000	1.3
***************
*** 301,306 ****
--- 301,311 ----
  {
    glitz_format_t format;
+   glitz_format_t *formats = screen_info->formats;
+   int n_formats = screen_info->n_formats;
    
    screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
+ 
+   for (; n_formats; n_formats--, formats++)
+     formats->drawable.offscreen = 0;
    
    /* Adding fake offscreen formats. Surfaces created with these format can
***************
*** 323,326 ****
--- 328,332 ----
  {
    glitz_bool_t status = 1;
+   glitz_format_t *format;
  
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_GLX13_MASK)
***************
*** 330,337 ****
      glitz_glx_query_formats_glx12 (screen_info);
    
!   if (!glitz_format_find_standard (screen_info->formats,
!                                    screen_info->n_formats,
!                                    GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                    GLITZ_STANDARD_ARGB32))
      glitz_glx_use_fake_offscreen_formats (screen_info);
    
--- 336,346 ----
      glitz_glx_query_formats_glx12 (screen_info);
    
!   format = glitz_format_find_standard (screen_info->formats,
!                                        screen_info->n_formats,
!                                        GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                        GLITZ_STANDARD_ARGB32);
! 
!   if (format == NULL ||
!       glitz_glx_ensure_pbuffer_support (screen_info, format->id))
      glitz_glx_use_fake_offscreen_formats (screen_info);
    

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glxint.h	28 Apr 2004 08:59:38 -0000	1.3
--- b/glitz_glxint.h	2 May 2004 14:11:09 -0000	1.4
***************
*** 148,151 ****
--- 148,155 ----
                         glitz_format_t *format);
  
+ extern int __internal_linkage
+ glitz_glx_ensure_pbuffer_support (glitz_glx_screen_info_t *screen_info,
+                                   XID fbconfigid);
+ 
  extern glitz_glx_context_t *__internal_linkage
  glitz_glx_context_get_default (glitz_glx_screen_info_t *screen_info);





More information about the cairo-commit mailing list