Dri2 buffer format

Kristian Høgsberg krh at bitplanet.net
Tue Nov 9 17:47:10 PST 2010


On Tue, Nov 9, 2010 at 8:43 PM, Russell Shaw <rjshaw at netspace.net.au> wrote:
> On 10/11/10 12:32, Jesse Barnes wrote:
>>
>> On Wed, 10 Nov 2010 12:30:11 +1100
>> Russell Shaw<rjshaw at netspace.net.au>  wrote:
>>
>>> On 10/11/10 09:28, Jerome Glisse wrote:
>>>>
>>>> On Mon, Nov 8, 2010 at 6:55 PM, Russell Shaw<rjshaw at netspace.net.au>
>>>> wrote:
>>>>>
>>>>> On 09/11/10 04:53, Jerome Glisse wrote:
>>>>>>
>>>>>> On Mon, Nov 8, 2010 at 10:52 AM, Russell Shaw<rjshaw at netspace.net.au>
>>>>>>   wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> How should the "format" of a DRI2 buffer be determined?
>>>>>>>
>>>>>>>
>>>>>>> http://www.x.org/releases/current/doc/dri2proto/dri2proto.txt
>>>>>>>
>>>>>>> DRI2ATTACH_FORMAT { attachment: CARD32
>>>>>>>             format:     CARD32 }
>>>>>>>
>>>>>>>     The DRI2ATTACH_FORMAT describes an attachment and the associated
>>>>>>>     format.  'attachment' describes the attachment point for the
>>>>>>> buffer,
>>>>>>>     'format' describes an opaque, device-dependent format for the
>>>>>>> buffer.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> As the spec says, it's opaque and only the driver understand it,
>>>>>> intel,
>>>>>> radeon, nouveau all use different things i think. DRI2 is meant to be
>>>>>> use btw different driver of same hw which should all understand each
>>>>>> others.
>>>>>
>>>>> If it's opaque, how does one know what bytes are red/green/blue so that
>>>>> you can draw a line in the right colour?
>>>>
>>>> This format is intend to be exchanged btw Xorg DDX driver for a given
>>>> hw for instance the nouveau ddx and with the mesa or other dri2 driver
>>>> like for instance the nouveau gallium driver. Both of this component
>>>> understand each others.
>>>>
>>>> DRI2 is not mean to be use by end user application, it's only use by
>>>> Xorg to comunicate with library such as opengl that want to provide
>>>> direct rendering to X pixmap/window.
>>>
>>> Ok. How do i plot a pixel in Wayland? I'm not using gtk/qt/OpenGL/OpenVG
>>> etc.
>>
>> Allocate an shm buffer based on an mmap you've done in your client.
>> Then you can draw to it and notify wayland of the damage.
>
> Ok. I'm already using shm buffers in X. Is there example code in wayland
> of getting the shm pixel format? (i couldn't see one last time i looked)

Look at the smoke.c example.

Kristian


More information about the wayland-devel mailing list