Re: [Intel-gfx] [PATCH] igt/kms_plane_scaling : plane scaling enhancement and plane support for bxt

2015-07-19 Thread Maiti, Nabendu Bikash



On 7/17/2015 5:06 PM, Thomas Wood wrote:

On 17 July 2015 at 09:34, Nabendu Maitinabendu.bikash.ma...@intel.com  wrote:

1) Added more overlay plane support for BXT.
2) Added and enhanced scaler test cases for additional planes.

Please split the various separate changes in different patches.

The i-g-t tag should also appear in the subject prefix rather than the
subject tag. (i.e. use --subject-prefix=PATCH i-g-t or git config
format.subjectprefix PATCH i-g-t).

Agreed.

Signed-off-by: Nabendu Maitinabendu.bikash.ma...@intel.com
---
  lib/igt_fb.c  | 40 
  lib/igt_fb.h  |  1 +
  lib/igt_kms.c |  1 +
  lib/igt_kms.h |  3 +-
  tests/kms_plane_scaling.c | 79 ---
  5 files changed, 118 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 134dbd2..e61b762 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -393,6 +393,46 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  }

  /**
+ * igt_paint_cross_ruler:
+ * @cr: cairo drawing context
+ * @dst_width: width of the horizontal ruler
+ * @dst_height: height of the vertical ruler
+ *
+ * This function can be used to draw a cross ruler on a frame buffer.
+ */
+void
+igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h)

Other cairo functions use int rather than uint16_t for width and
height, so int should be sufficient here too, at least for
consistency.


Okey. I'll do it.

+{
+
+   uint16_t i;
+
+   /* Paint corner markers */
+   paint_marker(cr, 0, 0);
+   paint_marker(cr, w, 0);
+   paint_marker(cr, 0, h);
+   paint_marker(cr, w, h);
+
+
+   cairo_move_to(cr, w/2, 0);
+   cairo_line_to(cr, w/2, h);
+
+   cairo_set_source_rgb(cr, 4, 1, 10);
+   cairo_move_to(cr, 0, h/2);
+   cairo_line_to(cr, w, h/2 );
+   cairo_stroke(cr);
+
+   cairo_set_source_rgb(cr, 2, 5, 1);
+   cairo_set_line_width(cr, 2);
+   cairo_stroke(cr);
+   cairo_stroke_preserve(cr);
+   for (i = 0; i  w; i +=200)
+   paint_marker(cr, i, h/2);
+
+   for (i = 0; i  h; i +=200)
+   paint_marker(cr, w/2, i);
+}
+
+/**
   * igt_create_fb_with_bo_size:
   * @fd: open i915 drm file descriptor
   * @width: width of the framebuffer in pixel
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index a07acd2..cf6e7e3 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -98,6 +98,7 @@ void igt_write_fb_to_png(int fd, struct igt_fb *fb, const 
char *filename);
  int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
double yspacing, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
+void igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h);

  /* helpers to handle drm fourcc codes */
  uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0bb16b4..781ffa5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -213,6 +213,7 @@ const char *kmstest_plane_name(enum igt_plane plane)
 [IGT_PLANE_1] = plane1,
 [IGT_PLANE_2] = plane2,
 [IGT_PLANE_3] = plane3,
+   [IGT_PLANE_4] = plane4,
 [IGT_PLANE_CURSOR] = cursor,
 };

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 09c08aa..14c8b28 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -53,6 +53,7 @@ enum igt_plane {
  IGT_PLANE_PRIMARY = IGT_PLANE_1,
  IGT_PLANE_2,
  IGT_PLANE_3,
+IGT_PLANE_4,
  IGT_PLANE_CURSOR,
  };

