1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright © 2011 Intel Corporation 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"), 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and/or sell copies of the Software, and to permit persons to whom the 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software is furnished to do so, subject to the following conditions: 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the next 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * paragraph) shall be included in all copies or substantial portions of the 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software. 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DEALINGS IN THE SOFTWARE. 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <gtest/gtest.h> 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <string.h> 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" { 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "glxclient.h" 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "glx_error.h" 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <xcb/glx.h> 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "mock_xdisplay.h" 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "fake_glx_screen.h" 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic bool CreateContextAttribsARB_was_sent; 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic xcb_glx_create_context_attribs_arb_request_t req; 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic uint32_t sent_attribs[1024]; 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic uint32_t next_id; 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct glx_screen *psc; 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" Bool 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_context_init(struct glx_context *gc, 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_screen *psc, struct glx_config *config) 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->majorOpcode = 123; 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->screen = psc->scr; 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->psc = psc; 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->config = config; 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->isDirect = GL_TRUE; 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->currentContextTag = -1; 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return GL_TRUE; 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" struct glx_screen * 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgGetGLXScreenConfigs(Display * dpy, int scrn) 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (void) dpy; 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (void) scrn; 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return psc; 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" uint32_t 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgxcb_generate_id(xcb_connection_t *c) 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (void) c; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return next_id++; 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" xcb_void_cookie_t 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgxcb_glx_create_context_attribs_arb_checked(xcb_connection_t *c, 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org xcb_glx_context_t context, 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t fbconfig, 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t screen, 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t share_list, 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint8_t is_direct, 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t num_attribs, 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const uint32_t *attribs) 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (void) c; 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org CreateContextAttribsARB_was_sent = true; 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.context = context; 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.fbconfig = fbconfig; 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.screen = screen; 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.share_list = share_list; 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.is_direct = is_direct; 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org req.num_attribs = num_attribs; 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (num_attribs != 0 && attribs != NULL) 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org memcpy(sent_attribs, attribs, num_attribs * 2 * sizeof(uint32_t)); 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org xcb_void_cookie_t cookie; 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org cookie.sequence = 0xbadc0de; 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return cookie; 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" xcb_generic_error_t * 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgxcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie) 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return NULL; 106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" void 109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org__glXSendErrorForXcb(Display * dpy, const xcb_generic_error_t *err) 110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern "C" void 114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org__glXSendError(Display * dpy, int_fast8_t errorCode, uint_fast32_t resourceID, 115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint_fast16_t minorCode, bool coreX11error) 116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgclass glXCreateContextAttribARB_test : public ::testing::Test { 120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgpublic: 121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org virtual void SetUp(); 122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Replace the existing screen with a direct-rendering screen 125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void use_direct_rendering_screen(); 127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org mock_XDisplay *dpy; 129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_config fbc; 130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglXCreateContextAttribARB_test::SetUp() 134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org CreateContextAttribsARB_was_sent = false; 136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org memset(&req, 0, sizeof(req)); 137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org next_id = 99; 138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org fake_glx_context::contexts_allocated = 0; 139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc = new fake_glx_screen(NULL, 0, ""); 140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->dpy = new mock_XDisplay(1); 142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org memset(&this->fbc, 0, sizeof(this->fbc)); 144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->fbc.fbconfigID = 0xbeefcafe; 145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid 148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglXCreateContextAttribARB_test::use_direct_rendering_screen() 149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_screen *direct_psc = 151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org new fake_glx_screen_direct(psc->display, 152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc->scr, 153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc->serverGLXexts); 154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org delete psc; 156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc = direct_psc; 157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \name Verify detection of client-side errors 161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@{*/ 163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, NULL_display_returns_None) 164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(NULL, (GLXFBConfig) &this->fbc, 0, 167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(None, ctx); 170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0, fake_glx_context::contexts_allocated); 171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, NULL_fbconfig_returns_None) 174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, NULL, 0, False, NULL); 177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(None, ctx); 179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0, fake_glx_context::contexts_allocated); 180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, NULL_screen_returns_None) 183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org delete psc; 185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc = NULL; 186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(None, ctx); 192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0, fake_glx_context::contexts_allocated); 193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@}*/ 195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \name Verify that correct protocol bits are sent to the server. 198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@{*/ 200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, does_send_protocol) 201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_TRUE(CreateContextAttribsARB_was_sent); 206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_context) 209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(99u, req.context); 214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_fbconfig) 217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0xbeefcafe, req.fbconfig); 222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_share_list) 225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext share = 227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, share); 231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, share, 233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *glx_ctx = (struct glx_context *) share; 236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(glx_ctx->xid, req.share_list); 237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_true) 240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org True, NULL); 243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(req.is_direct); 245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_false) 248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(req.is_direct); 253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_direct_screen_and_direct_set_to_true) 256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->use_direct_rendering_screen(); 258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org True, NULL); 261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_TRUE(req.is_direct); 263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_direct_screen_and_direct_set_to_false) 266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->use_direct_rendering_screen(); 268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(req.is_direct); 273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_screen) 276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->fbc.screen = 7; 278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc->scr = 7; 279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(7u, req.screen); 284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs) 287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* Use zeros in the second half of each attribute pair to try and trick the 289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * implementation into termiating the list early. 290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Use non-zero in the second half of the last attribute pair to try and 292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * trick the implementation into not terminating the list early enough. 293f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 294f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org static const int attribs[] = { 295f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 1, 0, 296f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 2, 0, 297f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 3, 0, 298f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 4, 0, 299f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 0, 6, 300f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 0, 0 301f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org }; 302f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 303f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 304f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, attribs); 305f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 306f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(4u, req.num_attribs); 307f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 308f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 309f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs_empty_list) 310f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 311f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org static const int attribs[] = { 312f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 0, 313f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org }; 314f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 315f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 316f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, attribs); 317f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 318f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0u, req.num_attribs); 319f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 320f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 321f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs_NULL_list_pointer) 322f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 323f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 324f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 325f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 326f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(0u, req.num_attribs); 327f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 328f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 329f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, sent_correct_attrib_list) 330f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 331f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int attribs[] = { 332f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLX_RENDER_TYPE, GLX_RGBA_TYPE, 333f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLX_CONTEXT_MAJOR_VERSION_ARB, 1, 334f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLX_CONTEXT_MINOR_VERSION_ARB, 2, 335f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 0 336f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org }; 337f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 338f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 339f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, attribs); 340f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 341f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org for (unsigned i = 0; i < 6; i++) { 342f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ((uint32_t) attribs[i], sent_attribs[i]); 343f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 344f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 345f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@}*/ 346f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 347f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 348f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \name Verify details of the returned GLXContext 349f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 350f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@{*/ 351f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context) 352f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 353f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 354f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 355f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 356f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 357f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* Since the server did not return an error, the GLXContext should not be 358f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NULL. 359f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 360f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_NE((GLXContext)0, ctx); 361f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 362f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* It shouldn't be the XID of the context either. 363f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 364f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_NE((GLXContext)99, ctx); 365f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 366f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 367f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_xid) 368f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 369f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 370f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 371f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 372f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 373f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* Since the server did not return an error, the GLXContext should not be 374f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NULL. 375f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 376f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext)0, ctx); 377f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 378f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *glx_ctx = (struct glx_context *) ctx; 379f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(99u, glx_ctx->xid); 380f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 381f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 382f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_share_xid) 383f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 384f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext first = 385f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 386f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 387f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 388f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, first); 389f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 390f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext second = 391f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, first, 392f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 393f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 394f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, second); 395f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 396f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *share = (struct glx_context *) first; 397f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *ctx = (struct glx_context *) second; 398f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(share->xid, ctx->share_xid); 399f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 400f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 401f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_true) 402f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 403f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 404f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 405f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org True, NULL); 406f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 407f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 408f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 409f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 410f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 411f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(gc->isDirect); 412f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 413f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 414f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_false) 415f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 416f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 417f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 418f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 419f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 420f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 421f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 422f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 423f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 424f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(gc->isDirect); 425f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 426f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 427f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_direct_screen_and_direct_set_to_true) 428f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 429f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->use_direct_rendering_screen(); 430f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 431f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 432f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 433f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org True, NULL); 434f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 435f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 436f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 437f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 438f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 439f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_TRUE(gc->isDirect); 440f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 441f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 442f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_direct_screen_and_direct_set_to_false) 443f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 444f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->use_direct_rendering_screen(); 445f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 446f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 447f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 448f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 449f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 450f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 451f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 452f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 453f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 454f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_FALSE(gc->isDirect); 455f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 456f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 457f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_indirect_context_client_state_private) 458f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 459f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 460f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 461f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 462f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 463f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 464f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 465f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 466f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 467f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_FALSE(gc->isDirect); 468f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ((struct __GLXattributeRec *) 0xcafebabe, 469f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org gc->client_state_private); 470f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 471f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 472f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_indirect_context_config) 473f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 474f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 475f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 476f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 477f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 478f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 479f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 480f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 481f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 482f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(&this->fbc, gc->config); 483f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 484f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 485f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_screen_number) 486f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 487f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org this->fbc.screen = 7; 488f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org psc->scr = 7; 489f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 490f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 491f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 492f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 493f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 494f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 495f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 496f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 497f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 498f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(7, gc->screen); 499f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 500f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 501f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgTEST_F(glXCreateContextAttribARB_test, correct_context_screen_pointer) 502f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 503f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org GLXContext ctx = 504f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 505f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org False, NULL); 506f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 507f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org ASSERT_NE((GLXContext) 0, ctx); 508f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 509f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct glx_context *gc = (struct glx_context *) ctx; 510f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 511f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPECT_EQ(psc, gc->psc); 512f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 513f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*@}*/ 514