From patchwork Fri May 28 05:55:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zou, Nanhai" X-Patchwork-Id: 102826 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4S5umqj017600 for ; Fri, 28 May 2010 05:57:24 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A3749EB41 for ; Thu, 27 May 2010 22:56:48 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BE2C9EFF5 for ; Thu, 27 May 2010 22:56:13 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 May 2010 22:52:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.53,316,1272870000"; d="scan'208";a="571288025" Received: from linux-g45.sh.intel.com (HELO hdmi.sh.intel.com) ([10.239.36.8]) by fmsmga002.fm.intel.com with ESMTP; 27 May 2010 22:54:58 -0700 From: Zou Nan hai To: Anholt Eric , intel-gfx Date: Fri, 28 May 2010 13:55:37 +0800 Message-Id: <1275026137-12784-1-git-send-email-nanhai.zou@intel.com> X-Mailer: git-send-email 1.7.1 Subject: [Intel-gfx] [PATCH] libdrm execute on different ring buffer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 28 May 2010 05:57:24 +0000 (UTC) different ring buffer. This is need for VAAPI to decode H.264 on BSD ring buffer Signed-off-by: Xiang Hai hao Signed-off-by: Zou Nan hai --- include/drm/i915_drm.h | 4 +++- intel/intel_bufmgr.c | 13 +++++++++++++ intel/intel_bufmgr.h | 3 +++ intel/intel_bufmgr_gem.c | 26 ++++++++++++++++++++------ intel/intel_bufmgr_priv.h | 7 +++++++ 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index c8cb3a6..b5b5a8e 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h @@ -616,7 +616,9 @@ struct drm_i915_gem_execbuffer2 { __u32 num_cliprects; /** This is a struct drm_clip_rect *cliprects */ __u64 cliprects_ptr; - __u64 flags; /* currently unused */ +#define ON_RENDER_RING (1 << 0) +#define ON_BSD_RING (1 << 1) + __u64 flags; __u64 rsvd1; __u64 rsvd2; }; diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c index 9144fdd..e58148d 100644 --- a/intel/intel_bufmgr.c +++ b/intel/intel_bufmgr.c @@ -145,6 +145,19 @@ drm_intel_bo_exec(drm_intel_bo *bo, int used, return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4); } +int +drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used, + drm_clip_rect_t *cliprects, int num_cliprects, int DR4, + int ring_flag) +{ + if (bo->bufmgr->bo_mrb_exec) + return bo->bufmgr->bo_mrb_exec(bo, used, + cliprects, num_cliprects, DR4, + ring_flag); + + return -ENODEV; +} + void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug) { bufmgr->debug = enable_debug; diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index cbcddb6..9da77f7 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -106,6 +106,9 @@ void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug); void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr); int drm_intel_bo_exec(drm_intel_bo *bo, int used, drm_clip_rect_t * cliprects, int num_cliprects, int DR4); +int drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used, + drm_clip_rect_t *cliprects, int num_cliprects, int DR4, + int ring_flag); int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count); int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index b76fd7e..75f97bc 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1530,14 +1530,17 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used, } static int -drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used, - drm_clip_rect_t *cliprects, int num_cliprects, - int DR4) +drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used, + drm_clip_rect_t *cliprects, int num_cliprects, int DR4, + int ring_flag) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; struct drm_i915_gem_execbuffer2 execbuf; int ret, i; + if ((ring_flag != ON_RENDER_RING) && (ring_flag != ON_BSD_RING)) + ring_flag = ON_RENDER_RING; + pthread_mutex_lock(&bufmgr_gem->lock); /* Update indices and set up the validate list. */ drm_intel_gem_bo_process_reloc2(bo); @@ -1555,7 +1558,7 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used, execbuf.num_cliprects = num_cliprects; execbuf.DR1 = 0; execbuf.DR4 = DR4; - execbuf.flags = 0; + execbuf.flags = ring_flag; execbuf.rsvd1 = 0; execbuf.rsvd2 = 0; @@ -1597,6 +1600,16 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used, } static int +drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used, + drm_clip_rect_t *cliprects, int num_cliprects, + int DR4) +{ + return drm_intel_gem_bo_mrb_exec2(bo, used, + cliprects, num_cliprects, DR4, + ON_RENDER_RING); +} + +static int drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; @@ -2076,9 +2089,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling; bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink; /* Use the new one if available */ - if (exec2) + if (exec2) { bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2; - else + bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2; + } else bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec; bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy; bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise; diff --git a/intel/intel_bufmgr_priv.h b/intel/intel_bufmgr_priv.h index f987d97..234f802 100644 --- a/intel/intel_bufmgr_priv.h +++ b/intel/intel_bufmgr_priv.h @@ -173,6 +173,13 @@ struct _drm_intel_bufmgr { drm_clip_rect_t *cliprects, int num_cliprects, int DR4); + /** Executes the command buffer pointed to by bo on the selected + * ring buffer + */ + int (*bo_mrb_exec) (drm_intel_bo *bo, int used, + drm_clip_rect_t *cliprects, int num_cliprects, + int DR4, int ring_flag); + /** * Pin a buffer to the aperture and fix the offset until unpinned *