From c67ad0eee8f75e1fd65e8ab2fdd660dc132764ee Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 3 Jan 2010 21:27:22 +0800 Subject: st/egl_g3d: Update the native display interface for modesetting. The new interface can be used to implement EGL_MESA_screen_surface. Signed-off-by: Chia-I Wu --- src/gallium/state_trackers/egl_g3d/common/native.h | 69 ++++++++++++++++++---- 1 file changed, 56 insertions(+), 13 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/egl_g3d/common/native.h b/src/gallium/state_trackers/egl_g3d/common/native.h index 34abd86a31..88d87c6f3a 100644 --- a/src/gallium/state_trackers/egl_g3d/common/native.h +++ b/src/gallium/state_trackers/egl_g3d/common/native.h @@ -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, -- cgit v1.2.3