@@ -711,12 +711,31 @@ static void create_shared_fb(enum pixel_format format)
PLANE_PRI, &s->big);
}
+static void destroy_fbs(enum pixel_format format)
+{
+ struct screen_fbs *s = &fbs[format];
+
+ if (!s->initialized)
+ return;
+
+ if (scnd_mode_params.connector_id) {
+ igt_remove_fb(drm.fd, &s->scnd_pri);
+ igt_remove_fb(drm.fd, &s->scnd_cur);
+ igt_remove_fb(drm.fd, &s->scnd_spr);
+ }
+ igt_remove_fb(drm.fd, &s->prim_pri);
+ igt_remove_fb(drm.fd, &s->prim_cur);
+ igt_remove_fb(drm.fd, &s->prim_spr);
+ igt_remove_fb(drm.fd, &s->offscreen);
+ igt_remove_fb(drm.fd, &s->big);
+}
+
static void create_fbs(enum pixel_format format)
{
struct screen_fbs *s = &fbs[format];
if (s->initialized)
- return;
+ destroy_fbs(format);
s->initialized = true;
@@ -747,25 +766,6 @@ static void create_fbs(enum pixel_format format)
LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_SPR, &s->scnd_spr);
}
-static void destroy_fbs(enum pixel_format format)
-{
- struct screen_fbs *s = &fbs[format];
-
- if (!s->initialized)
- return;
-
- if (scnd_mode_params.connector_id) {
- igt_remove_fb(drm.fd, &s->scnd_pri);
- igt_remove_fb(drm.fd, &s->scnd_cur);
- igt_remove_fb(drm.fd, &s->scnd_spr);
- }
- igt_remove_fb(drm.fd, &s->prim_pri);
- igt_remove_fb(drm.fd, &s->prim_cur);
- igt_remove_fb(drm.fd, &s->prim_spr);
- igt_remove_fb(drm.fd, &s->offscreen);
- igt_remove_fb(drm.fd, &s->big);
-}
-
static bool set_mode_for_params(struct modeset_params *params)
{
int rc;
This patch was originally written because of a workaround we were planning to merge. Later we improved the workaround so it wouldn't need this patch anymore. Then later we gave up on the workaround, but decided to go with a plan that would cause GTT mmap writes to invalidate FBC in case the frontbuffer ever had a WC mmap. So now we need the patch again because we don't want a subtest that involves an WC mmap to change the behavior of other unrelated subtests that use GTT mmaps. Even if we don't go with the current planned Kernel patch, merging this should be worth in order to avoid future related problems. v2: New commit message. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> --- tests/kms_frontbuffer_tracking.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)