mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
st/mesa: move st_manager_get_egl_image_surface into st_cb_eglimage.c
The only callers are here, and we will add generation of GL errors in the following patch. Rename the function to st_egl_image_get_surface, pass the gl_context instead of st_context, and move the cast from GLeglImageOES to void* into st_egl_image_get_surface. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
2f8d6bd578
commit
d10172d527
3 changed files with 34 additions and 37 deletions
|
|
@ -36,8 +36,40 @@
|
|||
#include "st_format.h"
|
||||
#include "st_manager.h"
|
||||
#include "st_sampler_view.h"
|
||||
#include "util/u_surface.h"
|
||||
|
||||
|
||||
/**
|
||||
* Return the surface of an EGLImage.
|
||||
* FIXME: I think this should operate on resources, not surfaces
|
||||
*/
|
||||
static struct pipe_surface *
|
||||
st_egl_image_get_surface(struct gl_context *ctx, GLeglImageOES image_handle)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct st_manager *smapi =
|
||||
(struct st_manager *) st->iface.st_context_private;
|
||||
struct st_egl_image stimg;
|
||||
struct pipe_surface *ps, surf_tmpl;
|
||||
|
||||
if (!smapi || !smapi->get_egl_image)
|
||||
return NULL;
|
||||
|
||||
memset(&stimg, 0, sizeof(stimg));
|
||||
if (!smapi->get_egl_image(smapi, (void *) image_handle, &stimg))
|
||||
return NULL;
|
||||
|
||||
u_surface_default_template(&surf_tmpl, stimg.texture);
|
||||
surf_tmpl.format = stimg.format;
|
||||
surf_tmpl.u.tex.level = stimg.level;
|
||||
surf_tmpl.u.tex.first_layer = stimg.layer;
|
||||
surf_tmpl.u.tex.last_layer = stimg.layer;
|
||||
ps = st->pipe->create_surface(st->pipe, stimg.texture, &surf_tmpl);
|
||||
pipe_resource_reference(&stimg.texture, NULL);
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the base format just like _mesa_base_fbo_format does.
|
||||
*/
|
||||
|
|
@ -73,11 +105,10 @@ st_egl_image_target_renderbuffer_storage(struct gl_context *ctx,
|
|||
struct gl_renderbuffer *rb,
|
||||
GLeglImageOES image_handle)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct st_renderbuffer *strb = st_renderbuffer(rb);
|
||||
struct pipe_surface *ps;
|
||||
|
||||
ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
|
||||
ps = st_egl_image_get_surface(ctx, image_handle);
|
||||
if (ps) {
|
||||
strb->Base.Width = ps->width;
|
||||
strb->Base.Height = ps->height;
|
||||
|
|
@ -159,10 +190,9 @@ st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
|
|||
struct gl_texture_image *texImage,
|
||||
GLeglImageOES image_handle)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_surface *ps;
|
||||
|
||||
ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
|
||||
ps = st_egl_image_get_surface(ctx, image_handle);
|
||||
if (ps) {
|
||||
st_bind_surface(ctx, target, texObj, texImage, ps);
|
||||
pipe_surface_reference(&ps, NULL);
|
||||
|
|
|
|||
|
|
@ -843,36 +843,6 @@ st_manager_flush_frontbuffer(struct st_context *st)
|
|||
stfb->iface->flush_front(&st->iface, stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the surface of an EGLImage.
|
||||
* FIXME: I think this should operate on resources, not surfaces
|
||||
*/
|
||||
struct pipe_surface *
|
||||
st_manager_get_egl_image_surface(struct st_context *st, void *eglimg)
|
||||
{
|
||||
struct st_manager *smapi =
|
||||
(struct st_manager *) st->iface.st_context_private;
|
||||
struct st_egl_image stimg;
|
||||
struct pipe_surface *ps, surf_tmpl;
|
||||
|
||||
if (!smapi || !smapi->get_egl_image)
|
||||
return NULL;
|
||||
|
||||
memset(&stimg, 0, sizeof(stimg));
|
||||
if (!smapi->get_egl_image(smapi, eglimg, &stimg))
|
||||
return NULL;
|
||||
|
||||
u_surface_default_template(&surf_tmpl, stimg.texture);
|
||||
surf_tmpl.format = stimg.format;
|
||||
surf_tmpl.u.tex.level = stimg.level;
|
||||
surf_tmpl.u.tex.first_layer = stimg.layer;
|
||||
surf_tmpl.u.tex.last_layer = stimg.layer;
|
||||
ps = st->pipe->create_surface(st->pipe, stimg.texture, &surf_tmpl);
|
||||
pipe_resource_reference(&stimg.texture, NULL);
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-validate the framebuffers.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,9 +34,6 @@
|
|||
|
||||
struct st_context;
|
||||
|
||||
struct pipe_surface *
|
||||
st_manager_get_egl_image_surface(struct st_context *st, void *eglimg);
|
||||
|
||||
void
|
||||
st_manager_flush_frontbuffer(struct st_context *st);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue