From patchwork Thu Dec 17 16:31:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 7874241 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5AFE99F349 for ; Thu, 17 Dec 2015 16:31:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8893D2042C for ; Thu, 17 Dec 2015 16:31:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6A64220444 for ; Thu, 17 Dec 2015 16:31:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B96016E313; Thu, 17 Dec 2015 08:31:56 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 424206E313 for ; Thu, 17 Dec 2015 08:31:56 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 17 Dec 2015 08:31:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,441,1444719600"; d="scan'208";a="709762138" Received: from nncongwa-mobl2.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.55.237]) by orsmga003.jf.intel.com with ESMTP; 17 Dec 2015 08:31:54 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Thu, 17 Dec 2015 16:31:48 +0000 Message-Id: <1450369910-11112-3-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1450369910-11112-1-git-send-email-lionel.g.landwerlin@intel.com> References: <1450369910-11112-1-git-send-email-lionel.g.landwerlin@intel.com> Cc: dhanya.p.r@intel.com Subject: [Intel-gfx] [PATCH 2/4] lib: kms: add helpers to get/set properties on pipes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Lionel Landwerlin --- lib/igt_kms.c | 40 ++++++++++++++++++++++++++++++++++++++++ lib/igt_kms.h | 9 ++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index eeed468..1f37489 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1285,6 +1285,16 @@ static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, enum igt_plane plane) return &pipe->planes[idx]; } +bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name, + uint32_t *prop_id, uint64_t *value, + drmModePropertyPtr *prop) +{ + return get_crtc_property(pipe->display->drm_fd, + pipe->crtc_id, + name, + prop_id, value, prop); +} + static uint32_t igt_plane_get_fb_id(igt_plane_t *plane) { if (plane->fb) @@ -1924,6 +1934,36 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation) plane->rotation_changed = true; } +int +igt_pipe_set_blob_property(igt_pipe_t *pipe, + const char *name, + void *data, + size_t length) +{ + igt_display_t *display = pipe->display; + uint32_t blob_id = 0, prop_id; + int ret; + + if (!igt_pipe_get_property(pipe, name, &prop_id, NULL, NULL)) + return -1; + + if (length > 0) { + ret = drmModeCreatePropertyBlob(display->drm_fd, + data, length, &blob_id); + CHECK_RETURN(ret, true); + } + + ret = drmModeObjectSetProperty(display->drm_fd, pipe->crtc_id, + DRM_MODE_OBJECT_CRTC, + prop_id, blob_id); + CHECK_RETURN(ret, true); + + if (blob_id != 0) + ret = drmModeDestroyPropertyBlob(display->drm_fd, blob_id); + + return ret; +} + /** * 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 c12c2e1..fb8fc8a 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -256,6 +256,14 @@ static inline bool igt_plane_supports_rotation(igt_plane_t *plane) return plane->rotation_property != 0; } +bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name, + uint32_t *prop_id, uint64_t *value, + drmModePropertyPtr *prop); +#define igt_pipe_has_property(pipe, prop) \ + igt_pipe_get_property(pipe, prop, NULL, NULL, NULL) +int igt_pipe_set_blob_property(igt_pipe_t *pipe, const char *name, + void *data, size_t length); + void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb); 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); @@ -291,4 +299,3 @@ const unsigned char* igt_kms_get_alt_edid(void); #endif /* __IGT_KMS_H__ */ -