From 8d36be9b49f383c328e9470f742238d554904ca3 Mon Sep 17 00:00:00 2001
From: hanishkvc <hanishkvc@gmail.com>
Date: Fri, 26 Jun 2020 16:12:01 +0530
Subject: [PATCH 05/15] Verbose where required.

Init tells what detile will be done. Currently only Intel X-Tile
is implemented by the way. Ok I have not yet checked this logic
against such a setup yet, currently stuck on a chromebook termina
which doesnt allow direct access for kmsgrab. Also dont have a
test stream with x-tiled data on this machine.

The initial flow when putting it down seemed ok, havent reviewed
the code yet.

Also now the alert is printed in filter logic for detile_intelx,
only if the width*4 doesnt match the src linesize | pitch.

NOTE: Previously in one of the commits I had mentioned, its hard
coded for 32bit / pixel formats, but at one level it should be
fine, wrt avoiding any corner case, because while negotiating
the pixel fileformats, I currently restrict it to a very narrow
set.
---
 libavfilter/vf_fbdetile.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_fbdetile.c b/libavfilter/vf_fbdetile.c
index 342fbb64e3..e0742c6263 100644
--- a/libavfilter/vf_fbdetile.c
+++ b/libavfilter/vf_fbdetile.c
@@ -59,6 +59,13 @@ static av_cold int init(AVFilterContext *ctx)
 {
     FBDetileContext *fbdetile = ctx->priv;
 
+    if (fbdetile->type == TYPE_INTELX) {
+        fprintf(stderr,"INFO:fbdetile:init: Intel X-tile to linear\n");
+    } else if (fbdetile->type == TYPE_INTELY) {
+        fprintf(stderr,"WARN:fbdetile:init: Intel Y-tile to linear, not yet implemented\n");
+    } else {
+        fprintf(stderr,"ERRR:fbdetile:init: Unknown Tile format specified\n");
+    }
     fbdetile->width = 1920;
     fbdetile->height = 1080;
     return 0;
@@ -78,7 +85,6 @@ static int query_formats(AVFilterContext *ctx)
 
 static int config_props(AVFilterLink *inlink)
 {
-    int p;
     AVFilterContext *ctx = inlink->dst;
     FBDetileContext *fbdetile = ctx->priv;
 
@@ -98,7 +104,10 @@ static void detile_intelx(AVFilterContext *ctx, int w, int h,
     int tileH = 8;
     int numHTiles = w/tileW;
 
-    fprintf(stderr,"DBUG:fbtile:intelx: w%dxh%d, dL%d, sL%d\n", w, h, dstLineSize, srcLineSize);
+    if (w*4 != srcLineSize) {
+        fprintf(stderr,"DBUG:fbtile:intelx: w%dxh%d, dL%d, sL%d\n", w, h, dstLineSize, srcLineSize);
+        fprintf(stderr,"ERRR:fbtile:intelx: dont support LineSize | Pitch going beyond width\n");
+    }
     int sO = 0;
     int dX = 0;
     int dY = 0;
-- 
2.20.1

