Message ID | 20161221001333.21941-2-hoegsberg@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 16-12-20 16:13:33, Kristian H. Kristensen wrote: >From: "Kristian H. Kristensen" <hoegsberg@chromium.org> > >BUG=chrome-os-partner:56407 >TEST=modetest on a KMS driver that exposes modifiers should print those > >Change-Id: I91b2a408b1c8f112d7ba5d0998119b3c800b199c >--- > tests/modetest/modetest.c | 40 ++++++++++++++++++++++++++++++++++++---- > 1 file changed, 36 insertions(+), 4 deletions(-) > >diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c >index dedd286..091bcba 100644 >--- a/tests/modetest/modetest.c >+++ b/tests/modetest/modetest.c >@@ -417,9 +417,30 @@ static void dump_framebuffers(struct device *dev) > printf("\n"); > } > >+static const char * >+mod_to_string(uint64_t mod, char *buf, int len) >+{ >+ switch (mod) { >+ case DRM_FORMAT_MOD_NONE: >+ return "LINEAR"; Just being pedantic here but a lack of modifier doesn't only mean that it's linear, it means that there is no compression, and whatever else the future holds. I'd just maybe return something like "unmodified". >+ case I915_FORMAT_MOD_X_TILED: >+ return "X_TILED"; >+ case I915_FORMAT_MOD_Y_TILED: >+ return "Y_TILED"; >+ case I915_FORMAT_MOD_Yf_TILED: >+ return "Yf_TILED"; >+ case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: >+ return "SAMSUNG_64_32_TILE"; >+ default: >+ snprintf(buf, len, "%016x", mod); >+ return buf; >+ } >+} >+ > static void dump_planes(struct device *dev) > { >- unsigned int i, j; >+ unsigned int i, j, k; >+ char buf[17]; > > printf("Planes:\n"); > printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\tpossible crtcs\n"); >@@ -442,8 +463,19 @@ static void dump_planes(struct device *dev) > continue; > > printf(" formats:"); >- for (j = 0; j < ovr->count_formats; j++) >- printf(" %4.4s", (char *)&ovr->formats[j]); >+ for (j = 0; j < ovr->count_formats; j++) { >+ if (ovr->count_format_modifiers == 0) { >+ printf(" %4.4s", (char *)&ovr->formats[j]); >+ continue; >+ } >+ struct drm_format_modifier *fm; >+ for (k = 0; k < ovr->count_format_modifiers; k++) { >+ fm = &ovr->format_modifiers[k]; >+ if (fm->formats & (1 << j)) >+ printf(" %4.4s:%s", (char *)&ovr->formats[j], >+ mod_to_string(fm->modifier, buf, sizeof(buf))); >+ } >+ } Wasn't the plan to have only 1 modifier per plane? Did that change? The GBM interface only allows 1 modifier per plane. > printf("\n"); > > if (plane->props) { >@@ -609,7 +641,7 @@ static struct resources *get_resources(struct device *dev) > if (!res->planes) > goto error; > >- get_resource(res, plane_res, plane, Plane); >+ get_resource(res, plane_res, plane, Plane2); > get_properties(res, plane_res, plane, PLANE); > > return res; >-- >2.9.3 >
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index dedd286..091bcba 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -417,9 +417,30 @@ static void dump_framebuffers(struct device *dev) printf("\n"); } +static const char * +mod_to_string(uint64_t mod, char *buf, int len) +{ + switch (mod) { + case DRM_FORMAT_MOD_NONE: + return "LINEAR"; + case I915_FORMAT_MOD_X_TILED: + return "X_TILED"; + case I915_FORMAT_MOD_Y_TILED: + return "Y_TILED"; + case I915_FORMAT_MOD_Yf_TILED: + return "Yf_TILED"; + case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: + return "SAMSUNG_64_32_TILE"; + default: + snprintf(buf, len, "%016x", mod); + return buf; + } +} + static void dump_planes(struct device *dev) { - unsigned int i, j; + unsigned int i, j, k; + char buf[17]; printf("Planes:\n"); printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\tpossible crtcs\n"); @@ -442,8 +463,19 @@ static void dump_planes(struct device *dev) continue; printf(" formats:"); - for (j = 0; j < ovr->count_formats; j++) - printf(" %4.4s", (char *)&ovr->formats[j]); + for (j = 0; j < ovr->count_formats; j++) { + if (ovr->count_format_modifiers == 0) { + printf(" %4.4s", (char *)&ovr->formats[j]); + continue; + } + struct drm_format_modifier *fm; + for (k = 0; k < ovr->count_format_modifiers; k++) { + fm = &ovr->format_modifiers[k]; + if (fm->formats & (1 << j)) + printf(" %4.4s:%s", (char *)&ovr->formats[j], + mod_to_string(fm->modifier, buf, sizeof(buf))); + } + } printf("\n"); if (plane->props) { @@ -609,7 +641,7 @@ static struct resources *get_resources(struct device *dev) if (!res->planes) goto error; - get_resource(res, plane_res, plane, Plane); + get_resource(res, plane_res, plane, Plane2); get_properties(res, plane_res, plane, PLANE); return res;
From: "Kristian H. Kristensen" <hoegsberg@chromium.org> BUG=chrome-os-partner:56407 TEST=modetest on a KMS driver that exposes modifiers should print those Change-Id: I91b2a408b1c8f112d7ba5d0998119b3c800b199c --- tests/modetest/modetest.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-)