@@ -205,7 +206,7 @@ struct igt_pipe {
 igt_display_t *display;
 enum pipe pipe;
 bool enabled;
-#define IGT_MAX_PLANES 4
+#define IGT_MAX_PLANES 5
 int n_planes;
 igt_plane_t planes[IGT_MAX_PLANES];
 uint64_t background; /* Background color MSB BGR 16bpc LSB */
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 00db5cb..8e3d559 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -23,7 +23,7 @@
   */

  #include math.h
-
+#include cairo.h

cairo is already included via igt_kms.h and igt_fb.h.


Will remove in the updated patches.

  #include drmtest.h
  #include igt_debugfs.h
  #include igt_kms.h
@@ -48,9 +48,11 @@ typedef struct {
 struct igt_fb fb1;
 struct igt_fb fb2;
 struct igt_fb fb3;
+   struct igt_fb fb4;
 int fb_id1;
 int fb_id2;
 int fb_id3;
+   int fb_id4;

 igt_plane_t *plane1;
 igt_plane_t *plane2;
@@ -61,6 +63,22 @@ typedef struct {
  #define FILE_NAME   1080p-left.png

  static void
+paint_plane_ID(data_t *d, struct igt_fb *fb, igt_plane_t *plane)
+{
+   cairo_t *cr;
+
+   cr = igt_get_cairo_ctx(d-drm_fd, fb);
+   cairo_move_to(cr, (fb-width/5),
+ (fb-height / 5));
+   cairo_set_font_size(cr, 25);
+   igt_cairo_printf_line(cr, align_hcenter, 10, 

Re: [Intel-gfx] [PATCH] igt/kms_plane_scaling : plane scaling enhancement and plane support for bxt

2015-07-17 Thread Thomas Wood
On 17 July 2015 at 09:34, Nabendu Maiti nabendu.bikash.ma...@intel.com wrote:
 1) Added more overlay plane support for BXT.
 2) Added and enhanced scaler test cases for additional planes.

Please split the various separate changes in different patches.

The i-g-t tag should also appear in the subject prefix rather than the
subject tag. (i.e. use --subject-prefix=PATCH i-g-t or git config
format.subjectprefix PATCH i-g-t).



 Signed-off-by: Nabendu Maiti nabendu.bikash.ma...@intel.com
 ---
  lib/igt_fb.c  | 40 
  lib/igt_fb.h  |  1 +
  lib/igt_kms.c |  1 +
  lib/igt_kms.h |  3 +-
  tests/kms_plane_scaling.c | 79 
 ---
  5 files changed, 118 insertions(+), 6 deletions(-)

 diff --git a/lib/igt_fb.c b/lib/igt_fb.c
 index 134dbd2..e61b762 100644
 --- a/lib/igt_fb.c
 +++ b/lib/igt_fb.c
 @@ -393,6 +393,46 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  }

  /**
 + * igt_paint_cross_ruler:
 + * @cr: cairo drawing context
 + * @dst_width: width of the horizontal ruler
 + * @dst_height: height of the vertical ruler
 + *
 + * This function can be used to draw a cross ruler on a frame buffer.
 + */
 +void
 +igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h)

Other cairo functions use int rather than uint16_t for width and
height, so int should be sufficient here too, at least for
consistency.


 +{
 +
 +   uint16_t i;
 +
 +   /* Paint corner markers */
 +   paint_marker(cr, 0, 0);
 +   paint_marker(cr, w, 0);
 +   paint_marker(cr, 0, h);
 +   paint_marker(cr, w, h);
 +
 +
 +   cairo_move_to(cr, w/2, 0);
 +   cairo_line_to(cr, w/2, h);
 +
 +   cairo_set_source_rgb(cr, 4, 1, 10);
 +   cairo_move_to(cr, 0, h/2);
 +   cairo_line_to(cr, w, h/2 );
 +   cairo_stroke(cr);
 +
 +   cairo_set_source_rgb(cr, 2, 5, 1);
 +   cairo_set_line_width(cr, 2);
 +   cairo_stroke(cr);
 +   cairo_stroke_preserve(cr);
 +   for (i = 0; i  w; i +=200)
 +   paint_marker(cr, i, h/2);
 +
 +   for (i = 0; i  h; i +=200)
 +   paint_marker(cr, w/2, i);
 +}
 +
 +/**
   * igt_create_fb_with_bo_size:
   * @fd: open i915 drm file descriptor
   * @width: width of the framebuffer in pixel
 diff --git a/lib/igt_fb.h b/lib/igt_fb.h
 index a07acd2..cf6e7e3 100644
 --- a/lib/igt_fb.h
 +++ b/lib/igt_fb.h
 @@ -98,6 +98,7 @@ void igt_write_fb_to_png(int fd, struct igt_fb *fb, const 
 char *filename);
  int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
double yspacing, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
 +void igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h);

  /* helpers to handle drm fourcc codes */
  uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
 diff --git a/lib/igt_kms.c b/lib/igt_kms.c
 index 0bb16b4..781ffa5 100644
 --- a/lib/igt_kms.c
 +++ b/lib/igt_kms.c
 @@ -213,6 +213,7 @@ const char *kmstest_plane_name(enum igt_plane plane)
 [IGT_PLANE_1] = plane1,
 [IGT_PLANE_2] = plane2,
 [IGT_PLANE_3] = plane3,
 +   [IGT_PLANE_4] = plane4,
 [IGT_PLANE_CURSOR] = cursor,
 };

 diff --git a/lib/igt_kms.h b/lib/igt_kms.h
 index 09c08aa..14c8b28 100644
 --- a/lib/igt_kms.h
 +++ b/lib/igt_kms.h
 @@ -53,6 +53,7 @@ enum igt_plane {
  IGT_PLANE_PRIMARY = IGT_PLANE_1,
  IGT_PLANE_2,
  IGT_PLANE_3,
 +IGT_PLANE_4,
  IGT_PLANE_CURSOR,
  };

 @@ -205,7 +206,7 @@ struct igt_pipe {
 igt_display_t *display;
 enum pipe pipe;
 bool enabled;
 -#define IGT_MAX_PLANES 4
 +#define IGT_MAX_PLANES 5
 int n_planes;
 igt_plane_t planes[IGT_MAX_PLANES];
 uint64_t background; /* Background color MSB BGR 16bpc LSB */
 diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
 index 00db5cb..8e3d559 100644
 --- a/tests/kms_plane_scaling.c
 +++ b/tests/kms_plane_scaling.c
 @@ -23,7 +23,7 @@
   */

  #include math.h
 -
 +#include cairo.h

cairo is already included via igt_kms.h and igt_fb.h.


  #include drmtest.h
  #include igt_debugfs.h
  #include igt_kms.h
 @@ -48,9 +48,11 @@ typedef struct {
 struct igt_fb fb1;
 struct igt_fb fb2;
 struct igt_fb fb3;
 +   struct igt_fb fb4;
 int fb_id1;
 int fb_id2;
 int fb_id3;
 +   int fb_id4;

 igt_plane_t *plane1;
 igt_plane_t *plane2;
 @@ -61,6 +63,22 @@ typedef struct {
  #define FILE_NAME   1080p-left.png

  static void
 +paint_plane_ID(data_t *d, struct igt_fb *fb, igt_plane_t *plane)
 +{
 +   cairo_t *cr;
 +
 +   cr = igt_get_cairo_ctx(d-drm_fd, fb);
 +   cairo_move_to(cr, (fb-width/5),
 + (fb-height / 5));
 +   cairo_set_font_size(cr, 25);
 +   igt_cairo_printf_line(cr, align_hcenter, 10, PIPE:PLANE:);
 + 

[Intel-gfx] [PATCH] igt/kms_plane_scaling : plane scaling enhancement and plane support for bxt

2015-07-17 Thread Nabendu Maiti
1) Added more overlay plane support for BXT.
2) Added and enhanced scaler test cases for additional planes.

Signed-off-by: Nabendu Maiti nabendu.bikash.ma...@intel.com
---
 lib/igt_fb.c  | 40 
 lib/igt_fb.h  |  1 +
 lib/igt_kms.c |  1 +
 lib/igt_kms.h |  3 +-
 tests/kms_plane_scaling.c | 79 ---
 5 files changed, 118 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 134dbd2..e61b762 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -393,6 +393,46 @@ void igt_paint_image(cairo_t *cr, const char *filename,
 }
 
 /**
+ * igt_paint_cross_ruler:
+ * @cr: cairo drawing context
+ * @dst_width: width of the horizontal ruler
+ * @dst_height: height of the vertical ruler
+ *
+ * This function can be used to draw a cross ruler on a frame buffer.
+ */
+void
+igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h)
+{
+
+   uint16_t i;
+
+   /* Paint corner markers */
+   paint_marker(cr, 0, 0);
+   paint_marker(cr, w, 0);
+   paint_marker(cr, 0, h);
+   paint_marker(cr, w, h);
+
+
+   cairo_move_to(cr, w/2, 0);
+   cairo_line_to(cr, w/2, h);
+
+   cairo_set_source_rgb(cr, 4, 1, 10);
+   cairo_move_to(cr, 0, h/2);
+   cairo_line_to(cr, w, h/2 );
+   cairo_stroke(cr);
+
+   cairo_set_source_rgb(cr, 2, 5, 1);
+   cairo_set_line_width(cr, 2);
+   cairo_stroke(cr);
+   cairo_stroke_preserve(cr);
+   for (i = 0; i  w; i +=200)
+   paint_marker(cr, i, h/2);
+
+   for (i = 0; i  h; i +=200)
+   paint_marker(cr, w/2, i);
+}
+
+/**
  * igt_create_fb_with_bo_size:
  * @fd: open i915 drm file descriptor
  * @width: width of the framebuffer in pixel
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index a07acd2..cf6e7e3 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -98,6 +98,7 @@ void igt_write_fb_to_png(int fd, struct igt_fb *fb, const 
char *filename);
 int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
   double yspacing, const char *fmt, ...)
   __attribute__((format (printf, 4, 5)));
+void igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h);
 
 /* helpers to handle drm fourcc codes */
 uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0bb16b4..781ffa5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -213,6 +213,7 @@ const char *kmstest_plane_name(enum igt_plane plane)
[IGT_PLANE_1] = plane1,
[IGT_PLANE_2] = plane2,
[IGT_PLANE_3] = plane3,
+   [IGT_PLANE_4] = plane4,
[IGT_PLANE_CURSOR] = cursor,
};
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 09c08aa..14c8b28 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -53,6 +53,7 @@ enum igt_plane {
 IGT_PLANE_PRIMARY = IGT_PLANE_1,
 IGT_PLANE_2,
 IGT_PLANE_3,
+IGT_PLANE_4,
 IGT_PLANE_CURSOR,
 };
 
