[Intel-gfx] [PATCH] Add DRI2 protocol, based off of dri2proto.h and the server code.

Julien Cristau jcristau at debian.org
Fri Oct 16 00:29:36 CEST 2009


On Thu, Oct 15, 2009 at 14:25:46 -0700, Eric Anholt wrote:

> diff --git a/src/dri2.xml b/src/dri2.xml
> new file mode 100644
> index 0000000..4d77f72
> --- /dev/null
> +++ b/src/dri2.xml
> @@ -0,0 +1,136 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<!--
> +Copyright (C) 2005 Jeremy Kolb.
> +All Rights Reserved.

This copyright notice seems wrong?

> +
> +Permission is hereby granted, free of charge, to any person ob/Sintaining a copy

s,/Sin,,

> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all
[...]
> +
> +<xcb header="dri2" extension-xname="DRI2" extension-name="DRI2"
> +    major-version="1" minor-version="1">
> +
> +    <!-- Types -->
> +
> +    <struct name="DRI2Buffer">
> +	<field type="CARD32" name="attachment" />

attachment could get an enum, I think.

> +	<field type="CARD32" name="name" />
> +	<field type="CARD32" name="pitch" />
> +	<field type="CARD32" name="cpp" />
> +	<field type="CARD32" name="flags" />
> +    </struct>
> +
> +    <struct name="GetBuffersWithFormatAttachment">
> +	<field type="CARD32" name="attachment" />
> +	<field type="CARD32" name="format" />
> +    </struct>
> +

dri2proto.txt calls this DRI2ATTACH_FORMAT, so maybe
name="AttachFormat"?

> +    <!-- Requests -->
> +    <request name="QueryVersion" opcode="0">
> +	<field type="CARD32" name="major_version" />
> +	<field type="CARD32" name="minor_version" />
> +	<reply>
> +	    <pad bytes="1" />
> +	    <field type="CARD32" name="major_version" />
> +	    <field type="CARD32" name="minor_version" />
> +	    <pad bytes="16" />

I think you can omit the trailing padding from replies.

> +	</reply>
> +    </request>
> +
> +    <request name="Connect" opcode="1">
> +	<field type="CARD32" name="window" />
> +	<field type="CARD32" name="driver_type" />

maybe add an enum for driver_type as well.

> +	<reply>
> +	    <pad bytes="1" />
> +	    <field type="CARD32" name="driver_name_length" />
> +	    <field type="CARD32" name="device_name_length" />
> +	    <pad bytes="16" />
> +	    <list type="char" name="driver_name">
> +		<fieldref>driver_name_length</fieldref>
> +	    </list>
> +	    <list type="char" name="device_name">
> +		<fieldref>device_name_length</fieldref>
> +	    </list>
> +	</reply>
> +    </request>
> +
> +    <request name="Authenticate" opcode="2">
> +	<field type="CARD32" name="window" />

type="WINDOW" works, if you add '<import>xproto</import>'

> +	<field type="CARD32" name="magic" />
> +	<reply>
> +	    <pad bytes="1" />
> +	    <field type="CARD32" name="authenticated" />
> +	    <pad bytes="20" />
> +	</reply>
> +    </request>
> +
> +    <request name="CreateDrawable" opcode="3">
> +	<field type="CARD32" name="drawable" />
> +    </request>
> +
> +    <request name="DestroyDrawable" opcode="4">
> +	<field type="CARD32" name="drawable" />
> +    </request>

type="DRAWABLE" for these two.

> +
> +    <request name="GetBuffers" opcode="5">
> +	<field type="CARD32" name="drawable" />
> +	<field type="CARD32" name="count" />
> +	<list type="CARD32" name="attachments" />

should this list have a <fieldref>count</fieldref>?  I guess it's not
necessary since the length can be deduced from the request length...

> +	<reply>
> +	    <pad bytes="1" />
> +	    <field type="CARD32" name="width" />
> +	    <field type="CARD32" name="height" />
> +	    <field type="CARD32" name="count" />
> +	    <list type="DRI2Buffer" name="buffers">
> +		<fieldref>count</fieldref>
> +	    </list>
> +	    <pad bytes="12" />

the list should be after the padding, afaict?

> +	</reply>
> +    </request>
> +
> +    <request name="CopyRegion" opcode="6">
> +	<field type="CARD32" name="drawable" />
> +	<field type="CARD32" name="region" />
> +	<field type="CARD32" name="dest" />
> +	<field type="CARD32" name="src" />
> +	<reply>
> +	    <pad bytes="1" />
> +	    <pad bytes="24" />
> +	</reply>
> +    </request>
> +
> +    <request name="GetBuffersWithFormat" opcode="7">
> +	<field type="CARD32" name="drawable" />
> +	<field type="CARD32" name="count" />
> +	<list type="GetBuffersWithFormatAttachment" name="attachments" />
> +	<reply>
> +	    <pad bytes="1" />
> +	    <field type="CARD32" name="width" />
> +	    <field type="CARD32" name="height" />
> +	    <field type="CARD32" name="count" />
> +	    <list type="DRI2Buffer" name="buffers">
> +		<fieldref>count</fieldref>
> +	    </list>
> +	    <pad bytes="12" />

same as above for pad vs list ordering.

> +	</reply>
> +    </request>
> +</xcb>

Cheers,
Julien



More information about the Intel-gfx mailing list