if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
sscreen->debug_flags |= DBG_ALL_SHADERS;
+ /* Syntax:
+ * EQAA=s,z,c
+ * Example:
+ * EQAA=8,4,2
+
+ * That means 8 coverage samples, 4 Z/S samples, and 2 color samples.
+ * Constraints:
+ * s >= z >= c (ignoring this only wastes memory)
+ * s = [2..16]
+ * z = [2..8]
+ * c = [2..8]
+ *
+ * Only MSAA color and depth buffers are overriden.
+ */
+ if (sscreen->info.drm_major == 3) {
+ const char *eqaa = debug_get_option("EQAA", NULL);
+ unsigned s,z,f;
+
+ if (eqaa && sscanf(eqaa, "%u,%u,%u", &s, &z, &f) == 3 && s && z && f) {
+ sscreen->eqaa_force_coverage_samples = s;
+ sscreen->eqaa_force_z_samples = z;
+ sscreen->eqaa_force_color_samples = f;
+ }
+ }
+
for (i = 0; i < num_comp_hi_threads; i++)
si_init_compiler(sscreen, &sscreen->compiler[i]);
for (i = 0; i < num_comp_lo_threads; i++)
return RADEON_SURF_MODE_2D;
}
-static unsigned si_get_num_color_samples(const struct pipe_resource *templ,
+static unsigned si_get_num_color_samples(struct si_screen *sscreen,
+ const struct pipe_resource *templ,
bool imported)
{
+ if (!imported && templ->nr_samples >= 2 &&
+ sscreen->eqaa_force_color_samples)
+ return sscreen->eqaa_force_color_samples;
+
return CLAMP(templ->nr_samples, 1, 8);
}
const struct pipe_resource *templ)
{
struct si_screen *sscreen = (struct si_screen*)screen;
+ bool is_zs = util_format_is_depth_or_stencil(templ->format);
+
+ if (templ->nr_samples >= 2) {
+ /* This is hackish (overwriting the const pipe_resource template),
+ * but should be harmless and state trackers can also see
+ * the overriden number of samples in the created pipe_resource.
+ */
+ if (is_zs && sscreen->eqaa_force_z_samples) {
+ ((struct pipe_resource*)templ)->nr_samples =
+ sscreen->eqaa_force_z_samples;
+ } else if (!is_zs && sscreen->eqaa_force_color_samples) {
+ ((struct pipe_resource*)templ)->nr_samples =
+ sscreen->eqaa_force_coverage_samples;
+ }
+ }
+
struct radeon_surf surface = {0};
bool is_flushed_depth = templ->flags & SI_RESOURCE_FLAG_FLUSHED_DEPTH;
bool tc_compatible_htile =
!(sscreen->debug_flags & DBG(NO_HYPERZ)) &&
!is_flushed_depth &&
templ->nr_samples <= 1 && /* TC-compat HTILE is less efficient with MSAA */
- util_format_is_depth_or_stencil(templ->format);
- unsigned num_color_samples = si_get_num_color_samples(templ, false);
+ is_zs;
+ unsigned num_color_samples = si_get_num_color_samples(sscreen, templ, false);
int r;
r = si_init_surface(sscreen, &surface, templ, num_color_samples,
si_surface_import_metadata(sscreen, &surface, &metadata,
&array_mode, &is_scanout);
- unsigned num_color_samples = si_get_num_color_samples(templ, true);
+ unsigned num_color_samples = si_get_num_color_samples(sscreen, templ, true);
r = si_init_surface(sscreen, &surface, templ, num_color_samples,
array_mode, stride, offset, true, is_scanout,
is_scanout = false;
}
- unsigned num_color_samples = si_get_num_color_samples(templ, true);
+ unsigned num_color_samples = si_get_num_color_samples(sscreen, templ, true);
r = si_init_surface(sscreen, &surface, templ, num_color_samples,
array_mode, memobj->stride, offset, true,