132001f49Smrg/* 232001f49Smrg * Copyright 2009 VMware, Inc. 332001f49Smrg * All Rights Reserved. 432001f49Smrg * 532001f49Smrg * Permission is hereby granted, free of charge, to any person obtaining a 632001f49Smrg * copy of this software and associated documentation files (the "Software"), 732001f49Smrg * to deal in the Software without restriction, including without limitation 832001f49Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 932001f49Smrg * license, and/or sell copies of the Software, and to permit persons to whom 1032001f49Smrg * the Software is furnished to do so, subject to the following conditions: 1132001f49Smrg * 1232001f49Smrg * The above copyright notice and this permission notice (including the next 1332001f49Smrg * paragraph) shall be included in all copies or substantial portions of the 1432001f49Smrg * Software. 1532001f49Smrg * 1632001f49Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1732001f49Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1832001f49Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 1932001f49Smrg * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 2032001f49Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 2132001f49Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 2232001f49Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. 2332001f49Smrg */ 2432001f49Smrg 2532001f49Smrg#include "pipe/p_compiler.h" 2632001f49Smrg#include "pipe/p_format.h" 2732001f49Smrg#include "util/u_memory.h" 2832001f49Smrg#include "util/u_debug.h" 2932001f49Smrg#include "util/u_network.h" 3032001f49Smrg 3132001f49Smrg#include "rbug/rbug.h" 3232001f49Smrg 3332001f49Smrgstatic void shader_info(struct rbug_connection *con, rbug_context_t ctx) 3432001f49Smrg{ 3532001f49Smrg struct rbug_header *header; 3632001f49Smrg struct rbug_proto_shader_list_reply *list; 3732001f49Smrg struct rbug_proto_shader_info_reply *info; 3832001f49Smrg int i; 3932001f49Smrg 4032001f49Smrg rbug_send_shader_list(con, ctx, NULL); 4132001f49Smrg 4232001f49Smrg header = rbug_get_message(con, NULL); 4332001f49Smrg assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY); 4432001f49Smrg list = (struct rbug_proto_shader_list_reply *)header; 4532001f49Smrg 4632001f49Smrg debug_printf(" context | shader | disabled |\n"); 4732001f49Smrg for (i = 0; i < list->shaders_len; i++) { 4832001f49Smrg rbug_send_shader_info(con, ctx, list->shaders[i], NULL); 4932001f49Smrg 5032001f49Smrg header = rbug_get_message(con, NULL); 5132001f49Smrg assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY); 5232001f49Smrg info = (struct rbug_proto_shader_info_reply *)header; 5332001f49Smrg 5432001f49Smrg debug_printf("%15llu | %15llu | %15u |\n", 5532001f49Smrg (unsigned long long)ctx, 5632001f49Smrg (unsigned long long)list->shaders[i], 5732001f49Smrg (unsigned)info->disabled); 5832001f49Smrg 5932001f49Smrg rbug_free_header(header); 6032001f49Smrg } 6132001f49Smrg 6232001f49Smrg rbug_free_header(&list->header); 6332001f49Smrg} 6432001f49Smrg 6532001f49Smrgstatic void talk() 6632001f49Smrg{ 6732001f49Smrg int c = u_socket_connect("localhost", 13370); 6832001f49Smrg struct rbug_connection *con = rbug_from_socket(c); 6932001f49Smrg struct rbug_header *header; 7032001f49Smrg struct rbug_proto_context_list_reply *list; 7132001f49Smrg int i; 7232001f49Smrg 7332001f49Smrg assert(c >= 0); 7432001f49Smrg assert(con); 7532001f49Smrg debug_printf("Connection get!\n"); 7632001f49Smrg 7732001f49Smrg debug_printf("Sending get contexts\n"); 7832001f49Smrg rbug_send_context_list(con, NULL); 7932001f49Smrg 8032001f49Smrg debug_printf("Waiting for contexts\n"); 8132001f49Smrg header = rbug_get_message(con, NULL); 8232001f49Smrg assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY); 8332001f49Smrg list = (struct rbug_proto_context_list_reply *)header; 8432001f49Smrg 8532001f49Smrg debug_printf("Got contexts:\n"); 8632001f49Smrg for (i = 0; i < list->contexts_len; i++) { 8732001f49Smrg shader_info(con, list->contexts[i]); 8832001f49Smrg } 8932001f49Smrg 9032001f49Smrg rbug_free_header(&list->header); 9132001f49Smrg rbug_disconnect(con); 9232001f49Smrg} 9332001f49Smrg 9432001f49Smrgint main(int argc, char** argv) 9532001f49Smrg{ 9632001f49Smrg talk(); 9732001f49Smrg return 0; 9832001f49Smrg} 99