st/egl_g3d: Update the native display interface for modesetting.
authorChia-I Wu <olvaffe@gmail.com>
Sun, 3 Jan 2010 13:27:22 +0000 (21:27 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 12 Jan 2010 03:09:00 +0000 (11:09 +0800)
The new interface can be used to implement EGL_MESA_screen_surface.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/state_trackers/egl_g3d/common/native.h

index 34abd86a31f9597f493b4a918c315614905e35fe..88d87c6f3ae2929bc77eaf782f7b9854dfeb5b24 100644 (file)
@@ -84,8 +84,23 @@ struct native_config {
    enum pipe_format color_format;
    enum pipe_format depth_format;
    enum pipe_format stencil_format;
+
+   /* treat it as an additional flag to mode.drawableType */
+   boolean scanout_bit;
+};
+
+struct native_connector {
+   int dummy;
 };
 
+struct native_mode {
+   const char *desc;
+   int width, height;
+   int refresh_rate;
+};
+
+struct native_display_modeset;
+
 /**
  * A pipe winsys abstracts the OS.  A pipe screen abstracts the graphcis
  * hardware.  A native display consists of a pipe winsys, a pipe screen, and
@@ -136,23 +151,51 @@ struct native_display {
                                                     const struct native_config *nconf,
                                                     uint width, uint height);
 
-#if 0
-   struct native_mode *(*get_modes)(struct native_display *ndpy,
-                                    int *num_modes);
+   const struct native_display_modeset *modeset;
+};
 
+/**
+ * Mode setting interface of the native display.  It exposes the mode setting
+ * capabilities of the underlying graphics hardware.
+ */
+struct native_display_modeset {
    /**
-    * Create a screen surface.
+    * Get the available physical connectors and the number of CRTCs.
     */
-   struct native_surface *(*create_screen_surface)(struct native_display *ndpy,
-                                                   const struct native_config *nconf,
-                                                   uint width, uint height);
-
-   boolean (*set_mode)(struct native_display *ndpy,
-                       const struct native_mode *nmode,
-                       struct native_surface *nsurf);
-#endif
-};
+   const struct native_connector **(*get_connectors)(struct native_display *ndpy,
+                                                     int *num_connectors,
+                                                     int *num_crtcs);
+
+   /**
+    * Get the current supported modes of a connector.  The returned modes may
+    * change every time this function is called and those from previous calls
+    * might become invalid.
+    */
+   const struct native_mode **(*get_modes)(struct native_display *ndpy,
+                                           const struct native_connector *nconn,
+                                           int *num_modes);
 
+   /**
+    * Create a scan-out surface.  Required unless no config has
+    * GLX_SCREEN_BIT_MESA set.
+    */
+   struct native_surface *(*create_scanout_surface)(struct native_display *ndpy,
+                                                    const struct native_config *nconf,
+                                                    uint width, uint height);
+
+   /**
+    * Program the CRTC to output the surface to the given connectors with the
+    * given mode.  When surface is not given, the CRTC is disabled.
+    *
+    * This interface does not export a way to query capabilities of the CRTCs.
+    * The native display usually needs to dynamically map the index to a CRTC
+    * that supports the given connectors.
+    */
+   boolean (*program)(struct native_display *ndpy, int crtc_idx,
+                      struct native_surface *nsurf, uint x, uint y,
+                      const struct native_connector **nconns, int num_nconns,
+                      const struct native_mode *nmode);
+};
 
 typedef void (*native_flush_frontbuffer)(void *dummy,
                                          struct pipe_surface *surf,