gpu: Compare fourccs, not GdkMemoryFormat

For dmabufs, the format is not an exact description of the data, it only
gives the closest memory format for a given fourcc.
This of course means that multiple different fourccs may report the same
format.

So when deciding if we need to copy the image to get the right data to
download, we need to check if the fourcc is correct, not if the format
is.

Related: #7046
This commit is contained in:
Benjamin Otte 2024-09-30 22:11:02 +02:00
parent 754c9cb323
commit ae741a06c0

View File

@ -17,6 +17,7 @@
#include "gskrendererprivate.h"
#include "gdk/gdkdmabufdownloaderprivate.h"
#include "gdk/gdkdmabuftextureprivate.h"
#include "gdk/gdkdrawcontextprivate.h"
#include "gdk/gdktexturedownloaderprivate.h"
@ -806,6 +807,7 @@ gsk_gpu_frame_download_texture (GskGpuFrame *self,
gsize stride)
{
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
const GdkDmabuf *dmabuf;
GdkColorState *image_cs;
GskGpuImage *image;
@ -826,10 +828,11 @@ gsk_gpu_frame_download_texture (GskGpuFrame *self,
}
image_cs = gdk_texture_get_color_state (texture);
dmabuf = gdk_dmabuf_texture_get_dmabuf (GDK_DMABUF_TEXTURE (texture));
gsk_gpu_frame_cleanup (self);
if (gsk_gpu_image_get_format (image) != format ||
if (gdk_memory_format_get_dmabuf_fourcc (gsk_gpu_image_get_format (image)) != dmabuf->fourcc ||
image_cs != color_state)
{
GskGpuImage *converted;