etnaviv: cosmetic etna_resource_alloc fixes

Get rid if the local bo variable, we can just assign it to the pointer
in the etna_resource struct.
Get rid of superfluous clearing of the TS bo pointer, the struct is already
zero initialized.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7367>
This commit is contained in:
Lucas Stach 2020-10-29 16:55:17 +01:00 committed by Marge Bot
parent 98db7c4841
commit 181790117b
1 changed files with 3 additions and 5 deletions

View File

@ -307,15 +307,13 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
uint32_t flags = DRM_ETNA_GEM_CACHE_WC;
if (templat->bind & PIPE_BIND_VERTEX_BUFFER)
flags |= DRM_ETNA_GEM_FORCE_MMU;
struct etna_bo *bo = etna_bo_new(screen->dev, size, flags);
if (unlikely(bo == NULL)) {
rsc->bo = etna_bo_new(screen->dev, size, flags);
if (unlikely(!rsc->bo)) {
BUG("Problem allocating video memory for resource");
goto free_rsc;
}
rsc->bo = bo;
rsc->ts_bo = 0; /* TS is only created when first bound to surface */
if (DBG_ENABLED(ETNA_DBG_ZERO)) {
void *map = etna_bo_map(bo);
memset(map, 0, size);