|
@@ -22,6 +22,73 @@
|
|
#define MSM_VIDC_MIN_UBWC_COMPRESSION_RATIO (1 << 16)
|
|
#define MSM_VIDC_MIN_UBWC_COMPRESSION_RATIO (1 << 16)
|
|
#define MSM_VIDC_MAX_UBWC_COMPRESSION_RATIO (5 << 16)
|
|
#define MSM_VIDC_MAX_UBWC_COMPRESSION_RATIO (5 << 16)
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Utility function to enforce some of our assumptions. Spam calls to this
|
|
|
|
+ * in hotspots in code to double check some of the assumptions that we hold.
|
|
|
|
+ */
|
|
|
|
+struct lut const *__lut(int width, int height, int fps)
|
|
|
|
+{
|
|
|
|
+ int frame_size = height * width, c = 0;
|
|
|
|
+
|
|
|
|
+ do {
|
|
|
|
+ if (LUT[c].frame_size >= frame_size && LUT[c].frame_rate >= fps)
|
|
|
|
+ return &LUT[c];
|
|
|
|
+ } while (++c < ARRAY_SIZE(LUT));
|
|
|
|
+
|
|
|
|
+ return &LUT[ARRAY_SIZE(LUT) - 1];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+fp_t __compression_ratio(struct lut const *entry, int bpp)
|
|
|
|
+{
|
|
|
|
+ int c = 0;
|
|
|
|
+
|
|
|
|
+ for (c = 0; c < COMPRESSION_RATIO_MAX; ++c) {
|
|
|
|
+ if (entry->compression_ratio[c].bpp == bpp)
|
|
|
|
+ return entry->compression_ratio[c].ratio;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WARN(true, "Shouldn't be here, LUT possibly corrupted?\n");
|
|
|
|
+ return FP_ZERO; /* impossible */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void __dump(struct dump dump[], int len)
|
|
|
|
+{
|
|
|
|
+ int c = 0;
|
|
|
|
+
|
|
|
|
+ for (c = 0; c < len; ++c) {
|
|
|
|
+ char format_line[128] = "", formatted_line[128] = "";
|
|
|
|
+
|
|
|
|
+ if (dump[c].val == DUMP_HEADER_MAGIC) {
|
|
|
|
+ snprintf(formatted_line, sizeof(formatted_line), "%s\n",
|
|
|
|
+ dump[c].key);
|
|
|
|
+ } else {
|
|
|
|
+ bool fp_format = !strcmp(dump[c].format, DUMP_FP_FMT);
|
|
|
|
+
|
|
|
|
+ if (!fp_format) {
|
|
|
|
+ snprintf(format_line, sizeof(format_line),
|
|
|
|
+ " %-35s: %s\n", dump[c].key,
|
|
|
|
+ dump[c].format);
|
|
|
|
+ snprintf(formatted_line, sizeof(formatted_line),
|
|
|
|
+ format_line, dump[c].val);
|
|
|
|
+ } else {
|
|
|
|
+ size_t integer_part, fractional_part;
|
|
|
|
+
|
|
|
|
+ integer_part = fp_int(dump[c].val);
|
|
|
|
+ fractional_part = fp_frac(dump[c].val);
|
|
|
|
+ snprintf(formatted_line, sizeof(formatted_line),
|
|
|
|
+ " %-35s: %zd + %zd/%zd\n",
|
|
|
|
+ dump[c].key, integer_part,
|
|
|
|
+ fractional_part,
|
|
|
|
+ fp_frac_base());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ d_vpr_b("%s", formatted_line);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
u64 msm_vidc_max_freq(struct msm_vidc_inst *inst)
|
|
u64 msm_vidc_max_freq(struct msm_vidc_inst *inst)
|
|
{
|
|
{
|
|
struct msm_vidc_core* core;
|
|
struct msm_vidc_core* core;
|