All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: maxime.ripard@bootlin.com, dri-devel@lists.freedesktop.org,
	kraxel@redhat.com, airlied@redhat.com, sean@poorly.run
Subject: Re: [PATCH v2 5/9] drm/ast: Pin framebuffer BO during dirty update
Date: Wed, 12 Jun 2019 09:35:32 +0200	[thread overview]
Message-ID: <038d4a58-1980-3b76-ea53-9b354980723a@suse.de> (raw)
In-Reply-To: <20190611202953.GA18315@ravnborg.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 3134 bytes --]

Hi

Am 11.06.19 um 22:29 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Tue, Jun 11, 2019 at 03:03:40PM +0200, Thomas Zimmermann wrote:
>> Another explicit lock operation of a GEM VRAM BO is located in AST's
>> framebuffer update code. Instead of locking the BO, we pin it to wherever
>> it is.
>>
>> v2:
>> 	* update with pin flag of 0
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/ast/ast_fb.c | 33 ++++++++++++++++-----------------
>>  1 file changed, 16 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
>> index 05f45222b702..b404b51c2c55 100644
>> --- a/drivers/gpu/drm/ast/ast_fb.c
>> +++ b/drivers/gpu/drm/ast/ast_fb.c
>> @@ -48,32 +48,31 @@ static void ast_dirty_update(struct ast_fbdev *afbdev,
>>  			     int x, int y, int width, int height)
>>  {
>>  	int i;
>> -	struct drm_gem_object *obj;
>>  	struct drm_gem_vram_object *gbo;
>>  	int src_offset, dst_offset;
>>  	int bpp = afbdev->afb.base.format->cpp[0];
>> -	int ret = -EBUSY;
>> +	int ret;
>>  	u8 *dst;
>>  	bool unmap = false;
>>  	bool store_for_later = false;
>>  	int x2, y2;
>>  	unsigned long flags;
>>  
>> -	obj = afbdev->afb.obj;
>> -	gbo = drm_gem_vram_of_gem(obj);
>> -
>> -	/* Try to lock the BO. If we fail with -EBUSY then
>> -	 * the BO is being moved and we should store up the
>> -	 * damage until later.
>> -	 */
>> -	if (drm_can_sleep())
>> -		ret = drm_gem_vram_lock(gbo, true);
>> -	if (ret) {
>> -		if (ret != -EBUSY)
>> -			return;
>> -
>> +	gbo = drm_gem_vram_of_gem(afbdev->afb.obj);
>> +
>> +	if (drm_can_sleep()) {
> 
> While touching this code, anyway we could get rid of drm_can_sleep()?
> I only ask because Daniel V. said that we should not use it.
> This was some months ago during some ehader file clean-up, so nothing
> in particular related to the ast driver.

I'm aware of what is commented in the header and the todo file. Do you
have a link to this discussion?

In any case, I'd prefer to fix this in a separate patch set. I have
patches that replace the ast and mgag200 fbdev consoles with generic
code. That might be the right place.

Best regards
Thomas

> 
> 	Sam
> 
>> +		/* We pin the BO so it won't be moved during the
>> +		 * update. The actual location, video RAM or system
>> +		 * memory, is not important.
>> +		 */
>> +		ret = drm_gem_vram_pin(gbo, 0);
>> +		if (ret) {
>> +			if (ret != -EBUSY)
>> +				return;
>> +			store_for_later = true;
>> +		}
>> +	} else
>>  		store_for_later = true;
>> -	}
>>  
>>  	x2 = x + width - 1;
>>  	y2 = y + height - 1;
>> @@ -126,7 +125,7 @@ static void ast_dirty_update(struct ast_fbdev *afbdev,
>>  		drm_gem_vram_kunmap(gbo);
>>  
>>  out:
>> -	drm_gem_vram_unlock(gbo);
>> +	drm_gem_vram_unpin(gbo);
>>  }
>>  
>>  static void ast_fillrect(struct fb_info *info,
>> -- 
>> 2.21.0

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-06-12  7:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 13:03 [PATCH v2 0/9] Remove explicit locking and kmap arguments from GEM VRAM interface Thomas Zimmermann
2019-06-11 13:03 ` [PATCH v2 1/9] drm/gem-vram: Support pinning buffers to current location Thomas Zimmermann
2019-06-12  8:13   ` Gerd Hoffmann
2019-06-12  8:29     ` Thomas Zimmermann
2019-06-12 12:30       ` Gerd Hoffmann
2019-06-11 13:03 ` [PATCH v2 2/9] drm/ast: Unpin cursor BO during cleanup Thomas Zimmermann
2019-06-11 13:03 ` [PATCH v2 3/9] drm/ast: Remove obsolete or unused cursor state Thomas Zimmermann
2019-06-11 13:03 ` [PATCH v2 4/9] drm/ast: Pin and map cursor source BO during update Thomas Zimmermann
2019-06-12  8:15   ` Gerd Hoffmann
2019-06-11 13:03 ` [PATCH v2 5/9] drm/ast: Pin framebuffer BO during dirty update Thomas Zimmermann
2019-06-11 20:29   ` Sam Ravnborg
2019-06-12  7:35     ` Thomas Zimmermann [this message]
2019-06-12  7:48       ` Sam Ravnborg
2019-06-11 13:03 ` [PATCH v2 6/9] drm/mgag200: " Thomas Zimmermann
2019-06-11 13:03 ` [PATCH v2 7/9] drm/mgag200: Rewrite cursor handling Thomas Zimmermann
2019-06-12  8:17   ` Gerd Hoffmann
2019-06-11 13:03 ` [PATCH v2 8/9] drm: Remove lock interfaces from GEM VRAM helpers Thomas Zimmermann
2019-06-11 13:03 ` [PATCH v2 9/9] drm: Remove functions with kmap-object argument " Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=038d4a58-1980-3b76-ea53-9b354980723a@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.