b8d253b30c
Adds an optional region selection, based off percentages of the starting/ending of an image's X & Y values. This is intended as a performance enhancement tradeoff for smaller images to be created. With a smaller image size, the screenshotting layer will change the region boundaries on the GPU side, which will decrease the amount of time it takes to copy the image over to CPU-accessible memory. Using vkcube as an example, the original image size is 500x500: mesa-screenshot: DEBUG: Screenshot Authorized! mesa-screenshot: DEBUG: Needs 2 steps mesa-screenshot: DEBUG: Time to copy: 123530 nanoseconds Then, by cropping the area to a 100x100 image, we get the following: mesa-screenshot: DEBUG: Screenshot Authorized! mesa-screenshot: DEBUG: Using region: startX = 40% (200), startY = 40% (200), endX = 60% (300), endY = 60% (300) mesa-screenshot: DEBUG: Needs 2 steps mesa-screenshot: DEBUG: Time to copy: 12679 nanoseconds For this example, this is a ~90% time reduction improvement! Overall, this option reduces the copy time to a point where it can become negligible, relative to the frame time of the application. Signed-off-by: Casey Bowman <casey.g.bowman@intel.com> Reviewed-by: Felix DeGrood felix.j.degrood@intel.com Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32016>