Back to home page

OSCL-LXR

 
 

    


0001 
0002 /*
0003  * Copyright 2017 Advanced Micro Devices, Inc.
0004  *
0005  * Permission is hereby granted, free of charge, to any person obtaining a
0006  * copy of this software and associated documentation files (the "Software"),
0007  * to deal in the Software without restriction, including without limitation
0008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0009  * and/or sell copies of the Software, and to permit persons to whom the
0010  * Software is furnished to do so, subject to the following conditions:
0011  *
0012  * The above copyright notice and this permission notice shall be included in
0013  * all copies or substantial portions of the Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0018  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0019  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0020  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0021  * OTHER DEALINGS IN THE SOFTWARE.
0022  *
0023  * Authors: AMD
0024  *
0025  */
0026 #include "rc_calc.h"
0027 
0028 /**
0029  * calc_rc_params - reads the user's cmdline mode
0030  * @rc: DC internal DSC parameters
0031  * @pps: DRM struct with all required DSC values
0032  *
0033  * This function expects a drm_dsc_config data struct with all the required DSC
0034  * values previously filled out by our driver and based on this information it
0035  * computes some of the DSC values.
0036  *
0037  * @note This calculation requires float point operation, most of it executes
0038  * under kernel_fpu_{begin,end}.
0039  */
0040 void calc_rc_params(struct rc_params *rc, const struct drm_dsc_config *pps)
0041 {
0042     enum colour_mode mode;
0043     enum bits_per_comp bpc;
0044     bool is_navite_422_or_420;
0045     u16 drm_bpp = pps->bits_per_pixel;
0046     int slice_width  = pps->slice_width;
0047     int slice_height = pps->slice_height;
0048 
0049     mode = pps->convert_rgb ? CM_RGB : (pps->simple_422  ? CM_444 :
0050                        (pps->native_422  ? CM_422 :
0051                         pps->native_420  ? CM_420 : CM_444));
0052     bpc = (pps->bits_per_component == 8) ? BPC_8 : (pps->bits_per_component == 10)
0053                          ? BPC_10 : BPC_12;
0054 
0055     is_navite_422_or_420 = pps->native_422 || pps->native_420;
0056 
0057     DC_FP_START();
0058     _do_calc_rc_params(rc, mode, bpc, drm_bpp, is_navite_422_or_420,
0059                slice_width, slice_height,
0060                pps->dsc_version_minor);
0061     DC_FP_END();
0062 }