dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, peter@stuge.se,
	linus.walleij@linaro.org, "Noralf Trønnes" <noralf@tronnes.org>
Subject: Re: [PATCH 7/7] drm/gud: Add module parameter to control emulation: xrgb8888
Date: Tue, 17 Aug 2021 16:12:30 +0200	[thread overview]
Message-ID: <f5d0ac5b-cb3f-9112-d57b-e06319c2f41b@tronnes.org> (raw)
In-Reply-To: <YRu+bNmOrExbWEBT@phenom.ffwll.local>



Den 17.08.2021 15.49, skrev Daniel Vetter:
> On Tue, Aug 17, 2021 at 02:29:17PM +0200, Noralf Trønnes wrote:
>> For devices that don't support XRGB8888 give the user the ability to
>> choose what's most important: Color depth or frames per second.
>>
>> Add an 'xrgb8888' module parameter to override the emulation format.
>>
>> Assume the user wants full control if xrgb8888 is set and don't set
>> DRM_CAP_DUMB_PREFERRED_DEPTH if RGB565 is supported (AFAIK only X.org
>> supports this).
>>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> ---
>>  drivers/gpu/drm/gud/gud_drv.c | 13 ++++++++++---
>>  1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c
>> index 3f9d4b9a1e3d..60d27ee5ddbd 100644
>> --- a/drivers/gpu/drm/gud/gud_drv.c
>> +++ b/drivers/gpu/drm/gud/gud_drv.c
>> @@ -30,6 +30,10 @@
>>  
>>  #include "gud_internal.h"
>>  
>> +static int gud_xrgb8888;
>> +module_param_named(xrgb8888, gud_xrgb8888, int, 0644);
>> +MODULE_PARM_DESC(xrgb8888, "XRGB8888 emulation format: GUD_PIXEL_FORMAT_* value, 0=auto, -1=disable [default=auto]");
>> +
>>  /* Only used internally */
>>  static const struct drm_format_info gud_drm_format_r1 = {
>>  	.format = GUD_DRM_FORMAT_R1,
>> @@ -530,12 +534,12 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id)
>>  		case DRM_FORMAT_RGB332:
>>  			fallthrough;
>>  		case DRM_FORMAT_RGB888:
>> -			if (!xrgb8888_emulation_format)
>> +			if (!gud_xrgb8888 && !xrgb8888_emulation_format)
>>  				xrgb8888_emulation_format = info;
> 
> Shouldn't the emulation format be per drm_device instance?

Ideally yes, this happens during probe so I can only use a module
parameter and I don't know how to differenciate the devices since the
DRM minor is unknown at this point and implementing filtering on the
various USB properties (VID:PID, serial number,..) will involve a lot of
code. So I've kept it simple. It can be expanded on later should someone
come up with a clever idea.

Noralf.

> -Daniel
> 
>>  			break;
>>  		case DRM_FORMAT_RGB565:
>>  			rgb565_supported = true;
>> -			if (!xrgb8888_emulation_format)
>> +			if (!gud_xrgb8888 && !xrgb8888_emulation_format)
>>  				xrgb8888_emulation_format = info;
>>  			break;
>>  		case DRM_FORMAT_XRGB8888:
>> @@ -543,6 +547,9 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id)
>>  			break;
>>  		}
>>  
>> +		if (gud_xrgb8888 == formats_dev[i])
>> +			xrgb8888_emulation_format = info;
>> +
>>  		fmt_buf_size = drm_format_info_min_pitch(info, 0, drm->mode_config.max_width) *
>>  			       drm->mode_config.max_height;
>>  		max_buffer_size = max(max_buffer_size, fmt_buf_size);
>> @@ -559,7 +566,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id)
>>  	}
>>  
>>  	/* Prefer speed over color depth */
>> -	if (rgb565_supported)
>> +	if (!gud_xrgb8888 && rgb565_supported)
>>  		drm->mode_config.preferred_depth = 16;
>>  
>>  	if (!xrgb8888_supported && xrgb8888_emulation_format) {
>> -- 
>> 2.32.0
>>
> 

      reply	other threads:[~2021-08-17 14:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 12:29 [PATCH 0/7] drm/gud: Add some more pixel formats Noralf Trønnes
2021-08-17 12:29 ` [PATCH 1/7] drm/fourcc: Add R8 to drm_format_info Noralf Trønnes
2021-08-17 13:59   ` Daniel Vetter
2021-08-17 14:17     ` Daniel Vetter
2021-08-17 12:29 ` [PATCH 2/7] drm/format-helper: Add drm_fb_xrgb8888_to_rgb332() Noralf Trønnes
2021-08-17 13:56   ` Daniel Vetter
2021-08-17 16:03     ` Peter Stuge
2021-08-30 12:08     ` Noralf Trønnes
2021-08-31 12:23       ` Daniel Vetter
2021-09-02 14:08         ` Noralf Trønnes
2021-09-02 14:24           ` Daniel Vetter
2021-08-17 12:29 ` [PATCH 3/7] drm/format-helper: Add drm_fb_xrgb8888_to_rgb888() Noralf Trønnes
2021-08-17 14:05   ` Daniel Vetter
2021-08-17 12:29 ` [PATCH 4/7] drm/gud: Add GUD_PIXEL_FORMAT_R8 Noralf Trønnes
2021-08-17 12:29 ` [PATCH 5/7] drm/gud: Add GUD_PIXEL_FORMAT_RGB332 Noralf Trønnes
2021-08-17 12:29 ` [PATCH 6/7] drm/gud: Add GUD_PIXEL_FORMAT_RGB888 Noralf Trønnes
2021-08-17 12:29 ` [PATCH 7/7] drm/gud: Add module parameter to control emulation: xrgb8888 Noralf Trønnes
2021-08-17 13:49   ` Daniel Vetter
2021-08-17 14:12     ` Noralf Trønnes [this message]

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=f5d0ac5b-cb3f-9112-d57b-e06319c2f41b@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=peter@stuge.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox