diff options
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_composite.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_crtc.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_dri2.c | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_driver.c | 66 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.c | 64 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_renderer.c | 16 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_tracker.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_xv.c | 21 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/subpicture.c | 11 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/surface.c | 12 |
11 files changed, 111 insertions, 94 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 4ff48026e50..d4dc84a122b 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -473,7 +473,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa, struct exa_pixmap_priv *pMask, struct exa_pixmap_priv *pDst) { - struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst); + struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pDst); renderer_bind_destination(exa->renderer, dst_surf, pDst->width, @@ -529,7 +529,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, struct exa_pixmap_priv *pixmap, Pixel fg) { - struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pixmap); + struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pixmap); unsigned vs_traits, fs_traits; struct xorg_shader shader; diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 80af82d97b2..28e30e09ff3 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -210,6 +210,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; templat.depth0 = 1; + templat.array_size = 1; templat.format = PIPE_FORMAT_B8G8R8A8_UNORM; templat.width0 = 64; templat.height0 = 64; @@ -225,9 +226,9 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) } transfer = pipe_get_transfer(ms->ctx, crtcp->cursor_tex, - 0, 0, 0, - PIPE_TRANSFER_WRITE, - 0, 0, 64, 64); + 0, 0, + PIPE_TRANSFER_WRITE, + 0, 0, 64, 64); ptr = ms->ctx->transfer_map(ms->ctx, transfer); util_copy_rect(ptr, crtcp->cursor_tex->format, transfer->stride, 0, 0, diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index b723a8e9cb0..17c34b7eac8 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -129,6 +129,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form template.width0 = pDraw->width; template.height0 = pDraw->height; template.depth0 = 1; + template.array_size = 1; template.last_level = 0; template.bind = PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SHARED; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 1ee79ae177e..66685ecec64 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -538,44 +538,37 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) return TRUE; } -static void drv_block_handler(int i, pointer blockData, pointer pTimeout, - pointer pReadmask) +void xorg_flush(ScreenPtr pScreen) { - ScreenPtr pScreen = screenInfo.screens[i]; modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]); - pScreen->BlockHandler = ms->blockHandler; - pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); - pScreen->BlockHandler = drv_block_handler; - if (ms->ctx) { - int j; + int j; - ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, - ms->dirtyThrottling ? - &ms->fence[XORG_NR_FENCES-1] : - NULL); + ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, + ms->dirtyThrottling ? + &ms->fence[XORG_NR_FENCES-1] : + NULL); - if (ms->dirtyThrottling) { - if (ms->fence[0]) - ms->ctx->screen->fence_finish(ms->ctx->screen, - ms->fence[0], 0); + if (ms->dirtyThrottling) { + if (ms->fence[0]) + ms->ctx->screen->fence_finish(ms->ctx->screen, + ms->fence[0], 0); - /* The amount of rendering generated by a block handler can be - * quite small. Let us get a fair way ahead of hardware before - * throttling. - */ - for (j = 0; j < XORG_NR_FENCES - 1; j++) - ms->screen->fence_reference(ms->screen, - &ms->fence[j], - ms->fence[j+1]); - - ms->screen->fence_reference(ms->screen, - &ms->fence[XORG_NR_FENCES-1], - NULL); - } + /* The amount of rendering generated by a block handler can be + * quite small. Let us get a fair way ahead of hardware before + * throttling. + */ + for (j = 0; j < XORG_NR_FENCES - 1; j++) + ms->screen->fence_reference(ms->screen, + &ms->fence[j], + ms->fence[j+1]); + + ms->screen->fence_reference(ms->screen, + &ms->fence[XORG_NR_FENCES-1], + NULL); + } } - #ifdef DRM_MODE_FEATURE_DIRTYFB { @@ -608,6 +601,19 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, #endif } +static void drv_block_handler(int i, pointer blockData, pointer pTimeout, + pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]); + + pScreen->BlockHandler = ms->blockHandler; + pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = drv_block_handler; + + xorg_flush(pScreen); +} + static Bool drv_create_screen_resources(ScreenPtr pScreen) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 4b1c02bad42..718a3453939 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -46,6 +46,8 @@ #include "util/u_math.h" #include "util/u_debug.h" #include "util/u_format.h" +#include "util/u_box.h" +#include "util/u_surface.h" #define DEBUG_PRINT 0 #define ROUND_UP_TEXTURES 1 @@ -188,8 +190,8 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, if (!priv || !priv->tex) return FALSE; - transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, - PIPE_TRANSFER_READ, x, y, w, h); + transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, + PIPE_TRANSFER_READ, x, y, w, h); if (!transfer) return FALSE; @@ -222,8 +224,8 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, if (!priv || !priv->tex) return FALSE; - transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, - PIPE_TRANSFER_WRITE, x, y, w, h); + transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, + PIPE_TRANSFER_WRITE, x, y, w, h); if (!transfer) return FALSE; @@ -265,7 +267,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index) assert(pPix->drawable.height <= priv->tex->height0); priv->map_transfer = - pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, + pipe_get_transfer(exa->pipe, priv->tex, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif @@ -449,6 +451,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.use_surface_copy = TRUE; } else { + struct pipe_surface surf_tmpl; exa->copy.use_surface_copy = FALSE; if (exa->copy.dst == exa->copy.src) @@ -458,11 +461,13 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, pipe_resource_reference(&exa->copy.src_texture, exa->copy.src->tex); + memset(&surf_tmpl, 0, sizeof(surf_tmpl)); + u_surface_default_template(&surf_tmpl, exa->copy.dst->tex, + PIPE_BIND_RENDER_TARGET); exa->copy.dst_surface = - exa->scrn->get_tex_surface(exa->scrn, - exa->copy.dst->tex, - 0, 0, 0, - PIPE_BIND_RENDER_TARGET); + exa->pipe->create_surface(exa->pipe, + exa->copy.dst->tex, + &surf_tmpl); renderer_copy_prepare(exa->renderer, @@ -492,19 +497,14 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, (void) priv; if (exa->copy.use_surface_copy) { - struct pipe_subresource subdst, subsrc; - subdst.face = 0; - subdst.level = 0; - subsrc.face = 0; - subsrc.level = 0; + struct pipe_box src_box; + u_box_2d(srcX, srcY, width, height, &src_box); exa->pipe->resource_copy_region( exa->pipe, exa->copy.dst->tex, - subdst, + 0, dstX, dstY, 0, exa->copy.src->tex, - subsrc, - srcX, srcY, 0, - width, height ); + 0, &src_box); } else { renderer_copy_pixmap(exa->renderer, @@ -874,24 +874,21 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, } template.depth0 = 1; + template.array_size = 1; template.last_level = 0; template.bind = PIPE_BIND_RENDER_TARGET | priv->flags; priv->tex_flags = priv->flags; texture = exa->scrn->resource_create(exa->scrn, &template); if (priv->tex) { - struct pipe_subresource subdst, subsrc; - - subdst.face = 0; - subdst.level = 0; - subsrc.face = 0; - subsrc.level = 0; + struct pipe_box src_box; + u_box_origin_2d(min(width, texture->width0), + min(height, texture->height0), + &src_box); exa->pipe->resource_copy_region(exa->pipe, texture, - subdst, 0, 0, 0, + 0, 0, 0, 0, priv->tex, - subsrc, 0, 0, 0, - min(width, texture->width0), - min(height, texture->height0)); + 0, &src_box); } pipe_resource_reference(&priv->tex, texture); @@ -947,6 +944,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, template.width0 = width; template.height0 = height; template.depth0 = 1; + template.array_size = 1; template.last_level = 0; template.bind |= PIPE_BIND_RENDER_TARGET; template.bind |= PIPE_BIND_SCANOUT; @@ -1063,10 +1061,14 @@ out_err: } struct pipe_surface * -xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv) +xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv) { - return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0, - PIPE_BIND_RENDER_TARGET); + struct pipe_surface surf_tmpl; + memset(&surf_tmpl, 0, sizeof(surf_tmpl)); + u_surface_default_template(&surf_tmpl, priv->tex, + PIPE_BIND_RENDER_TARGET); + + return pipe->create_surface(pipe, priv->tex, &surf_tmpl); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 86a1afc06e6..1f78f60be74 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -72,7 +72,7 @@ do { \ } while(0) struct pipe_surface * -xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv); +xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv); void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags, struct pipe_fence_handle **fence); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 92f1cc50653..a3d7c5a70e2 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -10,6 +10,7 @@ #include "util/u_sampler.h" #include "util/u_inlines.h" +#include "util/u_box.h" #include <math.h> @@ -535,6 +536,7 @@ renderer_clone_texture(struct xorg_renderer *r, templ.width0 = src->width0; templ.height0 = src->height0; templ.depth0 = 1; + templ.array_size = 1; templ.bind = PIPE_BIND_SAMPLER_VIEW; pt = screen->resource_create(screen, &templ); @@ -546,19 +548,15 @@ renderer_clone_texture(struct xorg_renderer *r, { /* copy source framebuffer surface into texture */ - struct pipe_subresource subsrc, subdst; - subsrc.face = 0; - subsrc.level = 0; - subdst.face = 0; - subdst.level = 0; + struct pipe_box src_box; + u_box_origin_2d(src->width0, src->height0, &src_box); + pipe->resource_copy_region(pipe, pt, /* dest */ - subdst, + 0, /* dest_level */ 0, 0, 0, /* destx/y/z */ src, - subsrc, - 0, 0, 0, - src->width0, src->height0); + 0, &src_box); } return pt; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index a3fb5e5dad0..56397b8fea8 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -156,6 +156,7 @@ CustomizerPtr xorg_customizer(ScrnInfoPtr pScrn); Bool xorg_has_gallium(ScrnInfoPtr pScrn); +void xorg_flush(ScreenPtr pScreen); /*********************************************************************** * xorg_exa.c */ diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index f64959f00e9..c72ba9ef8db 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -171,6 +171,7 @@ create_component_texture(struct pipe_context *pipe, templ.width0 = width; templ.height0 = height; templ.depth0 = 1; + templ.array_size = 1; templ.bind = PIPE_BIND_SAMPLER_VIEW; tex = screen->resource_create(screen, &templ); @@ -312,17 +313,17 @@ copy_packed_data(ScrnInfoPtr pScrn, int y_array_size = w * h; ytrans = pipe_get_transfer(pipe, dst[0], - 0, 0, 0, - PIPE_TRANSFER_WRITE, - left, top, w, h); + 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); utrans = pipe_get_transfer(pipe, dst[1], - 0, 0, 0, - PIPE_TRANSFER_WRITE, - left, top, w, h); + 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); vtrans = pipe_get_transfer(pipe, dst[2], - 0, 0, 0, - PIPE_TRANSFER_WRITE, - left, top, w, h); + 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); ymap = (char*)pipe->transfer_map(pipe, ytrans); umap = (char*)pipe->transfer_map(pipe, utrans); @@ -533,7 +534,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, if (!dst || !dst->tex) XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex"); - dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst); + dst_surf = xorg_gpu_surface(pPriv->r->pipe, dst); hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y)); #ifdef COMPOSITE diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c index e0c9e303817..1c70d1deb66 100644 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -135,6 +135,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture * struct pipe_video_context *vpipe; struct pipe_resource template; struct pipe_resource *tex; + struct pipe_surface surf_template; Status ret; XVMC_MSG(XVMC_TRACE, "[XvMC] Creating subpicture %p.\n", subpicture); @@ -181,8 +182,11 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture * subpicture_priv->context = context; tex = vpipe->screen->resource_create(vpipe->screen, &template); - subpicture_priv->sfc = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0, - PIPE_BIND_SAMPLER_VIEW); + + memset(&surf_template, 0, sizeof(surf_template)); + surf_template.format = tex->format; + surf_template.usage = PIPE_BIND_SAMPLER_VIEW; + subpicture_priv->sfc = vpipe->create_surface(vpipe, tex, &surf_template); pipe_resource_reference(&tex, NULL); if (!subpicture_priv->sfc) { FREE(subpicture_priv); @@ -239,7 +243,6 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage unsigned char *src, *dst, *dst_line; unsigned x, y; struct pipe_box dst_box = {dstx, dsty, 0, width, height, 1}; - struct pipe_subresource sr = {0, 0}; XVMC_MSG(XVMC_TRACE, "[XvMC] Compositing subpicture %p.\n", subpicture); @@ -264,7 +267,7 @@ Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage /* TODO: Assert rects are within bounds? Or clip? */ xfer = vpipe->get_transfer(vpipe, subpicture_priv->sfc->texture, - sr, PIPE_TRANSFER_WRITE, &dst_box); + 0, PIPE_TRANSFER_WRITE, &dst_box); if (!xfer) return BadAlloc; diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 209dffd2c58..d7285a478fb 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -203,6 +203,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac XvMCSurfacePrivate *surface_priv; struct pipe_resource template; struct pipe_resource *vsfc_tex; + struct pipe_surface surf_template; struct pipe_surface *vsfc; XVMC_MSG(XVMC_TRACE, "[XvMC] Creating surface %p.\n", surface); @@ -248,8 +249,10 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac return BadAlloc; } - vsfc = vpipe->screen->get_tex_surface(vpipe->screen, vsfc_tex, 0, 0, 0, - PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET); + memset(&surf_template, 0, sizeof(surf_template)); + surf_template.format = vsfc_tex->format; + surf_template.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; + vsfc = vpipe->create_surface(vpipe, vsfc_tex, &surf_template); pipe_resource_reference(&vsfc_tex, NULL); if (!vsfc) { FREE(surface_priv); @@ -396,7 +399,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, context = surface_priv->context; context_priv = context->privData; - drawable_surface = vl_drawable_surface_get(context_priv->vctx->vscreen, drawable); + drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable); if (!drawable_surface) return BadDrawable; @@ -448,7 +451,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, vpipe->screen->flush_frontbuffer ( vpipe->screen, - drawable_surface, + drawable_surface->texture, + 0, 0, vl_contextprivate_get(context_priv->vctx, drawable_surface) ); |