Lines Matching +full:up +full:- +full:samples
1 // SPDX-License-Identifier: GPL-2.0-only OR MIT
22 * struct pvr_rt_mtile_info - Render target macrotile information
45 struct pvr_device *pvr_dev = pvr_file->pvr_dev; in hwrt_init_kernel_structure()
49 hwrt->pvr_dev = pvr_dev; in hwrt_init_kernel_structure()
50 hwrt->max_rts = args->layers; in hwrt_init_kernel_structure()
53 for (i = 0; i < ARRAY_SIZE(hwrt->free_lists); i++) { in hwrt_init_kernel_structure()
54 hwrt->free_lists[i] = pvr_free_list_lookup(pvr_file, args->free_list_handles[i]); in hwrt_init_kernel_structure()
55 if (!hwrt->free_lists[i]) { in hwrt_init_kernel_structure()
56 err = -EINVAL; in hwrt_init_kernel_structure()
61 if (hwrt->free_lists[ROGUE_FW_LOCAL_FREELIST]->current_pages < in hwrt_init_kernel_structure()
63 err = -EINVAL; in hwrt_init_kernel_structure()
70 for (i = 0; i < ARRAY_SIZE(hwrt->free_lists); i++) { in hwrt_init_kernel_structure()
71 pvr_free_list_put(hwrt->free_lists[i]); in hwrt_init_kernel_structure()
72 hwrt->free_lists[i] = NULL; in hwrt_init_kernel_structure()
83 for (i = 0; i < ARRAY_SIZE(hwrt->free_lists); i++) { in hwrt_fini_kernel_structure()
84 pvr_free_list_put(hwrt->free_lists[i]); in hwrt_fini_kernel_structure()
85 hwrt->free_lists[i] = NULL; in hwrt_fini_kernel_structure()
92 pvr_fw_object_destroy(hwrt->common_fw_obj); in hwrt_fini_common_fw_structure()
96 get_cr_isp_mtile_size_val(struct pvr_device *pvr_dev, u32 samples, in get_cr_isp_mtile_size_val() argument
99 u32 x = info->mtile_x[0]; in get_cr_isp_mtile_size_val()
100 u32 y = info->mtile_y[0]; in get_cr_isp_mtile_size_val()
109 if (samples >= 4) in get_cr_isp_mtile_size_val()
111 if (samples >= 2) in get_cr_isp_mtile_size_val()
114 if (samples >= 8) in get_cr_isp_mtile_size_val()
116 if (samples >= 4) in get_cr_isp_mtile_size_val()
119 if (samples >= 8) in get_cr_isp_mtile_size_val()
122 WARN(true, "Unsupported ISP samples per pixel value"); in get_cr_isp_mtile_size_val()
123 return -EINVAL; in get_cr_isp_mtile_size_val()
133 get_cr_multisamplectl_val(u32 samples, bool y_flip, u64 *value_out) in get_cr_multisamplectl_val() argument
144 /* 2 samples */ in get_cr_multisamplectl_val()
149 /* 4 samples */ in get_cr_multisamplectl_val()
154 /* 8 samples */ in get_cr_multisamplectl_val()
160 const int idx = fls(samples) - 1; in get_cr_multisamplectl_val()
164 return -EINVAL; in get_cr_multisamplectl_val()
169 value |= (((u64)(16 - sample_positions[idx].y[i]) & 0xf)) << (i * 8 + 4); in get_cr_multisamplectl_val()
180 get_cr_te_aa_val(struct pvr_device *pvr_dev, u32 samples, u32 *value_out) in get_cr_te_aa_val() argument
192 if (samples >= 2) in get_cr_te_aa_val()
194 if (samples >= 4) in get_cr_te_aa_val()
198 if (samples >= 2) in get_cr_te_aa_val()
200 if (samples >= 4) in get_cr_te_aa_val()
202 if (samples >= 8) in get_cr_te_aa_val()
206 if (samples >= 2) in get_cr_te_aa_val()
208 if (samples >= 4) in get_cr_te_aa_val()
210 if (samples >= 8) in get_cr_te_aa_val()
214 WARN(true, "Unsupported ISP samples per pixel value"); in get_cr_te_aa_val()
215 return -EINVAL; in get_cr_te_aa_val()
228 memcpy(cpu_ptr, &hwrt->common, sizeof(hwrt->common)); in hwrtdata_common_init()
236 struct drm_pvr_create_hwrt_geom_data_args *geom_data_args = &args->geom_data_args; in hwrt_init_common_fw_structure()
237 struct pvr_device *pvr_dev = pvr_file->pvr_dev; in hwrt_init_common_fw_structure()
249 info.num_tiles_x = DIV_ROUND_UP(args->width, info.tile_size_x); in hwrt_init_common_fw_structure()
250 info.num_tiles_y = DIV_ROUND_UP(args->height, info.tile_size_y); in hwrt_init_common_fw_structure()
263 * Set up 16 macrotiles with a multiple of 2x2 tiles per macrotile, which is in hwrt_init_common_fw_structure()
272 info.tile_max_x = round_up(info.num_tiles_x, 2) - 1; in hwrt_init_common_fw_structure()
273 info.tile_max_y = round_up(info.num_tiles_y, 2) - 1; in hwrt_init_common_fw_structure()
275 /* Set up 16 macrotiles with a multiple of 4x4 tiles per macrotile. */ in hwrt_init_common_fw_structure()
282 info.tile_max_x = info.num_tiles_x - 1; in hwrt_init_common_fw_structure()
283 info.tile_max_y = info.num_tiles_y - 1; in hwrt_init_common_fw_structure()
286 hwrt->common.geom_caches_need_zeroing = false; in hwrt_init_common_fw_structure()
288 hwrt->common.isp_merge_lower_x = args->isp_merge_lower_x; in hwrt_init_common_fw_structure()
289 hwrt->common.isp_merge_lower_y = args->isp_merge_lower_y; in hwrt_init_common_fw_structure()
290 hwrt->common.isp_merge_upper_x = args->isp_merge_upper_x; in hwrt_init_common_fw_structure()
291 hwrt->common.isp_merge_upper_y = args->isp_merge_upper_y; in hwrt_init_common_fw_structure()
292 hwrt->common.isp_merge_scale_x = args->isp_merge_scale_x; in hwrt_init_common_fw_structure()
293 hwrt->common.isp_merge_scale_y = args->isp_merge_scale_y; in hwrt_init_common_fw_structure()
295 err = get_cr_multisamplectl_val(args->samples, false, in hwrt_init_common_fw_structure()
296 &hwrt->common.multi_sample_ctl); in hwrt_init_common_fw_structure()
300 err = get_cr_multisamplectl_val(args->samples, true, in hwrt_init_common_fw_structure()
301 &hwrt->common.flipped_multi_sample_ctl); in hwrt_init_common_fw_structure()
305 hwrt->common.mtile_stride = info.mtile_x[0] * info.mtile_y[0]; in hwrt_init_common_fw_structure()
307 err = get_cr_te_aa_val(pvr_dev, args->samples, &hwrt->common.teaa); in hwrt_init_common_fw_structure()
311 hwrt->common.screen_pixel_max = in hwrt_init_common_fw_structure()
312 (((args->width - 1) << ROGUE_CR_PPP_SCREEN_PIXXMAX_SHIFT) & in hwrt_init_common_fw_structure()
314 (((args->height - 1) << ROGUE_CR_PPP_SCREEN_PIXYMAX_SHIFT) & in hwrt_init_common_fw_structure()
317 hwrt->common.te_screen = in hwrt_init_common_fw_structure()
322 hwrt->common.te_mtile1 = in hwrt_init_common_fw_structure()
326 hwrt->common.te_mtile2 = in hwrt_init_common_fw_structure()
331 err = get_cr_isp_mtile_size_val(pvr_dev, args->samples, &info, in hwrt_init_common_fw_structure()
332 &hwrt->common.isp_mtile_size); in hwrt_init_common_fw_structure()
336 hwrt->common.tpc_stride = geom_data_args->tpc_stride; in hwrt_init_common_fw_structure()
337 hwrt->common.tpc_size = geom_data_args->tpc_size; in hwrt_init_common_fw_structure()
339 hwrt->common.rgn_header_size = args->region_header_size; in hwrt_init_common_fw_structure()
343 &hwrt->common_fw_obj); in hwrt_init_common_fw_structure()
353 memcpy(cpu_ptr, &hwrt_data->data, sizeof(hwrt_data->data)); in hwrt_fw_data_init()
363 struct drm_pvr_create_hwrt_geom_data_args *geom_data_args = &args->geom_data_args; in hwrt_data_init_fw_structure()
364 struct pvr_device *pvr_dev = pvr_file->pvr_dev; in hwrt_data_init_fw_structure()
369 pvr_fw_object_get_fw_addr(hwrt->common_fw_obj, in hwrt_data_init_fw_structure()
370 &hwrt_data->data.hwrt_data_common_fw_addr); in hwrt_data_init_fw_structure()
372 for (free_list_i = 0; free_list_i < ARRAY_SIZE(hwrt->free_lists); free_list_i++) { in hwrt_data_init_fw_structure()
373 pvr_fw_object_get_fw_addr(hwrt->free_lists[free_list_i]->fw_obj, in hwrt_data_init_fw_structure()
374 &hwrt_data->data.freelists_fw_addr[free_list_i]); in hwrt_data_init_fw_structure()
377 hwrt_data->data.tail_ptrs_dev_addr = geom_data_args->tpc_dev_addr; in hwrt_data_init_fw_structure()
378 hwrt_data->data.vheap_table_dev_addr = geom_data_args->vheap_table_dev_addr; in hwrt_data_init_fw_structure()
379 hwrt_data->data.rtc_dev_addr = geom_data_args->rtc_dev_addr; in hwrt_data_init_fw_structure()
381 hwrt_data->data.pm_mlist_dev_addr = rt_data_args->pm_mlist_dev_addr; in hwrt_data_init_fw_structure()
382 hwrt_data->data.macrotile_array_dev_addr = rt_data_args->macrotile_array_dev_addr; in hwrt_data_init_fw_structure()
383 hwrt_data->data.rgn_header_dev_addr = rt_data_args->region_header_dev_addr; in hwrt_data_init_fw_structure()
385 rta_ctl = &hwrt_data->data.rta_ctl; in hwrt_data_init_fw_structure()
387 rta_ctl->render_target_index = 0; in hwrt_data_init_fw_structure()
388 rta_ctl->active_render_targets = 0; in hwrt_data_init_fw_structure()
389 rta_ctl->valid_render_targets_fw_addr = 0; in hwrt_data_init_fw_structure()
390 rta_ctl->rta_num_partial_renders_fw_addr = 0; in hwrt_data_init_fw_structure()
391 rta_ctl->max_rts = args->layers; in hwrt_data_init_fw_structure()
393 if (args->layers > 1) { in hwrt_data_init_fw_structure()
394 err = pvr_fw_object_create(pvr_dev, args->layers * SRTC_ENTRY_SIZE, in hwrt_data_init_fw_structure()
396 NULL, NULL, &hwrt_data->srtc_obj); in hwrt_data_init_fw_structure()
399 pvr_fw_object_get_fw_addr(hwrt_data->srtc_obj, in hwrt_data_init_fw_structure()
400 &rta_ctl->valid_render_targets_fw_addr); in hwrt_data_init_fw_structure()
402 err = pvr_fw_object_create(pvr_dev, args->layers * RAA_ENTRY_SIZE, in hwrt_data_init_fw_structure()
404 NULL, NULL, &hwrt_data->raa_obj); in hwrt_data_init_fw_structure()
407 pvr_fw_object_get_fw_addr(hwrt_data->raa_obj, in hwrt_data_init_fw_structure()
408 &rta_ctl->rta_num_partial_renders_fw_addr); in hwrt_data_init_fw_structure()
413 hwrt_fw_data_init, hwrt_data, &hwrt_data->fw_obj); in hwrt_data_init_fw_structure()
417 pvr_free_list_add_hwrt(hwrt->free_lists[0], hwrt_data); in hwrt_data_init_fw_structure()
422 if (args->layers > 1) in hwrt_data_init_fw_structure()
423 pvr_fw_object_destroy(hwrt_data->raa_obj); in hwrt_data_init_fw_structure()
426 if (args->layers > 1) in hwrt_data_init_fw_structure()
427 pvr_fw_object_destroy(hwrt_data->srtc_obj); in hwrt_data_init_fw_structure()
435 struct pvr_hwrt_data *hwrt_data = &hwrt->data[hwrt_nr]; in hwrt_data_fini_fw_structure()
437 pvr_free_list_remove_hwrt(hwrt->free_lists[0], hwrt_data); in hwrt_data_fini_fw_structure()
439 if (hwrt->max_rts > 1) { in hwrt_data_fini_fw_structure()
440 pvr_fw_object_destroy(hwrt_data->raa_obj); in hwrt_data_fini_fw_structure()
441 pvr_fw_object_destroy(hwrt_data->srtc_obj); in hwrt_data_fini_fw_structure()
444 pvr_fw_object_destroy(hwrt_data->fw_obj); in hwrt_data_fini_fw_structure()
448 * pvr_hwrt_dataset_create() - Create a new HWRT dataset
454 * * ERR_PTR(-%ENOMEM) on out of memory.
467 return ERR_PTR(-ENOMEM); in pvr_hwrt_dataset_create()
477 for (; i < ARRAY_SIZE(hwrt->data); i++) { in pvr_hwrt_dataset_create()
479 &args->rt_data_args[i], in pvr_hwrt_dataset_create()
480 &hwrt->data[i]); in pvr_hwrt_dataset_create()
484 hwrt->data[i].hwrt_dataset = hwrt; in pvr_hwrt_dataset_create()
487 kref_init(&hwrt->ref_count); in pvr_hwrt_dataset_create()
491 while (--i >= 0) in pvr_hwrt_dataset_create()
509 for (int i = ARRAY_SIZE(hwrt->data) - 1; i >= 0; i--) { in pvr_hwrt_dataset_release()
510 WARN_ON(pvr_fw_structure_cleanup(hwrt->pvr_dev, ROGUE_FWIF_CLEANUP_HWRTDATA, in pvr_hwrt_dataset_release()
511 hwrt->data[i].fw_obj, 0)); in pvr_hwrt_dataset_release()
535 xa_for_each(&pvr_file->hwrt_handles, handle, hwrt) { in pvr_destroy_hwrt_datasets_for_file()
537 pvr_hwrt_dataset_put(xa_erase(&pvr_file->hwrt_handles, handle)); in pvr_destroy_hwrt_datasets_for_file()
542 * pvr_hwrt_dataset_put() - Release reference on HWRT dataset
549 kref_put(&hwrt->ref_count, pvr_hwrt_dataset_release); in pvr_hwrt_dataset_put()