summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/radeon/radeon_fbo.c
diff options
context:
space:
mode:
authorJohann Rudloff <cypheon@googlemail.com>2010-11-08 18:55:42 -0500
committerAlex Deucher <alexdeucher@gmail.com>2010-11-08 19:59:53 -0500
commitd7855ee3323e8493f139af70db9d0cdb853c2a08 (patch)
tree61cb7d51832b85dac2739a4d9a5e2eadfbf3ac51 /src/mesa/drivers/dri/radeon/radeon_fbo.c
parentb42e562a11a1dded1c4c734de065cb1480da1772 (diff)
radeon: Implement GL_OES_EGL_image
agd5f: add support to radeon/r200/r300 as well
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 2a6fbaeaf0..a36a1dc94a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -199,6 +199,48 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
}
+#if FEATURE_OES_EGL_image
+static void
+radeon_image_target_renderbuffer_storage(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ void *image_handle)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ struct radeon_renderbuffer *rrb;
+ __DRIscreen *screen;
+ __DRIimage *image;
+
+ screen = radeon->radeonScreen->driScreen;
+ image = screen->dri2.image->lookupEGLImage(screen, image_handle,
+ screen->loaderPrivate);
+ if (image == NULL)
+ return;
+
+ rrb = radeon_renderbuffer(rb);
+
+ if (ctx->Driver.Flush)
+ ctx->Driver.Flush(ctx); /* +r6/r7 */
+
+ if (rrb->bo)
+ radeon_bo_unref(rrb->bo);
+ rrb->bo = image->bo;
+ radeon_bo_ref(rrb->bo);
+ fprintf(stderr, "image->bo: %p, name: %d, rbs: w %d -> p %d\n", image->bo, image->bo->handle,
+ image->width, image->pitch);
+
+ rrb->cpp = image->cpp;
+ rrb->pitch = image->pitch * image->cpp;
+
+ rb->Format = image->format;
+ rb->InternalFormat = image->internal_format;
+ rb->Width = image->width;
+ rb->Height = image->height;
+ rb->Format = image->format;
+ rb->DataType = image->data_type;
+ rb->_BaseFormat = _mesa_base_fbo_format(radeon->glCtx,
+ image->internal_format);
+}
+#endif
/**
* Called for each hardware renderbuffer when a _window_ is resized.
@@ -622,6 +664,10 @@ void radeon_fbo_init(struct radeon_context *radeon)
#if FEATURE_EXT_framebuffer_blit
radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
#endif
+#if FEATURE_OES_EGL_image
+ radeon->glCtx->Driver.EGLImageTargetRenderbufferStorage =
+ radeon_image_target_renderbuffer_storage;
+#endif
}