Add C8, 30bpp and FP16 support to modetest
cover Add C8, 30bpp and FP16 support to modetest
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE pattern
util: fix MAKE_RGBA macro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a format
modetest: add an add_property_optional variant that does not print
errors
modetest: add C8 support to generate SMPTE pattern
modetest: add the ability to specify fill patterns on the commandline
modetest: add FP16 format support
tests/modetest/buffers.c | 13 ++ tests/modetest/modetest.c | 109 ++++++++-- tests/util/format.c | 7 + tests/util/pattern.c | 432 +++++++++++++++++++++++++++++++++++++- tests/util/pattern.h | 7 + 5 files changed, 543 insertions(+), 25 deletions(-)
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/10 util: add C8 format, support it with SMPTE pattern
This also adds a helper to generate a color LUT, which has to be used in conjunction with the C8 indexed format.
--- tests/util/format.c | 2 ++ tests/util/pattern.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ tests/util/pattern.h | 4 +++ 3 files changed, 81 insertions(+)
tests/util/format.c +2 -0
@@ -39,6 +39,8 @@ .yuv = { (order), (xsub), (ysub), (chroma_stride) }static const struct util_format_info format_info[] = { +/* Indexed */ + {DRM_FORMAT_C8 ,"C8" },/* YUV packed */ {DRM_FORMAT_UYVY ,"UYVY" ,MAKE_YUV_INFO (YUV_YCbCr |YUV_CY ,2 ,2 ,2 ) }, {DRM_FORMAT_VYUY ,"VYUY" ,MAKE_YUV_INFO (YUV_YCrCb |YUV_CY ,2 ,2 ,2 ) },
tests/util/pattern.c +75 -0
87 lines not on this page · raw message
tests/util/pattern.h +4 -0
@@ -26,6 +26,8 @@#ifndef UTIL_PATTERN_H #define UTIL_PATTERN_H +#include <drm/drm_mode.h> +enum util_fill_pattern {UTIL_PATTERN_TILES , UTIL_PATTERN_PLAIN,
@@ -36,4 +38,6 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern, void *planes[3], unsigned int width, unsigned int height, unsigned int stride); +void util_smpte_c8_gamma (unsigned size,struct drm_color_lut *lut); +#endif /* UTIL_PATTERN_H */
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/10 util: fix MAKE_RGBA macro for 10bpp modes
In reply to Ilia MirkinWe need to shift the values up, otherwise we'd end up with a negative shift. This works for up-to 16-bit components, which is fine for now.
--- tests/util/pattern.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
tests/util/pattern.c +15 -4
@@ -60,11 +60,22 @@ struct color_yuv { .u = MAKE_YUV_601_U(r, g, b), \ .v = MAKE_YUV_601_V(r, g, b) } +static inline uint32_t shiftcolor (const struct util_color_component *comp, +uint32_t value) +{ +/* Fill the low bits with the high bits. */ + value = (value <<8 ) | value; +/* Shift down to remove unwanted low bits */ + value = value >> (16 - comp->length); +/* Shift back up to where the value should be */ +return value << comp->offset; +} +#define MAKE_RGBA (rgb, r, g, b, a) \ - ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \ - (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \ - (((b) >> (8 - (rgb)->blue.length)) << (rgb)->blue.offset) | \ - (((a) >> (8 - (rgb)->alpha.length)) << (rgb)->alpha.offset)) + (shiftcolor(&(rgb)->red, (r)) | \ + shiftcolor(&(rgb)->green, (g)) | \ + shiftcolor(&(rgb)->blue, (b)) | \ + shiftcolor(&(rgb)->alpha, (a)))#define MAKE_RGB24 (rgb, r, g, b) \ { .value = MAKE_RGBA(rgb, r, g, b, 0) }
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/10 util: add gradient pattern
In reply to Ilia MirkinThe idea is to have a horizontal pattern split into two with the top and bottom halves having different precision. This allows one to see whether 10bpc support is working properly or not, as there are many pieces to the puzzle beyond the basic format support (gamma ramps, bpc encodings, etc).
This is really only useful on 10bpc formats, but we also add support for 8bpc formats to ease testing. In the future, this could be applied to 16bpc formats as well.
--- tests/util/pattern.c | 113 +++++++++++++++++++++++++++++++++++++++++-- tests/util/pattern.h | 1 + 2 files changed, 109 insertions(+), 5 deletions(-)
tests/util/pattern.c +108 -5
@@ -60,9 +60,11 @@ struct color_yuv { .u = MAKE_YUV_601_U(r, g, b), \ .v = MAKE_YUV_601_V(r, g, b) } -static inline uint32_t shiftcolor (const struct util_color_component *comp, +/* This function takes 8-bit color values */ +static inline uint32_t shiftcolor8 (const struct util_color_component *comp,uint32_t value) { + value &=0xff ;/* Fill the low bits with the high bits. */ value = (value <<8 ) | value;/* Shift down to remove unwanted low bits */
@@ -71,11 +73,30 @@ static inline uint32_t shiftcolor(const struct util_color_component *comp,return value << comp->offset; } +/* This function takes 10-bit color values */ +static inline uint32_t shiftcolor10 (const struct util_color_component *comp, +uint32_t value) +{ + value &=0x3ff ; +/* Fill the low bits with the high bits. */ + value = (value <<6 ) | (value >>4 ); +/* Shift down to remove unwanted low bits */ + value = value >> (16 - comp->length); +/* Shift back up to where the value should be */ +return value << comp->offset; +} + +#define MAKE_RGBA10 (rgb, r, g, b, a) \ + (shiftcolor10(&(rgb)->red, (r)) | \ + shiftcolor10(&(rgb)->green, (g)) | \ + shiftcolor10(&(rgb)->blue, (b)) | \ + shiftcolor10(&(rgb)->alpha, (a))) +#define MAKE_RGBA (rgb, r, g, b, a) \ - (shiftcolor(&(rgb)->red, (r)) | \ - shiftcolor(&(rgb)->green, (g)) | \ - shiftcolor(&(rgb)->blue, (b)) | \ - shiftcolor(&(rgb)->alpha, (a))) + (shiftcolor8(&(rgb)->red, (r)) | \ + shiftcolor8(&(rgb)->green, (g)) | \ + shiftcolor8(&(rgb)->blue, (b)) | \ + shiftcolor8(&(rgb)->alpha, (a)))#define MAKE_RGB24 (rgb, r, g, b) \ { .value = MAKE_RGBA(rgb, r, g, b, 0) }
@@ -912,6 +933,85 @@ static void fill_plain(void *planes[3],memset (planes[0 ],0x77 , stride * height); } +static void fill_gradient_rgb32 (const struct util_rgb_info *rgb, +void *mem, +unsigned int width,unsigned int height, +unsigned int stride) +{ +int i, j; + +for (i =0 ; i < height /2 ; i++) { +uint32_t *row = mem; + +for (j =0 ; j < width /2 ; j++) { +uint32_t value =MAKE_RGBA10 (rgb, j &0x3ff , j &0x3ff , j &0x3ff ,0 ); + row[2 *j] = row[2 *j+1 ] = value; + } + mem += stride; + } + +for (; i < height; i++) { +uint32_t *row = mem; + +for (j =0 ; j < width /2 ; j++) { +uint32_t value =MAKE_RGBA10 (rgb, j &0x3fc , j &0x3fc , j &0x3fc ,0 ); + row[2 *j] = row[2 *j+1 ] = value; + } + mem += stride; + } +} + +/* The gradient pattern creates two horizontal gray gradients, split +* into two halves. The top half has 10bpc precision, the bottom half +* has 8bpc precision. When using with a 10bpc fb format, there are 3 +* possible outcomes: +* +* - Pixel data is encoded as 8bpc to the display, no dithering. This +* would lead to the top and bottom halves looking identical. +* +* - Pixel data is encoded as 8bpc to the display, with dithering. This +* would lead to there being a visible difference between the two halves, +* but the top half would look a little speck-y due to the dithering. +* +* - Pixel data is encoded at 10bpc+ to the display (which implies +* the display is able to show this level of depth). This should +* lead to the top half being a very clean gradient, and visibly different +* from the bottom half. +* +* Once we support additional fb formats, this approach could be extended +* to distinguish even higher bpc precisions. +* +* Note that due to practical size considerations, for the screens +* where this matters, the pattern actually emits stripes 2-pixels +* wide for each gradient color. Otherwise the difference may be a bit +* hard to notice. +*/ +static void fill_gradient (const struct util_format_info *info,void *planes[3 ], +unsigned int width,unsigned int height, +unsigned int stride) +{ +switch (info->format) { +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_RGBA8888 : +case DRM_FORMAT_RGBX8888 : +case DRM_FORMAT_BGRA8888 : +case DRM_FORMAT_BGRX8888 : +case DRM_FORMAT_ARGB2101010 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_ABGR2101010 : +case DRM_FORMAT_XBGR2101010 : +case DRM_FORMAT_RGBA1010102 : +case DRM_FORMAT_RGBX1010102 : +case DRM_FORMAT_BGRA1010102 : +case DRM_FORMAT_BGRX1010102 : +return fill_gradient_rgb32 (&info->rgb, planes[0 ], + width, height, stride); + } +} +/* * util_fill_pattern - Fill a buffer with a test pattern * @format: Pixel format
@@ -944,6 +1044,9 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,case UTIL_PATTERN_PLAIN :return fill_plain (planes, height, stride); +case UTIL_PATTERN_GRADIENT : +return fill_gradient (info, planes, width, height, stride); +default :printf ("Error: unsupported test pattern %u.\n" , pattern);break ;
tests/util/pattern.h +1 -0
@@ -32,6 +32,7 @@ enum util_fill_pattern {UTIL_PATTERN_TILES ,UTIL_PATTERN_PLAIN ,UTIL_PATTERN_SMPTE , + UTIL_PATTERN_GRADIENT, }; void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/10 util: add fp16 format support
In reply to Ilia MirkinThis change adds support for all current patterns.
--- tests/util/format.c | 5 ++ tests/util/pattern.c | 207 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 209 insertions(+), 3 deletions(-)
tests/util/format.c +5 -0
@@ -93,6 +93,11 @@ static const struct util_format_info format_info[] = { { DRM_FORMAT_RGBX1010102, "RX30", MAKE_RGB_INFO(10, 22, 10, 12, 10, 2, 0, 0) }, { DRM_FORMAT_BGRA1010102, "BA30", MAKE_RGB_INFO(10, 2, 10, 12, 10, 22, 2, 0) }, { DRM_FORMAT_BGRX1010102, "BX30", MAKE_RGB_INFO(10, 2, 10, 12, 10, 22, 0, 0) }, + { DRM_FORMAT_XRGB16161616F, "XR4H", MAKE_RGB_INFO(16, 32, 16, 16, 16, 0, 0, 0) }, + { DRM_FORMAT_XBGR16161616F, "XB4H", MAKE_RGB_INFO(16, 0, 16, 16, 16, 32, 0, 0) }, + { DRM_FORMAT_ARGB16161616F, "AR4H", MAKE_RGB_INFO(16, 32, 16, 16, 16, 0, 16, 48) }, + { DRM_FORMAT_ABGR16161616F, "AB4H", MAKE_RGB_INFO(16, 0, 16, 16, 16, 32, 16, 48) }, + };uint32_t util_format_fourcc (const char *name)
tests/util/pattern.c +204 -3
267 lines not on this page · raw message
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/10 util: add cairo drawing for 30bpp formats when available
In reply to Ilia Mirkin--- tests/util/pattern.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tests/util/pattern.c +8 -0
@@ -788,6 +788,14 @@ static void make_pwetty(void *data, unsigned int width, unsigned int height,case DRM_FORMAT_BGR565 : cairo_format =CAIRO_FORMAT_RGB16_565 ;break ; +#if CAIRO_VERSION_MAJOR >1 || (CAIRO_VERSION_MAJOR ==1 &&CAIRO_VERSION_MINOR >=12 ) +case DRM_FORMAT_ARGB2101010 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_ABGR2101010 : +case DRM_FORMAT_XBGR2101010 : + cairo_format =CAIRO_FORMAT_RGB30 ; +break ; +#endif default :return ; }
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/10 modetest: don't pretend that atomic mode includes a format
In reply to Ilia Mirkin--- tests/modetest/modetest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/modetest/modetest.c +2 -2
@@ -1335,8 +1335,8 @@ static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsignedif (pipe->mode ==NULL )continue ; -printf ("setting mode %s-%dHz@%s on connectors " , - pipe->mode_str, pipe->mode->vrefresh, pipe->format_str); +printf ("setting mode %s-%dHz on connectors " , + pipe->mode_str, pipe->mode->vrefresh);for (j =0 ; j < pipe->num_cons; ++j) {printf ("%s, " , pipe->cons[j]);add_property (dev, pipe->con_ids[j],"CRTC_ID" , pipe->crtc->crtc->crtc_id);
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 06/10] modetest: don't pretend that atomic mode includes a format
Quoted 11 lines · Ilia Mirkin
Signed-off-by Ilia Mirkin <[email protected]>--- tests/modetest/modetest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/modetest/modetest.c +0
-0
tests/modetest/modetest.c static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsigned · line 1339
Quoted 7 lines
tests/modetest/modetest.c +2
-2@@ -1335,8 +1335,8 @@ static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsignedif (pipe->mode ==NULL )continue ; -printf ("setting mode %s-%dHz@%s on connectors " , - pipe->mode_str, pipe->mode->vrefresh, pipe->format_str); +printf ("setting mode %s-%dHz on connectors " , + pipe->mode_str, pipe->mode->vrefresh);
AFAICT we can drop the format on modeset all together. I cannot see anything that would require it - regardless if the modeset is atomic or not.
Plus we can remove the --help string and argument parsing code.
Can I interest you in doing that?
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 06/10] modetest: don't pretend that atomic mode includes a format
Quoted 26 lines · Emil Velikov
Quoted 11 lines · Ilia Mirkin
Signed-off-by Ilia Mirkin <[email protected]>--- tests/modetest/modetest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/modetest/modetest.c +0
-0tests/modetest/modetest.c static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsigned · line 1339
Quoted 7 lines
tests/modetest/modetest.c +2
-2@@ -1335,8 +1335,8 @@ static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsignedif (pipe->mode ==NULL )continue ; -printf ("setting mode %s-%dHz@%s on connectors " , - pipe->mode_str, pipe->mode->vrefresh, pipe->format_str); +printf ("setting mode %s-%dHz on connectors " , + pipe->mode_str, pipe->mode->vrefresh);AFAICT we can drop the format on modeset all together. I cannot see anything that would require it - regardless if the modeset is atomic or not.
Plus we can remove the --help string and argument parsing code.
Quoted 1 line
Can I interest you in doing that?
The format plays with a non-atomic modeset. It's used for the fb that gets added.
-ilia
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 06/10] modetest: don't pretend that atomic mode includes a format
Quoted 28 lines · Ilia Mirkin
Quoted 26 lines · Emil Velikov
Quoted 11 lines · Ilia Mirkin
Signed-off-by Ilia Mirkin <[email protected]>--- tests/modetest/modetest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/modetest/modetest.c +0
-0tests/modetest/modetest.c static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsigned · line 1339
Quoted 7 lines
tests/modetest/modetest.c +2
-2@@ -1335,8 +1335,8 @@ static void atomic_set_mode(struct device *dev, struct pipe_arg *pipes, unsignedif (pipe->mode ==NULL )continue ; -printf ("setting mode %s-%dHz@%s on connectors " , - pipe->mode_str, pipe->mode->vrefresh, pipe->format_str); +printf ("setting mode %s-%dHz on connectors " , + pipe->mode_str, pipe->mode->vrefresh);AFAICT we can drop the format on modeset all together. I cannot see anything that would require it - regardless if the modeset is atomic or not.
Plus we can remove the --help string and argument parsing code.
Quoted 5 lines
Quoted 1 line
Can I interest you in doing that?
The format plays with a non-atomic modeset. It's used for the fb that gets added.
Right with atomic we do the modeset and then attach a fb when applicable. With legacy we pass the fb during modeset. Using an invalid fb we end up re-using the currently bound one. And since there is none - we need to provide a valid one.
Thanks for the correction :-)
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/10 modetest: add an add_property_optional variant that does not print errors
In reply to Ilia MirkinAs new features are added and others are declared to be legacy, it's nice to be able to implement fallbacks. As such, create a property-setting variant that does not generate errors which can very well be entirely expected.
Will be used for gamma control in a future change.
--- tests/modetest/modetest.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
tests/modetest/modetest.c +23 -6
@@ -948,9 +948,10 @@ struct property_arg {char name[DRM_PROP_NAME_LEN +1 ];uint32_t prop_id;uint64_t value; +bool optional; }; -static void set_property (struct device *dev,struct property_arg *p) +static bool set_property (struct device *dev,struct property_arg *p) {drmModeObjectProperties *props =NULL ;drmModePropertyRes **props_info =NULL ;
@@ -982,13 +983,13 @@ static void set_property(struct device *dev, struct property_arg *p)if (p->obj_type ==0 ) {fprintf (stderr,"Object %i not found, can't set property\n" , p->obj_id); -return ; +return false; }if (!props) {fprintf (stderr,"%s %i has no properties\n" , obj_type, p->obj_id); -return ; +return false; }for (i =0 ; i < (int )props->count_props; ++i) {
@@ -999,9 +1000,10 @@ static void set_property(struct device *dev, struct property_arg *p) }if (i == (int )props->count_props) { -fprintf (stderr,"%s %i has no %s property\n" , - obj_type, p->obj_id, p->name); -return ; +if (!p->optional) +fprintf (stderr,"%s %i has no %s property\n" , + obj_type, p->obj_id, p->name); +return false; } p->prop_id = props->props[i];
@@ -1015,6 +1017,8 @@ static void set_property(struct device *dev, struct property_arg *p)if (ret <0 )fprintf (stderr,"failed to set %s %i property %s to %" PRIu64": %s\n" , obj_type, p->obj_id, p->name, p->value,strerror (errno)); + +return true; }/* -------------------------------------------------------------------------- */
@@ -1072,6 +1076,19 @@ static void add_property(struct device *dev, uint32_t obj_id,set_property (dev, &p); } +static bool add_property_optional (struct device *dev,uint32_t obj_id, +const char *name,uint64_t value) +{ +struct property_arg p; + + p.obj_id = obj_id; +strcpy (p.name, name); + p.value = value; + p.optional = true; + +return set_property (dev, &p); +} +static int atomic_set_plane (struct device *dev,struct plane_arg *p,int pattern,bool update) {
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/10 modetest: add C8 support to generate SMPTE pattern
In reply to Ilia MirkinThis includes logic to configure the LUT accordingly.
--- tests/modetest/buffers.c | 2 ++ tests/modetest/modetest.c | 47 ++++++++++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 5 deletions(-)
tests/modetest/buffers.c +2 -0
@@ -135,6 +135,7 @@ bo_create(int fd, unsigned int format,int ret;switch (format) { +case DRM_FORMAT_C8 :case DRM_FORMAT_NV12 :case DRM_FORMAT_NV21 :case DRM_FORMAT_NV16 :
@@ -275,6 +276,7 @@ bo_create(int fd, unsigned int format, planes[2 ] = virtual + offsets[2 ];break ; +case DRM_FORMAT_C8 :case DRM_FORMAT_ARGB4444 :case DRM_FORMAT_XRGB4444 :case DRM_FORMAT_ABGR4444 :
tests/modetest/modetest.c +42 -5
71 lines not on this page · raw message
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/10 modetest: add the ability to specify fill patterns on the commandline
In reply to Ilia MirkinInstead of hacking the binary every time, we can now specify directly.
--- tests/modetest/modetest.c | 29 ++++++++++++++++++++++++----- tests/util/pattern.c | 20 ++++++++++++++++++++ tests/util/pattern.h | 2 ++ 3 files changed, 46 insertions(+), 5 deletions(-)
tests/modetest/modetest.c +24 -5
@@ -67,6 +67,9 @@#include "buffers.h" #include "cursor.h" +static enum util_fill_pattern primary_fill =UTIL_PATTERN_SMPTE ; +static enum util_fill_pattern secondary_fill =UTIL_PATTERN_TILES ; +struct crtc {drmModeCrtc *crtc;drmModeObjectProperties *props;
@@ -1259,7 +1262,7 @@ static int set_plane(struct device *dev, struct plane_arg *p) p->w, p->h, p->format_str, plane_id); plane_bo =bo_create (dev->fd, p->fourcc, p->w, p->h, handles, - pitches, offsets,UTIL_PATTERN_TILES ); + pitches, offsets, secondary_fill);if (plane_bo ==NULL )return -1 ;
@@ -1300,12 +1303,12 @@ static int set_plane(struct device *dev, struct plane_arg *p)static void atomic_set_planes (struct device *dev,struct plane_arg *p,unsigned int count,bool update) { -unsigned int i, pattern =UTIL_PATTERN_SMPTE ; +unsigned int i, pattern = primary_fill;/* set up planes */ for (i =0 ; i < count; i++) {if (i >0 ) - pattern =UTIL_PATTERN_TILES ; + pattern = secondary_fill;else set_gamma (dev, p[i].crtc_id, p[i].fourcc);
@@ -1450,7 +1453,7 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co bo =bo_create (dev->fd, pipes[0 ].fourcc, dev->mode.width, dev->mode.height, handles, pitches, offsets, -UTIL_PATTERN_SMPTE ); + primary_fill);if (bo ==NULL )return ;
@@ -1794,6 +1797,18 @@ static int parse_property(struct property_arg *p, const char *arg)return 0 ; } +static void parse_fill_patterns (char *arg) +{ +char *fill =strtok (arg,"," ); +if (!fill) +return ; + primary_fill =util_pattern_enum (fill); + fill =strtok (NULL ,"," ); +if (!fill) +return ; + secondary_fill =util_pattern_enum (fill); +} +static void usage (char *name) {fprintf (stderr,"usage: %s [-acDdefMPpsCvw]\n" , name);
@@ -1811,6 +1826,7 @@ static void usage(char *name)fprintf (stderr,"\t-v\ttest vsynced page flipping\n" );fprintf (stderr,"\t-w <obj_id>:<prop_name>:<value>\tset property\n" );fprintf (stderr,"\t-a \tuse atomic API\n" ); +fprintf (stderr,"\t-F pattern1,pattern2\tspecify fill patterns\n" );fprintf (stderr,"\n Generic options:\n\n" );fprintf (stderr,"\t-d\tdrop master after mode set\n" );
@@ -1874,7 +1890,7 @@ static int pipe_resolve_connectors(struct device *dev, struct pipe_arg *pipe)return 0 ; } -static char optstr[] ="acdD:efM:P:ps:Cvw:" ; +static char optstr[] ="acdD:efF:M:P:ps:Cvw:" ;int main (int argc,char **argv) {
@@ -1923,6 +1939,9 @@ int main(int argc, char **argv)case 'f' : framebuffers =1 ;break ; +case 'F' : +parse_fill_patterns (optarg); +break ;case 'M' : module = optarg;/* Preserve the default behaviour of dumping all information. */
tests/util/pattern.c +20 -0
@@ -35,6 +35,7 @@#include <math.h> #endif +#include "common.h" #include "format.h" #include "pattern.h"
@@ -1261,3 +1262,22 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,break ; } } + +static const char *pattern_names[] = { + [UTIL_PATTERN_TILES ] ="tiles" , + [UTIL_PATTERN_SMPTE ] ="smpte" , + [UTIL_PATTERN_PLAIN ] ="plain" , + [UTIL_PATTERN_GRADIENT ] ="gradient" , +}; + +enum util_fill_pattern util_pattern_enum (const char *name) +{ +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (pattern_names); i++) +if (!strcmp (pattern_names[i], name)) +return (enum util_fill_pattern )i; + +printf ("Error: unsupported test pattern %s.\n" , name); +return UTIL_PATTERN_SMPTE ; +}
tests/util/pattern.h +2 -0
@@ -41,4 +41,6 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,void util_smpte_c8_gamma (unsigned size,struct drm_color_lut *lut); +enum util_fill_pattern util_pattern_enum (const char *name); +#endif /* UTIL_PATTERN_H */
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Does nouveau also work with igt tests for this stuff? We do have support for interactive testing (i.e. "human pls check yourself" kind of tests) in igt, so ideally we could merge everything into one place. Long-term at least ...
-Daniel
Quoted 28 lines
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE pattern
util: fixMAKE_RGBAmacro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a format
modetest: add anadd_property_optionalvariant that does not print
errors
modetest: add C8 support to generate SMPTE pattern
modetest: add the ability to specify fill patterns on the commandline
modetest: add FP16 format supporttests/modetest/buffers.c | 13 ++ tests/modetest/modetest.c | 109 ++++++++-- tests/util/format.c | 7 + tests/util/pattern.c | 432 +++++++++++++++++++++++++++++++++++++- tests/util/pattern.h | 7 + 5 files changed, 543 insertions(+), 25 deletions(-)Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Daniel Vetter
Quoted 8 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
Quoted 7 lines
Quoted 2 lines
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Does nouveau also work with igt tests for this stuff? We do have support for interactive testing (i.e. "human pls check yourself" kind of tests) in igt, so ideally we could merge everything into one place. Long-term at least ...
nouveau has no special exclusions for programs that start with the letters "igt", so presumably it should be OK with the basic tests. However it was my impression that igt was targeted at automated testing, and all the tests basically required crc, which is questionable whether it exists in the hw in a manner usable by such tests, and definitely not supported by nouveau in any case. As a result, I haven't really taken much of a look.
Having something flexible like modetest has been really useful in development. Being able to run with different formats, messing with resolutions, scaling parameters for overlays, different patterns -- these things have all been helpful in validating that the new features implemented actually work as expected. I plan on extending it further to cover HDR, as part of my bringup of HDR on nouveau.
As an example, pre-GF119 FP16 support expects a 0..1024-valued input instead of 0..1 (something which we did not previously know). I was able to guess that by changing the pattern in the code to generate larger numbers, after seeing a black display with the 0..1 pattern. (I may have also messed with the gamma ramp to see if it was "working" or not - I forget already.) Having a tool that makes things like that simple to investigate is pretty valuable to me.
-ilia
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Just to follow up, I've successfully tested on an Intel SKL with C8 and XB30/XR30 as well (and confirmed that the GAMMA_LUT gets unset in a sequence of C8 followed by XB30). FP16 was not available on the kernel I am currently using (and perhaps not the HW?)
-ilia
Quoted 21 lines
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE pattern
util: fixMAKE_RGBAmacro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a format
modetest: add anadd_property_optionalvariant that does not print
errors
modetest: add C8 support to generate SMPTE pattern
modetest: add the ability to specify fill patterns on the commandline
modetest: add FP16 format supporttests/modetest/buffers.c | 13 ++ tests/modetest/modetest.c | 109 ++++++++-- tests/util/format.c | 7 + tests/util/pattern.c | 432 +++++++++++++++++++++++++++++++++++++- tests/util/pattern.h | 7 + 5 files changed, 543 insertions(+), 25 deletions(-)
Quoted 3 lines
--
2.21.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Ilia Mirkin
Quoted 9 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
Quoted 7 lines
Quoted 2 lines
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Just to follow up, I've successfully tested on an Intel SKL with C8 and XB30/XR30 as well (and confirmed that the
GAMMA_LUTgets unset in a sequence of C8 followed by XB30). FP16 was not available on the kernel I am currently using (and perhaps not the HW?)
https://patchwork.freedesktop.org/series/61345/
or a slightly older version:git://github.com/vsyrjala/linux.git fp16_scanout_4
in case you want to test it.
Quoted 27 lines
-ilia
Quoted 24 lines
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE pattern
util: fixMAKE_RGBAmacro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a format
modetest: add anadd_property_optionalvariant that does not print
errors
modetest: add C8 support to generate SMPTE pattern
modetest: add the ability to specify fill patterns on the commandline
modetest: add FP16 format supporttests/modetest/buffers.c | 13 ++ tests/modetest/modetest.c | 109 ++++++++-- tests/util/format.c | 7 + tests/util/pattern.c | 432 +++++++++++++++++++++++++++++++++++++- tests/util/pattern.h | 7 + 5 files changed, 543 insertions(+), 25 deletions(-)--
2.21.0
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
Quoted 5 lines
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE pattern
I did not verify the numbers in this patch, but it looks reasonable:
Quoted 5 lines
util: fix
MAKE_RGBAmacro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a format
There a small, would be great but not required, comment here (part of which you addressed with in 08/10)
Quoted 6 lines
modetest: add an
add_property_optionalvariant that does not print
errors
modetest: add C8 support to generate SMPTE pattern
modetest: add the ability to specify fill patterns on the commandline
modetest: add FP16 format support
Patches 2-10 are
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Emil Velikov
Quoted 9 lines · Ilia Mirkin
This series improves the pattern generation logic to support additional formats, as well as a new "gradient" pattern (see patch comments on why I found it useful).
Furthermore, these formats are piped through to modetest, including the ability to set a gamma table, which is necessary for the C8 indexed format.
Quoted 5 lines
This was tested on nouveau, and used for bring-up of the C8, XB30, and FP16 formats on the NVIDIA hardware that supports these.
Ilia Mirkin (10):
util: add C8 format, support it with SMPTE patternI did not verify the numbers in this patch, but it looks reasonable:
Acked-by Emil Velikov <[email protected]>
Quoted 8 lines
Quoted 5 lines
util: fix
MAKE_RGBAmacro for 10bpp modes
util: add gradient pattern
util: add fp16 format support
util: add cairo drawing for 30bpp formats when available
modetest: don't pretend that atomic mode includes a formatThere a small, would be great but not required, comment here (part of which you addressed with in 08/10)
Grr scratch that part about 08/10 - I misread the format_str parsing.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel