Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Mesa 3-D graphics library
  3.  *
  4.  * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person obtaining a
  7.  * copy of this software and associated documentation files (the "Software"),
  8.  * to deal in the Software without restriction, including without limitation
  9.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10.  * and/or sell copies of the Software, and to permit persons to whom the
  11.  * Software is furnished to do so, subject to the following conditions:
  12.  *
  13.  * The above copyright notice and this permission notice shall be included
  14.  * in all copies or substantial portions of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  19.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21.  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22.  * DEALINGS IN THE SOFTWARE.
  23.  */
  24.  
  25. #ifndef _EGL_G3D_H_
  26. #define _EGL_G3D_H_
  27.  
  28. #include "pipe/p_compiler.h"
  29. #include "pipe/p_screen.h"
  30. #include "pipe/p_context.h"
  31. #include "pipe/p_format.h"
  32. #include "os/os_thread.h"
  33. #include "egldriver.h"
  34. #include "egldisplay.h"
  35. #include "eglcontext.h"
  36. #include "eglsurface.h"
  37. #include "eglconfig.h"
  38. #include "eglimage.h"
  39. #include "eglsync.h"
  40. #include "eglscreen.h"
  41. #include "eglmode.h"
  42.  
  43. #include "native.h"
  44. #include "egl_g3d_st.h"
  45. #include "egl_g3d_loader.h"
  46.  
  47. struct egl_g3d_driver {
  48.    _EGLDriver base;
  49.    const struct egl_g3d_loader *loader;
  50.    const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
  51. };
  52.  
  53. struct egl_g3d_display {
  54.    struct native_display *native;
  55.  
  56.    const struct egl_g3d_loader *loader;
  57.    struct st_manager *smapi;
  58. };
  59.  
  60. struct egl_g3d_context {
  61.    _EGLContext base;
  62.  
  63.    struct st_api *stapi;
  64.  
  65.    struct st_context_iface *stctxi;
  66. };
  67.  
  68. struct egl_g3d_surface {
  69.    _EGLSurface base;
  70.  
  71.    struct st_visual stvis;
  72.    struct st_framebuffer_iface *stfbi;
  73.  
  74.    /* the native surface;  NULL for pbuffers */
  75.    struct native_surface *native;
  76.    struct pipe_resource *render_texture;
  77.  
  78.    EGLenum client_buffer_type;
  79.    EGLClientBuffer client_buffer;
  80.  
  81.    unsigned int sequence_number;
  82. };
  83.  
  84. struct egl_g3d_config {
  85.    _EGLConfig base;
  86.    const struct native_config *native;
  87.    struct st_visual stvis;
  88. };
  89.  
  90. struct egl_g3d_image {
  91.    _EGLImage base;
  92.    struct pipe_resource *texture;
  93.    unsigned level;
  94.    unsigned layer;
  95. };
  96.  
  97. /* standard typecasts */
  98. _EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
  99. _EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
  100.  
  101. struct egl_g3d_sync {
  102.    _EGLSync base;
  103.  
  104.    /* the mutex protects only the condvar, not the struct */
  105.    pipe_mutex mutex;
  106.    pipe_condvar condvar;
  107.  
  108.    /* for fence sync */
  109.    struct pipe_fence_handle *fence;
  110. };
  111. _EGL_DRIVER_TYPECAST(egl_g3d_sync, _EGLSync, obj)
  112.  
  113. #ifdef EGL_MESA_screen_surface
  114.  
  115. struct egl_g3d_screen {
  116.    _EGLScreen base;
  117.    const struct native_connector *native;
  118.    const struct native_mode **native_modes;
  119. };
  120. _EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
  121.  
  122. #endif /* EGL_MESA_screen_surface */
  123.  
  124. static INLINE struct st_api *
  125. egl_g3d_get_st_api(_EGLDriver *drv, enum st_api_type api)
  126. {
  127.    struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
  128.  
  129.    return gdrv->loader->get_st_api(api);
  130. }
  131.  
  132. #endif /* _EGL_G3D_H_ */
  133.