1 /************************************************************************** 2 * 3 * Copyright 2009 VMware, Inc. All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sub license, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial portions 15 * of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 * 25 **************************************************************************/ 26 27 #include "VG/openvg.h" 28 29 #include "vg_context.h" 30 #include "api.h" 31 32 /* Hardware Queries */ 33 VGHardwareQueryResult vegaHardwareQuery(VGHardwareQueryType key, 34 VGint setting) 35 { 36 struct vg_context *ctx = vg_current_context(); 37 38 if (key < VG_IMAGE_FORMAT_QUERY || 39 key > VG_PATH_DATATYPE_QUERY) { 40 vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); 41 return VG_HARDWARE_UNACCELERATED; 42 } 43 44 if (key == VG_IMAGE_FORMAT_QUERY) { 45 if (setting < VG_sRGBX_8888 || 46 setting > VG_lABGR_8888_PRE) { 47 vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); 48 return VG_HARDWARE_UNACCELERATED; 49 } 50 } else if (key == VG_PATH_DATATYPE_QUERY) { 51 if (setting < VG_PATH_DATATYPE_S_8 || 52 setting > VG_PATH_DATATYPE_F) { 53 vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); 54 return VG_HARDWARE_UNACCELERATED; 55 } 56 } 57 /* we're supposed to accelerate everything */ 58 return VG_HARDWARE_ACCELERATED; 59 } 60 61 /* Renderer and Extension Information */ 62 const VGubyte *vegaGetString(VGStringID name) 63 { 64 struct vg_context *ctx = vg_current_context(); 65 static const VGubyte *vendor = (VGubyte *)"Tungsten Graphics, Inc"; 66 static const VGubyte *renderer = (VGubyte *)"Vega OpenVG 1.1"; 67 static const VGubyte *version = (VGubyte *)"1.1"; 68 69 if (!ctx) 70 return NULL; 71 72 switch(name) { 73 case VG_VENDOR: 74 return vendor; 75 case VG_RENDERER: 76 return renderer; 77 case VG_VERSION: 78 return version; 79 case VG_EXTENSIONS: 80 return NULL; 81 default: 82 return NULL; 83 } 84 } 85