@@ -205,7 +206,7 @@ struct igt_pipe {
igt_display_t *display;
enum pipe pipe;
bool enabled;
-#define IGT_MAX_PLANES 4
+#define IGT_MAX_PLANES 5
int n_planes;
igt_plane_t planes[IGT_MAX_PLANES];
uint64_t background; /* Background color MSB BGR 16bpc LSB */
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 00db5cb..8e3d559 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -23,7 +23,7 @@
  */
 
 #include math.h
-
+#include cairo.h
 #include drmtest.h
 #include igt_debugfs.h
 #include igt_kms.h
@@ -48,9 +48,11 @@ typedef struct {
struct igt_fb fb1;
struct igt_fb fb2;
struct igt_fb fb3;
+   struct igt_fb fb4;
int fb_id1;
int fb_id2;
int fb_id3;
+   int fb_id4;
 
igt_plane_t *plane1;
igt_plane_t *plane2;
@@ -61,6 +63,22 @@ typedef struct {
 #define FILE_NAME   1080p-left.png
 
 static void
+paint_plane_ID(data_t *d, struct igt_fb *fb, igt_plane_t *plane)
+{
+   cairo_t *cr;
+
+   cr = igt_get_cairo_ctx(d-drm_fd, fb);
+   cairo_move_to(cr, (fb-width/5),
+ (fb-height / 5));
+   cairo_set_font_size(cr, 25);
+   igt_cairo_printf_line(cr, align_hcenter, 10, PIPE:PLANE:);
+   cairo_set_font_size(cr, 30);
+   igt_cairo_printf_line(cr, align_hcenter, 40,  %d:%d,
+ plane-pipe-pipe, plane-index);
+   cairo_destroy(cr);
+}
+
+static void
 paint_color(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
 {
cairo_t *cr;
@@ -71,12 +89,14 @@ paint_color(data_t *d, struct igt_fb *fb, uint16_t w, 
uint16_t h)
 }
 
 static void
-paint_image(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
+paint_image(const char *filename, data_t *d, struct igt_fb *fb,
+   uint16_t w, uint16_t h)
 {
cairo_t *cr;
 
cr = igt_get_cairo_ctx(d-drm_fd, fb);
-