1 Reply Latest reply on Nov 4, 2013 12:19 PM by chm

    ADLDisplayMap and ADLDisplayTarget

    jossgray

      I'm confused about these structures and how they are used in the ADL_Display_DisplayMapConfig_Set method.

       

      I'm looking to reassign displays when they get mixed up so that, logical display 0 is mapped as the first display, 1 is the second, and so on.

       

      Please could some explain in a bit more depth, how this function works with the two structures.

       

      Thanks.

        • Re: ADLDisplayMap and ADLDisplayTarget
          chm

          Hi,

           

          I I understand your question correctly you want to change the position at which a display appears. The DisplayMap contains teh different DisplayModes. The DisplayMode actually defines the position of the display. The code below shows how to swap two displays. Maybe this illustrates how DisplayMapConfig_Set works. To swap the displays I just change the position of the actual displays. Assume the function is called with a list of 2 Adapter Index and two DisplayIndex:

           

          bool swapDisplaysMode(int* nAdapterIdx, int* pDspIndexList)
          {
              int                 nNumModes;
          ADLDisplayMap       mapArray[2];
              ADLDisplayTarget    pDisplayTargets[2];

              memset(&(mapArray), 0, 2 * sizeof(ADLDisplayMap));

          mapArray[0].iNumDisplayTarget = 2;
          mapArray[0].iDisplayMapIndex  = 0;

              int               numMaps[2]    = { 0, 0 };
              int               numTargets[2] = { 0, 0 };
              ADLDisplayMap*    pMaps[2]      = { NULL, NULL };
              ADLDisplayTarget* pTargets[2]   = { NULL, NULL };

              int err = ADL_Display_DisplayMapConfig_Get(nAdapterIdx[0], &numMaps[0], &pMaps[0], &numTargets[0], &pTargets[0], 0);

              err = ADL_Display_DisplayMapConfig_Get(nAdapterIdx[1], &numMaps[1], &pMaps[1], &numTargets[1], &pTargets[1], 0);

              mapArray[0].iNumDisplayTarget          = pMaps[0]->iNumDisplayTarget;
              mapArray[0].iDisplayMapIndex           = pMaps[0]->iDisplayMapIndex;

              mapArray[0].displayMode.iAdapterIndex  = nAdapterIdx[0];
          mapArray[0].displayMode.iModeFlag      = pMaps[0]->displayMode.iModeFlag;
          mapArray[0].displayMode.iOrientation   = pMaps[0]->displayMode.iOrientation;
          mapArray[0].displayMode.fRefreshRate   = pMaps[0]->displayMode.fRefreshRate;
          mapArray[0].displayMode.iColourDepth   = pMaps[0]->displayMode.iColourDepth;
          mapArray[0].displayMode.iXPos          = pMaps[1]->displayMode.iXPos;
          mapArray[0].displayMode.iYPos          = pMaps[1]->displayMode.iYPos;
          mapArray[0].displayMode.iXRes          = pMaps[1]->displayMode.iXRes;
          mapArray[0].displayMode.iYRes          = pMaps[1]->displayMode.iYRes;
              mapArray[0].iDisplayMapValue           = ADL_DISPLAY_DISPLAYMAP_MANNER_SINGLE;

           

              mapArray[1].iNumDisplayTarget          = pMaps[1]->iNumDisplayTarget;
              mapArray[1].iDisplayMapIndex           = pMaps[1]->iDisplayMapIndex;

              mapArray[1].displayMode.iAdapterIndex  = nAdapterIdx[1];
          mapArray[1].displayMode.iModeFlag      = pMaps[1]->displayMode.iModeFlag;
          mapArray[1].displayMode.iOrientation   = pMaps[1]->displayMode.iOrientation;
          mapArray[1].displayMode.fRefreshRate   = pMaps[1]->displayMode.fRefreshRate;
          mapArray[1].displayMode.iColourDepth   = pMaps[1]->displayMode.iColourDepth;
          mapArray[1].displayMode.iXPos          = pMaps[0]->displayMode.iXPos;
          mapArray[1].displayMode.iYPos          = pMaps[0]->displayMode.iYPos;
          mapArray[1].displayMode.iXRes          = pMaps[0]->displayMode.iXRes;
          mapArray[1].displayMode.iYRes          = pMaps[0]->displayMode.iYRes;
              mapArray[1].iDisplayMapValue           = ADL_DISPLAY_DISPLAYMAP_MANNER_SINGLE;

             
              pDisplayTargets[0].displayID          = pTargets[0]->displayID;
              pDisplayTargets[0].iDisplayMapIndex   = pTargets[0]->iDisplayMapIndex;
              pDisplayTargets[0].iDisplayTargetMask = pTargets[0]->iDisplayTargetMask;
              pDisplayTargets[0].iDisplayTargetValue = pTargets[0]->iDisplayTargetValue;

              pDisplayTargets[1].displayID          = pTargets[1]->displayID;
              pDisplayTargets[1].iDisplayMapIndex   = pTargets[1]->iDisplayMapIndex;
              pDisplayTargets[1].iDisplayTargetMask = pTargets[1]->iDisplayTargetMask;
              pDisplayTargets[1].iDisplayTargetValue = pTargets[1]->iDisplayTargetValue;

              err = ADL_Display_DisplayMapConfig_Set(nAdapterIdx[0] , 2, mapArray, 2, pDisplayTargets);
             
          ADL_Free(pMaps[0]);
              ADL_Free(pMaps[1]);
              ADL_Free(pTargets[0]);
              ADL_Free(pTargets[1]);

              return true;
          }

           

          Chris