The lib changes ensure the following:
1) Get the value of rc property during igt_display_init
2) Set the value of rc property during do_display_commit
3) Add supporting method to set rc property from kms_test

Signed-off-by: Mayuresh Gharpure <[email protected]>
---
 lib/igt_kms.c | 40 ++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h | 13 +++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f5670e0..df33727 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1059,6 +1059,13 @@ void igt_display_init(igt_display_t *display, int drm_fd)
                                           &prop_value,
                                           NULL);
                        plane->rotation = (igt_rotation_t)prop_value;
+
+                       get_plane_property(display->drm_fd, drm_plane->plane_id,
+                                          "render compression",
+                                          &plane->rc_property,
+                                          &prop_value,
+                                          NULL);
+                       plane->rc_value = (igt_rc_t)prop_value;
                }
 
                if (display->has_universal_planes) {
@@ -1397,6 +1404,14 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
                CHECK_RETURN(ret, fail_on_error);
        }
 
+       if (plane->rc_changed) {
+               ret = igt_plane_set_property(plane, plane->rc_property,
+                                      plane->rc_value);
+
+               plane->rc_changed = false;
+               CHECK_RETURN(ret, fail_on_error);
+       }
+
        return 0;
 }
 
@@ -1903,6 +1918,18 @@ static const char *rotation_name(igt_rotation_t rotation)
        }
 }
 
+static const char *rc_name(igt_rc_t compression)
+{
+       switch (compression) {
+       case IGT_COMP_NONE:
+               return "Not compression capable";
+       case IGT_COMP_RENDER:
+               return "Only render decompression";
+       default:
+               igt_assert(0);
+       }
+
+}
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
 {
        igt_pipe_t *pipe = plane->pipe;
@@ -1917,6 +1944,19 @@ void igt_plane_set_rotation(igt_plane_t *plane, 
igt_rotation_t rotation)
        plane->rotation_changed = true;
 }
 
+void igt_plane_set_render_compression(igt_plane_t *plane, igt_rc_t compression)
+{
+       igt_pipe_t *pipe = plane->pipe;
+       igt_display_t *display = pipe->display;
+
+       LOG(display, "%s.%d: plane_set_rc: %s \n",
+       kmstest_pipe_name(pipe->pipe),
+       plane->index, rc_name(compression));
+
+       plane->rc_value = compression;
+
+       plane->rc_changed = true;
+}
 /**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 09c08aa..3dbb3d6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -170,6 +170,13 @@ typedef enum {
        IGT_ROTATION_270 = 1 << 3,
 } igt_rotation_t;
 
+typedef enum {
+       /* this maps to the kernel API */
+       IGT_COMP_NONE   = 0,
+       IGT_COMP_RENDER  = 1,
+} igt_rc_t;
+
+
 typedef struct {
        /*< private >*/
        igt_pipe_t *pipe;
@@ -183,6 +190,7 @@ typedef struct {
        unsigned int panning_changed  : 1;
        unsigned int rotation_changed : 1;
        unsigned int size_changed     : 1;
+       unsigned int rc_changed       : 1;
        /*
         * drm_plane can be NULL for primary and cursor planes (when not
         * using the atomic modeset API)
@@ -192,6 +200,8 @@ typedef struct {
 
        uint32_t rotation_property;
 
+       uint32_t rc_property;
+
        /* position within pipe_src_w x pipe_src_h */
        int crtc_x, crtc_y;
        /* size within pipe_src_w x pipe_src_h */
@@ -199,6 +209,8 @@ typedef struct {
        /* panning offset within the fb */
        unsigned int pan_x, pan_y;
        igt_rotation_t rotation;
+
+       igt_rc_t rc_value;
 } igt_plane_t;
 
 struct igt_pipe {
@@ -259,6 +271,7 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int 
y);
 void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
+void igt_plane_set_render_compression(igt_plane_t *plane, igt_rc_t 
compression);
 void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background);
 void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
        uint32_t x, uint32_t y);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to