2 #include "vl_surface.h"
6 #include <pipe/p_screen.h>
7 #include <pipe/p_state.h>
8 #include <pipe/p_inlines.h>
10 #include "vl_screen.h"
11 #include "vl_context.h"
12 #include "vl_render.h"
18 struct vlScreen
*screen
,
22 struct vlSurface
**surface
25 struct vlSurface
*sfc
;
26 struct pipe_texture
template;
31 sfc
= calloc(1, sizeof(struct vlSurface
));
41 memset(&template, 0, sizeof(struct pipe_texture
));
42 template.target
= PIPE_TEXTURE_2D
;
43 template.format
= PIPE_FORMAT_A8R8G8B8_UNORM
;
44 template.last_level
= 0;
45 template.width
[0] = vlRoundUpPOT(sfc
->width
);
46 template.height
[0] = vlRoundUpPOT(sfc
->height
);
47 template.depth
[0] = 1;
48 template.compressed
= 0;
49 pf_get_block(template.format
, &template.block
);
50 template.tex_usage
= PIPE_TEXTURE_USAGE_SAMPLER
| PIPE_TEXTURE_USAGE_RENDER_TARGET
;
52 sfc
->texture
= vlGetPipeScreen(screen
)->texture_create(vlGetPipeScreen(screen
), &template);
61 struct vlSurface
*surface
66 pipe_texture_release(&surface
->texture
);
72 int vlRenderMacroBlocksMpeg2
74 struct vlMpeg2MacroBlockBatch
*batch
,
75 struct vlSurface
*surface
81 surface
->context
->render
->vlBegin(surface
->context
->render
);
83 surface
->context
->render
->vlRenderMacroBlocksMpeg2
85 surface
->context
->render
,
90 surface
->context
->render
->vlEnd(surface
->context
->render
);
97 struct vlSurface
*surface
,
98 vlNativeDrawable drawable
,
107 enum vlPictureType picture_type
111 struct pipe_context
*pipe
;
114 assert(surface
->context
);
116 surface
->context
->render
->vlFlush(surface
->context
->render
);
118 csc
= surface
->context
->csc
;
119 pipe
= surface
->context
->pipe
;
121 csc
->vlResizeFrameBuffer(csc
, destw
, desth
);
142 pipe
->flush(pipe
, PIPE_FLUSH_RENDER_CACHE
, NULL
);
143 bind_pipe_drawable(pipe
, drawable
);
144 /* TODO: Need to take destx, desty into consideration */
145 pipe
->winsys
->flush_frontbuffer
148 csc
->vlGetFrameBuffer(csc
),
155 struct vlScreen
* vlSurfaceGetScreen
157 struct vlSurface
*surface
162 return surface
->screen
;
165 struct vlContext
* vlBindToContext
167 struct vlSurface
*surface
,
168 struct vlContext
*context
171 struct vlContext
*old
;
175 old
= surface
->context
;
176 surface
->context
= context
;