diff options
author | Christian König <[email protected]> | 2012-02-15 17:20:50 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-02-25 12:14:14 +0100 |
commit | 1448e829e86981e6144410ba6a3d0f16357fb2b3 (patch) | |
tree | 18a95fc6ebab9afd59837d419f2e5ab96130624b /src/gallium/state_trackers | |
parent | b34c35a5243e0f4a23721891dbbccff8863b7d4c (diff) |
vl: rework winsys interface
Throw out all the old and now unneeded stuff.
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/vdpau/decode.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/device.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/mixer.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/presentation.c | 41 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/context.c | 28 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/subpicture.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/surface.c | 24 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/xvmc_private.h | 5 |
11 files changed, 72 insertions, 66 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index c45abb81799..64349a8bbce 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -65,7 +65,7 @@ vlVdpDecoderCreate(VdpDevice device, if (!dev) return VDP_STATUS_INVALID_HANDLE; - pipe = dev->context->pipe; + pipe = dev->context; screen = dev->vscreen->pscreen; supported = screen->get_video_param ( diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index 7b23863d120..f4a3dc04bfb 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -41,8 +41,9 @@ PUBLIC VdpStatus vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGetProcAddress **get_proc_address) { - VdpStatus ret; + struct pipe_screen *pscreen; vlVdpDevice *dev = NULL; + VdpStatus ret; if (!(display && device && get_proc_address)) return VDP_STATUS_INVALID_POINTER; @@ -64,7 +65,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, goto no_vscreen; } - dev->context = vl_video_create(dev->vscreen); + pscreen = dev->vscreen->pscreen; + dev->context = pscreen->context_create(pscreen, dev->vscreen); if (!dev->context) { ret = VDP_STATUS_RESOURCES; goto no_context; @@ -76,7 +78,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, goto no_handle; } - vl_compositor_init(&dev->compositor, dev->context->pipe); + vl_compositor_init(&dev->compositor, dev->context); *get_proc_address = &vlVdpGetProcAddress; @@ -160,7 +162,7 @@ vlVdpDeviceDestroy(VdpDevice device) return VDP_STATUS_INVALID_HANDLE; vl_compositor_cleanup(&dev->compositor); - vl_video_destroy(dev->context); + dev->context->destroy(dev->context); vl_screen_destroy(dev->vscreen); FREE(dev); diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index df6750d5698..082860888af 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -62,7 +62,7 @@ vlVdpVideoMixerCreate(VdpDevice device, return VDP_STATUS_RESOURCES; vmixer->device = dev; - vl_compositor_init(&vmixer->compositor, dev->context->pipe); + vl_compositor_init(&vmixer->compositor, dev->context); vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, vmixer->csc); if (!debug_get_bool_option("G3DVL_NO_CSC", FALSE)) @@ -300,8 +300,7 @@ vlVdpVideoMixerUpdateNoiseReductionFilter(vlVdpVideoMixer *vmixer) /* and create a new filter as needed */ if (vmixer->noise_reduction. enabled && vmixer->noise_reduction.level > 0) { vmixer->noise_reduction.filter = MALLOC(sizeof(struct vl_median_filter)); - vl_median_filter_init(vmixer->noise_reduction.filter, - vmixer->device->context->pipe, + vl_median_filter_init(vmixer->noise_reduction.filter, vmixer->device->context, vmixer->video_width, vmixer->video_height, vmixer->noise_reduction.level + 1, VL_MEDIAN_FILTER_CROSS); @@ -347,8 +346,7 @@ vlVdpVideoMixerUpdateSharpnessFilter(vlVdpVideoMixer *vmixer) } vmixer->sharpness.filter = MALLOC(sizeof(struct vl_matrix_filter)); - vl_matrix_filter_init(vmixer->sharpness.filter, - vmixer->device->context->pipe, + vl_matrix_filter_init(vmixer->sharpness.filter, vmixer->device->context, vmixer->video_width, vmixer->video_height, 3, 3, matrix); } diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 17ce0373dba..5ccb153fabd 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -58,7 +58,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device, if (!dev) return VDP_STATUS_INVALID_HANDLE; - pipe = dev->context->pipe; + pipe = dev->context; if (!pipe) return VDP_STATUS_INVALID_HANDLE; @@ -217,7 +217,7 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, if (!vlsurface) return VDP_STATUS_INVALID_HANDLE; - context = vlsurface->device->context->pipe; + context = vlsurface->device->context; compositor = &vlsurface->device->compositor; index_format = FormatIndexedToPipe(source_indexed_format); @@ -459,7 +459,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface, if (dst_vlsurface->device != src_vlsurface->device) return VDP_STATUS_HANDLE_DEVICE_MISMATCH; - context = dst_vlsurface->device->context->pipe; + context = dst_vlsurface->device->context; compositor = &dst_vlsurface->device->compositor; blend = BlenderToPipe(context, blend_state); diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 13025d21156..e3ad03a2a51 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -68,7 +68,7 @@ vlVdpPresentationQueueCreate(VdpDevice device, pq->device = dev; pq->drawable = pqt->drawable; - if (!vl_compositor_init(&pq->compositor, dev->context->pipe)) { + if (!vl_compositor_init(&pq->compositor, dev->context)) { ret = VDP_STATUS_ERROR; goto no_compositor; } @@ -202,17 +202,25 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, vlVdpOutputSurface *surf; struct pipe_context *pipe; - struct pipe_surface *drawable_surface; + struct pipe_resource *tex; + struct pipe_surface surf_templ, *surf_draw; struct pipe_video_rect src_rect, dst_clip; pq = vlGetDataHTAB(presentation_queue); if (!pq) return VDP_STATUS_INVALID_HANDLE; - drawable_surface = vl_drawable_surface_get(pq->device->context, pq->drawable); - if (!drawable_surface) + pipe = pq->device->context; + + tex = vl_screen_texture_from_drawable(pq->device->vscreen, pq->drawable); + if (!tex) return VDP_STATUS_INVALID_HANDLE; + memset(&surf_templ, 0, sizeof(surf_templ)); + surf_templ.format = tex->format; + surf_templ.usage = PIPE_BIND_RENDER_TARGET; + surf_draw = pipe->create_surface(pipe, tex, &surf_templ); + surf = vlGetDataHTAB(surface); if (!surf) return VDP_STATUS_INVALID_HANDLE; @@ -221,26 +229,22 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, src_rect.x = 0; src_rect.y = 0; - src_rect.w = drawable_surface->width; - src_rect.h = drawable_surface->height; + src_rect.w = surf_draw->width; + src_rect.h = surf_draw->height; dst_clip.x = 0; dst_clip.y = 0; - dst_clip.w = clip_width ? clip_width : drawable_surface->width; - dst_clip.h = clip_height ? clip_height : drawable_surface->height; + dst_clip.w = clip_width ? clip_width : surf_draw->width; + dst_clip.h = clip_height ? clip_height : surf_draw->height; vl_compositor_clear_layers(&pq->compositor); vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, &src_rect, NULL); - vl_compositor_render(&pq->compositor, drawable_surface, NULL, &dst_clip, &pq->dirty_area); - - pipe = pq->device->context->pipe; + vl_compositor_render(&pq->compositor, surf_draw, NULL, &dst_clip, &pq->dirty_area); pipe->screen->flush_frontbuffer ( - pipe->screen, - drawable_surface->texture, - 0, 0, - vl_contextprivate_get(pq->device->context, drawable_surface) + pipe->screen, tex, 0, 0, + vl_screen_get_private(pq->device->vscreen) ); pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL); @@ -259,7 +263,8 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, VDPAU_MSG(VDPAU_ERR, "[VDPAU] Dumping surface %d failed.\n", surface); } - pipe_surface_reference(&drawable_surface, NULL); + pipe_resource_reference(&tex, NULL); + pipe_surface_reference(&surf_draw, NULL); return VDP_STATUS_OK; } @@ -288,7 +293,7 @@ vlVdpPresentationQueueBlockUntilSurfaceIdle(VdpPresentationQueue presentation_qu return VDP_STATUS_INVALID_HANDLE; if (surf->fence) { - screen = pq->device->context->pipe->screen; + screen = pq->device->vscreen->pscreen; screen->fence_finish(screen, surf->fence, 0); } @@ -327,7 +332,7 @@ vlVdpPresentationQueueQuerySurfaceStatus(VdpPresentationQueue presentation_queue if (!surf->fence) { *status = VDP_PRESENTATION_QUEUE_STATUS_IDLE; } else { - screen = pq->device->context->pipe->screen; + screen = pq->device->vscreen->pscreen; if (screen->fence_signalled(screen, surf->fence)) { screen->fence_reference(screen, &surf->fence, NULL); *status = VDP_PRESENTATION_QUEUE_STATUS_VISIBLE; diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index a0ebe001aa8..04832426a10 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -71,7 +71,7 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type, } p_surf->device = dev; - pipe = dev->context->pipe; + pipe = dev->context; memset(&p_surf->templat, 0, sizeof(p_surf->templat)); p_surf->templat.buffer_format = pipe->screen->get_video_param @@ -204,7 +204,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, if (!p_surf) return VDP_STATUS_INVALID_HANDLE; - pipe = p_surf->device->context->pipe; + pipe = p_surf->device->context; if (!pipe) return VDP_STATUS_INVALID_HANDLE; diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 35f0dc0d58a..e02744ffd41 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -286,7 +286,7 @@ RectToPipe(const VdpRect *src, struct pipe_video_rect *dst) typedef struct { struct vl_screen *vscreen; - struct vl_context *context; + struct pipe_context *context; struct vl_compositor compositor; } vlVdpDevice; diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index b11f10fe402..e9ba06ba909 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -190,7 +190,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, unsigned short subpic_max_h = 0; Status ret; struct vl_screen *vscreen; - struct vl_context *vctx; + struct pipe_context *pipe; XvMCContextPrivate *context_priv; float csc[16]; @@ -236,18 +236,17 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, return BadAlloc; } - vctx = vl_video_create(vscreen); - if (!vctx) { + pipe = vscreen->pscreen->context_create(vscreen->pscreen, vscreen); + if (!pipe) { XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n"); vl_screen_destroy(vscreen); FREE(context_priv); return BadAlloc; } - context_priv->decoder = vctx->pipe->create_video_decoder + context_priv->decoder = pipe->create_video_decoder ( - vctx->pipe, - ProfileToPipe(mc_type), + pipe, ProfileToPipe(mc_type), (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC, FormatToPipe(chroma_format), width, height, 2, @@ -256,16 +255,16 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, if (!context_priv->decoder) { XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n"); - vl_video_destroy(vctx); + pipe->destroy(pipe); vl_screen_destroy(vscreen); FREE(context_priv); return BadAlloc; } - if (!vl_compositor_init(&context_priv->compositor, vctx->pipe)) { + if (!vl_compositor_init(&context_priv->compositor, pipe)) { XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n"); context_priv->decoder->destroy(context_priv->decoder); - vl_video_destroy(vctx); + pipe->destroy(pipe); vl_screen_destroy(vscreen); FREE(context_priv); return BadAlloc; @@ -283,7 +282,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, ); vl_compositor_set_csc_matrix(&context_priv->compositor, csc); - context_priv->vctx = vctx; + context_priv->vscreen = vscreen; + context_priv->pipe = pipe; context_priv->subpicture_max_width = subpic_max_w; context_priv->subpicture_max_height = subpic_max_h; @@ -305,8 +305,6 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, PUBLIC Status XvMCDestroyContext(Display *dpy, XvMCContext *context) { - struct vl_screen *vscreen; - struct vl_context *vctx; XvMCContextPrivate *context_priv; XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying context %p.\n", context); @@ -317,13 +315,11 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context) return XvMCBadContext; context_priv = context->privData; - vctx = context_priv->vctx; - vscreen = vctx->vscreen; pipe_surface_reference(&context_priv->drawable_surface, NULL); context_priv->decoder->destroy(context_priv->decoder); vl_compositor_cleanup(&context_priv->compositor); - vl_video_destroy(vctx); - vl_screen_destroy(vscreen); + context_priv->pipe->destroy(context_priv->pipe); + vl_screen_destroy(context_priv->vscreen); FREE(context_priv); context->privData = NULL; diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c index c5aa0c35213..d6be28ea3cd 100644 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -210,7 +210,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture * return XvMCBadContext; context_priv = context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; if (!subpicture) return XvMCBadSubpicture; @@ -321,7 +321,7 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh subpicture_priv = subpicture->privData; context_priv = subpicture_priv->context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; dst = subpicture_priv->sampler; /* TODO: Assert clear rect is within bounds? Or clip? */ @@ -371,7 +371,7 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage subpicture_priv = subpicture->privData; context_priv = subpicture_priv->context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; /* clipping should be done by upload_sampler and regardles what the documentation says image->pitches[0] doesn't seems to be in bytes, so don't use it */ @@ -421,7 +421,7 @@ Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsign subpicture_priv = subpicture->privData; context_priv = subpicture_priv->context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; dst_box.width = subpicture->num_palette_entries; diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 7f7eeadcbc6..293e7ad22a4 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -168,7 +168,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac return XvMCBadSurface; context_priv = context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate)); if (!surface_priv) @@ -373,17 +373,25 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, assert(srcy + srch - 1 < surface->height); subpicture_priv = surface_priv->subpicture ? surface_priv->subpicture->privData : NULL; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; compositor = &context_priv->compositor; if (!context_priv->drawable_surface || context_priv->dst_rect.x != dst_rect.x || context_priv->dst_rect.y != dst_rect.y || context_priv->dst_rect.w != dst_rect.w || context_priv->dst_rect.h != dst_rect.h) { + struct pipe_surface surf_templ; + struct pipe_resource *tex = vl_screen_texture_from_drawable( + context_priv->vscreen, drawable); + pipe_surface_reference(&context_priv->drawable_surface, NULL); - context_priv->drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable); - context_priv->dst_rect = dst_rect; + + memset(&surf_templ, 0, sizeof(surf_templ)); + surf_templ.format = tex->format; + surf_templ.usage = PIPE_BIND_RENDER_TARGET; + context_priv->drawable_surface = pipe->create_surface(pipe, tex, &surf_templ); vl_compositor_reset_dirty_area(&context_priv->dirty_area); + context_priv->dst_rect = dst_rect; } if (!context_priv->drawable_surface) @@ -436,10 +444,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, pipe->screen->flush_frontbuffer ( - pipe->screen, - context_priv->drawable_surface->texture, - 0, 0, - vl_contextprivate_get(context_priv->vctx, context_priv->drawable_surface) + pipe->screen, context_priv->drawable_surface->texture, 0, 0, + vl_screen_get_private(context_priv->vscreen) ); if(dump_window == -1) { @@ -476,7 +482,7 @@ Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) surface_priv = surface->privData; context_priv = surface_priv->context->privData; - pipe = context_priv->vctx->pipe; + pipe = context_priv->pipe; *status = 0; diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index daddba5fe54..b9519a7e65d 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -43,8 +43,6 @@ #define BLOCK_SIZE_SAMPLES 64 #define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) -struct vl_context; - struct pipe_video_decoder; struct pipe_video_buffer; @@ -53,7 +51,8 @@ struct pipe_fence_handle; typedef struct { - struct vl_context *vctx; + struct vl_screen *vscreen; + struct pipe_context *pipe; struct pipe_video_decoder *decoder; enum VL_CSC_COLOR_STANDARD color_standard; |