Path: blob/21.2-virgl/src/gallium/drivers/panfrost/pan_blit.c
4570 views
/*1* Copyright (C) 2014 Broadcom2* Copyright (C) 2019 Collabora, Ltd.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21* SOFTWARE.22*23* Authors (Collabora):24* Tomeu Vizoso <[email protected]>25* Alyssa Rosenzweig <[email protected]>26*27*/2829#include "pan_context.h"30#include "pan_util.h"31#include "util/format/u_format.h"3233static void34panfrost_blitter_save(35struct panfrost_context *ctx,36struct blitter_context *blitter,37bool render_cond)38{3940util_blitter_save_vertex_buffer_slot(blitter, ctx->vertex_buffers);41util_blitter_save_vertex_elements(blitter, ctx->vertex);42util_blitter_save_vertex_shader(blitter, ctx->shader[PIPE_SHADER_VERTEX]);43util_blitter_save_rasterizer(blitter, ctx->rasterizer);44util_blitter_save_viewport(blitter, &ctx->pipe_viewport);45util_blitter_save_scissor(blitter, &ctx->scissor);46util_blitter_save_fragment_shader(blitter, ctx->shader[PIPE_SHADER_FRAGMENT]);47util_blitter_save_blend(blitter, ctx->blend);48util_blitter_save_depth_stencil_alpha(blitter, ctx->depth_stencil);49util_blitter_save_stencil_ref(blitter, &ctx->stencil_ref);50util_blitter_save_so_targets(blitter, 0, NULL);51util_blitter_save_sample_mask(blitter, ctx->sample_mask);5253util_blitter_save_framebuffer(blitter, &ctx->pipe_framebuffer);54util_blitter_save_fragment_sampler_states(blitter,55ctx->sampler_count[PIPE_SHADER_FRAGMENT],56(void **)(&ctx->samplers[PIPE_SHADER_FRAGMENT]));57util_blitter_save_fragment_sampler_views(blitter,58ctx->sampler_view_count[PIPE_SHADER_FRAGMENT],59(struct pipe_sampler_view **)&ctx->sampler_views[PIPE_SHADER_FRAGMENT]);60util_blitter_save_fragment_constant_buffer_slot(blitter,61ctx->constant_buffer[PIPE_SHADER_FRAGMENT].cb);6263if (!render_cond) {64util_blitter_save_render_condition(blitter,65(struct pipe_query *) ctx->cond_query,66ctx->cond_cond, ctx->cond_mode);67}6869}7071void72panfrost_blit(struct pipe_context *pipe,73const struct pipe_blit_info *info)74{75struct panfrost_context *ctx = pan_context(pipe);7677if (info->render_condition_enable &&78!panfrost_render_condition_check(ctx))79return;8081if (!util_blitter_is_blit_supported(ctx->blitter, info))82unreachable("Unsupported blit\n");8384panfrost_blitter_save(ctx, ctx->blitter, info->render_condition_enable);85util_blitter_blit(ctx->blitter, info);86}878889