[gnome-remote-desktop/gnome-42] tests/egl: Replace tautologies with actual modifier checks



commit 9f27eb5dd57b399286b947caca4e2eab93d44643
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue May 10 18:28:15 2022 +0200

    tests/egl: Replace tautologies with actual modifier checks
    
    The DRM format modifier should only be used, when it is not invalid.
    The current checks currently do not correctly check for this.
    Instead, the existence of the modifiers array in the DmaBuf struct is
    always checked, which is always true.
    
    So, fix this by replacing this tautology with an actual modifier check.

 tests/egl-thread-test.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/tests/egl-thread-test.c b/tests/egl-thread-test.c
index c834a51e..51de7209 100644
--- a/tests/egl-thread-test.c
+++ b/tests/egl-thread-test.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <drm_fourcc.h>
 #include <epoxy/egl.h>
 #include <epoxy/gl.h>
 #include <fcntl.h>
@@ -95,7 +96,7 @@ create_dmabuf_image (EGLDisplay  egl_display,
       attribs[atti++] = dma_buf->offsets[0];
       attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
       attribs[atti++] = dma_buf->strides[0];
-      if (dma_buf->modifiers)
+      if (dma_buf->modifiers[0] != DRM_FORMAT_MOD_INVALID)
         {
           attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
           attribs[atti++] = dma_buf->modifiers[0] & 0xFFFFFFFF;
@@ -112,7 +113,7 @@ create_dmabuf_image (EGLDisplay  egl_display,
       attribs[atti++] = dma_buf->offsets[1];
       attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT;
       attribs[atti++] = dma_buf->strides[1];
-      if (dma_buf->modifiers)
+      if (dma_buf->modifiers[1] != DRM_FORMAT_MOD_INVALID)
         {
           attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT;
           attribs[atti++] = dma_buf->modifiers[1] & 0xFFFFFFFF;
@@ -129,7 +130,7 @@ create_dmabuf_image (EGLDisplay  egl_display,
       attribs[atti++] = dma_buf->offsets[2];
       attribs[atti++] = EGL_DMA_BUF_PLANE2_PITCH_EXT;
       attribs[atti++] = dma_buf->strides[2];
-      if (dma_buf->modifiers)
+      if (dma_buf->modifiers[2] != DRM_FORMAT_MOD_INVALID)
         {
           attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT;
           attribs[atti++] = dma_buf->modifiers[2] & 0xFFFFFFFF;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]