Re: [PATCH i-g-t v2 07/14] lib/igt_kms: Unexport broadcast rgb API.

Mika Kahola
2017-10-19T11:31:25Z

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Thu, 2017-10-12 at 13:54 +0200, Maarten Lankhorst wrote:
> Setting broadcast rgb was only used by chamelium, but is now handled
> in igt_display by default. This means that chamelium doesn't need to
> set it, and this can be hidden. The broadcast RGB property is intel
> connector specific, so rename the enum to intel_broadcast_rgb_mode.
>
> Keep the property and enum public in case someone wants to test the
> property later.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  lib/igt_kms.c     | 44 ++++++--------------------------------------
>  lib/igt_kms.h     |  7 +++----
>  tests/chamelium.c |  3 ---
>  3 files changed, 9 insertions(+), 45 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 5f54021350ac..ad0855d0c8fa 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -187,7 +187,8 @@ const char
> *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
>  const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>   "scaling mode",
>   "CRTC_ID",
> - "DPMS"
> + "DPMS",
> + "Broadcast RGB"
>  };
>
>  /*
> @@ -1037,40 +1038,6 @@ void kmstest_set_connector_dpms(int fd,
> drmModeConnector *connector, int mode)
>          dpms, mode) == 0);
>  }
>
> -/**
> - * kmstest_set_connector_broadcast_rgb:
> - * @fd: DRM fd
> - * @connector: libdrm connector
> - * @mode: Broadcast RGB mode
> - *
> - * This function sets the Broadcast RGB prop of @connector to @mode,
> if there
> - * is one.
> - *
> - * Returns: true if we found and set the Broadcast RGB prop, false
> otherwise
> - */
> -bool kmstest_set_connector_broadcast_rgb(int fd, drmModeConnector
> *connector,
> -  enum
> kmstest_broadcast_rgb_mode mode)
> -{
> - uint32_t prop_id;
> - int ret;
> -
> - ret = kmstest_get_property(fd, connector->connector_id,
> -    DRM_MODE_OBJECT_CONNECTOR,
> "Broadcast RGB",
> -    &prop_id, NULL, NULL);
> - if (!ret) {
> - igt_debug("Broadcast RGB property not found on
> %d\n",
> -   connector->connector_id);
> - return false;
> - }
> -
> - igt_debug("Setting Broadcast RGB mode on connector %d to
> %d\n",
> -   connector->connector_id, mode);
> - ret = drmModeConnectorSetProperty(fd, connector-
> >connector_id, prop_id,
> -   mode);
> -
> - return ret == 0;
> -}
> -
>  /**
>   * kmstest_get_property:
>   * @drm_fd: drm file descriptor
> @@ -1583,9 +1550,10 @@ static void igt_output_refresh(igt_output_t
> *output)
>   igt_atomic_fill_connector_props(display, output,
>   IGT_NUM_CONNECTOR_PROPS,
> igt_connector_prop_names);
>
> - kmstest_set_connector_broadcast_rgb(display->drm_fd,
> -     output-
> >config.connector,
> -     BROADCAST_RGB_FU
> LL);
> + if (output->props[IGT_CONNECTOR_BROADCAST_RGB])
> + igt_output_set_prop_value(output,
> +   IGT_CONNECTOR_BROA
> DCAST_RGB,
> +   BROADCAST_RGB_FULL
> );
>   }
>
>   LOG(display, "%s: Selecting pipe %s\n", output->name,
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 2e4c23437f4e..b8a04af73e2f 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -115,6 +115,7 @@ enum igt_atomic_connector_properties {
>         IGT_CONNECTOR_SCALING_MODE = 0,
>         IGT_CONNECTOR_CRTC_ID,
>         IGT_CONNECTOR_DPMS,
> +       IGT_CONNECTOR_BROADCAST_RGB,
>         IGT_NUM_CONNECTOR_PROPS
>  };
>
> @@ -171,13 +172,13 @@ enum kmstest_force_connector_state {
>  };
>
>  /**
> - * kmstest_broadcast_rgb_mode:
> + * intel_broadcast_rgb_mode:
>   * @BROADCAST_RGB_AUTO: Choose the color range to use automatically
>   * @BROADCAST_RGB_FULL: Force the connector to use full color range
>   * @BROADCAST_RGB_16_235: Force the connector to use a limited
> 16:235 color
>   * range
>   */
> -enum kmstest_broadcast_rgb_mode {
> +enum intel_broadcast_rgb_mode {
>   BROADCAST_RGB_AUTO = 0,
>   BROADCAST_RGB_FULL,
>   BROADCAST_RGB_16_235
> @@ -203,8 +204,6 @@ bool kmstest_probe_connector_config(int drm_fd,
> uint32_t connector_id,
>  void kmstest_free_connector_config(struct kmstest_connector_config
> *config);
>
>  void kmstest_set_connector_dpms(int fd, drmModeConnector *connector,
> int mode);
> -bool kmstest_set_connector_broadcast_rgb(int fd, drmModeConnector
> *connector,
> -  enum
> kmstest_broadcast_rgb_mode mode);
>  bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t
> object_type,
>     const char *name, uint32_t *prop_id,
> uint64_t *value,
>     drmModePropertyPtr *prop);
> diff --git a/tests/chamelium.c b/tests/chamelium.c
> index ae164920e86e..4ad29f9d178a 100644
> --- a/tests/chamelium.c
> +++ b/tests/chamelium.c
> @@ -466,9 +466,6 @@ enable_output(data_t *data,
>   igt_pipe_obj_replace_prop_blob(primary->pipe,
> IGT_CRTC_GAMMA_LUT, NULL, 0);
>   igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_CTM,
> NULL, 0);
>
> - kmstest_set_connector_broadcast_rgb(display->drm_fd,
> connector,
> -     BROADCAST_RGB_FULL);
> -
>   igt_display_commit(display);
>
>   if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
--
Mika Kahola - Intel OTC