st/dri: Refactor dri_st_api into other files
[mesa.git] / src / gallium / state_trackers / dri / drm / dri2.c
index 5ab7067ae2fdedaa13ebfe1347295be545301ecd..e1216f14c0e7718883e233d19f0bc2c1421a779e 100644 (file)
 #include "dri_screen.h"
 #include "dri_context.h"
 #include "dri_drawable.h"
-#include "dri_st_api.h"
 #include "dri2.h"
 
+#include "GL/internal/dri_interface.h"
+
 /**
  * DRI2 flush extension.
  */
@@ -59,7 +60,7 @@ dri2_invalidate_drawable(__DRIdrawable *dPriv)
    drawable->dPriv->lastStamp = *drawable->dPriv->pStamp;
 
    if (ctx)
-      ctx->st->notify_invalid_framebuffer(ctx->st, drawable->stfb);
+      ctx->st->notify_invalid_framebuffer(ctx->st, &drawable->base);
 }
 
 static const __DRI2flushExtension dri2FlushExtension = {
@@ -79,7 +80,7 @@ dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
    struct dri_drawable *drawable = dri_drawable(dPriv);
    struct pipe_resource *pt;
 
-   dri_st_framebuffer_validate_att(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);
+   dri_drawable_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT);
 
    pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
 
@@ -330,7 +331,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
       whandle.stride = buf->pitch;
 
       drawable->textures[statt] =
-         screen->pipe_screen->resource_from_handle(screen->pipe_screen,
+         screen->base.screen->resource_from_handle(screen->base.screen,
                &templ, &whandle);
    }
 
@@ -344,7 +345,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
  * Backend functions for st_framebuffer interface.
  */
 
-void
+static void
 dri2_allocate_textures(struct dri_drawable *drawable,
                        const enum st_attachment_type *statts,
                        unsigned count)
@@ -356,7 +357,7 @@ dri2_allocate_textures(struct dri_drawable *drawable,
    dri2_drawable_process_buffers(drawable, buffers, num_buffers);
 }
 
-void
+static void
 dri2_flush_frontbuffer(struct dri_drawable *drawable,
                        enum st_attachment_type statt)
 {
@@ -371,7 +372,7 @@ dri2_flush_frontbuffer(struct dri_drawable *drawable,
    }
 }
 
-__DRIimage *
+static __DRIimage *
 dri2_lookup_egl_image(struct dri_context *ctx, void *handle)
 {
    __DRIimageLookupExtension *loader = ctx->sPriv->dri2.image;
@@ -433,7 +434,7 @@ dri2_create_image_from_name(__DRIcontext *context,
    whandle.handle = name;
    whandle.stride = pitch * util_format_get_blocksize(pf);
 
-   img->texture = screen->pipe_screen->resource_from_handle(screen->pipe_screen,
+   img->texture = screen->base.screen->resource_from_handle(screen->base.screen,
          &templ, &whandle);
    if (!img->texture) {
       FREE(img);
@@ -510,6 +511,9 @@ dri2_init_screen(__DRIscreen * sPriv)
    screen->api = drm_api_create();
    screen->sPriv = sPriv;
    screen->fd = sPriv->fd;
+   screen->lookup_egl_image = dri2_lookup_egl_image;
+   screen->allocate_textures = dri2_allocate_textures;
+   screen->flush_frontbuffer = dri2_flush_frontbuffer;
 
    sPriv->private = (void *)screen;
    sPriv->extensions = dri_screen_extensions;