native.h revision a22a332fc7cc54d4d0973dcd21a90159cc51de1a
19c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar/*
29c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Mesa 3-D graphics library
39c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Version:  7.8
49c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar *
59c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
69c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar *
79c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Permission is hereby granted, free of charge, to any person obtaining a
89c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * copy of this software and associated documentation files (the "Software"),
99c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * to deal in the Software without restriction, including without limitation
109c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * the rights to use, copy, modify, merge, publish, distribute, sublicense,
119c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * and/or sell copies of the Software, and to permit persons to whom the
129c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Software is furnished to do so, subject to the following conditions:
139c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar *
1440f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar * The above copyright notice and this permission notice shall be included
15b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar * in all copies or substantial portions of the Software.
169c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar *
179c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
189c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
199c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
209c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21df91ef3d6c55692a0236f67b6c6b134a3bf84098Douglas Gregor * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22df91ef3d6c55692a0236f67b6c6b134a3bf84098Douglas Gregor * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2302633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar * DEALINGS IN THE SOFTWARE.
24f395528158379e7ea9f6ff4bbb791abadca15aabDaniel Dunbar */
2502633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar
2602633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar#ifndef _NATIVE_H_
27985b825eea7387be10478de0430815ed6a673326Daniel Dunbar#define _NATIVE_H_
289c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar
2920a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar#include "EGL/egl.h"  /* for EGL native types */
3092dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands
31df91ef3d6c55692a0236f67b6c6b134a3bf84098Douglas Gregor#include "pipe/p_compiler.h"
32df91ef3d6c55692a0236f67b6c6b134a3bf84098Douglas Gregor#include "pipe/p_screen.h"
33c21c485b4fb58ef5d55cf3e523263dd824a2ace4Daniel Dunbar#include "pipe/p_context.h"
34c21c485b4fb58ef5d55cf3e523263dd824a2ace4Daniel Dunbar#include "pipe/p_state.h"
35c21c485b4fb58ef5d55cf3e523263dd824a2ace4Daniel Dunbar#include "state_tracker/sw_winsys.h"
36c21c485b4fb58ef5d55cf3e523263dd824a2ace4Daniel Dunbar
37fa41d6975058ceb1b8a24564f6dcec72f89f62e8Daniel Dunbar#ifdef __cplusplus
38fa41d6975058ceb1b8a24564f6dcec72f89f62e8Daniel Dunbarextern "C" {
39ed734737d5af31906e30e537d4a41c760ddcfc59Eric Christopher#endif
409284d215022457ba867080a713f08f026d89ea17Bruno Cardoso Lopes
416acda16e9c194dcbd0dea64341e182bdb65d0f41Daniel Dunbar#include "native_buffer.h"
426acda16e9c194dcbd0dea64341e182bdb65d0f41Daniel Dunbar#include "native_modeset.h"
439c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar
443038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar/**
459c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * Only color buffers are listed.  The others are allocated privately through,
4660a53f24b160724de0e8dd0e142009981540fd26Daniel Dunbar * for example, st_renderbuffer_alloc_storage().
478767cbc475ed96397b6f08617814eeb9cab121bdDaniel Dunbar */
489c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbarenum native_attachment {
4947ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar   NATIVE_ATTACHMENT_FRONT_LEFT,
5047ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar   NATIVE_ATTACHMENT_BACK_LEFT,
5120a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   NATIVE_ATTACHMENT_FRONT_RIGHT,
5220a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   NATIVE_ATTACHMENT_BACK_RIGHT,
5320a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar
5420a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   NUM_NATIVE_ATTACHMENTS
5520a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar};
5620a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar
5720a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbarenum native_param_type {
5820a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   /*
5920a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar    * Return TRUE if window/pixmap surfaces use the buffers of the native
603038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    * types.
613038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    */
6220a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   NATIVE_PARAM_USE_NATIVE_BUFFER,
6320a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar
6420a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   /**
6520a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar    * Return TRUE if native_surface::present can preserve the buffer.
6620a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar    */
6720a9aa50f9a7d4b03f97bc67e96da1d605c309a2Daniel Dunbar   NATIVE_PARAM_PRESERVE_BUFFER,
681eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
691eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump   /**
701eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * Return the maximum supported swap interval.
7147ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar    */
729c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   NATIVE_PARAM_MAX_SWAP_INTERVAL
739c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar};
7431b1e5437e7435879fc044afb77ff27096008e72Daniel Dunbar
7531b1e5437e7435879fc044afb77ff27096008e72Daniel Dunbarstruct native_surface {
7692dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands   /**
779c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * Available for caller's use.
783038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    */
793038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar   void *user_data;
8047ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar
8147ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar   void (*destroy)(struct native_surface *nsurf);
821eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
831eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump   /**
841eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * Present the given buffer to the native engine.
8547ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar    */
86b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar   boolean (*present)(struct native_surface *nsurf,
87b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar                      enum native_attachment natt,
88b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar                      boolean preserve,
8982b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar                      uint swap_interval);
9082b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar
919c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   /**
929c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * Validate the buffers of the surface.  textures, if not NULL, points to an
931eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * array of size NUM_NATIVE_ATTACHMENTS and the returned textures are owned
9492dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands    * by the caller.  A sequence number is also returned.  The caller can use
959c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * it to check if anything has changed since the last call. Any of the
963038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    * pointers may be NULL and it indicates the caller has no interest in those
973038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    * values.
98b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar    *
9960a53f24b160724de0e8dd0e142009981540fd26Daniel Dunbar    * If this function is called multiple times with different attachment
100b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar    * masks, those not listed in the latest call might be destroyed.  This
101b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar    * behavior might change in the future.
10282b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar    */
10382b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar   boolean (*validate)(struct native_surface *nsurf, uint attachment_mask,
104b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar                       unsigned int *seq_num, struct pipe_resource **textures,
105b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar                       int *width, int *height);
10692dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands
107b488c1dac8e53206f07103d794a62a3f5012c0f4Daniel Dunbar   /**
1083038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    * Wait until all native commands affecting the surface has been executed.
1093038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar    */
1109c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   void (*wait)(struct native_surface *nsurf);
11160a53f24b160724de0e8dd0e142009981540fd26Daniel Dunbar};
1129c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar
11347ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar/**
11482b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar * Describe a native display config.
11582b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar */
1169c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbarstruct native_config {
1179c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   /* available buffers and their format */
11892dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands   uint buffer_mask;
1199c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   enum pipe_format color_format;
1203038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar
1213038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar   /* supported surface types */
1229c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   boolean window_bit;
12360a53f24b160724de0e8dd0e142009981540fd26Daniel Dunbar   boolean pixmap_bit;
1249c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   boolean scanout_bit;
12547ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar
12682b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar   int native_visual_id;
12782b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar   int native_visual_type;
1289c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   int level;
1299c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   boolean transparent_rgb;
13092dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands   int transparent_rgb_values[3];
1319c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar};
1323038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar
1333038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar/**
1349c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * A pipe winsys abstracts the OS.  A pipe screen abstracts the graphcis
1359c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar * hardware.  A native display consists of a pipe winsys, a pipe screen, and
13647ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar * the native display server.
13782b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar */
13882b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbarstruct native_display {
1399c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   /**
1409c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * The pipe screen of the native display.
14192dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands    */
1429c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar   struct pipe_screen *screen;
1433038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar
1443038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar   /**
1459c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * Available for caller's use.
1469c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    */
14747ac7d27c44bd64a7d0fc03d4babc196cf2b8230Daniel Dunbar   void *user_data;
14882b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar
14982b51cce8cea6b6bb6175c406c2ab425c91d9dc8Daniel Dunbar   void (*destroy)(struct native_display *ndpy);
1509c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar
15131b1e5437e7435879fc044afb77ff27096008e72Daniel Dunbar   /**
1529c073ff462eb75ccbb1c4446e21c148f3fc618e1Daniel Dunbar    * Query the parameters of the native display.
153ff7488dc9a766f94daf54d81b03ab9160d0bfd88Daniel Dunbar    *
15492dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands    * The return value is defined by the parameter.
155fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar    */
156fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar   int (*get_param)(struct native_display *ndpy,
157fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar                    enum native_param_type param);
158fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar
159fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar   /**
160fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar    * Get the supported configs.  The configs are owned by the display, but
161fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar    * the returned array should be FREE()ed.
162fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar    */
1633038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar   const struct native_config **(*get_configs)(struct native_display *ndpy,
1643038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar                                               int *num_configs);
165fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar
166fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1Daniel Dunbar   /**
16792dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands    * Test if a pixmap is supported by the given config.  Required unless no
168a5a7bd0de7b6b80212095195a055a4a43f21d4b2Daniel Dunbar    * config has pixmap_bit set.
1691eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    *
170a5a7bd0de7b6b80212095195a055a4a43f21d4b2Daniel Dunbar    * This function is usually called to find a config that supports a given
1711eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * pixmap.  Thus, it is usually called with the same pixmap in a row.
172a5a7bd0de7b6b80212095195a055a4a43f21d4b2Daniel Dunbar    */
1731eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump   boolean (*is_pixmap_supported)(struct native_display *ndpy,
174a5a7bd0de7b6b80212095195a055a4a43f21d4b2Daniel Dunbar                                  EGLNativePixmapType pix,
175a5a7bd0de7b6b80212095195a055a4a43f21d4b2Daniel Dunbar                                  const struct native_config *nconf);
17640f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar
17740f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar
178a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar   /**
179a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar    * Create a window surface.  Required unless no config has window_bit set.
18040f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar    */
18140f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar   struct native_surface *(*create_window_surface)(struct native_display *ndpy,
182a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar                                                   EGLNativeWindowType win,
18340f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                                                   const struct native_config *nconf);
18440f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar
185a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar   /**
1861eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * Create a pixmap surface.  The native config may be NULL.  In that case, a
187a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar    * "best config" will be picked.  Required unless no config has pixmap_bit
188a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar    * set.
189a3ec60e0cf2a1916f479288998d31bd980b1a306Daniel Dunbar    */
19040f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar   struct native_surface *(*create_pixmap_surface)(struct native_display *ndpy,
19140f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                                                   EGLNativePixmapType pix,
1923038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar                                                   const struct native_config *nconf);
1933038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar
19440f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar   const struct native_display_buffer *buffer;
19560a53f24b160724de0e8dd0e142009981540fd26Daniel Dunbar   const struct native_display_modeset *modeset;
19640f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar};
19740f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar
19840f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar/**
19992dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands * The handler for events that a native display may generate.  The events are
20040f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar * generated asynchronously and the handler may be called by any thread at any
2013038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar * time.
2023038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar */
20340f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbarstruct native_event_handler {
20440f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar   /**
2051eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    * This function is called when a surface needs to be validated.
2061eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    */
2071eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump   void (*invalid_surface)(struct native_display *ndpy,
20840f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                           struct native_surface *nsurf,
20940f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                           unsigned int seq_num);
21040f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar
21192dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands   struct pipe_screen *(*new_drm_screen)(struct native_display *ndpy,
21240f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                                         const char *name, int fd);
2133038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar   struct pipe_screen *(*new_sw_screen)(struct native_display *ndpy,
21440f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar                                        struct sw_winsys *ws);
21540f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar};
2161eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2171eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump/**
2181eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump * Test whether an attachment is set in the mask.
21940f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbar */
22040f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbarstatic INLINE boolean
22140f1265ebd42ece3e7f7917319b56012e8e2bce2Daniel Dunbarnative_attachment_mask_test(uint mask, enum native_attachment att)
22292dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands{
2238cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar   return !!(mask & (1 << att));
2243038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar}
2253038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbar
2268cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbarstruct native_platform {
2278cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar   const char *name;
2288cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar
2298cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar   void (*set_event_handler)(struct native_event_handler *handler);
2301eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump   struct native_display *(*create_display)(void *dpy,
2311eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump                                            boolean use_sw,
2321eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump                                            void *user_data);
23302633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar};
23402633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar
23502633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbarconst struct native_platform *
23692dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sandsnative_get_gdi_platform(void);
237748de8eda222f087434d8bd703176b316a061341Daniel Dunbar
238748de8eda222f087434d8bd703176b316a061341Daniel Dunbarconst struct native_platform *
23902633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbarnative_get_x11_platform(void);
24002633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar
2413038204fd8f6ff22082dd18e4b12ed252b75a5e4Daniel Dunbarconst struct native_platform *
24202633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbarnative_get_drm_platform(void);
24302633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbar
24402633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbarconst struct native_platform *
24502633b541b04ad5ffc1c70f4c2feeeb13e607057Daniel Dunbarnative_get_fbdev_platform(void);
2461eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2471eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump#ifdef __cplusplus
2481eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump}
2498cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar#endif
2508cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar
2518cac5f7e1ce63dd77ee0fb4ef68f9fa804f41ea6Daniel Dunbar#endif /* _NATIVE_H_ */
25292dd1915842410005c68d32c43bb3b3cf5a4a702Duncan Sands