From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 201B8895C8 for ; Tue, 7 Sep 2021 15:57:58 +0000 (UTC) From: Ramalingam C Date: Tue, 7 Sep 2021 21:30:12 +0530 Message-Id: <20210907160012.21601-3-ramalingam.c@intel.com> In-Reply-To: <20210907160012.21601-1-ramalingam.c@intel.com> References: <20210907160012.21601-1-ramalingam.c@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t 2/2] tests/kms_prime: Create the exporting BO with smem placement List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev Cc: Chris Wilson , Chris_intel_ID , Dixit Ashutosh , Michael Ruhl , Ramalingam C List-ID: On i915, to use the dmabuf, we need the sharing object needs to be migrated to smem. So shared object needs to have the smem as second placement option. Currently kms_prime sharing the dumb buffer between the devices. But dumb buffer can't have the placements and resides at lmem for the dgfx. Hence to meet the i915 expectation for dgfx, we create the BO using the gem_create with smem as second placement option. Signed-off-by: Ramalingam C --- tests/kms_prime.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/kms_prime.c b/tests/kms_prime.c index 2e20c58bc16e..877774249e0f 100644 --- a/tests/kms_prime.c +++ b/tests/kms_prime.c @@ -100,18 +100,16 @@ static void prepare_scratch(int exporter_fd, struct dumb_bo *scratch, scratch->height = mode->vdisplay; scratch->bpp = 32; - scratch->handle = kmstest_dumb_create(exporter_fd, - ALIGN(scratch->width, 256), - scratch->height, - scratch->bpp, - &scratch->pitch, - &scratch->size); - - - ptr = kmstest_dumb_map_buffer(exporter_fd, - scratch->handle, - scratch->size, - PROT_WRITE); + igt_calc_fb_size(exporter_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, + DRM_FORMAT_MOD_NONE, &scratch->size, &scratch->pitch); + if (gem_has_lmem(exporter_fd)) + scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size, + REGION_LMEM(0), REGION_SMEM); + else + scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size, + REGION_SMEM); + + ptr = gem_mmap_ptr(exporter_fd, scratch->handle, 0, scratch->size, PROT_WRITE | PROT_READ); for (size_t idx = 0; idx < scratch->size / sizeof(*ptr); ++idx) ptr[idx] = color; -- 2.20.1