#include "state_tracker/st_api.h"
#include "state_tracker/drm_api.h"
+struct dri_context;
+
struct dri_screen
{
/* dri */
int fd;
drmLock *drmLock;
+ /* hooks filled in by dri1, dri2 & drisw */
+ __DRIimage * (*lookup_egl_image)(struct dri_context *ctx, void *handle);
+
/* gallium */
struct drm_api *api;
struct pipe_winsys *pipe_winsys;
dri_st_manager_get_egl_image(struct st_manager *smapi,
struct st_egl_image *stimg)
{
+ struct dri_context *ctx =
+ (struct dri_context *)stimg->stctxi->st_manager_private;
+ struct dri_screen *screen = dri_screen(ctx->sPriv);
__DRIimage *img = NULL;
-#ifndef __NOT_HAVE_DRM_H
- if (!__dri1_api_hooks) {
- struct dri_context *ctx = (struct dri_context *)
- stimg->stctxi->st_manager_private;
- img = dri2_lookup_egl_image(ctx, stimg->egl_image);
+ if (screen->lookup_egl_image) {
+ img = screen->lookup_egl_image(ctx, stimg->egl_image);
}
-#endif
+
if (!img)
return FALSE;
}
}
-__DRIimage *
+static __DRIimage *
dri2_lookup_egl_image(struct dri_context *ctx, void *handle)
{
__DRIimageLookupExtension *loader = ctx->sPriv->dri2.image;
screen->api = drm_api_create();
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
+ screen->lookup_egl_image = dri2_lookup_egl_image;
sPriv->private = (void *)screen;
sPriv->extensions = dri_screen_extensions;
const enum st_attachment_type *statts,
unsigned count);
-__DRIimage *
-dri2_lookup_egl_image(struct dri_context *ctx, void *handle);
-
#endif /* DRI2_H */