4 Replies Latest reply on Sep 21, 2010 10:57 AM by Kirk

    Problem with setting rotation modes using IEGD driver on Windows 7

    Green Belt

       

       

      Hi, I am able to use the gui utility to set the rotated modes on my device but am not able to programtically change the rotation following the example in the IEGD SDK.

       

      The problem I am seeing is that the calls to ChangeDisplay Settings are failing with BADMODE ( -2 ) return code as a result of the mode not being valid when swapping width and height values. Call sequence looks like this with error checking removed:

       

      hdc = GetDC( Null );

       

       

       

       

       

       

       

       

       

       

       

      rot_flip.port_number = (((

      rot_flip.flip = 0;

       

       

      rot_flip.rotation = 90;

       

      rot_flip.rotation = 0;

       

      ExtEscape(hdc, INTEL_ESCAPE_SET_ROTATION_FLIP , input_size, rot_flip, 0, null);uint)hdc >> (PRIMARY * 4)) & 0x0f);

       

      ReleaseDC(hdc);

       

       

      int  mode_num = 0;

       

       

      // loop to refresh all available modes for this rotation setting

       

       

       

      while(true)

      {

       

       

         if (EnumDisplaySettings(null, mode_num++, dm_enum) == 0)

       

       

         {

       

       

            break;

         }

       

      }

       

       

       

      EnumDisplaySettings(null, ENUM_CURRENT_SETTINGS,  dm);

       

       

       

       

       

      int

      dm.dmPelsHeight = dm.dmPelsWidth;

      dm.dmPelsWidth = temp;

      temp = dm.dmPelsHeight;

      dm.dmFields =

      DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |DM_DISPLAYFREQUENCY;

       

       

       

      ChangeDisplaySettings(dm, CDS_NORESET | CDS_UPDATEREGISTRY CDS_GLOBAL);

       

      ChangeDisplaySettings(0, 0);

       

       The calls to enumerate the modes are returning modes for the zero degree rotation so I would expect the call to ChangeDisplaySettings to fail since the width and height of the modes dont match for the 90 degree rotation.

       

       

      The call to ExtEscape is returning a a valid return code although I think this may be what is failing.

       

       

       

      So the Question is ... what am I doing wrong since the gui application obviously works? 

       

       

      I notice that the sample code in the SDK to set the flip and rotation is never called from within the sample.

        • Re: Problem with setting rotation modes using IEGD driver on Windows 7
          Green Belt

          I was able to figure it out ... needed to get an internal dc using ExtEscape and from there derive the port number. Once I had the port number right eveything else worked.

           

          No need to respond.

            • Re: Problem with setting rotation modes using IEGD driver on Windows 7
              Felix_M BlackBelt

              Hi Sholten:

               

              Welcome to the Intel® Embedded Community.

               

              Glad you figured it out. And thanks for sharing the solution with the community!

               

              Thanks

              Felix

                  • Re: Problem with setting rotation modes using IEGD driver on Windows 7
                    Kirk Brown Belt

                                }

                                //          ........................................................................

                                long status;

                                if (devModeCur.dmPelsWidth == devModeRot.dmPelsWidth)
                                {
                                            if (devModeRot.dmBitsPerPel == 16)
                                                        devModeRot.dmBitsPerPel = 32;
                                            else if (devModeRot.dmBitsPerPel == 32)
                                                        devModeRot.dmBitsPerPel = 16;

                                            status = ChangeDisplaySettings(&devModeRot, 0);

                                            if (devModeRot.dmBitsPerPel == 16)
                                                        devModeRot.dmBitsPerPel = 32;
                                            else if (devModeRot.dmBitsPerPel == 32)
                                                        devModeRot.dmBitsPerPel = 16;
                                }

                                printf("New Mode : \%dx\%dx\%d@\%d\n",
                                               devModeRot.dmPelsWidth, devModeRot.dmPelsHeight,
                                               devModeRot.dmBitsPerPel, devModeRot.dmDisplayFrequency);

                                status = ChangeDisplaySettings(&devModeRot, CDS_RESET | CDS_UPDATEREGISTRY | CDS_GLOBAL);
                                if (status != DISP_CHANGE_SUCCESSFUL)
                                {
                                            printf("Error ! ChangeDisplaySettings() failed with status=\%d\n", status);
                                }

                                modeNum = 0;

                                while (1)
                                {
                                            DEVMODE devModeEnum;

                                            if (! EnumDisplaySettings(NULL, modeNum, &devModeEnum))
                                                        break;

                                            modeNum++;
                                }
                    }