Some cleanups (mostly ui/audio)
cover Some cleanups (mostly ui/audio)
Hi,
Please review those ui/audio related patches,
thanks
---
Marc-André Lureau (7):
audio: fix nominal volume channel (cosmetic) python/wheel: remove meson-1.9.0 scripts/vendor.py: add pycotap
audio: require pulse >= 0.9.13
audio: require spice >= 0.15
ui: drop legacy spice < 0.15 support code
ui: drop spice-protocol < 0.14.3 support
meson.build | 6 +++--- include/ui/qemu-spice.h | 6 ------ audio/audio.c | 2 +- audio/paaudio.c | 28 ++------------------------- audio/spiceaudio.c | 30 ----------------------------- chardev/spice.c | 6 ------ hw/display/qxl.c | 23 ++-------------------- ui/spice-display.c | 15 --------------- ui/vdagent.c | 18 ----------------- python/scripts/vendor.py | 2 ++ python/wheels/meson-1.9.0-py3-none-any.whl | Bin 1029634 -> 0 bytes 11 files changed, 10 insertions(+), 126 deletions(-)
---
base-commit: 0b91040d23dc8820724a60c811223b777f3bc6b7
change-id: 20260211-cleanups-b51df70c3b2f
Best regards,
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH 1/7 audio: fix nominal volume channel (cosmetic)
--- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio.c +1 -1
@@ -1948,7 +1948,7 @@ void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol) sw->vol.mute = vol->mute; sw->vol.l = nominal_volume.l * vol->vol[0 ] /255 ; - sw->vol.r = nominal_volume.l * vol->vol[vol->channels >1 ?1 :0 ] / + sw->vol.r = nominal_volume.r * vol->vol[vol->channels >1 ?1 :0 ] /255 ;if (hw->pcm_ops->volume_out) {
Signature · 1 line
2.52.0
PATCH 3/7 scripts/vendor.py: add pycotap
In reply to Marc-André LureauRelated to commit 5ec1eec11000ef118b2a87c330245ffaa475f5ee ("python:
Install pycotap in our venv if necessary")
--- python/scripts/vendor.py | 2 ++ 1 file changed, 2 insertions(+)
python/scripts/vendor.py +2 -0
@@ -43,6 +43,8 @@ def main() -> int: packages = { "meson==1.10.0": "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585", + "pycotap==1.3.1": + "1c3a25b3ff89e48f4e00f1f71dbbc1642b4f65c65d416524d07e73492fff25ea", } vendor_dir = Path(__file__, "..", "..", "wheels").resolve()
Signature · 1 line
2.52.0
PATCH 4/7 audio: require pulse >= 0.9.13
In reply to Marc-André Lureaupulseaudio 0.9.13 was released on 2009-09-10. All our supported distros have it.
PA_*_IS_GOOD are from 0.9.11.
--- meson.build | 2 +- audio/paaudio.c | 28 ++-------------------------- 2 files changed, 3 insertions(+), 27 deletions(-)
meson.build +1 -1
@@ -1283,7 +1283,7 @@ endif pulse = not_found if not get_option('pa').auto() or (host_os == 'linux' and have_system) - pulse = dependency('libpulse', required: get_option('pa'), + pulse = dependency('libpulse', version: '>=0.9.13', required: get_option('pa'), method: 'pkg-config') endif alsa = not_found
audio/paaudio.c +2 -26
@@ -54,26 +54,6 @@ static void G_GNUC_PRINTF (2, 3) qpa_logerr (int err, const char *fmt, ...)AUD_log (AUDIO_CAP ,"Reason: %s\n" ,pa_strerror (err)); } -#ifndef PA_CONTEXT_IS_GOOD -static inline int PA_CONTEXT_IS_GOOD (pa_context_state_t x) -{ -return - x ==PA_CONTEXT_CONNECTING || - x ==PA_CONTEXT_AUTHORIZING || - x ==PA_CONTEXT_SETTING_NAME || - x ==PA_CONTEXT_READY ; -} -#endif - -#ifndef PA_STREAM_IS_GOOD -static inline int PA_STREAM_IS_GOOD (pa_stream_state_t x) -{ -return - x ==PA_STREAM_CREATING || - x ==PA_STREAM_READY ; -} -#endif -#define CHECK_SUCCESS_GOTO (c, expression, label, msg) \ do { \ if (!(expression)) { \
@@ -671,9 +651,7 @@ static void qpa_volume_out(HWVoiceOut *hw, Volume *vol)PAConnection *c = pa->g->conn;int i; -#ifdef PA_CHECK_VERSION /* macro is present in 0.9.16+ */ -pa_cvolume_init (&v);/* function is present in 0.9.13+ */ -#endif +pa_cvolume_init (&v); v.channels = vol->channels;for (i =0 ; i < vol->channels; ++i) {
@@ -713,9 +691,7 @@ static void qpa_volume_in(HWVoiceIn *hw, Volume *vol)PAConnection *c = pa->g->conn;int i; -#ifdef PA_CHECK_VERSION -pa_cvolume_init (&v); -#endif +pa_cvolume_init (&v); v.channels = vol->channels;for (i =0 ; i < vol->channels; ++i) {
Signature · 1 line
2.52.0
PATCH 5/7 audio: require spice >= 0.15
In reply to Marc-André LureauSpice server 0.15.0 was released on 2021-04-16. It is part of all our supported distro (except CentOS 9, which doesn't include it).
It has all the new required audio APIs/interfaces.
--- meson.build | 2 +- audio/spiceaudio.c | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-)
meson.build +1 -1
@@ -1320,7 +1320,7 @@ if get_option('spice') \ .require(pixman.found(), error_message: 'cannot enable SPICE if pixman is not available') \ .allowed() - spice = dependency('spice-server', version: '>=0.14.0', + spice = dependency('spice-server', version: '>=0.15.0', required: get_option('spice'), method: 'pkg-config') endif
audio/spiceaudio.c +0 -30
@@ -29,17 +29,8 @@#include "qemu/audio.h" #include "audio_int.h" -#if SPICE_INTERFACE_PLAYBACK_MAJOR >1 ||SPICE_INTERFACE_PLAYBACK_MINOR >=3 #define LINE_OUT_SAMPLES (480 * 4) -#else -#define LINE_OUT_SAMPLES (256 * 4) -#endif - -#if SPICE_INTERFACE_RECORD_MAJOR >2 ||SPICE_INTERFACE_RECORD_MINOR >=3 #define LINE_IN_SAMPLES (480 * 4) -#else -#define LINE_IN_SAMPLES (256 * 4) -#endif typedef struct SpiceVoiceOut { HWVoiceOut hw;
@@ -95,11 +86,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsettings *as,SpiceVoiceOut *out =container_of (hw, SpiceVoiceOut, hw);struct audsettings settings; -#if SPICE_INTERFACE_PLAYBACK_MAJOR >1 ||SPICE_INTERFACE_PLAYBACK_MINOR >=3 settings.freq =spice_server_get_best_playback_rate (NULL ); -#else - settings.freq =SPICE_INTERFACE_PLAYBACK_FREQ ; -#endif settings.nchannels =SPICE_INTERFACE_PLAYBACK_CHAN ; settings.fmt =AUDIO_FORMAT_S16 ; settings.endianness =HOST_BIG_ENDIAN ;
@@ -110,9 +97,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsettings *as, out->sin.base.sif = &playback_sif.base; qemu_spice.add_interface (&out->sin.base); -#if SPICE_INTERFACE_PLAYBACK_MAJOR >1 ||SPICE_INTERFACE_PLAYBACK_MINOR >=3 spice_server_set_playback_rate (&out->sin, settings.freq); -#endif return 0 ; }
@@ -190,7 +175,6 @@ static void line_out_enable(HWVoiceOut *hw, bool enable) } } -#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >=1 ) && (SPICE_INTERFACE_PLAYBACK_MINOR >=2 ))static void line_out_volume (HWVoiceOut *hw,Volume *vol) {SpiceVoiceOut *out =container_of (hw, SpiceVoiceOut, hw);
@@ -202,7 +186,6 @@ static void line_out_volume(HWVoiceOut *hw, Volume *vol)spice_server_playback_set_volume (&out->sin,2 , svol);spice_server_playback_set_mute (&out->sin, vol->mute); } -#endif /* record */
@@ -211,11 +194,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)SpiceVoiceIn *in =container_of (hw, SpiceVoiceIn, hw);struct audsettings settings; -#if SPICE_INTERFACE_RECORD_MAJOR >2 ||SPICE_INTERFACE_RECORD_MINOR >=3 settings.freq =spice_server_get_best_record_rate (NULL ); -#else - settings.freq =SPICE_INTERFACE_RECORD_FREQ ; -#endif settings.nchannels =SPICE_INTERFACE_RECORD_CHAN ; settings.fmt =AUDIO_FORMAT_S16 ; settings.endianness =HOST_BIG_ENDIAN ;
@@ -226,9 +205,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) in->sin.base.sif = &record_sif.base; qemu_spice.add_interface (&in->sin.base); -#if SPICE_INTERFACE_RECORD_MAJOR >2 ||SPICE_INTERFACE_RECORD_MINOR >=3 spice_server_set_record_rate (&in->sin, settings.freq); -#endif return 0 ; }
@@ -277,7 +254,6 @@ static void line_in_enable(HWVoiceIn *hw, bool enable) } } -#if ((SPICE_INTERFACE_RECORD_MAJOR >=2 ) && (SPICE_INTERFACE_RECORD_MINOR >=2 ))static void line_in_volume (HWVoiceIn *hw,Volume *vol) {SpiceVoiceIn *in =container_of (hw, SpiceVoiceIn, hw);
@@ -289,7 +265,6 @@ static void line_in_volume(HWVoiceIn *hw, Volume *vol)spice_server_record_set_volume (&in->sin,2 , svol);spice_server_record_set_mute (&in->sin, vol->mute); } -#endif static struct audio_pcm_ops audio_callbacks = { .init_out = line_out_init,
@@ -299,19 +274,14 @@ static struct audio_pcm_ops audio_callbacks = { .get_buffer_out = line_out_get_buffer, .put_buffer_out = line_out_put_buffer, .enable_out = line_out_enable, -#if (SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && \ - (SPICE_INTERFACE_PLAYBACK_MINOR >= 2) .volume_out = line_out_volume, -#endif .init_in = line_in_init, .fini_in = line_in_fini, .read = line_in_read, .run_buffer_in = audio_generic_run_buffer_in, .enable_in = line_in_enable, -#if ((SPICE_INTERFACE_RECORD_MAJOR >= 2) && (SPICE_INTERFACE_RECORD_MINOR >= 2)) .volume_in = line_in_volume, -#endif };static struct audio_driver spice_audio_driver = {
Signature · 1 line
2.52.0
PATCH 6/7 ui: drop legacy spice < 0.15 support code
In reply to Marc-André Lureau--- include/ui/qemu-spice.h | 6 ------ chardev/spice.c | 6 ------ hw/display/qxl.c | 23 ++--------------------- ui/spice-display.c | 15 --------------- 4 files changed, 2 insertions(+), 48 deletions(-)
include/ui/qemu-spice.h +0 -6
@@ -34,12 +34,6 @@ int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);int qemu_spice_migrate_info (const char *hostname,int port,int tls_port,const char *subject); -#if SPICE_SERVER_VERSION >=0x000f00 /* release 0.15.0 */ -#define SPICE_HAS_ATTACHED_WORKER 1 -#else -#define SPICE_HAS_ATTACHED_WORKER 0 -#endif -#else /* CONFIG_SPICE */ #include "qemu/error-report.h"
chardev/spice.c +0 -6
@@ -278,12 +278,6 @@ static void qemu_chr_open_spice_vmc(Chardev *chr, } *be_opened = false; -#if SPICE_SERVER_VERSION <0x000e02 -/* Spice < 0.14.2 doesn't explicitly open smartcard chardev */ -if (strcmp (type,"smartcard" ) ==0 ) { - *be_opened = true; - } -#endif chr_open (chr, type); }
hw/display/qxl.c +2 -21
@@ -261,11 +261,6 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG , 0)); }else { -#if SPICE_SERVER_VERSION <0x000e02 /* release 0.14.2 */ -if (qxl->max_outputs) { -spice_qxl_set_max_monitors (&qxl->ssd.qxl, qxl->max_outputs); - } -#endif qxl->guest_monitors_config = qxl->ram->monitors_config; spice_qxl_monitors_config_async(&qxl->ssd.qxl, qxl->ram->monitors_config,
@@ -535,13 +530,6 @@ static void interface_attached_worker(QXLInstance *sin)trace_qxl_interface_attach_worker (qxl->id); } -#if !(SPICE_HAS_ATTACHED_WORKER ) -static void interface_attach_worker (QXLInstance *sin,QXLWorker *qxl_worker) -{ -interface_attached_worker (sin); -} -#endif -static void interface_set_compression_level (QXLInstance *sin,int level) {PCIQXLDevice *qxl =container_of (sin, PCIQXLDevice, ssd.qxl);
@@ -1136,12 +1124,7 @@ static const QXLInterface qxl_interface = { .base.major_version = SPICE_INTERFACE_QXL_MAJOR, .base.minor_version = SPICE_INTERFACE_QXL_MINOR, -#if SPICE_HAS_ATTACHED_WORKER .attached_worker = interface_attached_worker, -#else - .attache_worker = interface_attach_worker, -#endif - .set_compression_level = interface_set_compression_level, .get_init_info = interface_get_init_info,
@@ -2109,6 +2092,8 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)uint8_t * config = qxl->pci.config;uint32_t pci_device_rev;uint32_t io_size; +Error *err =NULL ; +char device_address[256 ] ="" ;qemu_spice_display_init_common (&qxl->ssd); qxl->mode =QXL_MODE_UNDEFINED ;
@@ -2208,9 +2193,6 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)return ; } -#if SPICE_SERVER_VERSION >=0x000e02 /* release 0.14.2 */ -Error *err =NULL ; -char device_address[256 ] ="" ;if (qemu_console_fill_device_address (qxl->vga.con, device_address,sizeof (device_address), &err)) {
@@ -2221,7 +2203,6 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp) }else {error_report_err (err); } -#endif qemu_add_vm_change_state_handler (qxl_vm_change_state_handler, qxl);
ui/spice-display.c +0 -15
@@ -507,17 +507,10 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)/* spice display interface callbacks */ -#if SPICE_HAS_ATTACHED_WORKER static void interface_attached_worker (QXLInstance *sin) {/* nothing to do */ } -#else -static void interface_attach_worker (QXLInstance *sin,QXLWorker *qxl_worker) -{ -/* nothing to do */ -} -#endif static void interface_set_compression_level (QXLInstance *sin,int level) {
@@ -689,13 +682,11 @@ static int interface_client_monitors_config(QXLInstance *sin,if (mc->num_of_monitors > head) { info.width = mc->monitors[head].width; info.height = mc->monitors[head].height; -#if SPICE_SERVER_VERSION >=0x000e04 /* release 0.14.4 */ if (mc->flags &VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE ) {VDAgentMonitorMM *mm = (void *)&mc->monitors[mc->num_of_monitors]; info.width_mm = mm[head].width; info.height_mm = mm[head].height; } -#endif }trace_qemu_spice_ui_info (ssd->qxl.id, info.width, info.height);
@@ -709,11 +700,7 @@ static const QXLInterface dpy_interface = { .base.major_version = SPICE_INTERFACE_QXL_MAJOR, .base.minor_version = SPICE_INTERFACE_QXL_MINOR, -#if SPICE_HAS_ATTACHED_WORKER .attached_worker = interface_attached_worker, -#else - .attache_worker = interface_attach_worker, -#endif .set_compression_level = interface_set_compression_level, .get_init_info = interface_get_init_info,
@@ -1414,7 +1401,6 @@ static void qemu_spice_display_init_one(QemuConsole *con) ssd->qxl.base.sif = &dpy_interface.base;qemu_spice_add_display_interface (&ssd->qxl, con); -#if SPICE_SERVER_VERSION >=0x000e02 /* release 0.14.2 */ Error *err =NULL ;char device_address[256 ] ="" ;if (qemu_console_fill_device_address (con, device_address,256 , &err)) {
@@ -1425,7 +1411,6 @@ static void qemu_spice_display_init_one(QemuConsole *con) }else {error_report_err (err); } -#endif qemu_spice_create_host_memslot (ssd);
Signature · 1 line
2.52.0
PATCH 7/7 ui: drop spice-protocol < 0.14.3 support
In reply to Marc-André LureauAccording to repology, all our supported distributions have 0.14.3.
--- meson.build | 2 +- ui/vdagent.c | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-)
meson.build +1 -1
@@ -1310,7 +1310,7 @@ endif spice_protocol = not_found if not get_option('spice_protocol').auto() or have_system - spice_protocol = dependency('spice-protocol', version: '>=0.14.0', + spice_protocol = dependency('spice-protocol', version: '>=0.14.3', required: get_option('spice_protocol'), method: 'pkg-config') endif
ui/vdagent.c +0 -18
@@ -17,14 +17,6 @@#include "spice/vd_agent.h" -#define CHECK_SPICE_PROTOCOL_VERSION (major, minor, micro) \ - (CONFIG_SPICE_PROTOCOL_MAJOR > (major) || \ - (CONFIG_SPICE_PROTOCOL_MAJOR == (major) && \ - CONFIG_SPICE_PROTOCOL_MINOR > (minor)) || \ - (CONFIG_SPICE_PROTOCOL_MAJOR == (major) && \ - CONFIG_SPICE_PROTOCOL_MINOR == (minor) && \ - CONFIG_SPICE_PROTOCOL_MICRO >= (micro))) -#define VDAGENT_BUFFER_LIMIT (1 * MiB)#define VDAGENT_MOUSE_DEFAULT true#define VDAGENT_CLIPBOARD_DEFAULT false
@@ -87,10 +79,8 @@ static const char *cap_name[] = { [VD_AGENT_CAP_FILE_XFER_DISABLED] = "file-xfer-disabled", [VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS] = "file-xfer-detailed-errors", [VD_AGENT_CAP_GRAPHICS_DEVICE_INFO] = "graphics-device-info", -#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 1) [VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB] = "clipboard-no-release-on-regrab", [VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL] = "clipboard-grab-serial", -#endif };static const char *msg_name[] = {
@@ -125,9 +115,7 @@ static const char *type_name[] = { [VD_AGENT_CLIPBOARD_IMAGE_BMP] = "bmp", [VD_AGENT_CLIPBOARD_IMAGE_TIFF] = "tiff", [VD_AGENT_CLIPBOARD_IMAGE_JPG] = "jpg", -#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 3) [VD_AGENT_CLIPBOARD_FILE_LIST] = "files", -#endif };#define GET_NAME (_m, _v) \
@@ -197,9 +185,7 @@ static void vdagent_send_caps(VDAgentChardev *vd, bool request)if (vd->clipboard) { caps->caps[0 ] |= (1 <<VD_AGENT_CAP_CLIPBOARD_BY_DEMAND ); caps->caps[0 ] |= (1 <<VD_AGENT_CAP_CLIPBOARD_SELECTION ); -#if CHECK_SPICE_PROTOCOL_VERSION (0 ,14 ,1 ) caps->caps[0 ] |= (1 <<VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL ); -#endif } caps->request = request;
@@ -318,11 +304,7 @@ static bool have_selection(VDAgentChardev *vd)static bool have_clipboard_serial (VDAgentChardev *vd) { -#if CHECK_SPICE_PROTOCOL_VERSION (0 ,14 ,1 )return vd->caps & (1 <<VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL ); -#else -return false; -#endif }static uint32_t type_qemu_to_vdagent (enum QemuClipboardType type)
Signature · 1 line
2.52.0
Thomas Huth
Reviewed-byRe: [PATCH 2/7] python/wheel: remove meson-1.9.0
In reply to a message not in the archivepython/wheels/meson-1.9.0-py3-none-any.whl
Quoted 9 lines · Marc-André Lureau
Leftover from commit
8c04b6a48b15a478ff3f9d152592a0ba503a31e4.Signed-off-by Marc-André Lureau <[email protected]>--- python/wheels/meson-1.9.0-py3-none-any.whl | Bin 1029634 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-)python/wheels/meson-1.9.0-py3-none-any.whl deleted +0
-0
Re: [PATCH 3/7] scripts/vendor.py: add pycotap
In reply to Marc-André LureauQuoted 13 lines · Marc-André Lureau
Related to commit
5ec1eec11000ef118b2a87c330245ffaa475f5ee("python:
Install pycotap in our venv if necessary")Signed-off-by Marc-André Lureau <[email protected]>--- python/scripts/vendor.py | 2 ++ 1 file changed, 2 insertions(+)python/scripts/vendor.py +0
-0
python/scripts/vendor.py def main() -> int: · line 48
Quoted 6 lines
python/scripts/vendor.py +2
-0@@ -43,6 +43,8 @@ def main() -> int: packages = { "meson==1.10.0": "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585", + "pycotap==1.3.1": + "1c3a25b3ff89e48f4e00f1f71dbbc1642b4f65c65d416524d07e73492fff25ea", }
This will have a (trivial) conflict with:
https://lore.kernel.org/qemu-devel/[email protected]/
Anyway,
Paolo Bonzini
AppliedQuoted 6 lines · Marc-André Lureau
Hi,
Please review those ui/audio related patches,
thanksSigned-off-by Marc-André Lureau <[email protected]>
Queued, thanks.
Paolo
Quoted 27 lines
---
Marc-André Lureau (7):
audio: fix nominal volume channel (cosmetic) python/wheel: remove meson-1.9.0scripts/vendor.py: add pycotap
audio: require pulse >= 0.9.13
audio: require spice >= 0.15
ui: drop legacy spice < 0.15 support code
ui: drop spice-protocol < 0.14.3 supportmeson.build | 6 +++--- include/ui/qemu-spice.h | 6 ------ audio/audio.c | 2 +- audio/paaudio.c | 28 ++------------------------- audio/spiceaudio.c | 30 ----------------------------- chardev/spice.c | 6 ------ hw/display/qxl.c | 23 ++-------------------- ui/spice-display.c | 15 --------------- ui/vdagent.c | 18 ----------------- python/scripts/vendor.py | 2 ++ python/wheels/meson-1.9.0-py3-none-any.whl | Bin 1029634 -> 0 bytes 11 files changed, 10 insertions(+), 126 deletions(-)---
base-commit:0b91040d23dc8820724a60c811223b777f3bc6b7
change-id: 20260211-cleanups-b51df70c3b2fBest regards,