Mesa (master): wgl: Add PFD flags based on stw_winsys callback response

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 10:43:32 UTC 2020


Module: Mesa
Branch: master
Commit: acf8af458f50600bbbbffaa46f782fec6ffe2df6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=acf8af458f50600bbbbffaa46f782fec6ffe2df6

Author: Jesse Natalie <jenatali at ntdev.microsoft.com>
Date:   Wed Mar 18 10:00:20 2020 -0700

wgl: Add PFD flags based on stw_winsys callback response

Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7535>

---

 src/gallium/frontends/wgl/stw_pixelformat.c | 33 +++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/gallium/frontends/wgl/stw_pixelformat.c b/src/gallium/frontends/wgl/stw_pixelformat.c
index dc922afd140..a494aa2b1d7 100644
--- a/src/gallium/frontends/wgl/stw_pixelformat.c
+++ b/src/gallium/frontends/wgl/stw_pixelformat.c
@@ -38,6 +38,7 @@
 #include "stw_device.h"
 #include "stw_pixelformat.h"
 #include "stw_tls.h"
+#include "stw_winsys.h"
 
 
 struct stw_pf_color_info
@@ -112,6 +113,13 @@ stw_pf_doublebuffer[] = {
 };
 
 
+static const stw_pfd_flag
+stw_pf_flag[] = {
+   stw_pfd_double_buffer,
+   stw_pfd_gdi_support,
+};
+
+
 const unsigned
 stw_pf_multisample[] = {
    0,
@@ -128,6 +136,7 @@ stw_pixelformat_add(struct stw_device *stw_dev,
                     const struct stw_pf_depth_info *depth,
                     unsigned accum,
                     boolean doublebuffer,
+                    boolean gdi,
                     unsigned samples)
 {
    struct stw_pixelformat_info *pfi;
@@ -163,6 +172,9 @@ stw_pixelformat_add(struct stw_device *stw_dev,
    if (doublebuffer)
       pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
 
+   if (gdi)
+      pfi->pfd.dwFlags |= PFD_SUPPORT_GDI;
+
    pfi->pfd.iPixelType = PFD_TYPE_RGBA;
 
    pfi->pfd.cColorBits =
@@ -229,11 +241,15 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
                           unsigned num_color_formats, boolean extended)
 {
    struct pipe_screen *screen = stw_dev->screen;
-   unsigned cfmt, ms, db, ds, acc;
+   unsigned cfmt, ms, db, ds, acc, f;
    unsigned bind_flags = PIPE_BIND_RENDER_TARGET;
    unsigned num_added = 0;
    int force_samples = 0;
 
+   unsigned supported_flags = 0;
+   if (stw_dev->stw_winsys && stw_dev->stw_winsys->get_pfd_flags)
+      supported_flags = stw_dev->stw_winsys->get_pfd_flags(screen);
+
    /* Since GLUT for Windows doesn't support MSAA we have an env var
     * to force all pixel formats to have a particular number of samples.
     */
@@ -273,11 +289,16 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
                   continue;
                }
 
-               for (acc = 0; acc < 2; acc++) {
-                  stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
-                                      depth,
-                                      acc * 16, doublebuffer, samples);
-                  num_added++;
+               for (f = 0; f < ARRAY_SIZE(stw_pf_flag); f++) {
+                  stw_pfd_flag flag = stw_pf_flag[f];
+                  if (!(supported_flags & flag) || (flag == stw_pfd_double_buffer && !doublebuffer))
+                     continue;
+                  for (acc = 0; acc < 2; acc++) {
+                     stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
+                                         depth, acc * 16, doublebuffer,
+                                         (flag == stw_pfd_gdi_support), samples);
+                     num_added++;
+                  }
                }
             }
          }



More information about the mesa-commit mailing list