Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/glxbackend.cpp
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Line(s) | 405 | const int attribs[] = { | |||
---|---|---|---|---|---|
411 | GLX_ALPHA_SIZE, 0, | 411 | GLX_ALPHA_SIZE, 0, | ||
412 | GLX_DEPTH_SIZE, 0, | 412 | GLX_DEPTH_SIZE, 0, | ||
413 | GLX_STENCIL_SIZE, 0, | 413 | GLX_STENCIL_SIZE, 0, | ||
414 | GLX_CONFIG_CAVEAT, GLX_NONE, | 414 | GLX_CONFIG_CAVEAT, GLX_NONE, | ||
415 | GLX_DOUBLEBUFFER, true, | 415 | GLX_DOUBLEBUFFER, true, | ||
416 | 0 | 416 | 0 | ||
417 | }; | 417 | }; | ||
418 | 418 | | |||
419 | // Try to find a double buffered configuration | 419 | const int attribs_srgb[] = { | ||
420 | GLX_RENDER_TYPE, GLX_RGBA_BIT, | ||||
421 | GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, | ||||
422 | GLX_RED_SIZE, 1, | ||||
423 | GLX_GREEN_SIZE, 1, | ||||
424 | GLX_BLUE_SIZE, 1, | ||||
425 | GLX_ALPHA_SIZE, 0, | ||||
426 | GLX_DEPTH_SIZE, 0, | ||||
427 | GLX_STENCIL_SIZE, 0, | ||||
428 | GLX_CONFIG_CAVEAT, GLX_NONE, | ||||
429 | GLX_DOUBLEBUFFER, true, | ||||
430 | GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, true, | ||||
431 | 0 | ||||
432 | }; | ||||
433 | | ||||
434 | // Try to find a double buffered sRGB capable configuration | ||||
420 | int count = 0; | 435 | int count = 0; | ||
421 | GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs, &count); | 436 | GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs_srgb, &count); | ||
437 | | ||||
438 | if (count == 0) { | ||||
439 | // Try to find a double buffered non-sRGB capable configuration | ||||
440 | configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs, &count); | ||||
441 | } | ||||
422 | 442 | | |||
423 | struct FBConfig { | 443 | struct FBConfig { | ||
424 | GLXFBConfig config; | 444 | GLXFBConfig config; | ||
425 | int depth; | 445 | int depth; | ||
426 | int stencil; | 446 | int stencil; | ||
427 | }; | 447 | }; | ||
428 | 448 | | |||
429 | std::deque<FBConfig> candidates; | 449 | std::deque<FBConfig> candidates; | ||
Show All 17 Lines | 466 | if (left.stencil < right.stencil) | |||
447 | return true; | 467 | return true; | ||
448 | 468 | | |||
449 | return false; | 469 | return false; | ||
450 | }); | 470 | }); | ||
451 | 471 | | |||
452 | if (candidates.size() > 0) { | 472 | if (candidates.size() > 0) { | ||
453 | fbconfig = candidates.front().config; | 473 | fbconfig = candidates.front().config; | ||
454 | 474 | | |||
455 | int fbconfig_id, visual_id, red, green, blue, alpha, depth, stencil; | 475 | int fbconfig_id, visual_id, red, green, blue, alpha, depth, stencil, srgb; | ||
456 | glXGetFBConfigAttrib(display(), fbconfig, GLX_FBCONFIG_ID, &fbconfig_id); | 476 | glXGetFBConfigAttrib(display(), fbconfig, GLX_FBCONFIG_ID, &fbconfig_id); | ||
457 | glXGetFBConfigAttrib(display(), fbconfig, GLX_VISUAL_ID, &visual_id); | 477 | glXGetFBConfigAttrib(display(), fbconfig, GLX_VISUAL_ID, &visual_id); | ||
458 | glXGetFBConfigAttrib(display(), fbconfig, GLX_RED_SIZE, &red); | 478 | glXGetFBConfigAttrib(display(), fbconfig, GLX_RED_SIZE, &red); | ||
459 | glXGetFBConfigAttrib(display(), fbconfig, GLX_GREEN_SIZE, &green); | 479 | glXGetFBConfigAttrib(display(), fbconfig, GLX_GREEN_SIZE, &green); | ||
460 | glXGetFBConfigAttrib(display(), fbconfig, GLX_BLUE_SIZE, &blue); | 480 | glXGetFBConfigAttrib(display(), fbconfig, GLX_BLUE_SIZE, &blue); | ||
461 | glXGetFBConfigAttrib(display(), fbconfig, GLX_ALPHA_SIZE, &alpha); | 481 | glXGetFBConfigAttrib(display(), fbconfig, GLX_ALPHA_SIZE, &alpha); | ||
462 | glXGetFBConfigAttrib(display(), fbconfig, GLX_DEPTH_SIZE, &depth); | 482 | glXGetFBConfigAttrib(display(), fbconfig, GLX_DEPTH_SIZE, &depth); | ||
463 | glXGetFBConfigAttrib(display(), fbconfig, GLX_STENCIL_SIZE, &stencil); | 483 | glXGetFBConfigAttrib(display(), fbconfig, GLX_STENCIL_SIZE, &stencil); | ||
484 | glXGetFBConfigAttrib(display(), fbconfig, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgb); | ||||
464 | 485 | | |||
465 | qCDebug(KWIN_X11STANDALONE, "Choosing GLXFBConfig %#x X visual %#x depth %d RGBA %d:%d:%d:%d ZS %d:%d", | 486 | qCDebug(KWIN_X11STANDALONE, "Choosing GLXFBConfig %#x X visual %#x depth %d RGBA %d:%d:%d:%d ZS %d:%d sRGB: %d", | ||
466 | fbconfig_id, visual_id, visualDepth(visual_id), red, green, blue, alpha, depth, stencil); | 487 | fbconfig_id, visual_id, visualDepth(visual_id), red, green, blue, alpha, depth, stencil, srgb); | ||
467 | } | 488 | } | ||
468 | 489 | | |||
469 | if (fbconfig == nullptr) { | 490 | if (fbconfig == nullptr) { | ||
470 | qCCritical(KWIN_X11STANDALONE) << "Failed to find a usable framebuffer configuration"; | 491 | qCCritical(KWIN_X11STANDALONE) << "Failed to find a usable framebuffer configuration"; | ||
471 | return false; | 492 | return false; | ||
472 | } | 493 | } | ||
473 | 494 | | |||
474 | return true; | 495 | return true; | ||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |