From patchwork Mon Aug 12 18:14:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFyZWsgT2zFocOhaw==?= X-Patchwork-Id: 2843243 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0B1479F271 for ; Mon, 12 Aug 2013 18:29:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80FB920579 for ; Mon, 12 Aug 2013 18:29:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B11F320578 for ; Mon, 12 Aug 2013 18:29:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A03CEE76FF for ; Mon, 12 Aug 2013 11:29:11 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) by gabe.freedesktop.org (Postfix) with ESMTP id EDEEFE6916; Mon, 12 Aug 2013 11:14:16 -0700 (PDT) Received: by mail-ee0-f42.google.com with SMTP id b45so3656585eek.15 for ; Mon, 12 Aug 2013 11:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=uC2+9JkOCcAShMe8s8E5Z3rBsMTYeNIRaLwmBikgOx8=; b=tylMcPnSmA5z2ysFZzQpAb/evdcZIBQseMlIqY3GirhhKsw8Qd4V91sSbu513AQsQt ec3W1BJzqVujzHjgpG6vFPXPjlFlFrbkYzggkd+X03hKcl9cN5IIywTrOcrWWfmCwgaZ a5NlTOLLdrQbHCuSri4ncLMKMS2UyTKz8/sdbUf8ZPoOHOx0gBf13reHRXrtfOgFcTkJ +qu1td2Ok0ROslQytSQudg+ivGIAUSuEeb6RHm6cuKQTKnw+nEky5oDMsNcPTamac7uR fa6EkbJZZ2zVHDZlJsOSH2qN8DpY0Pltp1zias5f/Xsw7KkIU1VKTNTxflog3l/E+Gz8 D+OQ== X-Received: by 10.15.24.5 with SMTP id i5mr344734eeu.74.1376331256166; Mon, 12 Aug 2013 11:14:16 -0700 (PDT) Received: from localhost.localdomain ([194.228.11.33]) by mx.google.com with ESMTPSA id a6sm47385368eei.10.2013.08.12.11.14.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 11:14:15 -0700 (PDT) From: "=?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?=" To: mesa-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] r600g, radeonsi: set/get the scanout flag using the set/get_tiling ioctls Date: Mon, 12 Aug 2013 20:14:10 +0200 Message-Id: <1376331250-32665-1-git-send-email-marek.olsak@amd.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 --- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r300/r300_texture.c | 4 ++-- src/gallium/drivers/r600/r600_texture.c | 13 ++++++++----- src/gallium/drivers/radeonsi/r600_texture.c | 13 ++++++++----- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 12 ++++++++++-- src/gallium/winsys/radeon/drm/radeon_winsys.h | 4 +++- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index e69a605..dad3dc5 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -843,7 +843,7 @@ static void r300_tex_set_tiling_flags(struct r300_context *r300, tex->tex.macrotile[level]) { r300->rws->buffer_set_tiling(tex->buf, r300->cs, tex->tex.microtile, tex->tex.macrotile[level], - 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, FALSE, tex->tex.stride_in_bytes[0]); tex->surface_level = level; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 13e9bc3..4b58f06 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -1059,7 +1059,7 @@ r300_texture_create_object(struct r300_screen *rscreen, rws->buffer_set_tiling(tex->buf, NULL, tex->tex.microtile, tex->tex.macrotile[0], - 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, FALSE, tex->tex.stride_in_bytes[0]); return tex; @@ -1115,7 +1115,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen, if (!buffer) return NULL; - rws->buffer_get_tiling(buffer, µtile, ¯otile, NULL, NULL, NULL, NULL, NULL); + rws->buffer_get_tiling(buffer, µtile, ¯otile, NULL, NULL, NULL, NULL, NULL, NULL); /* Enforce a microtiled zbuffer. */ if (util_format_is_depth_or_stencil(base->format) && diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 742e982..f27d0dc 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -131,7 +131,7 @@ static int r600_init_surface(struct r600_screen *rscreen, struct radeon_surface *surface, const struct pipe_resource *ptex, unsigned array_mode, - bool is_flushed_depth) + bool is_flushed_depth, bool is_scanout) { const struct util_format_description *desc = util_format_description(ptex->format); @@ -205,7 +205,7 @@ static int r600_init_surface(struct r600_screen *rscreen, default: return -EINVAL; } - if (ptex->bind & PIPE_BIND_SCANOUT) { + if (is_scanout) { surface->flags |= RADEON_SURF_SCANOUT; } @@ -285,6 +285,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, surface->tile_split, surface->stencil_tile_split, surface->mtilea, + (surface->flags & RADEON_SURF_SCANOUT) != 0, rtex->surface.level[0].pitch_bytes); return rscreen->ws->buffer_get_handle(resource->buf, @@ -624,7 +625,8 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, } r = r600_init_surface(rscreen, &surface, templ, array_mode, - templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH); + (templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH) != 0, + (templ->bind & PIPE_BIND_SCANOUT) != 0); if (r) { return NULL; } @@ -689,6 +691,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, unsigned array_mode = 0; enum radeon_bo_layout micro, macro; struct radeon_surface surface; + boolean scanout; int r; /* Support only 2D textures without mipmaps */ @@ -704,7 +707,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, &surface.bankw, &surface.bankh, &surface.tile_split, &surface.stencil_tile_split, - &surface.mtilea); + &surface.mtilea, &scanout); if (macro == RADEON_LAYOUT_TILED) array_mode = V_0280A0_ARRAY_2D_TILED_THIN1; @@ -713,7 +716,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, else array_mode = V_038000_ARRAY_LINEAR_ALIGNED; - r = r600_init_surface(rscreen, &surface, templ, array_mode, false); + r = r600_init_surface(rscreen, &surface, templ, array_mode, false, scanout); if (r) { return NULL; } diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index 8e01b14..8841cea 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -124,7 +124,7 @@ static int r600_init_surface(struct r600_screen *rscreen, struct radeon_surface *surface, const struct pipe_resource *ptex, unsigned array_mode, - bool is_flushed_depth) + bool is_flushed_depth, bool is_scanout) { const struct util_format_description *desc = util_format_description(ptex->format); @@ -197,7 +197,7 @@ static int r600_init_surface(struct r600_screen *rscreen, default: return -EINVAL; } - if (ptex->bind & PIPE_BIND_SCANOUT) { + if (is_scanout) { surface->flags |= RADEON_SURF_SCANOUT; } @@ -260,6 +260,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, surface->tile_split, surface->stencil_tile_split, surface->mtilea, + (surface->flags & RADEON_SURF_SCANOUT) != 0, surface->level[0].pitch_bytes); return rscreen->ws->buffer_get_handle(resource->buf, @@ -534,7 +535,8 @@ struct pipe_resource *si_texture_create(struct pipe_screen *screen, } r = r600_init_surface(rscreen, &surface, templ, array_mode, - templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH); + (templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH) != 0, + (templ->bind & PIPE_BIND_SCANOUT) != 0); if (r) { return NULL; } @@ -592,6 +594,7 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, unsigned array_mode; enum radeon_bo_layout micro, macro; struct radeon_surface surface; + boolean scanout; int r; /* Support only 2D textures without mipmaps */ @@ -607,7 +610,7 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, &surface.bankw, &surface.bankh, &surface.tile_split, &surface.stencil_tile_split, - &surface.mtilea); + &surface.mtilea, &scanout); if (macro == RADEON_LAYOUT_TILED) array_mode = V_009910_ARRAY_2D_TILED_THIN1; @@ -616,7 +619,7 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, else array_mode = V_009910_ARRAY_LINEAR_ALIGNED; - r = r600_init_surface(rscreen, &surface, templ, array_mode, false); + r = r600_init_surface(rscreen, &surface, templ, array_mode, false, scanout); if (r) { return NULL; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 19e2715..1b3573b 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -48,6 +48,7 @@ */ #define RADEON_BO_FLAGS_MACRO_TILE 1 #define RADEON_BO_FLAGS_MICRO_TILE 2 +#define RADEON_TILING_R600_SCANOUT 0x4 /* r600 and later */ #define RADEON_BO_FLAGS_MICRO_TILE_SQUARE 0x20 #ifndef DRM_RADEON_GEM_WAIT @@ -738,7 +739,8 @@ static void radeon_bo_get_tiling(struct pb_buffer *_buf, unsigned *bankw, unsigned *bankh, unsigned *tile_split, unsigned *stencil_tile_split, - unsigned *mtilea) + unsigned *mtilea, + boolean *scanout) { struct radeon_bo *bo = get_radeon_bo(_buf); struct drm_radeon_gem_set_tiling args; @@ -759,13 +761,14 @@ static void radeon_bo_get_tiling(struct pb_buffer *_buf, if (args.tiling_flags & RADEON_BO_FLAGS_MACRO_TILE) *macrotiled = RADEON_LAYOUT_TILED; - if (bankw && tile_split && stencil_tile_split && mtilea && tile_split) { + if (bankw && tile_split && stencil_tile_split && mtilea && tile_split && scanout) { *bankw = (args.tiling_flags >> RADEON_TILING_EG_BANKW_SHIFT) & RADEON_TILING_EG_BANKW_MASK; *bankh = (args.tiling_flags >> RADEON_TILING_EG_BANKH_SHIFT) & RADEON_TILING_EG_BANKH_MASK; *tile_split = (args.tiling_flags >> RADEON_TILING_EG_TILE_SPLIT_SHIFT) & RADEON_TILING_EG_TILE_SPLIT_MASK; *stencil_tile_split = (args.tiling_flags >> RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT) & RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK; *mtilea = (args.tiling_flags >> RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT) & RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK; *tile_split = eg_tile_split(*tile_split); + *scanout = (args.tiling_flags & RADEON_TILING_R600_SCANOUT) != 0; } } @@ -777,6 +780,7 @@ static void radeon_bo_set_tiling(struct pb_buffer *_buf, unsigned tile_split, unsigned stencil_tile_split, unsigned mtilea, + boolean scanout, uint32_t pitch) { struct radeon_bo *bo = get_radeon_bo(_buf); @@ -818,6 +822,10 @@ static void radeon_bo_set_tiling(struct pb_buffer *_buf, args.tiling_flags |= (mtilea & RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK) << RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT; + if (cs->ws->gen >= DRV_R600 && scanout) { + args.tiling_flags |= RADEON_TILING_R600_SCANOUT; + } + args.handle = bo->handle; args.pitch = pitch; diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index a619d70..fb95848 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -305,7 +305,8 @@ struct radeon_winsys { unsigned *bankw, unsigned *bankh, unsigned *tile_split, unsigned *stencil_tile_split, - unsigned *mtilea); + unsigned *mtilea, + boolean *scanout); /** * Set tiling flags describing a memory layout of a buffer object. @@ -326,6 +327,7 @@ struct radeon_winsys { unsigned tile_split, unsigned stencil_tile_split, unsigned mtilea, + boolean scanout, unsigned stride); /**