static void vrend_renderer_prepare_blit_extra_info(struct vrend_context *ctx,
                                                   struct vrend_resource *src_res,
                                                   struct vrend_resource *dst_res,
                                                   struct vrend_blit_info *info)
{
   info->can_fbo_blit = true;

   info->gl_filter = convert_mag_filter(info->b.filter);

   if (!dst_res->y_0_top) {
      info->dst_y1 = info->b.dst.box.y + info->b.dst.box.height;
      info->dst_y2 = info->b.dst.box.y;
   } else {
      info->dst_y1 = dst_res->base.height0 - info->b.dst.box.y - info->b.dst.box.height;
      info->dst_y2 = dst_res->base.height0 - info->b.dst.box.y;
   }

   if (!src_res->y_0_top) {
      info->src_y1 = info->b.src.box.y + info->b.src.box.height;
      info->src_y2 = info->b.src.box.y;
   } else {
      info->src_y1 = src_res->base.height0 - info->b.src.box.y - info->b.src.box.height;
      info->src_y2 = src_res->base.height0 - info->b.src.box.y;
   }

   if (vrend_blit_needs_swizzle(info->b.dst.format, info->b.src.format)) {
      info->needs_swizzle = true;
      info->can_fbo_blit = false;
   }

   if (info->needs_swizzle && vrend_get_format_table_entry(dst_res->base.format)->flags & VIRGL_TEXTURE_NEED_SWIZZLE)
      memcpy(info->swizzle, tex_conv_table[dst_res->base.format].swizzle, sizeof(info->swizzle));

   if (vrend_blit_needs_redblue_swizzle(src_res, dst_res, &info->b)) {
      VREND_DEBUG(dbg_blit, ctx, "Applying red/blue swizzle during blit involving an external BGR* resource\n");
      uint8_t temp = info->swizzle[0];
      info->swizzle[0] = info->swizzle[2];
      info->swizzle[2] = temp;
      info->can_fbo_blit = false;
   }

   /* for scaled MS blits we either need extensions or hand roll */
   if (info->b.mask & PIPE_MASK_RGBA &&
       src_res->base.nr_samples > 0 &&
       src_res->base.nr_samples != dst_res->base.nr_samples &&
       (info->b.src.box.width != info->b.dst.box.width ||
        info->b.src.box.height != info->b.dst.box.height)) {
      if (has_feature(feat_ms_scaled_blit))
         info->gl_filter = GL_SCALED_RESOLVE_NICEST_EXT;
      else
         info->can_fbo_blit = false;
   }
}
static void vrend_renderer_prepare_blit_extra_info(struct vrend_context *ctx,
                                                   struct vrend_resource *src_res,
                                                   struct vrend_resource *dst_res,
                                                   struct vrend_blit_info *info)
{
   info->can_fbo_blit = true;

   info->gl_filter = convert_mag_filter(info->b.filter);

   if (!dst_res->y_0_top) {
      info->dst_y1 = info->b.dst.box.y + info->b.dst.box.height;
      info->dst_y2 = info->b.dst.box.y;
   } else {
      info->dst_y1 = dst_res->base.height0 - info->b.dst.box.y - info->b.dst.box.height;
      info->dst_y2 = dst_res->base.height0 - info->b.dst.box.y;
   }

   if (!src_res->y_0_top) {
      info->src_y1 = info->b.src.box.y + info->b.src.box.height;
      info->src_y2 = info->b.src.box.y;
   } else {
      info->src_y1 = src_res->base.height0 - info->b.src.box.y - info->b.src.box.height;
      info->src_y2 = src_res->base.height0 - info->b.src.box.y;
   }

   if (vrend_blit_needs_swizzle(info->b.dst.format, info->b.src.format)) {
      info->needs_swizzle = true;
      info->can_fbo_blit = false;
   }

   if (info->needs_swizzle && vrend_get_format_table_entry(dst_res->base.format)->flags & VIRGL_TEXTURE_NEED_SWIZZLE)
      memcpy(info->swizzle, tex_conv_table[dst_res->base.format].swizzle, sizeof(info->swizzle));

   if (vrend_blit_needs_redblue_swizzle(src_res, dst_res, &info->b)) {
      VREND_DEBUG(dbg_blit, ctx, "Applying red/blue swizzle during blit involving an external BGR* resource\n");
      uint8_t temp = info->swizzle[0];
      info->swizzle[0] = info->swizzle[2];
      info->swizzle[2] = temp;
      info->can_fbo_blit = false;
   }

    
   if (info->b.mask & PIPE_MASK_RGBA &&
       src_res->base.nr_samples > 0 &&
       src_res->base.nr_samples != dst_res->base.nr_samples &&
       (info->b.src.box.width != info->b.dst.box.width ||
        info->b.src.box.height != info->b.dst.box.height)) {
      if (has_feature(feat_ms_scaled_blit))
         info->gl_filter = GL_SCALED_RESOLVE_NICEST_EXT;
      else
         info->can_fbo_blit = false;
   }
}