From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dhanya Pillai Subject: [PATCH] tests/kms_color:Color IGT Date: Fri, 11 Dec 2015 16:01:42 +0530 Message-ID: <1449829902-21924-1-git-send-email-dhanya.p.r@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0075747067==" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 85B2B6EC71 for ; Fri, 11 Dec 2015 02:30:15 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org Cc: jesse.barnes@intel.com, Dhanya List-Id: intel-gfx@lists.freedesktop.org --===============0075747067== Content-Type: text/plain; charset=y Content-Transfer-Encoding: quoted-printable From: Dhanya This patch will verify color correction capability of a display driver. Gamma/CSC/De-gamma for SKL/BXT supported. Signed-off-by: Dhanya --- tests/.gitignore | 1 + tests/Makefile.sources | 1 + tests/kms_color.c | 684 +++++++++++++++++++++++++++++++++++++++++++= ++++++ 3 files changed, 686 insertions(+) create mode 100644 tests/kms_color.c diff --git a/tests/.gitignore b/tests/.gitignore index 80af9a7..58c79e2 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -127,6 +127,7 @@ gen7_forcewake_mt kms_3d kms_addfb_basic kms_atomic +kms_color kms_crtc_background_color kms_cursor_crc kms_draw_crc diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 8fb2de8..906c14f 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -64,6 +64,7 @@ TESTS_progs_M =3D \ gem_write_read_ring_switch \ kms_addfb_basic \ kms_atomic \ + kms_color \ kms_cursor_crc \ kms_draw_crc \ kms_fbc_crc \ diff --git a/tests/kms_color.c b/tests/kms_color.c new file mode 100644 index 0000000..b5d199b --- /dev/null +++ b/tests/kms_color.c @@ -0,0 +1,684 @@ +/* + * Copyright =C2=A9 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtainin= g a + * copy of this software and associated documentation files (the "Softwa= re"), + * to deal in the Software without restriction, including without limita= tion + * the rights to use, copy, modify, merge, publish, distribute, sublicen= se, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the = next + * paragraph) shall be included in all copies or substantial portions of= the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRE= SS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SH= ALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR = OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISI= NG + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER D= EALINGS + * IN THE SOFTWARE. + * + */ + +#include +#include "drmtest.h" +#include "drm.h" +#include "igt_debugfs.h" +#include "igt_kms.h" +#include "igt_core.h" +#include "intel_io.h" +#include "intel_chipset.h" +#include "igt_aux.h" +#include +#include +#include +#include + + +IGT_TEST_DESCRIPTION("Test Color Features at Pipe level"); +/* +This tool tests the following color features: + 1.csc-red + 2.csc-green + 3.csc-blue + 4.gamma-legacy + 5.gamma-8bit + 6.gamma-10bit + 7.gamma-12bit + 8.gamma-split + +Verification is done by CRC checks. + +*/ + +#define CSC_MAX_VALS 9 +#define GEN9_SPLITGAMMA_MAX_VALS 512 +#define GEN9_8BIT_GAMMA_MAX_VALS 256 +#define GEN9_10BIT_GAMMA_MAX_VALS 1024 +#define GEN9_12BIT_GAMMA_MAX_VALS 513 +#define GEN9_MAX_GAMMA ((1 << 24) - 1) +#define GEN9_MIN_GAMMA 0 +#define RED_CSC 0 +#define GREEN_CSC 1 +#define BLUE_CSC 2 +#define RED_FB 0 +#define GREEN_FB 1 +#define BLUE_FB 2 + +struct _drm_r32g32b32 { + __u32 r32; + __u32 g32; + __u32 b32; + __u32 reserved; +}; + +struct _drm_palette { + struct _drm_r32g32b32 lut[0]; +}; + +struct _drm_ctm { + __s64 ctm_coeff[9]; +}; + +float ctm_red[9] =3D {1, 1, 1, 0, 0, 0, 0, 0, 0}; +float ctm_green[9] =3D {0, 0, 0, 1, 1, 1, 0, 0, 0}; +float ctm_blue[9] =3D {0, 0, 0, 0, 0, 0, 1, 1, 1}; +float ctm_unity[9] =3D {1, 0, 0, 0, 1, 0, 0, 0, 1}; + +struct framebuffer_color { + int red; + int green; + int blue; +}; +struct framebuffer_color fb_color =3D {0,0,0}; + +igt_crc_t crc_reference, crc_reference_black, crc_reference_white; +igt_crc_t crc_black, crc_white, crc_current; + +struct data_t { + int fb_initial; + int drm_fd; + int gen; + int w, h; + igt_display_t display; + struct igt_fb fb_prep; + struct igt_fb fb, fb1; + igt_pipe_crc_t *pipe_crc; + enum pipe pipe; + +}; + + +static int create_blob(int fd, uint64_t *data, int length) +{ + struct drm_mode_create_blob blob; + int ret =3D -1; + + blob.data =3D (uint64_t)data; + blob.length =3D length; + blob.blob_id =3D -1; + ret =3D ioctl(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &blob); + if (!ret) + return blob.blob_id; + igt_fail(IGT_EXIT_FAILURE); + return ret; +} + +static void prepare_crtc(struct data_t *data, igt_output_t *output, + enum pipe pipe1, igt_plane_t *plane, drmModeModeInfo *mode, + enum igt_commit_style s) +{ + igt_display_t *display =3D &data->display; + + igt_output_set_pipe(output, pipe1); +=09 + igt_pipe_crc_free(data->pipe_crc); + data->pipe_crc =3D igt_pipe_crc_new(pipe1, INTEL_PIPE_CRC_SOURCE= _AUTO); +=09 + /* before allocating, free if any older fb */ + if (data->fb_initial) { + igt_remove_fb(data->drm_fd, &data->fb_prep); + data->fb_initial =3D 0; + } + + /* allocate fb for plane 1 */ + data->fb_initial =3D igt_create_color_fb(data->drm_fd, + mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ + fb_color.red, fb_color.green, fb_color.blue, + &data->fb_prep); + igt_assert(data->fb_initial); + + igt_plane_set_fb(plane, &data->fb_prep); + + igt_display_commit2(display, s); +} + +static void cleanup_fb(struct data_t *data) +{ + + if (data->fb_initial) { + igt_remove_fb(data->drm_fd, &data->fb_prep); + data->fb_initial =3D 0; + } + if (data->fb.fb_id) + igt_remove_fb(data->drm_fd, &data->fb); + +} + +static void cleanup_crtc(struct data_t *data, igt_output_t *output, + igt_plane_t *plane) +{ + igt_display_t *display =3D &data->display; + + if (!plane->is_primary) { + igt_plane_t *primary; + + primary =3D igt_output_get_plane(output, IGT_PLANE_PRIMARY); + igt_plane_set_fb(primary, NULL); + } + + igt_plane_set_fb(plane, NULL); + igt_output_set_pipe(output, PIPE_ANY); + igt_display_commit2(display, COMMIT_UNIVERSAL); + +} + +static int get_color_property(int drm_fd, int id, int object,const char = *prop_name, + int blob_id) +{ + int i =3D 0, ret =3D 0; + drmModeObjectPropertiesPtr props =3D NULL; + igt_fail_on_f(id < 0 || ((object !=3D DRM_MODE_OBJECT_CRTC) && + (object !=3D DRM_MODE_OBJECT_PLANE)), + "Invalid input to get color property %d", id); + + props =3D drmModeObjectGetProperties(drm_fd, id, object); + igt_fail_on_f(!props, + "\nNo property for object id=3D%d\n", id); + for (i =3D 0; i < props->count_props; i++) { + drmModePropertyPtr prop =3D drmModeGetProperty(drm_fd, + props->props[i]); + if (strcmp(prop->name, prop_name) =3D=3D 0) { + blob_id =3D props->prop_values[i]; + break; + } + drmModeFreeProperty(prop); + } + + ret =3D blob_id; + drmModeFreeObjectProperties(props); + igt_fail_on_f(i =3D=3D props->count_props, + "%s No such property\n", prop_name); + return ret; +} + + +static int set_color_property(int drm_fd, int id, int object, const char= *prop_name, int blob_id) +{ + int i =3D 0, res; + + drmModeObjectPropertiesPtr props =3D NULL; + igt_fail_on_f(id < 0 || ((object !=3D DRM_MODE_OBJECT_CRTC) && + (object !=3D DRM_MODE_OBJECT_PLANE)), + "Invalid input to get color property %d", id); + + + props =3D drmModeObjectGetProperties(drm_fd, id, object); + igt_fail_on_f(!props, + "\nNo property for object id=3D%d\n", id); + for (i =3D 0; i < props->count_props; i++) { + drmModePropertyPtr prop =3D drmModeGetProperty(drm_fd, + props->props[i]); + if (strcmp(prop->name, prop_name) =3D=3D 0) { + res =3D drmModeObjectSetProperty(drm_fd, id, object, + (uint32_t)prop->prop_id, blob_id); + + if (res) { + drmModeFreeProperty(prop); + drmModeFreeObjectProperties(props); + } else { + drmModeFreeProperty(prop); + break; + } + } + + drmModeFreeProperty(prop); + } + drmModeFreeObjectProperties(props); + igt_fail_on_f(i =3D=3D props->count_props, + "%s No such property\n", prop_name); + return 0; +} + +static int64_t convertFloatToBinary(double input) +{ + + int integer_part, count =3D 0; + uint32_t temp_ip, frac_val =3D 0x00000000; + uint64_t integer_val =3D 0x00000000; + int64_t value =3D 0x0000000000000000; + float fractional_part, ip; + integer_part =3D (int)input; + fractional_part =3D input - integer_part; + while (fractional_part !=3D 0.000000) { + ip =3D fractional_part * 16; + temp_ip =3D (int)(fractional_part * 16); + frac_val =3D frac_val | (temp_ip << (28 - count * 4)); + count++; + fractional_part =3D ip - temp_ip; + } + integer_val =3D integer_part; + value =3D value | (integer_val << 32); + value =3D value | frac_val; + return value; + + +} + +static void write_gamma_lut( uint32_t num_samples, struct _drm_r32g32b32= *gamma_ptr, int unit_gamma ) +{ + unsigned short Red, Green, Blue; + uint32_t r32, b32, g32; + uint64_t i, val; + + for (i =3D 0; i < num_samples; i++) { + if(unit_gamma =3D=3D 0) { + Blue =3D GEN9_MAX_GAMMA; + Green =3D GEN9_MAX_GAMMA; + Red =3D GEN9_MAX_GAMMA; + } else { + Blue =3D GEN9_MIN_GAMMA; + Green =3D GEN9_MIN_GAMMA; + Red =3D GEN9_MIN_GAMMA; + } + r32 =3D Red; + g32 =3D Green; + b32 =3D Blue; + r32 <<=3D8; + g32 <<=3D8; + b32 <<=3D8; + gamma_ptr[i].r32 =3D r32; + gamma_ptr[i].g32 =3D g32; + gamma_ptr[i].b32 =3D b32; + } +} + +static uint64_t get_blob(int fd, int blob_id, int length) +{ + struct drm_mode_get_blob blob; + int ret =3D 0; + + blob.blob_id =3D blob_id; + blob.length =3D length; + blob.data =3D (uint64_t)malloc(blob.length); + ret =3D ioctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob); + + if (ret) + igt_info("GET BLOB Failed\n"); + + return blob.data; +} + +static void enable_plane(struct data_t *data, igt_display_t *display, ig= t_output_t *output , int pipe1) +{ + enum igt_commit_style commit; + enum pipe pipe2; + int width, height; + uint32_t pixelformat =3D DRM_FORMAT_XRGB8888; + + commit =3D COMMIT_UNIVERSAL; + for_each_connected_output(display, output) { + drmModeModeInfo *mode; + igt_plane_t *plane; + pipe2 =3D output->config.pipe; + + if (pipe2 !=3D pipe1) + break; + igt_output_set_pipe(output, pipe2); + mode =3D igt_output_get_mode(output); + /*Draw the initial primary plane*/ + plane =3D igt_output_get_plane(output, IGT_PLANE_PRIMARY); + + prepare_crtc(data, output, pipe2, plane, mode, commit); + /*Random Size Buffer Creation */ + width =3D 600; + height =3D 600; + + plane =3D igt_output_get_plane(output, IGT_PLANE_2); + igt_create_color_fb(data->drm_fd, + width, height, + pixelformat, + LOCAL_DRM_FORMAT_MOD_NONE, + fb_color.red,fb_color.green,fb_color.blue, + &data->fb); + igt_plane_set_position(plane, 100, 100); + + igt_plane_set_fb(plane, &data->fb); + igt_display_commit2(display, commit); + } + +} +/* +This function verify csc feature using both CRC check. +Steps followed are: + 1.Enable plane for capturing reference CRC + 2.Capture Reference CRC + 3.Apply CSC on Pipe + 4.Enable Plane .CSC will be applied on this planes. + 5.Capture CRC and compare with reference CRC + 6. Register Validation for CRC +*/ +static void test_pipe_csc(struct data_t *data, igt_display_t *display, i= gt_output_t *output, + igt_plane_t *plane, bool enable, int value, int pipe1) +{ + + struct _drm_ctm *ctm_data =3D NULL; + bool ret =3D false; + int res, i, blob_id; + float *ctm; + uint64_t blob_address; + ctm_data =3D (struct _drm_ctm *) + malloc(sizeof(struct _drm_ctm)); + if (!enable) { + ctm =3D ctm_unity; + } else { + if (value =3D=3D RED_CSC) { + ctm =3D ctm_red; + } else if (value =3D=3D GREEN_CSC) { + ctm =3D ctm_green; + } else if (value =3D=3D BLUE_CSC) { + ctm =3D ctm_blue; + } else{ + ctm =3D ctm_unity; + } } + if(value =3D=3D RED_FB) { + fb_color.red =3D 1; + fb_color.green =3D0; + fb_color.blue =3D 0; + } else if(value =3D=3D GREEN_FB) { + fb_color.red =3D 0; + fb_color.green =3D 1; + fb_color.blue =3D 0; + } else if(value =3D=3D BLUE_FB) { + fb_color.red =3D 0; + fb_color.green =3D 0; + fb_color.blue =3D 1; + } else { + fb_color.red =3D 1; + fb_color.green =3D 1; + fb_color.blue =3D 1; + } + /*Enable planes and capture reference crc*/ + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_reference); + + fb_color.red =3D 1; + fb_color.green =3D 1; + fb_color.blue =3D 1; + + enable_plane(data, display, output, pipe1); + + for (i =3D 0; i < CSC_MAX_VALS; i++) { + ctm_data->ctm_coeff[i] =3D convertFloatToBinary(*(ctm + i)); + } + + blob_id =3D create_blob(display->drm_fd, + (int *)(ctm_data), sizeof(struct _drm_ctm)); + igt_fail_on_f (blob_id < 0, "CTM:BLOB IOCTL Fail\n"); + res =3D set_color_property(display->drm_fd, output->config.crtc->crtc_i= d, + DRM_MODE_OBJECT_CRTC, "CTM", blob_id); + igt_fail_on_f (res < 0, "CTM:Set Property Failed\n"); + res =3D get_color_property(display->drm_fd, output->config.crtc->crtc_i= d, DRM_MODE_OBJECT_CRTC, "CTM", blob_id); + igt_fail_on_f (res < 0, "CTM:Get Property Failed\n"); +=09 + blob_address =3D get_blob(display->drm_fd, res, sizeof(struct _drm_ctm)= ); + ctm_data =3D (struct _drm_ctm *) (intptr_t) blob_address; + + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_current); + igt_assert_crc_equal(&crc_reference, &crc_current); + /*Restoring the Unit CSC*/ + ctm =3D ctm_unity; + for (i =3D 0; i < CSC_MAX_VALS; i++) { + ctm_data->ctm_coeff[i] =3D convertFloatToBinary(*(ctm + i)); + } + + blob_id =3D create_blob(display->drm_fd, + (int *)(ctm_data), sizeof(struct _drm_ctm)); + igt_fail_on_f (blob_id < 0, "CTM:BLOB IOCTL Fail\n"); + + res =3D set_color_property(display->drm_fd, output->config.crtc->crtc_i= d, + DRM_MODE_OBJECT_CRTC, "CTM", blob_id); + igt_fail_on_f (res < 0, "CTM:Set Property Failed\n"); + + free(ctm_data); + +} + + +static void apply_gamma(struct data_t *data, igt_display_t *display, igt= _output_t *output, int pipe1, uint32_t num_samples, int unit_gamma)=20 +{ + struct _drm_palette *gamma_data =3D NULL; + int ret, res, blob_id, blob_length; + bool status =3D false; + + + if (num_samples =3D=3D 0) + blob_length =3D 1; + else + blob_length =3D (sizeof(struct _drm_palette) + (num_samples * sizeof(s= truct _drm_r32g32b32))); + + gamma_data =3D malloc(blob_length); + write_gamma_lut(num_samples, gamma_data->lut, unit_gamma); + blob_id =3D create_blob(display->drm_fd, (uint64_t *)(gamma_data), blob= _length); + if (blob_id < 0) + free(gamma_data); + + igt_fail_on_f (blob_id < 0, "GAMMA:BLOB IOCTL Fail\n"); + /*Disabling degamma*/ + if(unit_gamma =3D=3D 2 ) { + res =3D set_color_property(display->drm_fd, output->config.crtc->crtc_= id, + DRM_MODE_OBJECT_CRTC, "PALETTE_BEFORE_CTM", blob= _id); + ret =3D get_color_property(display->drm_fd, output->conf= ig.crtc->crtc_id, + DRM_MODE_OBJECT_CRTC, "PALETTE_BEFORE_CTM", blob= _id); + igt_fail_on_f (res < 0, "PALETTE_BEFORE_CTM:Set Property= Failed\n"); + igt_fail_on_f (ret < 0, "PALETTE_BEFORE_CTM:Set Property= Failed\n"); + + } + + if (num_samples =3D=3D GEN9_SPLITGAMMA_MAX_VALS) { + res =3D set_color_property(display->drm_fd, output->config.crtc->crtc_= id, + DRM_MODE_OBJECT_CRTC, "PALETTE_BEFORE_CTM", blob= _id); + ret =3D get_color_property(display->drm_fd, output->config.crtc->crtc_= id, + DRM_MODE_OBJECT_CRTC, "PALETTE_BEFORE_CTM", blob= _id); + if (res < 0) + free(gamma_data); + igt_fail_on_f (res < 0, "PALETTE_BEFORE_CTM:Set Property Failed= \n"); + igt_fail_on_f (ret < 0, "PALETTE_BEFORE_CTM:Set Property= Failed\n"); + + } + + res =3D set_color_property(display->drm_fd, output->config.crtc->crtc_i= d, + DRM_MODE_OBJECT_CRTC, "PALETTE_AFTER_CTM", blob_id); + if (res < 0) { + free(gamma_data); + } + igt_fail_on_f (res < 0, "PALETTE_AFTER_CTM:Set Property Failed\n= "); + + ret =3D get_color_property(display->drm_fd, output->config.crtc->crtc_i= d, + DRM_MODE_OBJECT_CRTC, "PALETTE_AFTER_CTM", blob_id); + if (ret < 0) { + free(gamma_data); + } + igt_fail_on_f (ret < 0, "PALETTE_BEFORE_CTM:Set Property Failed\= n"); + + free(gamma_data); + + +} +/* +This function verify csc feature using both CRC check. +Steps followed are: + 1.Enable Black plane and capture CRC_REFERENCE_BLACK. + 2.Enable White plane and capture CRS_REFERENCE_WHITE + 3.Enable Red plane. + 4.Apply LOW Gamma. + 5.Capture CRC_Black. + 6.Apply High Gamma and capture CRC_White. + 7.CRC_Black should be equivalent to CRC_REFERENCE_BLACK + 8.CRC_White should be equivalent to CRC_REFERENCE_WHite. + + +*/ +static void test_pipe_gamma(struct data_t *data, igt_display_t *display,= igt_output_t *output, + uint32_t num_samples, int values, int pipe1) +{ + int unit_gamma, disable_gamma; + igt_plane_t *plane; + + /*Enable black planes and capture reference crc*/ + + fb_color.red =3D 0; + fb_color.green =3D0; + fb_color.blue =3D 0; + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_reference_black); + /*Enable white plane and capture refernce crc*/ + fb_color.red =3D 1; + fb_color.green =3D1; + fb_color.blue =3D 1; + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_reference_white); + + /*Enable red planes and apply unit gamma*/ + fb_color.red =3D 1; + fb_color.green =3D0; + fb_color.blue =3D 0; + unit_gamma =3D 0; /*0 -> white 1->black*/ + apply_gamma(data, display, output, pipe1, num_samples, unit_gamma); + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_white); + + /* Apply 0x0 gamma */ + unit_gamma =3D 1; + + apply_gamma(data, display, output, pipe1, num_samples, unit_gamma); + enable_plane(data, display, output, pipe1); + igt_pipe_crc_collect_crc(data->pipe_crc, &crc_black); + igt_assert_crc_equal(&crc_reference_black, &crc_black); + igt_assert_crc_equal(&crc_reference_white, &crc_white); + + /*Disabling gamma*/ + if( num_samples =3D=3D GEN9_SPLITGAMMA_MAX_VALS) { + disable_gamma =3D 2; + apply_gamma(data, display, output, pipe1, 0, disable_gamma); + } else { + apply_gamma(data, display, output, pipe1, 0, unit_gamma)= ; + } +=09 + + + +} + +static void test_legacy_gamma (struct data_t *data, igt_display_t *displ= ay, igt_output_t *output, int pipe1) +{ + int fd,ret,i; + + uint32_t crtc; + uint16_t *val =3D malloc(sizeof(uint16_t) * 256); + igt_plane_t *plane; + + fb_color.red =3D 1; + fb_color.green =3D1; + fb_color.blue =3D 1; + enable_plane(data, display, output, pipe1); + float gamma1 =3D 1.0; + for(i =3D 0; i < 256 ; i++) { + val[i] =3D 0xffff * pow((i/255), gamma1); + + } + for_each_connected_output (display, output) { + ret =3D drmModeCrtcSetGamma (display->drm_fd, output->config.crtc->crt= c_id, 256, val, val, val); + igt_assert_lte(0, ret); + + } +} + +static void test_pipe_color(struct data_t *data, const char *prop_name,= int enable, int value) +{ + igt_display_t *display =3D &data->display; + igt_output_t *output; + igt_plane_t *plane; + enum pipe pipe1; + + for_each_connected_output(display, output) { + pipe1 =3D output->config.pipe; + igt_output_set_pipe(output,pipe1); + if ((strcmp(prop_name, "gamma_property_8bit") =3D=3D 0) && + enable =3D=3D true){ + test_pipe_gamma(data, display, output, + GEN9_8BIT_GAMMA_MAX_VALS, value, pipe1); + } else if ((strcmp(prop_name, "legacy_gamma") =3D=3D 0)){ + test_legacy_gamma(data, display, output, pipe1); + } else if ((strcmp(prop_name, "gamma_property_10bit") =3D=3D 0) && + enable =3D=3D true) { + test_pipe_gamma(data, display, output, GEN9_10BIT_GAMMA_MAX_VALS, val= ue, pipe1); + } else if ((strcmp(prop_name, "csc_property") =3D=3D 0)) { + test_pipe_csc(data, display, output, plane, enable, value, pipe1); + } else if ((strcmp(prop_name, "gamma_property_split") =3D=3D 0) && + enable =3D=3D true) { + test_pipe_gamma(data, display, output, + GEN9_SPLITGAMMA_MAX_VALS, value, pipe1); + } else if ((strcmp(prop_name, "gamma_property_12bit") =3D=3D 0) && en= able =3D=3D true) { + test_pipe_gamma(data, display, output, + GEN9_12BIT_GAMMA_MAX_VALS, value, pipe1); + } else { + igt_info("Invalid Test\n"); + } + cleanup_fb(data); + plane =3D igt_output_get_plane(output, IGT_PLANE_2); + cleanup_crtc(data, output, plane); + } +} + +igt_main +{ + struct data_t data =3D {}; + int values =3D 1; + igt_skip_on_simulation(); + igt_fixture{ + // data.drm_fd =3D drm_open_driver_master(DRIVER_INTEL)= ; + data.drm_fd =3D drm_open_any_master(); + kmstest_set_vt_graphics_mode(); + igt_display_init(&data.display, data.drm_fd); + data.gen =3D intel_gen(intel_get_drm_devid(data.drm_fd)); + igt_require(data.gen >=3D 9); + } + igt_subtest_f("csc-red") + test_pipe_color(&data, "csc_property", true, RED_CSC); + igt_subtest_f("csc-green") + test_pipe_color(&data, "csc_property", true, GREEN_CSC); + igt_subtest_f("csc-blue") + test_pipe_color(&data, "csc_property", true, BLUE_CSC); + igt_subtest_f("gamma-legacy") + test_pipe_color(&data, "legacy_gamma", true, values); + + igt_subtest_f("gamma-8bit") + test_pipe_color(&data, "gamma_property_8bit", true, values); + igt_subtest_f("gamma-10bit") + test_pipe_color(&data, "gamma_property_10bit", true, values); + igt_subtest_f("gamma-12bit") + test_pipe_color(&data, "gamma_property_12bit", true, values); + igt_subtest_f("gamma-split") + test_pipe_color(&data, "gamma_property_split", true, values); + + igt_fixture{ + igt_display_fini(&data.display); + } +} + --=20 1.9.1 --===============0075747067== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============0075747067==--