Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #ifndef __DAL_COMPRESSOR_H__
0027 #define __DAL_COMPRESSOR_H__
0028 
0029 #include "include/grph_object_id.h"
0030 #include "bios_parser_interface.h"
0031 
0032 enum fbc_compress_ratio {
0033     FBC_COMPRESS_RATIO_INVALID = 0,
0034     FBC_COMPRESS_RATIO_1TO1 = 1,
0035     FBC_COMPRESS_RATIO_2TO1 = 2,
0036     FBC_COMPRESS_RATIO_4TO1 = 4,
0037     FBC_COMPRESS_RATIO_8TO1 = 8,
0038 };
0039 
0040 union fbc_physical_address {
0041     struct {
0042         uint32_t low_part;
0043         int32_t high_part;
0044     } addr;
0045     uint64_t quad_part;
0046 };
0047 
0048 struct compr_addr_and_pitch_params {
0049     /* enum controller_id controller_id; */
0050     uint32_t inst;
0051     uint32_t source_view_width;
0052     uint32_t source_view_height;
0053 };
0054 
0055 enum fbc_hw_max_resolution_supported {
0056     FBC_MAX_X = 3840,
0057     FBC_MAX_Y = 2400,
0058     FBC_MAX_X_SG = 1920,
0059     FBC_MAX_Y_SG = 1080,
0060 };
0061 
0062 struct compressor;
0063 
0064 struct compressor_funcs {
0065 
0066     void (*power_up_fbc)(struct compressor *cp);
0067     void (*enable_fbc)(struct compressor *cp,
0068         struct compr_addr_and_pitch_params *params);
0069     void (*disable_fbc)(struct compressor *cp);
0070     void (*set_fbc_invalidation_triggers)(struct compressor *cp,
0071         uint32_t fbc_trigger);
0072     void (*surface_address_and_pitch)(
0073         struct compressor *cp,
0074         struct compr_addr_and_pitch_params *params);
0075     bool (*is_fbc_enabled_in_hw)(struct compressor *cp,
0076         uint32_t *fbc_mapped_crtc_id);
0077 };
0078 struct compressor {
0079     struct dc_context *ctx;
0080     /* CONTROLLER_ID_D0 + instance, CONTROLLER_ID_UNDEFINED = 0 */
0081     uint32_t attached_inst;
0082     bool is_enabled;
0083     const struct compressor_funcs *funcs;
0084     union {
0085         uint32_t raw;
0086         struct {
0087             uint32_t FBC_SUPPORT:1;
0088             uint32_t FB_POOL:1;
0089             uint32_t DYNAMIC_ALLOC:1;
0090             uint32_t LPT_SUPPORT:1;
0091             uint32_t LPT_MC_CONFIG:1;
0092             uint32_t DUMMY_BACKEND:1;
0093             uint32_t CLK_GATING_DISABLED:1;
0094 
0095         } bits;
0096     } options;
0097 
0098     union fbc_physical_address compr_surface_address;
0099 
0100     uint32_t embedded_panel_h_size;
0101     uint32_t embedded_panel_v_size;
0102     uint32_t memory_bus_width;
0103     uint32_t banks_num;
0104     uint32_t raw_size;
0105     uint32_t channel_interleave_size;
0106     uint32_t dram_channels_num;
0107 
0108     uint32_t allocated_size;
0109     uint32_t preferred_requested_size;
0110     uint32_t lpt_channels_num;
0111     enum fbc_compress_ratio min_compress_ratio;
0112 };
0113 
0114 struct fbc_input_info {
0115     bool           dynamic_fbc_buffer_alloc;
0116     unsigned int   source_view_width;
0117     unsigned int   source_view_height;
0118     unsigned int   num_of_active_targets;
0119 };
0120 
0121 
0122 struct fbc_requested_compressed_size {
0123     unsigned int   preferred_size;
0124     unsigned int   preferred_size_alignment;
0125     unsigned int   min_size;
0126     unsigned int   min_size_alignment;
0127     union {
0128         struct {
0129             /* Above preferedSize must be allocated in FB pool */
0130             unsigned int preferred_must_be_framebuffer_pool : 1;
0131             /* Above minSize must be allocated in FB pool */
0132             unsigned int min_must_be_framebuffer_pool : 1;
0133         } bits;
0134         unsigned int flags;
0135     };
0136 };
0137 #endif