예제 #1
0
파일: xorg_exa.c 프로젝트: anupamkaul/mesa
static Bool
ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
    struct exa_context *exa = ms->exa;

    exa_debug_printf("ExaPrepareSolid(0x%x)\n", fg);

    if (!exa->accel)
	return FALSE;

    if (!exa->pipe)
	XORG_FALLBACK("accel not enabled");

    if (!priv || !priv->tex)
	XORG_FALLBACK("%s", !priv ? "!priv" : "!priv->tex");

    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask))
	XORG_FALLBACK("planeMask is not solid");

    if (alu != GXcopy)
	XORG_FALLBACK("not GXcopy");

    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                        priv->tex->target, 0,
                                        PIPE_BIND_RENDER_TARGET)) {
	XORG_FALLBACK("format %s", util_format_name(priv->tex->format));
    }

    return xorg_solid_bind_state(exa, priv, fg);
}
예제 #2
0
boolean xorg_composite_accelerated(int op,
                                   PicturePtr pSrcPicture,
                                   PicturePtr pMaskPicture,
                                   PicturePtr pDstPicture)
{
   ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
   ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
   modesettingPtr ms = modesettingPTR(pScrn);
   struct xorg_composite_blend blend;

   if (!is_filter_accelerated(pSrcPicture) ||
       !is_filter_accelerated(pMaskPicture)) {
      XORG_FALLBACK("Unsupported Xrender filter");
   }

   if (pSrcPicture->pSourcePict) {
      if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
         XORG_FALLBACK("Gradients not enabled (haven't been well tested)");
   }

   if (blend_for_op(&blend, op,
                    pSrcPicture, pMaskPicture, pDstPicture)) {
      /* Check for component alpha */
      if (pMaskPicture && pMaskPicture->componentAlpha &&
          PICT_FORMAT_RGB(pMaskPicture->format)) {
         if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) {
            XORG_FALLBACK("Component alpha not supported with source "
                          "alpha and source value blending. (op=%d)",
                          op);
         }
      }

      return TRUE;
   }
   XORG_FALLBACK("Unsupported composition operation = %d", op);
}
예제 #3
0
파일: xorg_exa.c 프로젝트: anupamkaul/mesa
static Bool
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
	       int ydir, int alu, Pixel planeMask)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen);
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_context *exa = ms->exa;
    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
    struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);

    exa_debug_printf("ExaPrepareCopy\n");

    if (!exa->accel)
	return FALSE;

    if (!exa->pipe)
	XORG_FALLBACK("accel not enabled");

    if (!priv || !priv->tex)
	XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");

    if (!src_priv || !src_priv->tex)
	XORG_FALLBACK("pSrc %s", !src_priv ? "!priv" : "!priv->tex");

    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
	XORG_FALLBACK("planeMask is not solid");

    if (alu != GXcopy)
	XORG_FALLBACK("alu not GXcopy");

    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                        priv->tex->target, 0,
                                        PIPE_BIND_RENDER_TARGET))
	XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));

    if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
                                        src_priv->tex->target, 0,
                                        PIPE_BIND_SAMPLER_VIEW))
	XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));

    exa->copy.src = src_priv;
    exa->copy.dst = priv;

    return TRUE;
}
예제 #4
0
파일: xorg_exa.c 프로젝트: anupamkaul/mesa
static Bool
ExaPrepareComposite(int op, PicturePtr pSrcPicture,
		    PicturePtr pMaskPicture, PicturePtr pDstPicture,
		    PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
   ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
   modesettingPtr ms = modesettingPTR(pScrn);
   struct exa_context *exa = ms->exa;
   struct exa_pixmap_priv *priv;

   if (!exa->accel)
       return FALSE;

   exa_debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n",
                op, pSrcPicture, pMaskPicture, pDstPicture);
   exa_debug_printf("\tFormats: src(%s), mask(%s), dst(%s)\n",
                pSrcPicture ? render_format_name(pSrcPicture->format) : "none",
                pMaskPicture ? render_format_name(pMaskPicture->format) : "none",
                pDstPicture ? render_format_name(pDstPicture->format) : "none");

   if (!exa->pipe)
      XORG_FALLBACK("accel not enabled");

   priv = exaGetPixmapDriverPrivate(pDst);
   if (!priv || !priv->tex)
      XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");

   if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                       priv->tex->target, 0,
                                       PIPE_BIND_RENDER_TARGET))
      XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format));

   if (priv->picture_format != pDstPicture->format)
      XORG_FALLBACK("pDst pic_format: %s != %s",
                    render_format_name(priv->picture_format),
                    render_format_name(pDstPicture->format));

   if (pSrc) {
      priv = exaGetPixmapDriverPrivate(pSrc);
      if (!priv || !priv->tex)
         XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");

      if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                          priv->tex->target, 0,
                                          PIPE_BIND_SAMPLER_VIEW))
         XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format));

      if (!picture_check_formats(priv, pSrcPicture))
         XORG_FALLBACK("pSrc pic_format: %s != %s",
                       render_format_name(priv->picture_format),
                       render_format_name(pSrcPicture->format));

   }

   if (pMask) {
      priv = exaGetPixmapDriverPrivate(pMask);
      if (!priv || !priv->tex)
         XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");

      if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                          priv->tex->target, 0,
                                          PIPE_BIND_SAMPLER_VIEW))
         XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format));

      if (!picture_check_formats(priv, pMaskPicture))
         XORG_FALLBACK("pMask pic_format: %s != %s",
                       render_format_name(priv->picture_format),
                       render_format_name(pMaskPicture->format));
   }

   return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
                                    pDstPicture,
                                    pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
                                    pMask ? exaGetPixmapDriverPrivate(pMask) : NULL,
                                    exaGetPixmapDriverPrivate(pDst));
}
예제 #5
0
static Bool
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
	       int ydir, int alu, Pixel planeMask)
{
    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_context *exa = ms->exa;
    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
    struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);

    exa_debug_printf("ExaPrepareCopy\n");

    if (!exa->accel)
	return FALSE;

    if (!exa->pipe)
	XORG_FALLBACK("accel not enabled");

    if (!priv || !priv->tex)
	XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");

    if (!src_priv || !src_priv->tex)
	XORG_FALLBACK("pSrc %s", !src_priv ? "!priv" : "!priv->tex");

    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
	XORG_FALLBACK("planeMask is not solid");

    if (alu != GXcopy)
	XORG_FALLBACK("alu not GXcopy");

    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                        priv->tex->target, 0,
                                        PIPE_BIND_RENDER_TARGET))
	XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));

    if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
                                        src_priv->tex->target, 0,
                                        PIPE_BIND_SAMPLER_VIEW))
	XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));

    exa->copy.src = src_priv;
    exa->copy.dst = priv;

    /* XXX this used to use resource_copy_region for same-surface copies,
     * but they were redefined to not allow overlaps (some of the util code
     * always assumed this anyway).
     * Drivers should implement accelerated resource_copy_region or it will
     * be slow - disable for now.
     */
    if (0 && exa->copy.src != exa->copy.dst) {
       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)
          exa->copy.src_texture = renderer_clone_texture( exa->renderer,
                                                          exa->copy.src->tex );
       else
          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->pipe->create_surface(exa->pipe,
                                    exa->copy.dst->tex,
                                    &surf_tmpl);


       renderer_copy_prepare(exa->renderer, 
                             exa->copy.dst_surface,
                             exa->copy.src_texture );
    }


    return TRUE;
}
예제 #6
0
static Bool
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
	       int ydir, int alu, Pixel planeMask)
{
    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_context *exa = ms->exa;
    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
    struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);

