+ struct st_egl_image stimg;
+
+ if (st_get_egl_image(ctx, image_handle, PIPE_BIND_RENDER_TARGET,
+ "glEGLImageTargetRenderbufferStorage",
+ &stimg)) {
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct pipe_surface *ps, surf_tmpl;
+
+ 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 = pipe->create_surface(pipe, stimg.texture, &surf_tmpl);
+ pipe_resource_reference(&stimg.texture, NULL);
+
+ if (!ps)
+ return;