Custom KMS driver + X

Jose Abreu Jose.Abreu at synopsys.com
Tue Jul 19 15:25:47 UTC 2016


Hi,


On 14-07-2016 20:28, Eric Anholt wrote:
> Jose Abreu <Jose.Abreu at synopsys.com> writes:
>
>> Hi Adam,
>>
>> Thanks for your answer!
>>
>>
>> On 06-07-2016 15:57, Adam Jackson wrote:
>>> On Tue, 2016-07-05 at 15:28 +0100, Jose Abreu wrote:
>>>
>>>>      - First: My driver only supports 24 bpp (I mean real 24
>>>> bits, not 24 packed in 32 bits). Is there a way to specify to X
>>>> (or specify in the driver itself) to use 24bpp **only** in the
>>>> new driver that I created?
>>> Kind of. The arguments to xf86SetDepthBpp (which you're probably
>>> calling in your PreInit hook) specify how the root window is to be
>>> treated. If you can only do 24bpp, you'll want to pass Support24bppFb
>>> (and nothing else) as the last argument. By default (ie, without exa or
>>> glamor or other acceleration) other pixmaps will be created in host
>>> memory as 32bpp, and the software renderer will convert between formats
>>> as needed. If you want to add support for pixmaps in video memory
>>> you'll need to enforce the 24bpp restriction in your accel support
>>> code.
>> Ok, something is missing because I am not calling
>> xf86SetDetpthBpp at all. You mean I need to have a X driver (or
>> module, I don't know the nomenclature) in order to use my KMS
>> driver? Can't I just use the 'modesetting' driver? Sorry if I am
>> making some dumb mistake but my understanding of the inner
>> workings of X is barely null.
>>
>> Right now I am able to force X to use 24bpp in the KMS driver. I
>> just return -EINVAL in the dumb_create() callback of DRM when the
>> bpp is not 24 and then X tries again with the right bpp, but when
>> I do this the X stops working and in the log it appears the stack
>> trace that I sent in the first email.
> Yeah, I would think that updating the modesetting driver would be the
> way to go.  You could probably use drmModeGetPlaneResources() /
> drmModeGetPlane() to figure out what formats are supported on the
> primary plane and adjust xf86SetDepthBpp() according to what it returns.
>
> That said, you're going to be so much better off if you can possibly do
> 32bpp instead.

So, I talked with the hardware team and I now have a working
32bpp setup. Everything works fine using mpv and manually
specifying the DRM device, still I can't manage to get it work
with X. The server seems to load the modesetting driver fine (I
don't have any xorg.conf file) and in the GUI I can change the
resolution fine but the output is a blank screen. Debugging DRM I
found that a call to prime_fd_to_handle is failing because I am
using CMA while the intel driver (my native graphics card) is
not. Can this be the cause of my blank screen? Even with this
call failing the modesetting driver still configures the device,
shouldn't this fail gracefully?

Best regards,
Jose Miguel Abreu


More information about the xorg-devel mailing list