The plain pattern is useful to debug display issues. Unfortunatly this pattern is not configurable. Add a new option '-V' for this. Co-developed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Signed-off-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx> --- tests/modetest/buffers.c | 5 +++-- tests/modetest/buffers.h | 3 ++- tests/modetest/modetest.c | 22 +++++++++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 03a6d424f102..328370ce2cfc 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -114,7 +114,8 @@ struct bo * bo_create(int fd, unsigned int format, unsigned int width, unsigned int height, unsigned int handles[4], unsigned int pitches[4], - unsigned int offsets[4], enum util_fill_pattern pattern) + unsigned int offsets[4], enum util_fill_pattern pattern, + unsigned int color) { unsigned int virtual_height, xsub, ysub; struct bo *bo; @@ -386,7 +387,7 @@ bo_create(int fd, unsigned int format, break; } - util_fill_pattern(format, pattern, 0x38383838, planes, width, height, pitches[0]); + util_fill_pattern(format, pattern, color, planes, width, height, pitches[0]); bo_unmap(bo); return bo; diff --git a/tests/modetest/buffers.h b/tests/modetest/buffers.h index cbd54e9ed386..3e2aa14796cb 100644 --- a/tests/modetest/buffers.h +++ b/tests/modetest/buffers.h @@ -34,7 +34,8 @@ struct bo; struct bo *bo_create(int fd, unsigned int format, unsigned int width, unsigned int height, unsigned int handles[4], unsigned int pitches[4], - unsigned int offsets[4], enum util_fill_pattern pattern); + unsigned int offsets[4], enum util_fill_pattern pattern, + unsigned int color); void bo_destroy(struct bo *bo); void bo_dump(struct bo *bo, const char *filename); diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index d9e761e6cfa0..d98fe3c98dfb 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -70,6 +70,7 @@ static enum util_fill_pattern primary_fill = UTIL_PATTERN_SMPTE; static enum util_fill_pattern secondary_fill = UTIL_PATTERN_TILES; +static unsigned long color = 0x308830; static drmModeModeInfo user_mode; struct crtc { @@ -1199,7 +1200,7 @@ bo_fb_create(int fd, unsigned int fourcc, const uint32_t w, const uint32_t h, struct bo *bo; unsigned int fb_id; - bo = bo_create(fd, fourcc, w, h, handles, pitches, offsets, pat); + bo = bo_create(fd, fourcc, w, h, handles, pitches, offsets, pat, color); if (bo == NULL) return -1; @@ -1240,7 +1241,7 @@ static int atomic_set_plane(struct device *dev, struct plane_arg *p, if (!plane_bo) { if (bo_fb_create(dev->fd, p->fourcc, p->w, p->h, - pattern, &plane_bo, &p->fb_id)) + pattern, &plane_bo, &p->fb_id)) return -1; } @@ -1665,7 +1666,7 @@ static unsigned int set_mode(struct device *dev, struct pipe_arg **pipe_args, un } if (bo_fb_create(dev->fd, pipes[0].fourcc, dev->mode.width, dev->mode.height, - primary_fill, &dev->mode.bo, &dev->mode.fb_id)) + primary_fill, &dev->mode.bo, &dev->mode.fb_id)) return 0; } @@ -1857,7 +1858,7 @@ static void set_cursors(struct device *dev, struct pipe_arg *pipes, unsigned int * translucent alpha */ bo = bo_create(dev->fd, DRM_FORMAT_ARGB8888, cw, ch, handles, pitches, - offsets, UTIL_PATTERN_PLAIN); + offsets, UTIL_PATTERN_PLAIN, color); if (bo == NULL) return; @@ -2126,6 +2127,13 @@ static void parse_fill_patterns(char *arg) secondary_fill = util_pattern_enum(fill); } +static void parse_fill_value(char *arg) +{ + char *end; + + color = strtoul(arg, &end, 16); +} + static void usage(char *name) { fprintf(stderr, "usage: %s [-acDdefMoPpsCvrw]\n", name); @@ -2149,6 +2157,7 @@ static void usage(char *name) fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property, see 'property'\n"); fprintf(stderr, "\t-a \tuse atomic API\n"); fprintf(stderr, "\t-F pattern1,pattern2\tspecify fill patterns\n"); + fprintf(stderr, "\t-V <RRGGBB hex value>\tspecify RGB hex color for plain pattern\n"); fprintf(stderr, "\t-o <desired file path> \t Dump writeback output buffer to file\n"); fprintf(stderr, "\n Generic options:\n\n"); @@ -2179,7 +2188,7 @@ static void usage(char *name) exit(0); } -static char optstr[] = "acdD:efF:M:P:ps:Cvrw:o:"; +static const char optstr[] = "acdD:efF:V:M:P:ps:Cvrw:o:"; int main(int argc, char **argv) { @@ -2236,6 +2245,9 @@ int main(int argc, char **argv) case 'F': parse_fill_patterns(optarg); break; + case 'V': + parse_fill_value(optarg); + break; case 'M': module = optarg; /* Preserve the default behaviour of dumping all information. */ -- 2.48.1