#if DEBUG_PRINT
    debug_printf("ExaPrepareCopy\n");
#endif

    if (!exa->accel)
	return FALSE;

    if (!exa->pipe)
	XORG_FALLBACK("accle not enabled");

    if (!priv || !priv->tex)
	XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");

    if (!src_priv || !src_priv->tex)
	XORG_FALLBACK("pSrc %s", !src_priv ? "!priv" : "!priv->tex");

    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
	XORG_FALLBACK("planeMask is not solid");

    if (alu != GXcopy)
	XORG_FALLBACK("alu not GXcopy");

    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                        priv->tex->target,
                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
	XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));

    if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
                                        src_priv->tex->target,
                                        PIPE_TEXTURE_USAGE_SAMPLER, 0))
	XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));

    exa->copy.src = src_priv;
    exa->copy.dst = priv;

    /* For same-surface copies, the pipe->surface_copy path is clearly
     * superior, providing it is implemented.  In other cases it's not
     * clear what the better path would be, and eventually we'd
     * probably want to gather timings and choose dynamically.
     */
    if (exa->pipe->surface_copy &&
        exa->copy.src == exa->copy.dst) {

       exa->copy.use_surface_copy = TRUE;
       
       exa->copy.src_surface =
          exa->scrn->get_tex_surface( exa->scrn,
                                      exa->copy.src->tex,
                                      0, 0, 0,
                                      PIPE_BUFFER_USAGE_GPU_READ);

       exa->copy.dst_surface =
          exa->scrn->get_tex_surface( exa->scrn, 
                                      exa->copy.dst->tex,
                                      0, 0, 0, 
                                      PIPE_BUFFER_USAGE_GPU_WRITE );
    }
    else {
       exa->copy.use_surface_copy = FALSE;

       if (exa->copy.dst == exa->copy.src)
          exa->copy.src_texture = renderer_clone_texture( exa->renderer,
                                                          exa->copy.src->tex );
       else
          pipe_texture_reference(&exa->copy.src_texture,
                                 exa->copy.src->tex);

       exa->copy.dst_surface =
          exa->scrn->get_tex_surface(exa->scrn,
                                     exa->copy.dst->tex,
                                     0, 0, 0,
                                     PIPE_BUFFER_USAGE_GPU_WRITE);


       renderer_copy_prepare(exa->renderer, 
                             exa->copy.dst_surface,
                             exa->copy.src_texture );
    }


    return TRUE;
}