question

JTurner-2908 avatar image
0 Votes"
JTurner-2908 asked StriveSun-MSFT commented

IDXGIOutputDuplication::AcquireNextFrame

I'm using IDXGIOutputDuplication::AcquireNextFrame with a rotated monitor. When using on Win10 I'm getting an un-rotated orientation frame like the documentation states. When using on Win8.1 the frame returned is not un-rotated but is matching the screen orientation. Is there a way to determine if the returned frame is un-rotated or not?

windows-api-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, @JTurner-2908

When using on Win8.1 the frame returned is not un-rotated but is matching the screen orientation.

I did not find the parameter containing the orientation information from IDXGIOutputDuplication::AcquireNextFrame, maybe I missed something?

Which api do you use to get the size and orientation of the frame? You can add some codes and images to describe the problem, don't forget to erase personal information.



0 Votes 0 ·

I save the Rotation value from when I'm calling IDXGIOutputDuplication::GetDesc when I'm calling IDXGIAdapter::EnumOutputs. What I really need to know is if this a Win8 behavior or if it is the graphic driver behavior. If it acts this way only with Win8 I can code for that. If this is a driver issue then I don't know how to handle it.

0 Votes 0 ·
StriveSun-MSFT avatar image
0 Votes"
StriveSun-MSFT answered

Hello, @JTurner-2908

I save the Rotation value from when I'm calling IDXGIOutputDuplication::GetDesc when I'm calling IDXGIAdapter::EnumOutputs.

 typedef struct DXGI_OUTPUT_DESC {
   WCHAR              DeviceName[32];
   RECT               DesktopCoordinates;
   BOOL               AttachedToDesktop;
   DXGI_MODE_ROTATION Rotation;
   HMONITOR           Monitor;
 } DXGI_OUTPUT_DESC;

1.png

Do you mean the DesktopCoordinates and Rotation parameters? They will change as the display orientation changes.


When using on Win8.1 the frame returned is not un-rotated but is matching the screen orientation.

What does un-rotated mean? How will the Rotation value change?

What I really need to know is if this a Win8 behavior or if it is the graphic driver behavior.

I'm not sure for the time being whether the results I got are consistent with yours, so I need more details on debugging before we get the correct answer.



Thank you!

If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (25.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JTurner-2908 avatar image
0 Votes"
JTurner-2908 answered StriveSun-MSFT commented

From https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/desktop-dup-api

Rotating the desktop image
You must add explicit code to your desktop duplication client app to support rotated modes. In a rotated mode, the surface that you receive from IDXGIOutputDuplication::AcquireNextFrame is always in the un-rotated orientation, and the desktop image is rotated within the surface. For example, if the desktop is set to 768x1024 at 90 degrees rotation, AcquireNextFrame returns a 1024x768 surface with the desktop image rotated within it. Here are some rotation examples.

On a Win10 machine a 1920x1080 monitor in portrait mode will return an un-rotated image in 1920x1080. On Win8.1 the image I get matches the orientation of the monitor and is 1080x1920. This makes it really hard to try and handle both cases. My concern is that it is the video driver that is returning the image in 1080x1920 and that on Win10 I'll still have a problem. I'm trying to find an api that will tell me if the captured frame is rotated or un-rotated other than the width and height values. Because if the monitor is in landscaped (flipped) there is no way to determine what the orientation is.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

On win8.1 machine, rotating the desktop image,the surface returned by IDXGIOutputDuplication::AcquireNextFrame will not always keep 1920x1080?

I noticed that the surface returned by win10 will always return 1920x1080 from the doc.


0 Votes 0 ·