Lines Matching refs:vsnd
814 VirtIOSound *vsnd = VIRTIO_SND(vdev); in empty_invalid_queue() local
816 g_assert(!QSIMPLEQ_EMPTY(&vsnd->invalid)); in empty_invalid_queue()
818 while (!QSIMPLEQ_EMPTY(&vsnd->invalid)) { in empty_invalid_queue()
819 buffer = QSIMPLEQ_FIRST(&vsnd->invalid); in empty_invalid_queue()
832 QSIMPLEQ_REMOVE_HEAD(&vsnd->invalid, entry); in empty_invalid_queue()
848 VirtIOSound *vsnd = VIRTIO_SND(vdev); in virtio_snd_handle_tx_xfer() local
883 if (stream_id >= vsnd->snd_conf.streams in virtio_snd_handle_tx_xfer()
884 || vsnd->pcm->streams[stream_id] == NULL) { in virtio_snd_handle_tx_xfer()
888 stream = vsnd->pcm->streams[stream_id]; in virtio_snd_handle_tx_xfer()
912 QSIMPLEQ_INSERT_TAIL(&vsnd->invalid, buffer, entry); in virtio_snd_handle_tx_xfer()
929 VirtIOSound *vsnd = VIRTIO_SND(vdev); in virtio_snd_handle_rx_xfer() local
964 if (stream_id >= vsnd->snd_conf.streams in virtio_snd_handle_rx_xfer()
965 || !vsnd->pcm->streams[stream_id]) { in virtio_snd_handle_rx_xfer()
969 stream = vsnd->pcm->streams[stream_id]; in virtio_snd_handle_rx_xfer()
990 QSIMPLEQ_INSERT_TAIL(&vsnd->invalid, buffer, entry); in virtio_snd_handle_rx_xfer()
1028 VirtIOSound *vsnd = VIRTIO_SND(dev); in virtio_snd_realize() local
1033 trace_virtio_snd_realize(vsnd); in virtio_snd_realize()
1036 if (vsnd->snd_conf.jacks > 8) { in virtio_snd_realize()
1039 vsnd->snd_conf.jacks); in virtio_snd_realize()
1042 if (vsnd->snd_conf.streams < 1 || vsnd->snd_conf.streams > 10) { in virtio_snd_realize()
1045 vsnd->snd_conf.streams); in virtio_snd_realize()
1049 if (vsnd->snd_conf.chmaps > VIRTIO_SND_CHMAP_MAX_SIZE) { in virtio_snd_realize()
1052 vsnd->snd_conf.chmaps); in virtio_snd_realize()
1056 if (!AUD_register_card("virtio-sound", &vsnd->card, errp)) { in virtio_snd_realize()
1060 vsnd->vmstate = in virtio_snd_realize()
1061 qemu_add_vm_change_state_handler(virtio_snd_vm_state_change, vsnd); in virtio_snd_realize()
1063 vsnd->pcm = g_new0(VirtIOSoundPCM, 1); in virtio_snd_realize()
1064 vsnd->pcm->snd = vsnd; in virtio_snd_realize()
1065 vsnd->pcm->streams = in virtio_snd_realize()
1066 g_new0(VirtIOSoundPCMStream *, vsnd->snd_conf.streams); in virtio_snd_realize()
1067 vsnd->pcm->pcm_params = in virtio_snd_realize()
1068 g_new0(virtio_snd_pcm_set_params, vsnd->snd_conf.streams); in virtio_snd_realize()
1071 virtio_add_feature(&vsnd->features, VIRTIO_F_VERSION_1); in virtio_snd_realize()
1080 vsnd->queues[VIRTIO_SND_VQ_CONTROL] = in virtio_snd_realize()
1082 vsnd->queues[VIRTIO_SND_VQ_EVENT] = in virtio_snd_realize()
1084 vsnd->queues[VIRTIO_SND_VQ_TX] = in virtio_snd_realize()
1086 vsnd->queues[VIRTIO_SND_VQ_RX] = in virtio_snd_realize()
1088 qemu_mutex_init(&vsnd->cmdq_mutex); in virtio_snd_realize()
1089 QTAILQ_INIT(&vsnd->cmdq); in virtio_snd_realize()
1090 QSIMPLEQ_INIT(&vsnd->invalid); in virtio_snd_realize()
1092 for (uint32_t i = 0; i < vsnd->snd_conf.streams; i++) { in virtio_snd_realize()
1093 status = virtio_snd_set_pcm_params(vsnd, i, &default_params); in virtio_snd_realize()
1100 status = virtio_snd_pcm_prepare(vsnd, i); in virtio_snd_realize()
1310 VirtIOSound *vsnd = VIRTIO_SND(dev); in virtio_snd_unrealize() local
1313 qemu_del_vm_change_state_handler(vsnd->vmstate); in virtio_snd_unrealize()
1314 trace_virtio_snd_unrealize(vsnd); in virtio_snd_unrealize()
1316 if (vsnd->pcm) { in virtio_snd_unrealize()
1317 if (vsnd->pcm->streams) { in virtio_snd_unrealize()
1318 for (uint32_t i = 0; i < vsnd->snd_conf.streams; i++) { in virtio_snd_unrealize()
1319 stream = vsnd->pcm->streams[i]; in virtio_snd_unrealize()
1327 g_free(vsnd->pcm->streams); in virtio_snd_unrealize()
1329 g_free(vsnd->pcm->pcm_params); in virtio_snd_unrealize()
1330 g_free(vsnd->pcm); in virtio_snd_unrealize()
1331 vsnd->pcm = NULL; in virtio_snd_unrealize()
1333 AUD_remove_card(&vsnd->card); in virtio_snd_unrealize()
1334 qemu_mutex_destroy(&vsnd->cmdq_mutex); in virtio_snd_unrealize()
1335 virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_CONTROL]); in virtio_snd_unrealize()
1336 virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_EVENT]); in virtio_snd_unrealize()
1337 virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_TX]); in virtio_snd_unrealize()
1338 virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_RX]); in virtio_snd_unrealize()
1345 VirtIOSound *vsnd = VIRTIO_SND(vdev); in virtio_snd_reset() local
1353 g_assert(QSIMPLEQ_EMPTY(&vsnd->invalid)); in virtio_snd_reset()
1355 WITH_QEMU_LOCK_GUARD(&vsnd->cmdq_mutex) { in virtio_snd_reset()
1356 while (!QTAILQ_EMPTY(&vsnd->cmdq)) { in virtio_snd_reset()
1357 cmd = QTAILQ_FIRST(&vsnd->cmdq); in virtio_snd_reset()
1358 QTAILQ_REMOVE(&vsnd->cmdq, cmd, next); in virtio_snd_reset()