egl: Improve driver selection.
[mesa.git] / src / gallium / state_trackers / egl / common / native.h
index 3c3f57e2670e3124f30f3f1ca8d6a063c022cdb4..6461b5edbdf000ada763f5d0c95119f54f1fd09c 100644 (file)
 #include "pipe/p_state.h"
 #include "state_tracker/sw_winsys.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "native_buffer.h"
 #include "native_modeset.h"
 
 /**
@@ -54,7 +59,17 @@ enum native_param_type {
     * Return TRUE if window/pixmap surfaces use the buffers of the native
     * types.
     */
-   NATIVE_PARAM_USE_NATIVE_BUFFER
+   NATIVE_PARAM_USE_NATIVE_BUFFER,
+
+   /**
+    * Return TRUE if native_surface::present can preserve the buffer.
+    */
+   NATIVE_PARAM_PRESERVE_BUFFER,
+
+   /**
+    * Return the maximum supported swap interval.
+    */
+   NATIVE_PARAM_MAX_SWAP_INTERVAL
 };
 
 struct native_surface {
@@ -66,17 +81,12 @@ struct native_surface {
    void (*destroy)(struct native_surface *nsurf);
 
    /**
-    * Swap the front and back buffers so that the back buffer is visible.  It
-    * is no-op if the surface is single-buffered.  The contents of the back
-    * buffer after swapping may or may not be preserved.
-    */
-   boolean (*swap_buffers)(struct native_surface *nsurf);
-
-   /**
-    * Make the front buffer visible.  In some native displays, changes to the
-    * front buffer might not be visible immediately and require manual flush.
+    * Present the given buffer to the native engine.
     */
-   boolean (*flush_frontbuffer)(struct native_surface *nsurf);
+   boolean (*present)(struct native_surface *nsurf,
+                      enum native_attachment natt,
+                      boolean preserve,
+                      uint swap_interval);
 
    /**
     * Validate the buffers of the surface.  textures, if not NULL, points to an
@@ -116,8 +126,6 @@ struct native_config {
    int native_visual_id;
    int native_visual_type;
    int level;
-   int samples;
-   boolean slow_config;
    boolean transparent_rgb;
    int transparent_rgb_values[3];
 };
@@ -175,12 +183,15 @@ struct native_display {
                                                    const struct native_config *nconf);
 
    /**
-    * Create a pixmap surface.  Required unless no config has pixmap_bit set.
+    * Create a pixmap surface.  The native config may be NULL.  In that case, a
+    * "best config" will be picked.  Required unless no config has pixmap_bit
+    * set.
     */
    struct native_surface *(*create_pixmap_surface)(struct native_display *ndpy,
                                                    EGLNativePixmapType pix,
                                                    const struct native_config *nconf);
 
+   const struct native_display_buffer *buffer;
    const struct native_display_modeset *modeset;
 };
 
@@ -215,8 +226,9 @@ native_attachment_mask_test(uint mask, enum native_attachment att)
 struct native_platform {
    const char *name;
 
+   void (*set_event_handler)(struct native_event_handler *handler);
    struct native_display *(*create_display)(void *dpy,
-                                            struct native_event_handler *handler,
+                                            boolean use_sw,
                                             void *user_data);
 };
 
@@ -232,4 +244,8 @@ native_get_drm_platform(void);
 const struct native_platform *
 native_get_fbdev_platform(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _NATIVE_H_ */