void JvmtiEnvBase::env_dispose() { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); // We have been entered with all events disabled on this environment. // A race to re-enable events (by setting callbacks) is prevented by // checking for a valid environment when setting callbacks (while // holding the JvmtiThreadState_lock). // Mark as invalid. _magic = DISPOSED_MAGIC; // Relinquish all capabilities. jvmtiCapabilities *caps = get_capabilities(); JvmtiManageCapabilities::relinquish_capabilities(caps, caps, caps); // Same situation as with events (see above) set_native_method_prefixes(0, NULL); JvmtiTagMap* tag_map_to_deallocate = _tag_map; set_tag_map(NULL); // A tag map can be big, deallocate it now if (tag_map_to_deallocate != NULL) { delete tag_map_to_deallocate; } _needs_clean_up = true; }
void MET_set_capabilities(ISC_STATUS* user_status, tdr* trans) { AliceGlobals* tdgbl = AliceGlobals::getSpecific(); if (!(DB = trans->tdr_db_handle)) return; /*START_TRANSACTION*/ { { isc_start_transaction (isc_status, (FB_API_HANDLE*) &gds_trans, (short) 1, &DB, (short) 0, (char*) 0); }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } trans->tdr_db_caps = get_capabilities(user_status); /*ROLLBACK*/ { isc_rollback_transaction (isc_status, (FB_API_HANDLE*) &gds_trans);; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } }
/* * TODO: Implement method of setting TERM env var to xterm-256color. When I do * this with setenv() it freezes up the terminal after the application closes * for some reason. */ int t_enable_color() { get_capabilities(); if (termtype == 0) return TUI_NONE_SPECIFIED; if (strcasecmp(termtype, "xterm-256color") != 0) return TUI_TERM_NOT_SUPPORTED; if(has_colors() == FALSE) return TUI_COL_NOT_SUPPORTED; start_color(); int status = tgetent(term_buffer, termtype); if (status < 0) return TUI_NO_TERMCAP_ACCESS; if (status == 0) return TUI_TERM_NOT_DEFINED; if (maxcolors <= 0) return TUI_COL_NOT_IN_CAPS; if (maxpairs <= 0) return TUI_PAIRS_NOT_IN_CAPS; COL_MODE = 1; return maxcolors; }
static gboolean has_config_widget (const char *bdaddr, const char **uuids) { gboolean pan = FALSE, dun = FALSE; get_capabilities (bdaddr, uuids, &pan, &dun); return pan || dun; }
/*! * Determine the hardware security capabilities of this platform. * * Though a user context object is passed into this function, it will always * act in a non-blocking manner. * * @param user_ctx The user context which will be used for the query. * * @return A pointer to the capabilities object. */ fsl_shw_pco_t *fsl_shw_get_capabilities(fsl_shw_uco_t * user_ctx) { fsl_shw_pco_t *retval = NULL; if (cap.populated) { retval = &cap.pco; } else { if (get_capabilities(user_ctx, &cap.pco) == FSL_RETURN_OK_S) { cap.populated = 1; retval = &cap.pco; } } return retval; }
void JvmtiEnvBase::record_first_time_class_file_load_hook_enabled() { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); if (!_class_file_load_hook_ever_enabled) { _class_file_load_hook_ever_enabled = true; if (get_capabilities()->can_retransform_classes) { _is_retransformable = true; } else { _is_retransformable = false; // cannot add retransform capability after ClassFileLoadHook has been enabled get_prohibited_capabilities()->can_retransform_classes = 1; } } }
static int capinfo_for_dom(const char *uri, struct domain *dominfo, struct capabilities **capsinfo) { virConnectPtr conn = NULL; char *caps_xml = NULL; int ret = 0; conn = virConnectOpen(uri); if (conn == NULL) { printf("Unable to connect to libvirt\n"); goto out; } ret = get_capabilities(conn, capsinfo); out: free(caps_xml); virConnectClose(conn); return ret; }
static int usbtmc_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usbtmc_device_data *data; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; int n; int retcode; dev_dbg(&intf->dev, "%s called\n", __func__); data = kmalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; data->intf = intf; data->id = id; data->usb_dev = usb_get_dev(interface_to_usbdev(intf)); usb_set_intfdata(intf, data); kref_init(&data->kref); mutex_init(&data->io_mutex); init_waitqueue_head(&data->waitq); atomic_set(&data->iin_data_valid, 0); atomic_set(&data->srq_asserted, 0); data->zombie = 0; /* Determine if it is a Rigol or not */ data->rigol_quirk = 0; dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n", le16_to_cpu(data->usb_dev->descriptor.idVendor), le16_to_cpu(data->usb_dev->descriptor.idProduct)); for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) { if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) && (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) { dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n"); data->rigol_quirk = 1; break; } } /* Initialize USBTMC bTag and other fields */ data->bTag = 1; data->TermCharEnabled = 0; data->TermChar = '\n'; /* 2 <= bTag <= 127 USBTMC-USB488 subclass specification 4.3.1 */ data->iin_bTag = 2; /* USBTMC devices have only one setting, so use that */ iface_desc = data->intf->cur_altsetting; data->ifnum = iface_desc->desc.bInterfaceNumber; /* Find bulk in endpoint */ for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { endpoint = &iface_desc->endpoint[n].desc; if (usb_endpoint_is_bulk_in(endpoint)) { data->bulk_in = endpoint->bEndpointAddress; dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in); break; } } /* Find bulk out endpoint */ for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { endpoint = &iface_desc->endpoint[n].desc; if (usb_endpoint_is_bulk_out(endpoint)) { data->bulk_out = endpoint->bEndpointAddress; dev_dbg(&intf->dev, "Found Bulk out endpoint at %u\n", data->bulk_out); break; } } /* Find int endpoint */ for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { endpoint = &iface_desc->endpoint[n].desc; if (usb_endpoint_is_int_in(endpoint)) { data->iin_ep_present = 1; data->iin_ep = endpoint->bEndpointAddress; data->iin_wMaxPacketSize = usb_endpoint_maxp(endpoint); data->iin_interval = endpoint->bInterval; dev_dbg(&intf->dev, "Found Int in endpoint at %u\n", data->iin_ep); break; } } retcode = get_capabilities(data); if (retcode) dev_err(&intf->dev, "can't read capabilities\n"); else retcode = sysfs_create_group(&intf->dev.kobj, &capability_attr_grp); if (data->iin_ep_present) { /* allocate int urb */ data->iin_urb = usb_alloc_urb(0, GFP_KERNEL); if (!data->iin_urb) goto error_register; /* will reference data in int urb */ kref_get(&data->kref); /* allocate buffer for interrupt in */ data->iin_buffer = kmalloc(data->iin_wMaxPacketSize, GFP_KERNEL); if (!data->iin_buffer) goto error_register; /* fill interrupt urb */ usb_fill_int_urb(data->iin_urb, data->usb_dev, usb_rcvintpipe(data->usb_dev, data->iin_ep), data->iin_buffer, data->iin_wMaxPacketSize, usbtmc_interrupt, data, data->iin_interval); retcode = usb_submit_urb(data->iin_urb, GFP_KERNEL); if (retcode) { dev_err(&intf->dev, "Failed to submit iin_urb\n"); goto error_register; } } retcode = sysfs_create_group(&intf->dev.kobj, &data_attr_grp); retcode = usb_register_dev(intf, &usbtmc_class); if (retcode) { dev_err(&intf->dev, "Not able to get a minor" " (base %u, slice default): %d\n", USBTMC_MINOR_BASE, retcode); goto error_register; } dev_dbg(&intf->dev, "Using minor number %d\n", intf->minor); return 0; error_register: sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp); sysfs_remove_group(&intf->dev.kobj, &data_attr_grp); usbtmc_free_int(data); kref_put(&data->kref, usbtmc_delete); return retcode; }
static GtkWidget * get_config_widgets (const char *bdaddr, const char **uuids) { PluginInfo *info; GtkWidget *vbox, *hbox; gboolean pan = FALSE, dun = FALSE; /* Don't allow configuration if NM isn't running; it just confuses people * if they see the checkboxes but the configuration doesn't seem to have * any visible effect since they aren't running NM/bm-applet. */ if (!bm_is_running ()) return NULL; get_capabilities (bdaddr, uuids, &pan, &dun); if (!pan && !dun) return NULL; info = g_malloc0 (sizeof (PluginInfo)); info->settings = BM_SETTINGS_INTERFACE (nma_gconf_settings_new (NULL)); info->bdaddr = g_strdup (bdaddr); info->pan = pan; info->dun = dun; /* BluetoothClient setup */ info->btclient = bluetooth_client_new (); info->btmodel = bluetooth_client_get_model (info->btclient); g_signal_connect (G_OBJECT (info->btclient), "notify::default-adapter", G_CALLBACK (default_adapter_changed), info); g_signal_connect (G_OBJECT (info->btclient), "notify::default-adapter-powered", G_CALLBACK (default_adapter_powered_changed), info); /* UI setup */ vbox = gtk_vbox_new (FALSE, 6); g_object_set_data_full (G_OBJECT (vbox), "info", info, plugin_info_destroy); if (pan) { info->pan_connection = get_connection_for_bdaddr (info->settings, bdaddr, TRUE); info->pan_button = gtk_check_button_new_with_label (_("Use your mobile phone as a network device (PAN/NAP)")); if (info->pan_connection) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->pan_button), TRUE); info->pan_toggled_id = g_signal_connect (G_OBJECT (info->pan_button), "toggled", G_CALLBACK (pan_button_toggled), info); gtk_box_pack_start (GTK_BOX (vbox), info->pan_button, FALSE, TRUE, 6); } if (dun) { info->dun_connection = get_connection_for_bdaddr (info->settings, bdaddr, FALSE); info->dun_button = gtk_check_button_new_with_label (_("Access the Internet using your mobile phone (DUN)")); if (info->dun_connection) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->dun_button), TRUE); info->dun_toggled_id = g_signal_connect (G_OBJECT (info->dun_button), "toggled", G_CALLBACK (dun_button_toggled), info); gtk_box_pack_start (GTK_BOX (vbox), info->dun_button, FALSE, TRUE, 6); } hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6); /* Spinner's hbox */ info->hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), info->hbox, FALSE, FALSE, 0); info->label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), info->label, FALSE, TRUE, 6); default_adapter_powered_changed (G_OBJECT (info->btclient), NULL, info); return vbox; }
static int __init quadd_module_init(void) { int i, nr_events, err; int *events; pr_info("Branch: %s\n", QUADD_MODULE_BRANCH); pr_info("Version: %s\n", QUADD_MODULE_VERSION); pr_info("Samples version: %d\n", QUADD_SAMPLES_VERSION); pr_info("IO version: %d\n", QUADD_IO_VERSION); #ifdef QM_DEBUG_SAMPLES_ENABLE pr_info("############## DEBUG VERSION! ##############\n"); #endif atomic_set(&ctx.started, 0); atomic_set(&ctx.tegra_profiler_lock, 0); get_default_properties(); ctx.pmu_info.active = 0; ctx.pl310_info.active = 0; #ifdef CONFIG_ARM64 ctx.pmu = quadd_armv8_pmu_init(); #else ctx.pmu = quadd_armv7_pmu_init(); #endif if (!ctx.pmu) { pr_err("PMU init failed\n"); return -ENODEV; } else { events = ctx.pmu_info.supported_events; nr_events = ctx.pmu->get_supported_events(events, QUADD_MAX_COUNTERS); ctx.pmu_info.nr_supported_events = nr_events; pr_debug("PMU: amount of events: %d\n", nr_events); for (i = 0; i < nr_events; i++) pr_debug("PMU event: %s\n", quadd_get_event_str(events[i])); } #ifdef CONFIG_CACHE_L2X0 ctx.pl310 = quadd_l2x0_events_init(); #else ctx.pl310 = NULL; #endif if (ctx.pl310) { events = ctx.pl310_info.supported_events; nr_events = ctx.pl310->get_supported_events(events, QUADD_MAX_COUNTERS); ctx.pl310_info.nr_supported_events = nr_events; pr_info("pl310 success, amount of events: %d\n", nr_events); for (i = 0; i < nr_events; i++) pr_info("pl310 event: %s\n", quadd_get_event_str(events[i])); } else { pr_debug("PL310 not found\n"); } ctx.hrt = quadd_hrt_init(&ctx); if (IS_ERR(ctx.hrt)) { pr_err("error: HRT init failed\n"); return PTR_ERR(ctx.hrt); } err = quadd_power_clk_init(&ctx); if (err < 0) { pr_err("error: POWER CLK init failed\n"); return err; } ctx.comm = quadd_comm_events_init(&control); if (IS_ERR(ctx.comm)) { pr_err("error: COMM init failed\n"); return PTR_ERR(ctx.comm); } err = quadd_auth_init(&ctx); if (err < 0) { pr_err("error: auth failed\n"); return err; } err = quadd_unwind_init(); if (err < 0) { pr_err("error: EH unwinding init failed\n"); return err; } get_capabilities(&ctx.cap); quadd_proc_init(&ctx); return 0; }
/** Initializes the swapchain object. */ bool Anvil::Swapchain::init() { uint32_t n_swapchain_images = 0; auto parent_surface_ptr = m_create_info_ptr->get_rendering_surface(); VkResult result = VK_ERROR_INITIALIZATION_FAILED; Anvil::StructChainUniquePtr<VkSwapchainCreateInfoKHR> struct_chain_ptr; std::vector<VkImage> swapchain_images; const VkSurfaceTransformFlagBitsKHR swapchain_transformation = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; const WindowPlatform window_platform = m_create_info_ptr->get_window()->get_platform(); const bool is_offscreen_rendering_enabled = (window_platform == WINDOW_PLATFORM_DUMMY || window_platform == WINDOW_PLATFORM_DUMMY_WITH_PNG_SNAPSHOTS); m_size.width = parent_surface_ptr->get_width (); m_size.height = parent_surface_ptr->get_height(); /* not doing offscreen rendering */ if (!is_offscreen_rendering_enabled) { const auto& khr_swapchain_entrypoints = m_device_ptr->get_extension_khr_swapchain_entrypoints(); Anvil::StructChainer<VkSwapchainCreateInfoKHR> struct_chainer; #ifdef _DEBUG { const Anvil::SGPUDevice* sgpu_device_ptr(dynamic_cast<const Anvil::SGPUDevice*>(m_device_ptr) ); const Anvil::DeviceType device_type = m_device_ptr->get_type(); uint32_t n_physical_devices = 0; bool result_bool = false; const char* required_surface_extension_name = nullptr; VkSurfaceCapabilitiesKHR surface_caps; VkCompositeAlphaFlagsKHR supported_composite_alpha_flags = static_cast<VkCompositeAlphaFlagsKHR>(0); VkSurfaceTransformFlagsKHR supported_surface_transform_flags; #ifdef _WIN32 #if defined(ANVIL_INCLUDE_WIN3264_WINDOW_SYSTEM_SUPPORT) required_surface_extension_name = VK_KHR_WIN32_SURFACE_EXTENSION_NAME; #endif #else #if defined(ANVIL_INCLUDE_XCB_WINDOW_SYSTEM_SUPPORT) required_surface_extension_name = VK_KHR_XCB_SURFACE_EXTENSION_NAME; #endif #endif anvil_assert(required_surface_extension_name == nullptr || m_device_ptr->get_parent_instance()->is_instance_extension_supported(required_surface_extension_name) ); switch (device_type) { case Anvil::DEVICE_TYPE_SINGLE_GPU: n_physical_devices = 1; break; default: { anvil_assert_fail(); } } for (uint32_t n_physical_device = 0; n_physical_device < n_physical_devices; ++n_physical_device) { const Anvil::PhysicalDevice* current_physical_device_ptr = nullptr; switch (device_type) { case Anvil::DEVICE_TYPE_SINGLE_GPU: current_physical_device_ptr = sgpu_device_ptr->get_physical_device(); break; default: { anvil_assert_fail(); } } /* Ensure opaque composite alpha mode is supported */ anvil_assert(parent_surface_ptr->get_supported_composite_alpha_flags(&supported_composite_alpha_flags) ); anvil_assert(supported_composite_alpha_flags & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR); /* Ensure we can use the swapchain image format */ anvil_assert(parent_surface_ptr->is_compatible_with_image_format(m_create_info_ptr->get_format(), &result_bool) ); anvil_assert(result_bool); /* Ensure the transformation we're about to request is supported by the rendering surface */ anvil_assert(parent_surface_ptr->get_supported_transformations(&supported_surface_transform_flags) ); anvil_assert(supported_surface_transform_flags & swapchain_transformation); /* Ensure the requested number of swapchain images is reasonable*/ anvil_assert(parent_surface_ptr->get_capabilities(&surface_caps) ); anvil_assert(surface_caps.maxImageCount == 0 || surface_caps.maxImageCount >= m_create_info_ptr->get_n_images() ); } } #endif { VkSwapchainCreateInfoKHR create_info; create_info.clipped = true; /* we won't be reading from the presentable images */ create_info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; create_info.flags = m_create_info_ptr->get_flags(); create_info.imageArrayLayers = 1; create_info.imageColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; create_info.imageExtent.height = parent_surface_ptr->get_height(); create_info.imageExtent.width = parent_surface_ptr->get_width (); create_info.imageFormat = m_create_info_ptr->get_format (); create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; create_info.imageUsage = m_create_info_ptr->get_usage_flags(); create_info.minImageCount = m_create_info_ptr->get_n_images (); create_info.oldSwapchain = VK_NULL_HANDLE; create_info.pNext = nullptr; create_info.pQueueFamilyIndices = nullptr; create_info.presentMode = m_create_info_ptr->get_present_mode(); create_info.preTransform = swapchain_transformation; create_info.queueFamilyIndexCount = 0; create_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; create_info.surface = parent_surface_ptr->get_surface(); struct_chainer.append_struct(create_info); } struct_chain_ptr = struct_chainer.create_chain(); parent_surface_ptr->lock(); { result = khr_swapchain_entrypoints.vkCreateSwapchainKHR(m_device_ptr->get_device_vk(), struct_chain_ptr->get_root_struct(), nullptr, /* pAllocator */ &m_swapchain); } parent_surface_ptr->unlock(); anvil_assert_vk_call_succeeded(result); if (is_vk_call_successful(result) ) { set_vk_handle(m_swapchain); } /* Retrieve swap-chain images */ result = khr_swapchain_entrypoints.vkGetSwapchainImagesKHR(m_device_ptr->get_device_vk(), m_swapchain, &n_swapchain_images, nullptr); /* pSwapchainImages */ anvil_assert_vk_call_succeeded(result); anvil_assert (n_swapchain_images > 0); swapchain_images.resize(n_swapchain_images); result = khr_swapchain_entrypoints.vkGetSwapchainImagesKHR(m_device_ptr->get_device_vk(), m_swapchain, &n_swapchain_images, &swapchain_images[0]); anvil_assert_vk_call_succeeded(result); } else /* offscreen rendering */ { m_create_info_ptr->set_usage_flags(m_create_info_ptr->get_usage_flags() | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); n_swapchain_images = m_create_info_ptr->get_n_images(); } for (uint32_t n_result_image = 0; n_result_image < n_swapchain_images; ++n_result_image) { /* Spawn an Image wrapper class for the swap-chain image. */ if (!is_offscreen_rendering_enabled) { auto create_info_ptr = Anvil::ImageCreateInfo::create_swapchain_wrapper(m_device_ptr, this, swapchain_images[n_result_image], n_result_image); create_info_ptr->set_mt_safety(Anvil::Utils::convert_boolean_to_mt_safety_enum(is_mt_safe() ) ); m_image_ptrs[n_result_image] = Anvil::Image::create(std::move(create_info_ptr) ); } else { auto create_info_ptr = Anvil::ImageCreateInfo::create_nonsparse_alloc(m_device_ptr, VK_IMAGE_TYPE_2D, m_create_info_ptr->get_format(), VK_IMAGE_TILING_OPTIMAL, m_create_info_ptr->get_usage_flags(), m_size.width, m_size.height, 1, /* base_mipmap_depth */ 1, VK_SAMPLE_COUNT_1_BIT, QUEUE_FAMILY_GRAPHICS_BIT, VK_SHARING_MODE_EXCLUSIVE, false, /* in_use_full_mipmap_chain */ 0, /* in_memory_features */ 0, /* in_create_flags */ VK_IMAGE_LAYOUT_GENERAL, nullptr); create_info_ptr->set_mt_safety(Anvil::Utils::convert_boolean_to_mt_safety_enum(is_mt_safe() ) ); m_image_ptrs[n_result_image] = Anvil::Image::create(std::move(create_info_ptr) ); } /* For each swap-chain image, create a relevant view */ { auto create_info_ptr = Anvil::ImageViewCreateInfo::create_2D(m_device_ptr, m_image_ptrs[n_result_image].get(), 0, /* n_base_layer */ 0, /* n_base_mipmap_level */ 1, /* n_mipmaps */ VK_IMAGE_ASPECT_COLOR_BIT, m_create_info_ptr->get_format(), VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A); create_info_ptr->set_mt_safety(Anvil::Utils::convert_boolean_to_mt_safety_enum(is_mt_safe() ) ); m_image_view_ptrs[n_result_image] = Anvil::ImageView::create(std::move(create_info_ptr) ); } result = VK_SUCCESS; } /* Sign up for present submission notifications. This is needed to ensure that number of presented frames == * number of acquired frames at destruction time. */ { std::vector<Anvil::Queue*> queues; switch (m_device_ptr->get_type() ) { case Anvil::DEVICE_TYPE_SINGLE_GPU: { const std::vector<uint32_t>* queue_fams_with_present_support_ptr(nullptr); const auto rendering_surface_ptr (m_create_info_ptr->get_rendering_surface() ); const Anvil::SGPUDevice* sgpu_device_ptr (dynamic_cast<const Anvil::SGPUDevice*>(m_device_ptr) ); if (!rendering_surface_ptr->get_queue_families_with_present_support(&queue_fams_with_present_support_ptr) ) { break; } if (queue_fams_with_present_support_ptr == nullptr) { anvil_assert(queue_fams_with_present_support_ptr != nullptr); } else { for (const auto queue_fam : *queue_fams_with_present_support_ptr) { const uint32_t n_queues = sgpu_device_ptr->get_n_queues(queue_fam); for (uint32_t n_queue = 0; n_queue < n_queues; ++n_queue) { auto queue_ptr = sgpu_device_ptr->get_queue_for_queue_family_index(queue_fam, n_queue); anvil_assert(queue_ptr != nullptr); if (std::find(queues.begin(), queues.end(), queue_ptr) == queues.end() ) { queues.push_back(queue_ptr); } } } } break; } } for (auto queue_ptr : queues) { queue_ptr->register_for_callbacks( QUEUE_CALLBACK_ID_PRESENT_REQUEST_ISSUED, std::bind(&Swapchain::on_present_request_issued, this, std::placeholders::_1), this ); m_observed_queues.push_back(queue_ptr); } } /* Sign up for "about to close the parent window" notifications. Swapchain instance SHOULD be deinitialized * before the window is destroyed, so we're going to act as nice citizens. */ m_create_info_ptr->get_window()->register_for_callbacks( WINDOW_CALLBACK_ID_ABOUT_TO_CLOSE, std::bind(&Swapchain::on_parent_window_about_to_close, this), this ); return is_vk_call_successful(result); }
BOOL OSS_Capability_Trigger(void) { if (!get_capabilities()) return 0; return (audio_capabilities & DSP_CAP_TRIGGER) ? TRUE : FALSE; }
tdr* MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id) { struct isc_9_struct { ISC_QUAD isc_10; /* RDB$TRANSACTION_DESCRIPTION */ short isc_11; /* isc_utility */ } isc_9; struct isc_7_struct { ISC_LONG isc_8; /* RDB$TRANSACTION_ID */ } isc_7; FB_API_HANDLE request = 0; tdr* trans = NULL; AliceGlobals* tdgbl = AliceGlobals::getSpecific(); if (!(DB = handle)) return 0; /*START_TRANSACTION*/ { { isc_start_transaction (isc_status, (FB_API_HANDLE*) &gds_trans, (short) 1, &DB, (short) 0, (char*) 0); }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } const USHORT capabilities = get_capabilities(user_status); if (capabilities & CAP_transactions) { /*FOR(REQUEST_HANDLE request) TRA IN RDB$TRANSACTIONS WITH TRA.RDB$TRANSACTION_ID = id AND TRA.RDB$TRANSACTION_DESCRIPTION NOT MISSING*/ { if (!request) isc_compile_request (isc_status, (FB_API_HANDLE*) &DB, (FB_API_HANDLE*) &request, (short) sizeof(isc_6), (char*) isc_6); isc_7.isc_8 = id; if (request) isc_start_and_send (isc_status, (FB_API_HANDLE*) &request, (FB_API_HANDLE*) &gds_trans, (short) 0, (short) 4, &isc_7, (short) 0); if (!isc_status [1]) { while (1) { isc_receive (isc_status, (FB_API_HANDLE*) &request, (short) 1, (short) 10, &isc_9, (short) 0); if (!isc_9.isc_11 || isc_status [1]) break; trans = get_description(&/*TRA.RDB$TRANSACTION_DESCRIPTION*/ isc_9.isc_10); /*END_FOR*/ } }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } isc_release_request(gds_status, &request); if (gds_status[1]) { return_error(user_status); } } /*ROLLBACK*/ { isc_rollback_transaction (isc_status, (FB_API_HANDLE*) &gds_trans);; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } if (trans) trans->tdr_db_caps = capabilities; return trans; }
static int usbtmc_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usbtmc_device_data *data; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; int n; int retcode; dev_dbg(&intf->dev, "%s called\n", __func__); data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; data->intf = intf; data->id = id; data->usb_dev = usb_get_dev(interface_to_usbdev(intf)); usb_set_intfdata(intf, data); kref_init(&data->kref); mutex_init(&data->io_mutex); data->zombie = 0; /* Determine if it is a Rigol or not */ data->rigol_quirk = 0; dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n", le16_to_cpu(data->usb_dev->descriptor.idVendor), le16_to_cpu(data->usb_dev->descriptor.idProduct)); for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) { if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) && (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) { dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n"); data->rigol_quirk = 1; break; } } /* Initialize USBTMC bTag and other fields */ data->bTag = 1; data->TermCharEnabled = 0; data->TermChar = '\n'; /* USBTMC devices have only one setting, so use that */ iface_desc = data->intf->cur_altsetting; /* Find bulk in endpoint */ for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { endpoint = &iface_desc->endpoint[n].desc; if (usb_endpoint_is_bulk_in(endpoint)) { data->bulk_in = endpoint->bEndpointAddress; dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in); break; } } /* Find bulk out endpoint */ for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { endpoint = &iface_desc->endpoint[n].desc; if (usb_endpoint_is_bulk_out(endpoint)) { data->bulk_out = endpoint->bEndpointAddress; dev_dbg(&intf->dev, "Found Bulk out endpoint at %u\n", data->bulk_out); break; } } retcode = get_capabilities(data); if (retcode) dev_err(&intf->dev, "can't read capabilities\n"); else retcode = sysfs_create_group(&intf->dev.kobj, &capability_attr_grp); retcode = sysfs_create_group(&intf->dev.kobj, &data_attr_grp); retcode = usb_register_dev(intf, &usbtmc_class); if (retcode) { dev_err(&intf->dev, "Not able to get a minor" " (base %u, slice default): %d\n", USBTMC_MINOR_BASE, retcode); goto error_register; } dev_dbg(&intf->dev, "Using minor number %d\n", intf->minor); return 0; error_register: sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp); sysfs_remove_group(&intf->dev.kobj, &data_attr_grp); kref_put(&data->kref, usbtmc_delete); return retcode; }
void avdtp_dump(int level, struct frame *frm) { uint8_t hdr, sid, nsp, type; uint16_t seqn; uint32_t time, ssrc; switch (frm->num) { case 1: p_indent(level, frm); hdr = get_u8(frm); nsp = (hdr & 0x0c) == 0x04 ? get_u8(frm) : 0; sid = hdr & 0x08 ? 0x00 : get_u8(frm); printf("AVDTP(s): %s %s: transaction %d nsp 0x%02x\n", hdr & 0x08 ? pt2str(hdr) : si2str(sid), mt2str(hdr), hdr >> 4, nsp); switch (sid & 0x7f) { case 0x01: discover(level + 1, hdr, frm); break; case 0x02: case 0x0c: get_capabilities(level + 1, hdr, frm); break; case 0x03: set_configuration(level + 1, hdr, frm); break; case 0x04: get_configuration(level + 1, hdr, frm); break; case 0x05: reconfigure(level + 1, hdr, frm); break; case 0x06: open_close_stream(level + 1, hdr, frm); break; case 0x07: start_suspend_stream(level + 1, hdr, frm); break; case 0x08: open_close_stream(level + 1, hdr, frm); break; case 0x09: start_suspend_stream(level + 1, hdr, frm); break; case 0x0a: abort_streaming(level + 1, hdr, frm); break; case 0x0b: security(level + 1, hdr, frm); break; case 0x0d: delay_report(level + 1, hdr, frm); break; } break; case 2: p_indent(level, frm); hdr = get_u8(frm); type = get_u8(frm); seqn = get_u16(frm); time = get_u32(frm); ssrc = get_u32(frm); printf("AVDTP(m): ver %d %s%scc %d %spt %d seqn %d time %d ssrc %d\n", hdr >> 6, hdr & 0x20 ? "pad " : "", hdr & 0x10 ? "ext " : "", hdr & 0xf, type & 0x80 ? "mark " : "", type & 0x7f, seqn, time, ssrc); break; } raw_dump(level, frm); }
static GtkWidget * get_config_widgets (const char *bdaddr, const char **uuids) { WidgetInfo *info; NmaBtDevice *device; GtkWidget *vbox, *hbox; gboolean pan = FALSE, dun = FALSE, busy; GtkTreeIter iter; BluetoothClient *btclient; GtkTreeModel *btmodel; guint id; /* Don't allow configuration if NM isn't running; it just confuses people * if they see the checkboxes but the configuration doesn't seem to have * any visible effect since they aren't running NM/nm-applet. */ if (!nm_is_running ()) return NULL; get_capabilities (bdaddr, uuids, &pan, &dun); if (!pan && !dun) return NULL; /* BluetoothClient setup */ btclient = bluetooth_client_new (); btmodel = bluetooth_client_get_model (btclient); g_assert (btmodel); device = get_device (bdaddr); if (!device) { const char *op = NULL; gpointer proxy; char *alias; if (!get_device_iter (btmodel, bdaddr, &iter)) { g_warning ("%s: failed to retrieve device %s from gnome-bluetooth!", __func__, bdaddr); g_object_unref (btmodel); g_object_unref (btclient); return NULL; } gtk_tree_model_get (btmodel, &iter, BLUETOOTH_COLUMN_ALIAS, &alias, BLUETOOTH_COLUMN_PROXY, &proxy, -1); g_assert (proxy); /* At some point gnome-bluetooth switched to gdbus, so we don't know * if the proxy will be a DBusGProxy (dbus-glib) or a GDBusProxy (gdbus). */ if (G_IS_DBUS_PROXY (proxy)) op = g_dbus_proxy_get_object_path (G_DBUS_PROXY (proxy)); else if (DBUS_IS_G_PROXY (proxy)) op = dbus_g_proxy_get_path (DBUS_G_PROXY (proxy)); else g_assert_not_reached (); device = nma_bt_device_new (bdaddr, alias, op, pan, dun); g_free (alias); g_object_unref (proxy); if (!device) { g_warning ("%s: failed to create Bluetooth proxy object!", bdaddr); g_object_unref (btmodel); g_object_unref (btclient); return NULL; } add_device (device); } info = g_malloc0 (sizeof (WidgetInfo)); info->device = g_object_ref (device); info->btclient = btclient; g_signal_connect (G_OBJECT (btclient), "notify::default-adapter", G_CALLBACK (default_adapter_changed), info); g_signal_connect (G_OBJECT (btclient), "notify::default-adapter-powered", G_CALLBACK (default_adapter_powered_changed), info); id = g_signal_connect (device, "notify::" NMA_BT_DEVICE_PAN_ENABLED, G_CALLBACK (device_pan_enabled_cb), info); info->sigids = g_slist_prepend (info->sigids, GUINT_TO_POINTER (id)); id = g_signal_connect (device, "notify::" NMA_BT_DEVICE_DUN_ENABLED, G_CALLBACK (device_dun_enabled_cb), info); info->sigids = g_slist_prepend (info->sigids, GUINT_TO_POINTER (id)); id = g_signal_connect (device, "notify::" NMA_BT_DEVICE_BUSY, G_CALLBACK (device_busy_cb), info); info->sigids = g_slist_prepend (info->sigids, GUINT_TO_POINTER (id)); id = g_signal_connect (device, "notify::" NMA_BT_DEVICE_STATUS, G_CALLBACK (device_status_cb), info); info->sigids = g_slist_prepend (info->sigids, GUINT_TO_POINTER (id)); /* UI setup */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); g_object_set_data_full (G_OBJECT (vbox), "info", info, widget_info_destroy); busy = nma_bt_device_get_busy (device); if (pan) { info->pan_button = gtk_check_button_new_with_label (_("Use your mobile phone as a network device (PAN/NAP)")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->pan_button), nma_bt_device_get_pan_enabled (device)); info->pan_toggled_id = g_signal_connect (G_OBJECT (info->pan_button), "toggled", G_CALLBACK (pan_button_toggled), info); gtk_box_pack_start (GTK_BOX (vbox), info->pan_button, FALSE, TRUE, 6); gtk_widget_set_sensitive (info->pan_button, !busy); } if (dun) { info->dun_button = gtk_check_button_new_with_label (_("Access the Internet using your mobile phone (DUN)")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->dun_button), nma_bt_device_get_dun_enabled (device)); info->dun_toggled_id = g_signal_connect (G_OBJECT (info->dun_button), "toggled", G_CALLBACK (dun_button_toggled), info); gtk_box_pack_start (GTK_BOX (vbox), info->dun_button, FALSE, TRUE, 6); set_dun_button_sensitive (info, !busy); } hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6); /* Spinner's hbox */ info->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (hbox), info->hbox, FALSE, FALSE, 0); device_busy_cb (device, NULL, info); /* Status label */ info->status = gtk_label_new (nma_bt_device_get_status (device)); gtk_label_set_max_width_chars (GTK_LABEL (info->status), 80); gtk_label_set_line_wrap (GTK_LABEL (info->status), TRUE); gtk_box_pack_start (GTK_BOX (hbox), info->status, FALSE, TRUE, 6); default_adapter_powered_changed (G_OBJECT (info->btclient), NULL, info); return vbox; }
BOOL OSS_Capability_MMap(void) { if (!get_capabilities()) return 0; return (audio_capabilities & DSP_CAP_MMAP) ? TRUE : FALSE; }
int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) { int rc; struct arch_domain *ad = &d->arch; uint32_t capabilities = get_capabilities(d); rc = xsm_vm_event_control(XSM_PRIV, d, mop->op, mop->event); if ( rc ) return rc; switch ( mop->op ) { case XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES: mop->event = capabilities; return 0; case XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP: d->arch.mem_access_emulate_each_rep = !!mop->event; return 0; } /* * Sanity check */ if ( mop->op != XEN_DOMCTL_MONITOR_OP_ENABLE && mop->op != XEN_DOMCTL_MONITOR_OP_DISABLE ) return -EOPNOTSUPP; /* Check if event type is available. */ if ( !(capabilities & (1 << mop->event)) ) return -EOPNOTSUPP; switch ( mop->event ) { case XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG: { unsigned int ctrlreg_bitmask = monitor_ctrlreg_bitmask(mop->u.mov_to_cr.index); bool_t status = !!(ad->monitor.write_ctrlreg_enabled & ctrlreg_bitmask); struct vcpu *v; rc = status_check(mop, status); if ( rc ) return rc; if ( mop->u.mov_to_cr.sync ) ad->monitor.write_ctrlreg_sync |= ctrlreg_bitmask; else ad->monitor.write_ctrlreg_sync &= ~ctrlreg_bitmask; if ( mop->u.mov_to_cr.onchangeonly ) ad->monitor.write_ctrlreg_onchangeonly |= ctrlreg_bitmask; else ad->monitor.write_ctrlreg_onchangeonly &= ~ctrlreg_bitmask; domain_pause(d); if ( !status ) ad->monitor.write_ctrlreg_enabled |= ctrlreg_bitmask; else ad->monitor.write_ctrlreg_enabled &= ~ctrlreg_bitmask; domain_unpause(d); if ( mop->u.mov_to_cr.index == VM_EVENT_X86_CR3 ) /* Latches new CR3 mask through CR0 code */ for_each_vcpu ( d, v ) hvm_update_guest_cr(v, 0); break; } case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR: { bool_t status = ad->monitor.mov_to_msr_enabled; rc = status_check(mop, status); if ( rc ) return rc; if ( mop->op == XEN_DOMCTL_MONITOR_OP_ENABLE && mop->u.mov_to_msr.extended_capture ) { if ( hvm_enable_msr_exit_interception(d) ) ad->monitor.mov_to_msr_extended = 1; else return -EOPNOTSUPP; } else ad->monitor.mov_to_msr_extended = 0; domain_pause(d); ad->monitor.mov_to_msr_enabled = !status; domain_unpause(d); break; } case XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP: { bool_t status = ad->monitor.singlestep_enabled; rc = status_check(mop, status); if ( rc ) return rc; domain_pause(d); ad->monitor.singlestep_enabled = !status; domain_unpause(d); break; } case XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT: { bool_t status = ad->monitor.software_breakpoint_enabled; rc = status_check(mop, status); if ( rc ) return rc; domain_pause(d); ad->monitor.software_breakpoint_enabled = !status; domain_unpause(d); break; } case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST: { bool_t status = ad->monitor.guest_request_enabled; rc = status_check(mop, status); if ( rc ) return rc; ad->monitor.guest_request_sync = mop->u.guest_request.sync; domain_pause(d); ad->monitor.guest_request_enabled = !status; domain_unpause(d); break; } default: return -EOPNOTSUPP; }; return 0; }
BOOL OSS_Capability_Duplex(void) { if (!get_capabilities()) return 0; return (audio_capabilities & DSP_CAP_DUPLEX) ? TRUE : FALSE; }
int OSS_Revision(void) { if (!get_capabilities()) return 0; return audio_capabilities & DSP_CAP_REVISION; }
BOOL OSS_Capability_Realtime(void) { if (!get_capabilities()) return 0; return (audio_capabilities & DSP_CAP_REALTIME) ? TRUE : FALSE; }