VirtualBox

Changeset 82319 in vbox


Ignore:
Timestamp:
Dec 2, 2019 12:30:24 PM (5 years ago)
Author:
vboxsync
Message:

DevHDA,DevIchAc97: Use devhlp for CFGMR3 functions. Don't pass empty DebugPathOut to devices (ConsoleImpl2.cpp). bugref:9218

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHDA.cpp

    r82318 r82319  
    33413341
    33423342/**
    3343  * @callback_method_impl{FNIOMMMIOWNEWWRITE,
     3343 * @callback_method_impl{FNIOMMMIONEWWRITE,
    33443344 *      Looks up and calls the appropriate handler.}
    33453345 */
     
    47244724{
    47254725    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
    4726     PHDASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
     4726    PHDASTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
     4727    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    47274728    Assert(iInstance == 0); RT_NOREF(iInstance);
    47284729
     
    47364737
    47374738    /*
    4738      * Validations.
     4739     * Validate and read configuration.
    47394740     */
    4740     if (!CFGMR3AreValuesValid(pCfg, "RZEnabled\0"
    4741                                     "TimerHz\0"
    4742                                     "PosAdjustEnabled\0"
    4743                                     "PosAdjustFrames\0"
    4744                                     "DebugEnabled\0"
    4745                                     "DebugPathOut\0"))
    4746     {
    4747         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    4748                                 N_ ("Invalid configuration for the Intel HDA device"));
    4749     }
    4750 
    4751     int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
    4752     if (RT_FAILURE(rc))
    4753         return PDMDEV_SET_ERROR(pDevIns, rc,
    4754                                 N_("HDA configuration error: failed to read RCEnabled as boolean"));
    4755 
    4756 
    4757     rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
     4741    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "TimerHz|PosAdjustEnabled|PosAdjustFrames|DebugEnabled|DebugPathOut", "");
     4742
     4743    int rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
    47584744    if (RT_FAILURE(rc))
    47594745        return PDMDEV_SET_ERROR(pDevIns, rc,
     
    47634749        LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz));
    47644750
    4765     rc = CFGMR3QueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
     4751    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
    47664752    if (RT_FAILURE(rc))
    47674753        return PDMDEV_SET_ERROR(pDevIns, rc,
     
    47714757        LogRel(("HDA: Position adjustment is disabled\n"));
    47724758
    4773     rc = CFGMR3QueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
     4759    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
    47744760    if (RT_FAILURE(rc))
    47754761        return PDMDEV_SET_ERROR(pDevIns, rc,
     
    47794765        LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames));
    47804766
    4781     rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
     4767    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
    47824768    if (RT_FAILURE(rc))
    47834769        return PDMDEV_SET_ERROR(pDevIns, rc,
    47844770                                N_("HDA configuration error: failed to read debugging enabled flag as boolean"));
    47854771
    4786     rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
    4787                               VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
     4772    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
     4773                                     VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
    47884774    if (RT_FAILURE(rc))
    47894775        return PDMDEV_SET_ERROR(pDevIns, rc,
    47904776                                N_("HDA configuration error: failed to read debugging output path flag as string"));
    4791 
    4792     if (!strlen(pThis->Dbg.szOutPath))
    4793         RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
    47944777
    47954778    if (pThis->Dbg.fEnabled)
  • trunk/src/VBox/Devices/Audio/DevHDA.h

    r82300 r82319  
    134134    /** DMA position buffer enable bit. */
    135135    bool                    fDMAPosition;
    136     /** Flag whether the R0 and RC parts are enabled. */
    137     bool                    fRZEnabled;
    138136    /** Reserved. */
    139     bool                    fPadding1b;
     137    bool                    afPadding1b[2];
    140138    /** Number of active (running) SDn streams. */
    141139    uint8_t                 cStreamsActive;
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r82317 r82319  
    492492    /** RC pointer to the device instance. */
    493493    PPDMDEVINSRC            pDevInsRC;
    494     /** Set if R0/RC is enabled. */
    495     bool                    fRZEnabled;
    496     bool                    afPadding0[3];
     494    bool                    afPadding0[4];
    497495    /** Global Control (Bus Master Control Register). */
    498496    uint32_t                glob_cnt;
     
    40424040{
    40434041    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
    4044     PAC97STATE pThis = PDMDEVINS_2_DATA(pDevIns, PAC97STATE);
     4042    PAC97STATE      pThis   = PDMDEVINS_2_DATA(pDevIns, PAC97STATE);
     4043    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    40454044    Assert(iInstance == 0); RT_NOREF(iInstance);
    40464045
     
    40554054
    40564055    /*
    4057      * Validations.
     4056     * Validate and read configuration.
    40584057     */
    4059     if (!CFGMR3AreValuesValid(pCfg, "RZEnabled\0"
    4060                                     "Codec\0"
    4061                                     "TimerHz\0"
    4062                                     "DebugEnabled\0"
    4063                                     "DebugPathOut\0"))
    4064         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    4065                                 N_("Invalid configuration for the AC'97 device"));
    4066 
    4067     /*
    4068      * Read config data.
    4069      */
    4070     int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
    4071     if (RT_FAILURE(rc))
    4072         return PDMDEV_SET_ERROR(pDevIns, rc,
    4073                                 N_("AC'97 configuration error: failed to read RCEnabled as boolean"));
     4058    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "Codec|TimerHz|DebugEnabled|DebugPathOut", "");
    40744059
    40754060    char szCodec[20];
    4076     rc = CFGMR3QueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700");
     4061    int rc = pHlp->pfnCFGMQueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700");
    40774062    if (RT_FAILURE(rc))
    40784063        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    40794064                                N_("AC'97 configuration error: Querying \"Codec\" as string failed"));
    40804065
    4081     rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, AC97_TIMER_HZ_DEFAULT /* Default value, if not set. */);
     4066    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, AC97_TIMER_HZ_DEFAULT /* Default value, if not set. */);
    40824067    if (RT_FAILURE(rc))
    40834068        return PDMDEV_SET_ERROR(pDevIns, rc,
     
    40874072        LogRel(("AC97: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz));
    40884073
    4089     rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
     4074    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
    40904075    if (RT_FAILURE(rc))
    40914076        return PDMDEV_SET_ERROR(pDevIns, rc,
    40924077                                N_("AC97 configuration error: failed to read debugging enabled flag as boolean"));
    40934078
    4094     rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
    4095                               VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
     4079    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
     4080                                     VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
    40964081    if (RT_FAILURE(rc))
    40974082        return PDMDEV_SET_ERROR(pDevIns, rc,
    40984083                                N_("AC97 configuration error: failed to read debugging output path flag as string"));
    4099 
    4100     if (!strlen(pThis->Dbg.szOutPath))
    4101         RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
    41024084
    41034085    if (pThis->Dbg.fEnabled)
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r82252 r82319  
    28432843        if (fAudioEnabled)
    28442844        {
    2845             Utf8Str strAudioDevice;
    2846 
    2847             AudioControllerType_T audioController;
    2848             hrc = audioAdapter->COMGETTER(AudioController)(&audioController);               H();
    2849             AudioCodecType_T audioCodec;
    2850             hrc = audioAdapter->COMGETTER(AudioCodec)(&audioCodec);                         H();
     2845            AudioControllerType_T enmAudioController;
     2846            hrc = audioAdapter->COMGETTER(AudioController)(&enmAudioController);            H();
     2847            AudioCodecType_T enmAudioCodec;
     2848            hrc = audioAdapter->COMGETTER(AudioCodec)(&enmAudioCodec);                      H();
    28512849
    28522850            GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp);
    2853             const uint64_t fDebugEnabled = (strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1")) ? 1 : 0;
     2851            const bool fDebugEnabled = strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1");
    28542852
    28552853            Utf8Str strDebugPathOut;
     
    28592857             *        without duplicating (more) code. */
    28602858
    2861             switch (audioController)
     2859            const char *pszAudioDevice;
     2860            switch (enmAudioController)
    28622861            {
    28632862                case AudioControllerType_AC97:
    28642863                {
    28652864                    /* ICH AC'97. */
    2866                     strAudioDevice = "ichac97";
    2867 
    2868                     InsertConfigNode   (pDevices, strAudioDevice.c_str(),  &pDev);
    2869                     InsertConfigNode   (pDev,     "0",                     &pInst);
    2870                     InsertConfigInteger(pInst,    "Trusted",               1); /* boolean */
    2871                     hrc = pBusMgr->assignPCIDevice(strAudioDevice.c_str(), pInst);          H();
    2872                     InsertConfigNode   (pInst,    "Config",                &pCfg);
    2873                     switch (audioCodec)
     2865                    pszAudioDevice = "ichac97";
     2866
     2867                    InsertConfigNode(pDevices,      pszAudioDevice,         &pDev);
     2868                    InsertConfigNode(pDev,          "0",                    &pInst);
     2869                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
     2870                    hrc = pBusMgr->assignPCIDevice(pszAudioDevice, pInst);              H();
     2871                    InsertConfigNode(pInst,         "Config",               &pCfg);
     2872                    switch (enmAudioCodec)
    28742873                    {
    28752874                        case AudioCodecType_STAC9700:
    2876                             InsertConfigString(pCfg,   "Codec", "STAC9700");
     2875                            InsertConfigString(pCfg, "Codec",              "STAC9700");
    28772876                            break;
    28782877                        case AudioCodecType_AD1980:
    2879                             InsertConfigString(pCfg,   "Codec", "AD1980");
     2878                            InsertConfigString(pCfg, "Codec",              "AD1980");
    28802879                            break;
    28812880                        default: AssertFailedBreak();
    28822881                    }
    2883                     InsertConfigInteger(pCfg, "DebugEnabled", fDebugEnabled);
    2884                     InsertConfigString (pCfg, "DebugPathOut", strDebugPathOut);
     2882                    InsertConfigInteger(pCfg,       "DebugEnabled",         fDebugEnabled);
     2883                    if (strDebugPathOut.isNotEmpty())
     2884                        InsertConfigString(pCfg,    "DebugPathOut",         strDebugPathOut);
    28852885                    break;
    28862886                }
     
    28882888                {
    28892889                    /* Legacy SoundBlaster16. */
    2890                     strAudioDevice = "sb16";
    2891 
    2892                     InsertConfigNode   (pDevices, strAudioDevice.c_str(), &pDev);
    2893                     InsertConfigNode   (pDev,     "0", &pInst);
    2894                     InsertConfigInteger(pInst,    "Trusted",              1); /* boolean */
    2895                     InsertConfigNode   (pInst,    "Config",               &pCfg);
    2896                     InsertConfigInteger(pCfg,     "IRQ",                  5);
    2897                     InsertConfigInteger(pCfg,     "DMA",                  1);
    2898                     InsertConfigInteger(pCfg,     "DMA16",                5);
    2899                     InsertConfigInteger(pCfg,     "Port",                 0x220);
    2900                     InsertConfigInteger(pCfg,     "Version",              0x0405);
     2890                    pszAudioDevice = "sb16";
     2891
     2892                    InsertConfigNode(pDevices,      pszAudioDevice,        &pDev);
     2893                    InsertConfigNode(pDev,          "0", &pInst);
     2894                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
     2895                    InsertConfigNode(pInst,         "Config",               &pCfg);
     2896                    InsertConfigInteger(pCfg,       "IRQ",                  5);
     2897                    InsertConfigInteger(pCfg,       "DMA",                  1);
     2898                    InsertConfigInteger(pCfg,       "DMA16",                5);
     2899                    InsertConfigInteger(pCfg,       "Port",                 0x220);
     2900                    InsertConfigInteger(pCfg,       "Version",              0x0405);
    29012901                    break;
    29022902                }
     
    29042904                {
    29052905                    /* Intel HD Audio. */
    2906                     strAudioDevice = "hda";
    2907 
    2908                     InsertConfigNode   (pDevices, strAudioDevice.c_str(),  &pDev);
    2909                     InsertConfigNode   (pDev,     "0",                     &pInst);
    2910                     InsertConfigInteger(pInst,    "Trusted",               1); /* boolean */
    2911                     hrc = pBusMgr->assignPCIDevice(strAudioDevice.c_str(), pInst);          H();
    2912                     InsertConfigNode   (pInst,    "Config",                &pCfg);
    2913                     InsertConfigInteger(pCfg,     "DebugEnabled",          fDebugEnabled);
    2914                     InsertConfigString (pCfg,     "DebugPathOut",          strDebugPathOut);
     2906                    pszAudioDevice = "hda";
     2907
     2908                    InsertConfigNode(pDevices,      pszAudioDevice,         &pDev);
     2909                    InsertConfigNode(pDev,          "0",                    &pInst);
     2910                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
     2911                    hrc = pBusMgr->assignPCIDevice(pszAudioDevice, pInst);              H();
     2912                    InsertConfigNode(pInst,         "Config",               &pCfg);
     2913                    InsertConfigInteger(pCfg,       "DebugEnabled",         fDebugEnabled);
     2914                    if (strDebugPathOut.isNotEmpty())
     2915                        InsertConfigString(pCfg,    "DebugPathOut",         strDebugPathOut);
    29152916                    break;
    29162917                }
     
    30163017            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
    30173018            InsertConfigString(pLunL0, "Driver", "AUDIO");
    3018             AudioDriverCfg DrvCfgVRDE(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVRDE");
     3019            AudioDriverCfg DrvCfgVRDE(pszAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVRDE");
    30193020            rc = mAudioVRDE->InitializeConfig(&DrvCfgVRDE);
    30203021            if (RT_SUCCESS(rc))
     
    30263027            InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
    30273028            InsertConfigString(pLunL0, "Driver", "AUDIO");
    3028             AudioDriverCfg DrvCfgVideoRec(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVideoRec");
     3029            AudioDriverCfg DrvCfgVideoRec(pszAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVideoRec");
    30293030            rc = Recording.mAudioRec->InitializeConfig(&DrvCfgVideoRec);
    30303031            if (RT_SUCCESS(rc))
     
    30443045                 * Tweak the logging groups.
    30453046                 */
    3046                 Utf8Str strLogGroups = "drv_host_audio.e.l.l2.l3.f+" \
    3047                                        "drv_audio.e.l.l2.l3.f+" \
    3048                                        "audio_mixer.e.l.l2.l3.f+" \
    3049                                        "dev_hda_codec.e.l.l2.l3.f+" \
    3050                                        "dev_hda.e.l.l2.l3.f+" \
    3051                                        "dev_ac97.e.l.l2.l3.f+" \
     3047                Utf8Str strLogGroups = "drv_host_audio.e.l.l2.l3.f+"
     3048                                       "drv_audio.e.l.l2.l3.f+"
     3049                                       "audio_mixer.e.l.l2.l3.f+"
     3050                                       "dev_hda_codec.e.l.l2.l3.f+"
     3051                                       "dev_hda.e.l.l2.l3.f+"
     3052                                       "dev_ac97.e.l.l2.l3.f+"
    30523053                                       "dev_sb16.e.l.l2.l3.f";
    30533054
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette