Merge branch 'lp-offset-twoside'
[mesa.git] / src / gallium / state_trackers / dri / common / dri_screen.c
index e869b4b9b18a1e4081c9dab86bbde929fe9fa7a7..1302e9bc0134799dfc1b4174b799d5ff8904bdb5 100644 (file)
@@ -33,8 +33,6 @@
 #include "xmlpool.h"
 
 #include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_drawable.h"
 
 #include "util/u_inlines.h"
 #include "pipe/p_screen.h"
@@ -229,10 +227,13 @@ dri_fill_in_modes(struct dri_screen *screen,
  */
 void
 dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
-                   const __GLcontextModes *mode)
+                   const struct gl_config *mode)
 {
    memset(stvis, 0, sizeof(*stvis));
 
+   if (!mode)
+      return;
+
    stvis->samples = mode->samples;
    stvis->render_buffer = ST_ATTACHMENT_INVALID;
 
@@ -288,16 +289,14 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
 
 static boolean
 dri_get_egl_image(struct st_manager *smapi,
-                  struct st_context_iface *stctxi,
                   void *egl_image,
                   struct st_egl_image *stimg)
 {
-   struct dri_context *ctx =
-      (struct dri_context *)stctxi->st_manager_private;
+   struct dri_screen *screen = (struct dri_screen *)smapi;
    __DRIimage *img = NULL;
 
-   if (ctx->lookup_egl_image) {
-      img = ctx->lookup_egl_image(ctx, egl_image);
+   if (screen->lookup_egl_image) {
+      img = screen->lookup_egl_image(screen, egl_image);
    }
 
    if (!img)
@@ -379,11 +378,16 @@ dri_init_screen_helper(struct dri_screen *screen,
 
    screen->base.get_egl_image = dri_get_egl_image;
    screen->base.get_param = dri_get_param;
-   screen->st_api = st_gl_api_create();
 
+   screen->st_api = st_gl_api_create();
    if (!screen->st_api)
       return NULL;
 
+   if(pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES))
+      screen->target = PIPE_TEXTURE_2D;
+   else
+      screen->target = PIPE_TEXTURE_RECT;
+
    driParseOptionInfo(&screen->optionCache,
                       __driConfigOptions, __driNConfigOptions);