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

Author: Alexander von Gluck IV <[email protected]>
Date:   Tue Nov 21 17:49:10 2023 +0000

hgl: Redefine visual options in hgl_context.h

* For now, move the visual mask flags into hgl_context.h
* This removes an un-needed dependency on GLView.h from glvnd
* Eventually, these need converted into normal EGL parameters

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26322>

---

 src/egl/drivers/haiku/egl_haiku.cpp     | 22 ++++------------------
 src/gallium/frontends/hgl/hgl.c         | 18 ++++++++----------
 src/gallium/frontends/hgl/hgl_context.h | 17 ++++++++++++++++-
 3 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
index bd269edb83d..5b3e6bb274f 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -53,20 +53,6 @@ extern "C" {
 #include "target-helpers/inline_sw_helper.h"
 }
 
-#define BGL_RGB           0
-#define BGL_INDEX         1
-#define BGL_SINGLE        0
-#define BGL_DOUBLE        2
-#define BGL_DIRECT        0
-#define BGL_INDIRECT      4
-#define BGL_ACCUM         8
-#define BGL_ALPHA         16
-#define BGL_DEPTH         32
-#define BGL_OVERLAY       64
-#define BGL_UNDERLAY      128
-#define BGL_STENCIL       512
-#define BGL_SHARE_CONTEXT 1024
-
 #ifdef DEBUG
 #define TRACE(x...) printf("egl_haiku: " x)
 #define CALLED()    TRACE("CALLED: %s\n", __PRETTY_FUNCTION__)
@@ -120,7 +106,7 @@ haiku_create_window_surface(_EGLDisplay *disp, _EGLConfig 
*conf,
    }
 
    struct st_visual visual;
-   hgl_get_st_visual(&visual, BGL_DOUBLE | BGL_DEPTH);
+   hgl_get_st_visual(&visual, HGL_DOUBLE | HGL_DEPTH);
 
    wgl_surf->fb =
       hgl_create_st_framebuffer(hgl_dpy->disp, &visual, native_window);
@@ -159,7 +145,7 @@ haiku_create_pbuffer_surface(_EGLDisplay *disp, _EGLConfig 
*conf,
    }
 
    struct st_visual visual;
-   hgl_get_st_visual(&visual, BGL_DOUBLE | BGL_DEPTH);
+   hgl_get_st_visual(&visual, HGL_DOUBLE | HGL_DEPTH);
 
    wgl_surf->fb = hgl_create_st_framebuffer(hgl_dpy->disp, &visual, NULL);
    if (!wgl_surf->fb) {
@@ -239,7 +225,7 @@ haiku_swap_buffers(_EGLDisplay *disp, _EGLSurface *surf)
       p_atomic_inc(&buffer->base.stamp);
    }
 
-   // XXX: right front / back if BGL_STEREO?
+   // XXX: right front / back if HGL_STEREO?
 
    update_size(buffer);
 
@@ -432,7 +418,7 @@ haiku_create_context(_EGLDisplay *disp, _EGLConfig *conf,
    struct haiku_egl_display *hgl_dpy = haiku_egl_display(disp);
 
    struct st_visual visual;
-   hgl_get_st_visual(&visual, BGL_DOUBLE | BGL_DEPTH);
+   hgl_get_st_visual(&visual, HGL_DOUBLE | HGL_DEPTH);
 
    struct haiku_egl_context *context =
       (struct haiku_egl_context *)calloc(1, sizeof(*context));
diff --git a/src/gallium/frontends/hgl/hgl.c b/src/gallium/frontends/hgl/hgl.c
index b70a2b14a62..7997b4b7c66 100644
--- a/src/gallium/frontends/hgl/hgl.c
+++ b/src/gallium/frontends/hgl/hgl.c
@@ -18,8 +18,6 @@
 #include "util/u_inlines.h"
 #include "state_tracker/st_context.h"
 
-#include "GLView.h"
-
 
 #ifdef DEBUG
 #   define TRACE(x...) printf("hgl:frontend: " x)
@@ -321,39 +319,39 @@ hgl_get_st_visual(struct st_visual* visual, ulong options)
        assert(visual);
 
        // Determine color format
-       if ((options & BGL_INDEX) != 0) {
+       if ((options & HGL_INDEX) != 0) {
                // Index color
                visual->color_format = PIPE_FORMAT_B5G6R5_UNORM;
                // TODO: Indexed color depth buffer?
                visual->depth_stencil_format = PIPE_FORMAT_NONE;
        } else {
                // RGB color
-               visual->color_format = (options & BGL_ALPHA)
+               visual->color_format = (options & HGL_ALPHA)
                        ? PIPE_FORMAT_BGRA8888_UNORM : 
PIPE_FORMAT_BGRX8888_UNORM;
                // TODO: Determine additional stencil formats
-               visual->depth_stencil_format = (options & BGL_DEPTH)
+               visual->depth_stencil_format = (options & HGL_DEPTH)
                        ? PIPE_FORMAT_Z24_UNORM_S8_UINT : PIPE_FORMAT_NONE;
     }
 
-       visual->accum_format = (options & BGL_ACCUM)
+       visual->accum_format = (options & HGL_ACCUM)
                ? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
 
        visual->buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
 
-       if ((options & BGL_DOUBLE) != 0) {
+       if ((options & HGL_DOUBLE) != 0) {
                TRACE("double buffer enabled\n");
                visual->buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
        }
 
 #if 0
-       if ((options & BGL_STEREO) != 0) {
+       if ((options & HGL_STEREO) != 0) {
                visual->buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
-               if ((options & BGL_DOUBLE) != 0)
+               if ((options & HGL_DOUBLE) != 0)
                        visual->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
   }
 #endif
 
-       if ((options & BGL_DEPTH) || (options & BGL_STENCIL))
+       if ((options & HGL_DEPTH) || (options & HGL_STENCIL))
                visual->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
 
        TRACE("%s: Visual color format: %s\n", __func__,
diff --git a/src/gallium/frontends/hgl/hgl_context.h 
b/src/gallium/frontends/hgl/hgl_context.h
index f5d44ede9c1..4ec985e1571 100644
--- a/src/gallium/frontends/hgl/hgl_context.h
+++ b/src/gallium/frontends/hgl/hgl_context.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009-2014, Haiku, Inc. All Rights Reserved.
+ * Copyright 2009-2023, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -16,6 +16,21 @@
 
 #include "frontend/api.h"
 
+// visual options
+#define HGL_RGB                        0
+#define HGL_INDEX              1
+#define HGL_SINGLE             0
+#define HGL_DOUBLE             2
+#define HGL_DIRECT             0
+#define HGL_INDIRECT           4
+#define HGL_ACCUM              8
+#define HGL_ALPHA              16
+#define HGL_DEPTH              32
+#define HGL_OVERLAY            64
+#define HGL_UNDERLAY           128
+#define HGL_STENCIL            512
+#define HGL_SHARE_CONTEXT      1024
+
 
 #ifdef __cplusplus
 extern "C" {

Reply via email to