2
* nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
5
* Copyright (C) 2004 NVIDIA Corporation.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of Version 2 of the GNU General Public
9
* License as published by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
14
* of the GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the:
19
* Free Software Foundation, Inc.
20
* 59 Temple Place - Suite 330
21
* Boston, MA 02111-1307, USA
29
#include <NvCtrlAttributes.h>
31
#include "glxinfo.h" /* xxx_abbrev functions */
33
#include "ctkbanner.h"
36
#include "ctkconfig.h"
38
#include "ctkconstants.h"
40
#include <GL/glx.h> /* GLX #defines */
43
/* Number of FBConfigs attributes reported in gui */
44
#define NUM_FBCONFIG_ATTRIBS 32
47
/* FBConfig tooltips */
48
static const char * __show_fbc_help =
49
"Show the GLX Frame Buffer Configurations table in a new window.";
50
static const char * __fid_help =
51
"fid (Frame buffer ID) - Frame Buffer Configuration ID.";
52
static const char * __vid_help =
53
"vid (XVisual ID) - ID of the associated X Visual.";
54
static const char * __vt_help =
55
"vt (XVisual Type) - Type of the associated X Visual. "
56
"Possible X visual types are 'tc', 'dc', 'pc', 'sc', 'gs', 'sg' and '.' "
57
"which mean TrueColor, DirectColor, PseudoColor, StaticColor, GrayScale, "
58
"StaticGray and None, respectively.";
59
static const char * __bfs_help =
60
"bfs (buffer size) - Number of bits per color in the color buffer.";
61
static const char * __lvl_help =
62
"lvl (level) - Frame buffer level. Level zero is the default frame "
63
"buffer. Positive levels are the overlay frame buffers (on top of the "
64
"default frame buffer). Negative levels are the underlay frame buffers "
65
"(under the default frame buffer).";
66
static const char * __bf_help =
67
"bf (Buffer format) - Color buffer format. 'rgb' means each element of the "
68
"pixel buffer holds red, green, blue, and alpha values. 'ci' means each "
69
"element of the pixel buffer holds a color index value, where the actual "
70
"color is defined by a color map.";
71
static const char * __db_help =
72
"db (Double buffer) - 'y' if the configuration has front and back color "
73
"buffers that are swappable. '-' if this is not supported.";
74
static const char * __st_help =
75
"st (Stereo buffer) - 'y' if the configuration has left and right color "
76
"buffers that are rendered to in stereo. '-' if this is not supported.";
77
static const char * __rs_help =
78
"rs (Red size) - Number of bits per color used for red. "
79
"Undefined for configurations that use color indexing.";
80
static const char * __gs_help =
81
"gs (Green size) - Number of bits per color used for green. "
82
"Undefined for configurations that use color indexing.";
83
static const char * __bs_help =
84
"bs (Blue size) - Number of bits per color used for blue. "
85
"Undefined for configurations that use color indexing.";
86
static const char * __as_help =
87
"as (Alpha size) - Number of bits per color used for alpha. "
88
"Undefined for configurations that use color indexing.";
89
static const char * __aux_help =
90
"aux (Auxiliary buffers) - Number of available auxiliary color buffers.";
91
static const char * __dpt_help =
92
"dpt (Depth buffer size) - Number of bits per color in the depth buffer.";
93
static const char * __stn_help =
94
"stn (Stencil size) - Number of bits per element in the stencil buffer.";
95
static const char * __acr_help =
96
"acr (Accumulator red size) - Number of bits per color used for red "
97
"in the accumulator buffer.";
98
static const char * __acg_help =
99
"acg (Accumulator green size) - Number of bits per color used for green "
100
"in the accumulator buffer.";
101
static const char * __acb_help =
102
"acb (Accumulator blue size) - Number of bits per color used for blue "
103
"in the accumulator buffer.";
104
static const char * __aca_help =
105
"aca (Accumulator alpha size) - Number of bits per color used for alpha "
106
"in the accumulator buffer.";
107
static const char * __mvs_help =
108
"mvs (Multisample coverage samples) - Number of coverage samples per multisample.";
109
static const char * __mcs_help =
110
"mcs (Multisample color samples) - Number of color samples per multisample.";
111
static const char * __mb_help =
112
"mb (Multisample buffer count) - Number of multisample buffers.";
113
static const char * __cav_help =
114
"cav (Caveats) - Caveats for this configuration. A frame buffer "
115
"configuration may have the following caveats: 'NonC' if it supports "
116
"any non-conformant visual extension. 'Slow' if it has reduced "
117
"preformance. '-' if it has no caveats.";
118
static const char * __pbw_help =
119
"pbw (Pbuffer width) - Width of pbuffer (in hexadecimal).";
120
static const char * __pbh_help =
121
"pbh (Pbuffer height) - Height of pbuffer (in hexadecimal).";
122
static const char * __pbp_help =
123
"pbp (Pbuffer max pixels) - Max number of pixels in pbuffer (in "
125
static const char * __trt_help =
126
"trt (Transparency type) - Type of transparency (RGBA or Index).";
127
static const char * __trr_help =
128
"trr (Transparency red value) - Red value consided transparent.";
129
static const char * __trg_help =
130
"trg (Transparency green value) - Green value consided transparent.";
131
static const char * __trb_help =
132
"trb (Transparency blue value) - Blue value consided transparent.";
133
static const char * __tra_help =
134
"tra (Transparency alpha value) - Alpha value consided transparent.";
135
static const char * __tri_help =
136
"tri (Transparency index value) - Color index value consided transparent.";
139
GType ctk_glx_get_type(void)
141
static GType ctk_glx_type = 0;
144
static const GTypeInfo ctk_glx_info = {
145
sizeof (CtkGLXClass),
146
NULL, /* base_init */
147
NULL, /* base_finalize */
148
NULL, /* class_init, */
149
NULL, /* class_finalize */
150
NULL, /* class_data */
153
NULL, /* instance_init */
156
ctk_glx_type = g_type_register_static (GTK_TYPE_VBOX,
157
"CtkGLX", &ctk_glx_info, 0);
161
} /* ctk_glx_get_type() */
164
static void dummy_button_signal(GtkWidget *widget,
167
/* This is a dummy function so tooltips are enabled
168
* for the fbconfig table column titles
174
* show_fbc_toggled() - called when the show GLX Frame Buffer Configurations
175
* button has been toggled.
178
static void show_fbc_toggled(GtkWidget *widget, gpointer user_data)
180
CtkGLX *ctk_glx = user_data;
183
/* get the enabled state */
185
enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
188
gtk_widget_show_all(ctk_glx->fbc_window);
190
gtk_widget_hide(ctk_glx->fbc_window);
193
ctk_config_statusbar_message(ctk_glx->ctk_config,
194
"Show GLX Frame Buffer Configurations button %s.",
195
enabled ? "enabled" : "disabled");
197
} /* show_fbc_toggled() */
201
* fbc_window_destroy() - called when the window displaying the
202
* GLX Frame Buffer Configurations table is closed.
205
fbc_window_destroy(GtkWidget *widget, GdkEvent *event, gpointer user_data)
207
CtkGLX *ctk_glx = user_data;
209
gtk_toggle_button_set_active
210
(GTK_TOGGLE_BUTTON(ctk_glx->show_fbc_button),
215
} /* fbc_window_destroy() */
218
/* Creates the GLX information widget
220
* NOTE: The GLX information other than the FBConfigs will
221
* be setup when this page is hooked up and the "parent-set"
222
* signal is thrown. This will result in calling the
223
* ctk_glx_probe_info() function.
226
typedef struct WidgetSizeRec {
231
GtkWidget* ctk_glx_new(NvCtrlAttributeHandle *handle,
232
CtkConfig *ctk_config, CtkEvent *ctk_event)
238
GtkWidget *hseparator;
240
GtkWidget *vbox, *vbox2;
241
GtkWidget *scrollWin;
242
GtkWidget *event; /* For setting the background color to white */
243
GtkWidget *data_table, *header_table;
244
GtkWidget *data_viewport, *full_viewport;
245
GtkWidget *vscrollbar, *hscrollbar;
246
GtkWidget *show_fbc_button, *window;
250
char * glx_info_str = NULL; /* Test if GLX supported */
251
GLXFBConfigAttr *fbconfig_attribs = NULL; /* FBConfig data */
252
int i; /* Iterator */
253
int num_fbconfigs = 0;
254
char *err_str = NULL;
256
gchar *fbconfig_titles[NUM_FBCONFIG_ATTRIBS] = {
257
"fid", "vid", "vt", "bfs", "lvl",
259
"rs", "gs", "bs", "as",
261
"acr", "acg", "acb", "aca",
265
"trt", "trr", "trg", "trb", "tra", "tri"
268
WidgetSize fbconfig_header_sizes[NUM_FBCONFIG_ATTRIBS];
270
const char *fbconfig_tooltips[NUM_FBCONFIG_ATTRIBS] = {
271
__fid_help, __vid_help, __vt_help, __bfs_help, __lvl_help,
272
__bf_help, __db_help, __st_help,
273
__rs_help, __gs_help, __bs_help, __as_help,
274
__aux_help, __dpt_help, __stn_help,
275
__acr_help, __acg_help, __acb_help, __aca_help,
276
__mvs_help, __mcs_help, __mb_help,
278
__pbw_help, __pbh_help, __pbp_help,
279
__trt_help, __trr_help, __trg_help,
280
__trb_help, __tra_help, __tri_help
284
/* Create the ctk glx object */
285
object = g_object_new(CTK_TYPE_GLX, NULL);
286
ctk_glx = CTK_GLX(object);
289
/* Cache the attribute handle */
290
ctk_glx->handle = handle;
292
/* Set container properties of the object */
293
ctk_glx->ctk_config = ctk_config;
294
gtk_box_set_spacing(GTK_BOX(ctk_glx), 10);
298
banner = ctk_banner_image_new(BANNER_ARTWORK_GLX);
299
gtk_box_pack_start(GTK_BOX(ctk_glx), banner, FALSE, FALSE, 0);
301
/* Determine if GLX is supported */
302
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
303
NV_CTRL_STRING_GLX_SERVER_VENDOR,
306
if ( ret != NvCtrlSuccess ) {
307
err_str = "Failed to query the GLX server vendor.";
312
/* Information Scroll Box */
313
scrollWin = gtk_scrolled_window_new(NULL, NULL);
314
hbox = gtk_hbox_new(FALSE, 0);
315
vbox = gtk_vbox_new(FALSE, 5);
316
event = gtk_event_box_new();
317
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin),
318
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
319
gtk_widget_modify_fg(event, GTK_STATE_NORMAL, &(event->style->text[GTK_STATE_NORMAL]));
320
gtk_widget_modify_bg(event, GTK_STATE_NORMAL, &(event->style->base[GTK_STATE_NORMAL]));
321
gtk_container_add(GTK_CONTAINER(event), hbox);
322
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollWin),
324
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5);
325
ctk_glx->glxinfo_vpane = vbox;
326
gtk_widget_set_size_request(scrollWin, -1, 50);
329
/* GLX 1.3 supports frame buffer configurations */
330
#ifdef GLX_VERSION_1_3
332
/* Grab the FBConfigs */
333
ret = NvCtrlGetVoidAttribute(handle, NV_CTRL_ATTR_GLX_FBCONFIG_ATTRIBS,
334
(void *)(&fbconfig_attribs));
335
if ( ret != NvCtrlSuccess ) {
336
err_str = "Failed to query list of GLX frame buffer configurations.";
340
/* Count the number of fbconfigs */
341
if ( fbconfig_attribs ) {
342
for (num_fbconfigs = 0;
343
fbconfig_attribs[num_fbconfigs].fbconfig_id != 0;
346
if ( ! num_fbconfigs ) {
347
err_str = "No frame buffer configurations found.";
352
show_fbc_button = gtk_toggle_button_new_with_label(
353
"Show GLX Frame Buffer Configurations");
354
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_fbc_button), FALSE);
355
ctk_config_set_tooltip(ctk_config, show_fbc_button, __show_fbc_help);
356
g_signal_connect(G_OBJECT(show_fbc_button),
357
"clicked", G_CALLBACK(show_fbc_toggled),
360
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
361
gtk_window_set_title(GTK_WINDOW(window), "GLX Frame Buffer Configurations");
362
gtk_container_set_border_width(GTK_CONTAINER(window), CTK_WINDOW_PAD);
363
gtk_widget_set_size_request(window, 400, 200);
364
g_signal_connect(G_OBJECT(window), "destroy-event",
365
G_CALLBACK(fbc_window_destroy),
367
g_signal_connect(G_OBJECT(window), "delete-event",
368
G_CALLBACK(fbc_window_destroy),
371
ctk_glx->fbc_window = window;
372
ctk_glx->show_fbc_button = show_fbc_button;
374
hbox = gtk_hbox_new(FALSE, 0);
375
vbox = gtk_vbox_new(FALSE, 10);
376
vbox2 = gtk_vbox_new(FALSE, 10);
378
data_viewport = gtk_viewport_new(NULL, NULL);
379
gtk_widget_set_size_request(data_viewport, 400, 50);
380
vscrollbar = gtk_vscrollbar_new(gtk_viewport_get_vadjustment
381
(GTK_VIEWPORT(data_viewport)));
383
full_viewport = gtk_viewport_new(NULL, NULL);
384
gtk_widget_set_size_request(full_viewport, 400, 50);
385
hscrollbar = gtk_hscrollbar_new(gtk_viewport_get_hadjustment
386
(GTK_VIEWPORT(full_viewport)));
388
* NODE: Because clists have a hard time displaying tooltips in their
389
* column labels/buttons, we make the fbconfig table using a
393
/* Create the header table */
395
header_table = gtk_table_new(num_fbconfigs, NUM_FBCONFIG_ATTRIBS, FALSE);
397
for ( i = 0; i < NUM_FBCONFIG_ATTRIBS; i++ ) {
398
GtkWidget * btn = gtk_button_new_with_label(fbconfig_titles[i]);
399
g_signal_connect(G_OBJECT(btn), "clicked",
400
G_CALLBACK(dummy_button_signal),
402
ctk_config_set_tooltip(ctk_config, btn, fbconfig_tooltips[i]);
403
gtk_table_attach(GTK_TABLE(header_table), btn, i, i+1, 0, 1,
404
GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
406
fbconfig_header_sizes[i].widget = btn;
407
gtk_widget_size_request(btn, &req);
408
fbconfig_header_sizes[i].width = req.width;
411
/* Create the data table */
413
data_table = gtk_table_new(num_fbconfigs, NUM_FBCONFIG_ATTRIBS, FALSE);
414
event = gtk_event_box_new();
416
gtk_widget_modify_fg(data_table, GTK_STATE_NORMAL,
417
&(data_table->style->text[GTK_STATE_NORMAL]));
418
gtk_widget_modify_bg(data_table, GTK_STATE_NORMAL,
419
&(data_table->style->base[GTK_STATE_NORMAL]));
420
gtk_container_add (GTK_CONTAINER(event), data_table);
421
gtk_widget_modify_fg(event, GTK_STATE_NORMAL,
422
&(event->style->text[GTK_STATE_NORMAL]));
423
gtk_widget_modify_bg(event, GTK_STATE_NORMAL,
424
&(event->style->base[GTK_STATE_NORMAL]));
425
gtk_container_add(GTK_CONTAINER(data_viewport), event);
427
/* Pack the fbconfig header and data tables */
429
vbox = gtk_vbox_new(FALSE, 0);
430
gtk_box_pack_start(GTK_BOX(vbox), header_table, FALSE, FALSE, 0);
431
gtk_box_pack_start(GTK_BOX(vbox), data_viewport, TRUE, TRUE, 0);
432
gtk_container_add (GTK_CONTAINER(full_viewport), vbox);
434
vbox = gtk_vbox_new(FALSE, 0);
435
gtk_box_pack_start(GTK_BOX(vbox), full_viewport, TRUE, TRUE, 0);
436
gtk_box_pack_start(GTK_BOX(vbox), hscrollbar, FALSE, FALSE, 0);
438
hbox = gtk_hbox_new(FALSE, 0);
439
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
440
gtk_box_pack_start(GTK_BOX(hbox), vscrollbar, FALSE, FALSE, 0);
442
gtk_container_add(GTK_CONTAINER(window), hbox);
444
vbox = gtk_vbox_new(FALSE, 0);
445
gtk_box_pack_start(GTK_BOX(vbox), show_fbc_button, FALSE, FALSE, 0);
446
hbox = gtk_hbox_new(FALSE, 0);
447
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
449
hseparator = gtk_hseparator_new();
451
vbox = gtk_vbox_new(FALSE, 5);
452
gtk_box_pack_start(GTK_BOX(vbox), scrollWin, TRUE, TRUE, 0);
453
gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, FALSE, 0);
454
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
456
gtk_box_pack_start(GTK_BOX(ctk_glx), vbox, TRUE, TRUE, 0);
458
/* Fill the data table */
460
if ( fbconfig_attribs ) {
462
/* Populate FBConfig table */
464
while ( fbconfig_attribs[i].fbconfig_id != 0 ) {
465
char str[NUM_FBCONFIG_ATTRIBS + 1][16];
466
int cell = 0; /* Used for putting information into cells */
468
if ( fbconfig_attribs[i].fbconfig_id ) {
469
snprintf((char *) (&(str[cell++])), 16, "0x%02X",
470
fbconfig_attribs[i].fbconfig_id);
472
sprintf((char *) (&(str[cell++])),".");
475
if ( fbconfig_attribs[i].visual_id ) {
476
snprintf((char *) (&(str[cell++])), 16, "0x%02X",
477
fbconfig_attribs[i].visual_id);
479
sprintf((char *) (&(str[cell++])),".");
481
snprintf((char *) (&(str[cell++])), 16, "%s",
482
x_visual_type_abbrev(fbconfig_attribs[i].x_visual_type));
483
snprintf((char *) (&(str[cell++])), 16, "%3d",
484
fbconfig_attribs[i].buffer_size);
485
snprintf((char *) (&(str[cell++])), 16, "%2d",
486
fbconfig_attribs[i].level);
487
snprintf((char *) (&(str[cell++])), 16, "%s",
488
render_type_abbrev(fbconfig_attribs[i].render_type) );
489
snprintf((char *) (&(str[cell++])), 16, "%c",
490
fbconfig_attribs[i].doublebuffer ? 'y' : '.');
491
snprintf((char *) (&(str[cell++])), 16, "%c",
492
fbconfig_attribs[i].stereo ? 'y' : '.');
493
snprintf((char *) (&(str[cell++])), 16, "%2d",
494
fbconfig_attribs[i].red_size);
495
snprintf((char *) (&(str[cell++])), 16, "%2d",
496
fbconfig_attribs[i].green_size);
497
snprintf((char *) (&(str[cell++])), 16, "%2d",
498
fbconfig_attribs[i].blue_size);
499
snprintf((char *) (&(str[cell++])), 16, "%2d",
500
fbconfig_attribs[i].alpha_size);
501
snprintf((char *) (&(str[cell++])), 16, "%2d",
502
fbconfig_attribs[i].aux_buffers);
503
snprintf((char *) (&(str[cell++])), 16, "%2d",
504
fbconfig_attribs[i].depth_size);
505
snprintf((char *) (&(str[cell++])), 16, "%2d",
506
fbconfig_attribs[i].stencil_size);
507
snprintf((char *) (&(str[cell++])), 16, "%2d",
508
fbconfig_attribs[i].accum_red_size);
509
snprintf((char *) (&(str[cell++])), 16, "%2d",
510
fbconfig_attribs[i].accum_green_size);
511
snprintf((char *) (&(str[cell++])), 16, "%2d",
512
fbconfig_attribs[i].accum_blue_size);
513
snprintf((char *) (&(str[cell++])), 16, "%2d",
514
fbconfig_attribs[i].accum_alpha_size);
515
if (fbconfig_attribs[i].multi_sample_valid) {
516
snprintf((char *) (&(str[cell++])), 16, "%2d",
517
fbconfig_attribs[i].multi_samples);
518
if (fbconfig_attribs[i].multi_sample_coverage_valid) {
519
snprintf((char *) (&(str[cell++])), 16, "%2d",
520
fbconfig_attribs[i].multi_samples_color);
522
snprintf((char *) (&(str[cell++])), 16, "%2d",
523
fbconfig_attribs[i].multi_samples);
526
snprintf((char *) (&(str[cell++])), 16, " 0");
527
snprintf((char *) (&(str[cell++])), 16, " 0");
529
snprintf((char *) (&(str[cell++])), 16, "%1d",
530
fbconfig_attribs[i].multi_sample_buffers);
531
snprintf((char *) (&(str[cell++])), 16, "%s",
532
caveat_abbrev( fbconfig_attribs[i].config_caveat) );
533
snprintf((char *) (&(str[cell++])), 16, "0x%04X",
534
fbconfig_attribs[i].pbuffer_width);
535
snprintf((char *) (&(str[cell++])), 16, "0x%04X",
536
fbconfig_attribs[i].pbuffer_height);
537
snprintf((char *) (&(str[cell++])), 16, "0x%07X",
538
fbconfig_attribs[i].pbuffer_max);
539
snprintf((char *) (&(str[cell++])), 16, "%s",
540
transparent_type_abbrev(fbconfig_attribs[i].transparent_type));
541
snprintf((char *) (&(str[cell++])), 16, "%3d",
542
fbconfig_attribs[i].transparent_red_value);
543
snprintf((char *) (&(str[cell++])), 16, "%3d",
544
fbconfig_attribs[i].transparent_green_value);
545
snprintf((char *) (&(str[cell++])), 16, "%3d",
546
fbconfig_attribs[i].transparent_blue_value);
547
snprintf((char *) (&(str[cell++])), 16, "%3d",
548
fbconfig_attribs[i].transparent_alpha_value);
549
snprintf((char *) (&(str[cell++])), 16, "%3d",
550
fbconfig_attribs[i].transparent_index_value);
551
str[NUM_FBCONFIG_ATTRIBS][0] = '\0';
553
/* Populate row cells */
554
for ( cell = 0; cell < NUM_FBCONFIG_ATTRIBS ; cell++) {
555
GtkWidget * label = gtk_label_new( str[cell] );
556
gtk_label_set_justify( GTK_LABEL(label), GTK_JUSTIFY_CENTER);
557
gtk_table_attach(GTK_TABLE(data_table), label,
560
GTK_EXPAND, GTK_EXPAND, 0, 0);
562
/* Make sure the table headers are the same width
563
* as their table data column
565
gtk_widget_size_request(label, &req);
567
if ( fbconfig_header_sizes[cell].width > req.width ) {
568
gtk_widget_set_size_request(label,
569
fbconfig_header_sizes[cell].width,
571
} else if ( fbconfig_header_sizes[cell].width < req.width ) {
572
fbconfig_header_sizes[cell].width = req.width + 6;
573
gtk_widget_set_size_request(fbconfig_header_sizes[cell].widget,
574
fbconfig_header_sizes[cell].width,
580
} /* Done - Populating FBconfig table */
583
free(fbconfig_attribs);
585
} /* Done - FBConfigs exist */
587
#endif /* GLX_VERSION_1_3 */
590
gtk_widget_show_all(GTK_WIDGET(object));
592
return GTK_WIDGET(object);
595
/* Failure (no GLX) */
598
label = gtk_label_new(err_str);
599
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
601
gtk_container_add(GTK_CONTAINER(ctk_glx), label);
604
/* Free memory that may have been allocated */
605
free(fbconfig_attribs);
607
gtk_widget_show_all(GTK_WIDGET(object));
608
return GTK_WIDGET(object);
615
/* Probes for GLX information and sets up the results
618
void ctk_glx_probe_info(GtkWidget *widget)
620
CtkGLX *ctk_glx = CTK_GLX(widget);
624
char *direct_rendering = NULL;
625
char *glx_extensions = NULL;
626
char *server_vendor = NULL;
627
char *server_version = NULL;
628
char *server_extensions = NULL;
629
char *client_vendor = NULL;
630
char *client_version = NULL;
631
char *client_extensions = NULL;
632
char *opengl_vendor = NULL;
633
char *opengl_renderer = NULL;
634
char *opengl_version = NULL;
635
char *opengl_extensions = NULL;
638
GtkWidget *hseparator;
639
GtkWidget *hbox, *hbox2;
640
GtkWidget *vbox, *vbox2;
645
/* Make sure the widget was initialized and that glx information
646
* has not yet been initialized.
648
if ( !ctk_glx || !ctk_glx->glxinfo_vpane ||
649
ctk_glx->glxinfo_initialized ) {
654
/* Get GLX information */
655
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
656
NV_CTRL_STRING_GLX_DIRECT_RENDERING,
658
if ( ret != NvCtrlSuccess ) { goto done; }
659
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
660
NV_CTRL_STRING_GLX_GLX_EXTENSIONS,
662
if ( ret != NvCtrlSuccess ) { goto done; }
665
/* Get Server GLX information */
666
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
667
NV_CTRL_STRING_GLX_SERVER_VENDOR,
669
if ( ret != NvCtrlSuccess ) { goto done; }
670
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
671
NV_CTRL_STRING_GLX_SERVER_VERSION,
673
if ( ret != NvCtrlSuccess ) { goto done; }
674
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
675
NV_CTRL_STRING_GLX_SERVER_EXTENSIONS,
677
if ( ret != NvCtrlSuccess ) { goto done; }
680
/* Get Client GLX information */
681
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
682
NV_CTRL_STRING_GLX_CLIENT_VENDOR,
684
if ( ret != NvCtrlSuccess ) { goto done; }
685
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
686
NV_CTRL_STRING_GLX_CLIENT_VERSION,
688
if ( ret != NvCtrlSuccess ) { goto done; }
689
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
690
NV_CTRL_STRING_GLX_CLIENT_EXTENSIONS,
692
if ( ret != NvCtrlSuccess ) { goto done; }
695
/* Get OpenGL information */
696
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
697
NV_CTRL_STRING_GLX_OPENGL_VENDOR,
699
if ( ret != NvCtrlSuccess ) { goto done; }
700
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
701
NV_CTRL_STRING_GLX_OPENGL_RENDERER,
703
if ( ret != NvCtrlSuccess ) { goto done; }
704
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
705
NV_CTRL_STRING_GLX_OPENGL_VERSION,
707
if ( ret != NvCtrlSuccess ) { goto done; }
708
ret = NvCtrlGetStringAttribute(ctk_glx->handle,
709
NV_CTRL_STRING_GLX_OPENGL_EXTENSIONS,
711
if ( ret != NvCtrlSuccess ) { goto done; }
714
/* Modify extension lists so they show only one name per line */
715
for ( ptr = glx_extensions; ptr != NULL && ptr[0] != '\0'; ptr++ ) {
716
if ( ptr[0] == ' ' ) ptr[0] = '\n';
718
for ( ptr = server_extensions; ptr != NULL && ptr[0] != '\0'; ptr++ ) {
719
if ( ptr[0] == ' ' ) ptr[0] = '\n';
721
for ( ptr = client_extensions; ptr != NULL && ptr[0] != '\0'; ptr++ ) {
722
if ( ptr[0] == ' ' ) ptr[0] = '\n';
724
for ( ptr = opengl_extensions; ptr != NULL && ptr[0] != '\0'; ptr++ ) {
725
if ( ptr[0] == ' ' ) ptr[0] = '\n';
729
/* Add (Shared) GLX information to widget */
730
vbox = ctk_glx->glxinfo_vpane;
731
vbox2 = gtk_vbox_new(FALSE, 0);
732
hbox = gtk_hbox_new(FALSE, 0);
733
label = gtk_label_new("GLX Information");
734
hseparator = gtk_hseparator_new();
735
gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 2);
736
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
737
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
738
gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
740
hbox = gtk_hbox_new(FALSE, 0);
741
hbox2 = gtk_hbox_new(FALSE, 0);
742
table = gtk_table_new(2, 2, FALSE);
743
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
744
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
745
add_table_row(table, 0,
746
0, 0, "Direct Rendering:",
747
0, 0, direct_rendering);
748
add_table_row(table, 1,
749
0, 0, "GLX Extensions:",
750
0, 0, glx_extensions);
751
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
752
gtk_box_pack_start(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
753
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
756
/* Add server GLX information to widget */
757
hbox = gtk_hbox_new(FALSE, 0);
758
label = gtk_label_new("Server GLX Information");
759
hseparator = gtk_hseparator_new();
760
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
761
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
762
gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
764
hbox = gtk_hbox_new(FALSE, 0);
765
hbox2 = gtk_hbox_new(FALSE, 0);
766
table = gtk_table_new(3, 2, FALSE);
767
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
768
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
769
add_table_row(table, 0,
771
0, 0, server_vendor);
772
add_table_row(table, 1,
774
0, 0, server_version);
775
add_table_row(table, 2,
777
0, 0, server_extensions);
778
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
779
gtk_box_pack_start(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
780
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
783
/* Add client GLX information to widget */
784
hbox = gtk_hbox_new(FALSE, 0);
785
label = gtk_label_new("Client GLX Information");
786
hseparator = gtk_hseparator_new();
787
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
788
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
789
gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
791
hbox = gtk_hbox_new(FALSE, 0);
792
hbox2 = gtk_hbox_new(FALSE, 0);
793
table = gtk_table_new(3, 2, FALSE);
794
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
795
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
796
add_table_row(table, 0,
798
0, 0, client_vendor);
799
add_table_row(table, 1,
801
0, 0, client_version);
802
add_table_row(table, 2,
804
0, 0, client_extensions);
805
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
806
gtk_box_pack_start(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
807
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
810
/* Add OpenGL information to widget */
811
hbox = gtk_hbox_new(FALSE, 0);
812
label = gtk_label_new("OpenGL Information");
813
hseparator = gtk_hseparator_new();
814
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
815
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
816
gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
818
hbox = gtk_hbox_new(FALSE, 0);
819
hbox2 = gtk_hbox_new(FALSE, 0);
820
table = gtk_table_new(4, 2, FALSE);
821
vbox2 = gtk_vbox_new(FALSE, 0);
822
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
823
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
824
add_table_row(table, 0,
826
0, 0, opengl_vendor);
827
add_table_row(table, 1,
829
0, 0, opengl_renderer);
830
add_table_row(table, 2,
832
0, 0, opengl_version);
833
add_table_row(table, 3,
835
0, 0, opengl_extensions);
836
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
837
gtk_box_pack_start(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
838
gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
839
gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 2);
842
/* Show the information */
843
gtk_widget_show_all(GTK_WIDGET(ctk_glx));
845
ctk_glx->glxinfo_initialized = True;
850
/* Free temp strings */
851
free(direct_rendering);
852
free(glx_extensions);
854
free(server_version);
855
free(server_extensions);
857
free(client_version);
858
free(client_extensions);
860
free(opengl_renderer);
861
free(opengl_version);
862
free(opengl_extensions);
864
} /* ctk_glx_probe_info() */
868
GtkTextBuffer *ctk_glx_create_help(GtkTextTagTable *table,
874
b = gtk_text_buffer_new(table);
876
gtk_text_buffer_get_iter_at_offset(b, &i, 0);
878
ctk_help_title(b, &i, "GLX Help");
880
"This page in the NVIDIA X Server Control Panel describes "
881
"information about the OpenGL extension to the X Server "
885
ctk_help_heading(b, &i, "Direct Rendering");
887
"This will tell you if direct rendering is available. If "
888
"direct rendering is available, then a program running on "
889
"the same computer that the control panel is running on "
890
"will be able to bypass the X Server and take advantage of "
891
"faster rendering. If direct rendering is not available, "
892
"then indirect rendering will be used and all rendering "
893
"will happen through the X Server."
895
ctk_help_heading(b, &i, "GLX Extensions");
897
"This is the list of GLX extensions that are supported by "
898
"both the client (libraries) and server (GLX extension to "
902
ctk_help_heading(b, &i, "Server GLX Vendor String");
904
"This is the vendor supplying the GLX extension running on "
907
ctk_help_heading(b, &i, "Server GLX Version String");
909
"This is the version of the GLX extension running on the X "
912
ctk_help_heading(b, &i, "Server GLX Extensions");
914
"This is the list of extensions supported by the GLX "
915
"extension running on the X Server."
918
ctk_help_heading(b, &i, "Client GLX Vendor String");
920
"This is the vendor supplying the GLX libraries."
922
ctk_help_heading(b, &i, "Client GLX Version String");
924
"This is the version of the GLX libraries."
926
ctk_help_heading(b, &i, "Client GLX Extensions");
928
"This is the list of extensions supported by the GLX "
932
ctk_help_heading(b, &i, "OpenGL Vendor String");
934
"This is the name of the vendor providing the OpenGL "
937
ctk_help_heading(b, &i, "OpenGL Renderer String");
939
"This shows the details of the graphics card on which "
942
ctk_help_heading(b, &i, "OpenGL Version String");
944
"This is the version of the OpenGL implementation."
946
ctk_help_heading(b, &i, "OpenGL Extensions");
948
"This is the list of OpenGL extensions that are supported "
952
ctk_help_heading(b, &i, "Show GLX Frame Buffer Configurations");
953
ctk_help_para(b, &i, __show_fbc_help);
955
ctk_help_heading(b, &i, "GLX Frame Buffer Configurations");
956
ctk_help_para(b, &i, "This table lists the supported frame buffer "
957
"configurations for the display.");
1034
} /* ctk_glx_create_help() */