X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fegl%2Fcommon%2Fnative.h;h=58593a489cd948c4cb77e96ab24059a204ab99be;hb=f8e6d19f3f40931be741b44d3edf210c38e13f0f;hp=3886ca20562b0ae25a3a33a8294821d55a843fc6;hpb=af977b53826695afcdcfe900816a93671aec00f5;p=mesa.git diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 3886ca20562..58593a489cd 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -40,6 +40,7 @@ extern "C" { #include "native_buffer.h" #include "native_modeset.h" +#include "native_wayland_bufmgr.h" /** * Only color buffers are listed. The others are allocated privately through, @@ -126,8 +127,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]; }; @@ -143,11 +142,21 @@ struct native_display { */ struct pipe_screen *screen; + /** + * Context used for copy operations. + */ + struct pipe_context *pipe; + /** * Available for caller's use. */ void *user_data; + /** + * Initialize and create the pipe screen. + */ + boolean (*init_screen)(struct native_display *ndpy); + void (*destroy)(struct native_display *ndpy); /** @@ -166,16 +175,21 @@ struct native_display { int *num_configs); /** - * Test if a pixmap is supported by the given config. Required unless no - * config has pixmap_bit set. - * - * This function is usually called to find a config that supports a given - * pixmap. Thus, it is usually called with the same pixmap in a row. + * Get the color format of the pixmap. Required unless no config has + * pixmap_bit set. */ - boolean (*is_pixmap_supported)(struct native_display *ndpy, - EGLNativePixmapType pix, - const struct native_config *nconf); + boolean (*get_pixmap_format)(struct native_display *ndpy, + EGLNativePixmapType pix, + enum pipe_format *format); + /** + * Copy the contents of the resource to the pixmap's front-left attachment. + * This is used to implement eglCopyBuffers. Required unless no config has + * pixmap_bit set. + */ + boolean (*copy_to_pixmap)(struct native_display *ndpy, + EGLNativePixmapType pix, + struct pipe_resource *src); /** * Create a window surface. Required unless no config has window_bit set. @@ -185,7 +199,9 @@ 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, @@ -193,6 +209,7 @@ struct native_display { const struct native_display_buffer *buffer; const struct native_display_modeset *modeset; + const struct native_display_wayland_bufmgr *wayland_bufmgr; }; /** @@ -212,6 +229,9 @@ struct native_event_handler { const char *name, int fd); struct pipe_screen *(*new_sw_screen)(struct native_display *ndpy, struct sw_winsys *ws); + + struct pipe_resource *(*lookup_egl_image)(struct native_display *ndpy, + void *egl_image); }; /** @@ -223,25 +243,58 @@ native_attachment_mask_test(uint mask, enum native_attachment att) return !!(mask & (1 << att)); } +/** + * Get the display copy context + */ +static INLINE struct pipe_context * +ndpy_get_copy_context(struct native_display *ndpy) +{ + if (!ndpy->pipe) + ndpy->pipe = ndpy->screen->context_create(ndpy->screen, NULL); + return ndpy->pipe; +} + +/** + * Free display screen and context resources + */ +static INLINE void +ndpy_uninit(struct native_display *ndpy) +{ + if (ndpy->pipe) + ndpy->pipe->destroy(ndpy->pipe); + if (ndpy->screen) + ndpy->screen->destroy(ndpy->screen); +} + struct native_platform { const char *name; - struct native_display *(*create_display)(void *dpy, - struct native_event_handler *handler, - void *user_data); + /** + * Create the native display and usually establish a connection to the + * display server. + * + * No event should be generated at this stage. + */ + struct native_display *(*create_display)(void *dpy, boolean use_sw); }; const struct native_platform * -native_get_gdi_platform(void); +native_get_gdi_platform(const struct native_event_handler *event_handler); + +const struct native_platform * +native_get_x11_platform(const struct native_event_handler *event_handler); + +const struct native_platform * +native_get_wayland_platform(const struct native_event_handler *event_handler); const struct native_platform * -native_get_x11_platform(void); +native_get_drm_platform(const struct native_event_handler *event_handler); const struct native_platform * -native_get_drm_platform(void); +native_get_fbdev_platform(const struct native_event_handler *event_handler); const struct native_platform * -native_get_fbdev_platform(void); +native_get_android_platform(const struct native_event_handler *event_handler); #ifdef __cplusplus }