/* * Copyright © 2014-2015 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * DOC: Render command list generation * * In the V3D hardware, render command lists are what load and store * tiles of a framebuffer and optionally call out to binner-generated * command lists to do the 3D drawing for that tile. * * In the VC4 driver, render command list generation is performed by the * kernel instead of userspace. We do this because validating a * user-submitted command list is hard to get right and has high CPU overhead, * while the number of valid configurations for render command lists is * actually fairly low. */ #include "uapi/drm/vc4_drm.h" #include "vc4_drv.h" #include "vc4_packet.h" struct vc4_rcl_setup { … }; static inline void rcl_u8(struct vc4_rcl_setup *setup, u8 val) { … } static inline void rcl_u16(struct vc4_rcl_setup *setup, u16 val) { … } static inline void rcl_u32(struct vc4_rcl_setup *setup, u32 val) { … } /* * Emits a no-op STORE_TILE_BUFFER_GENERAL. * * If we emit a PACKET_TILE_COORDINATES, it must be followed by a store of * some sort before another load is triggered. */ static void vc4_store_before_load(struct vc4_rcl_setup *setup) { … } /* * Calculates the physical address of the start of a tile in a RCL surface. * * Unlike the other load/store packets, * VC4_PACKET_LOAD/STORE_FULL_RES_TILE_BUFFER don't look at the tile * coordinates packet, and instead just store to the address given. */ static uint32_t vc4_full_res_offset(struct vc4_exec_info *exec, struct drm_gem_dma_object *bo, struct drm_vc4_submit_rcl_surface *surf, uint8_t x, uint8_t y) { … } /* * Emits a PACKET_TILE_COORDINATES if one isn't already pending. * * The tile coordinates packet triggers a pending load if there is one, are * used for clipping during rendering, and determine where loads/stores happen * relative to their base address. */ static void vc4_tile_coordinates(struct vc4_rcl_setup *setup, uint32_t x, uint32_t y) { … } static void emit_tile(struct vc4_exec_info *exec, struct vc4_rcl_setup *setup, uint8_t x, uint8_t y, bool first, bool last) { … } static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, struct vc4_rcl_setup *setup) { … } static int vc4_full_res_bounds_check(struct vc4_exec_info *exec, struct drm_gem_dma_object *obj, struct drm_vc4_submit_rcl_surface *surf) { … } static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, struct drm_gem_dma_object **obj, struct drm_vc4_submit_rcl_surface *surf) { … } static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, struct drm_gem_dma_object **obj, struct drm_vc4_submit_rcl_surface *surf, bool is_write) { … } static int vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, struct vc4_rcl_setup *setup, struct drm_gem_dma_object **obj, struct drm_vc4_submit_rcl_surface *surf) { … } int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) { … }