From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakob Bornecrantz Subject: Re: [PATCH] drm/ttm: Don't move non-existing data Date: Mon, 18 Nov 2013 03:38:08 -0800 (PST) Message-ID: <1394911539.36268921.1384774688452.JavaMail.root@vmware.com> References: <1384759838-3501-1-git-send-email-thellstrom@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTP id 041DF105C04 for ; Mon, 18 Nov 2013 03:38:09 -0800 (PST) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 44F3E2A14A for ; Mon, 18 Nov 2013 03:38:09 -0800 (PST) Received: from zcs-prod-mta-2.vmware.com (zcs-prod-mta-2.vmware.com [10.113.163.64]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 3DFAF184E3 for ; Mon, 18 Nov 2013 03:38:09 -0800 (PST) In-Reply-To: <1384759838-3501-1-git-send-email-thellstrom@vmware.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Thomas Hellstrom Cc: linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org ----- Original Message ----- > If ttm_bo_move_memcpy was instructed to move a non-populated ttm to > io memory, it would first populate the ttm, then move the data and then > destroy the ttm. That's stupid. However, some drivers might have relied on > this to clear io memory from old stuff. So instead of a NOP, which would > be the most efficient, just clear the destination. > > Signed-off-by: Thomas Hellstrom Reviewed-by: Jakob Bornecrantz Cheers, Jakob. > --- > drivers/gpu/drm/ttm/ttm_bo_util.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c > b/drivers/gpu/drm/ttm/ttm_bo_util.c > index 4834c46..15b86a9 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -350,10 +350,13 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, > goto out2; > > /* > - * Move nonexistent data. NOP. > + * Don't move nonexistent data. Clear destination instead. > */ > - if (old_iomap == NULL && ttm == NULL) > + if (old_iomap == NULL && > + (ttm == NULL || ttm->state == tt_unpopulated)) { > + memset_io(new_iomap, 0, new_mem->num_pages*PAGE_SIZE); > goto out2; > + } > > /* > * TTM might be null for moves within the same region. > -- > 1.7.10.4 >