Commit Graph

37 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Michel Dänzer 8a87acc9e5 dri2: Add DRI2CreateDrawable2.
Same as DRI2CreateDrawable, except it can return the DRI2 specific XID of the
DRI2 drawable reference to the base drawable.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-12 15:08:37 -07:00
Daniel Stone 9a953e0e9d Move DRI2 from external module to built-in
Instead of keeping a tiny amount of code in an external module, just man
up and build it into the core server.

v2: Fix test/Makefile.am to only link libdri2.la if DRI2 is set

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-10 00:31:01 -07:00
Daniel Stone b8a3267c36 DRI2: Remove prototype for DRI2DestroyDrawable
DRI2DestroyDrawable() was still being _X_EXPORTed, but hasn't existed
since 1da1f33f last year.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-10 00:31:01 -07:00
Dave Airlie 3029801216 dri2: add initial prime support. (v1.2)
This adds the initial prime support for dri2 offload. The main thing is
when we get a connection from a prime client, we stored the information
and mark all drawables from that client as prime. We then create all
buffers for that drawable on the prime device dri2screen.

Then DRI2UpdatePrime is provided which drivers can call to get a shared
pixmap which they can use as the front buffer. The driver is then
responsible for doing the back->front copy to the shared buffer.

prime requires a compositing manager be run, but it handles the case where
a window get un-redirected by allocating a new pixmap and pointing the crtc
at it while the client is in that state.

Currently prime can't handle pageflipping, so always does straight copy swap,

v1.1: renumber on top of master.
v1.2: fix auth on top of master.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:39:10 +01:00
Christopher James Halse Rogers 3f97284b10 dri2: Pass a ScreenPtr through to the driver's AuthMagic function. (v3)
xwayland drivers need access to their screen private data to authenticate.
Now that drivers no longer have direct access to the global screen arrays,
this needs to be passed in as function context.

v2: Don't break ABI
v3: Paint the bikeshed blue; drop fd from AuthMagic2ProcPtr prototype

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-20 11:56:55 -07:00
Chad Versace 78f0d9cdc4 dri2: Add DRI2GetParam request (v2)
Bump dri2proto dependency to 2.7.
Bump DRI2INFOREC_VERSION to 7.

This new protocol request effectively allows clients to perform feature
detection on the DDX. The request was added in DRI2 protocol 1.4.

If I had DRI2GetParam in June 2011, when I was implementing support in the
Intel DDX and Mesa for new hardware that required a new DRI2 attachment
format, then I could have avoided a week of pain caused by the necessity
to write a horrid feature detection hack [1] in Mesa. In the future, when
the work begins to add MSAA support to the Intel DDX, having a clean way
to do feature detection will allow us to avoid revisiting and expanding
that hack.

[1] mesa, commit aea2236a, function intel_verify_dri2_has_hiz

v2: If driver doesn't define ds->GetParam, dont' crash. Fall back to
    default behavior, per keithp.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net> (v1)
Reviewed-by: Ian Romanick <idr@freedesktop.org> (v1)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2012-05-31 12:14:17 -07:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Ville Syrjälä 4df65d247b dri2: Invalidate window pixmaps
While a redirected window is flipped, its pixmap may still be used as
and EGL image and should also get invalidated. When sending invalidate
events for a window, also send the events for its pixmap.

Signed-off-by: Ville Syrjälä <syrjala@sci.fi>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-19 22:32:33 -08:00
Pauli Nieminen 871d65790e DRI2: Allow DDX to validate swap_limit changes
DDX can now implement validation for swap_limit changes to prevent
configurations that are not support in driver.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
CC: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-09-21 14:04:37 -07:00
Pauli Nieminen b435e2aac1 DRI2: Expose API to set drawable swap limit.
This allows ddx to set swap_limit if there is more than one back
buffer for drawable. Setting swap_limit has to also check if change
affects a client that is blocked.

This can be used to implement N-buffering in driver with minimal
logic in allocation and selecting next back.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-09-21 13:55:45 -07:00
Pauli Nieminen 86f8da0aa7 DRI2: Add ReuseBufferNotify hook
ReuseBufferNotify hook is called whenever old buffer is reused in DRI2
code.

Driver can use this hook to rewrite the buffer name if hardware requires
shared buffers. Shared buffer might be some hardware limited resources like
framebuffer that is preallocated in boot.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-09-21 13:54:55 -07:00
Jesse Barnes 932513e23b DRI2/GLX: use new swap event types
Use the new event types so we can pass a valid SBC value to clients.
Fix up the completion calls to use CARD32 instead of CARD64 to match
the new field size.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-06-29 11:05:36 -07:00
Mario Kleiner b3548612c7 DRI2: Don't return junk reply instead of blocking in glXWaitForSbcOML()
DRI2WaitSBC() didn't block if requested targetSBC wasn't yet reached.

Instead it returned a xreply with uninitialized junk return values, then
blocked the connection until targetSBC was reached.

Therefore the client didn't block, but continued with bogus return
values from glXWaitForSbcOML.

This patch fixes the problem by implementing DRI2WaitSBC similar
to the clean and proven DRI2WaitMSC implementation.

Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:43:46 -07:00
Tiago Vignatti 6eef70dc56 DRI2: Allow building without libdrm
Some drivers use DRI protocol but implement their own kernel rendering
manager. For these drivers, libdrm becomes useless. --disable-libdrm
configure parameter can be used to disable libdrm support in dri2.

To provide ABI/API compatibility for libdrm based drivers, libdrm call
is wrapped in ifdef.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2010-06-03 11:56:03 +03:00
Tiago Vignatti cdcb575664 DRI2: add AuthMagic hook for driver side support
With this new hook, drmAuthMagic becomes useless and should be deprecated.
You might want to implement AuthMagic on driver side instead.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2010-06-03 11:55:05 +03:00
Kristian Høgsberg 421606a8ef dri2: Send out event when auxillary buffers are invalidated
This lets the DRI2 clients rely on the server to notify them when they
need to get new buffers.  Without this, OpenGL clients poll the server
in glViewport() which can be a performance problems and also isn't
completely correct behaviour.

We bump the DRI2 protocol minor to indicate the availability of the
event, which the DRI2 clients can use to avoid polling.  This speeds up
various piglit and oglc test cases as well as real applications.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13 06:32:04 -07:00
Kristian Høgsberg 9de0e31746 dri2: Take an XID for tracking the DRI2 drawable
Some pixmaps (window pixmaps and scratch pixmaps) don't have the
drawable->id set and thus DRI2 gets confused when using that field
for looking up the DRI2 drawable.  Go back to using privates for getting
at the DRI2 drawable from a DrawablePtr.  We need to keep the resource
tracking in place so we can remove the DRI2 drawable when the X resource
it was created for goes away.  Additionally, we also now track the DRI2
drawable using a client XID so we can reclaim the DRI2 drawable even if
the client goes before the drawable and doesn't destroy the DRI2 drawable.

Tested-by: Owen W. Taylor <otaylor@fishsoup.net>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-05-11 11:01:35 -04:00
Jesse Barnes 165a4a9c7d GLX/DRI2: expose swap control extensions if DDX support is present
Export DDX swap control status from the DRI2 module and check for it in
GLX when initializing extensions.

Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-29 10:03:12 -07:00
Jesse Barnes 5933b0abc6 DRI2: prevent swap wakes from waking MSC waiters
If a few swaps were queued leading to a throttle related block on the
client, and then the client submitted an MSC wait, one of the previous
swap wakeups could have caused the MSC wait to complete early.  Add a
flag for this to prevent a swap wake from prematurely waking an MSC
waiter.

Reported-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-29 10:02:57 -07:00
Jesse Barnes db1c7cb604 DRI2: advertise lowest supported DRI2 protocol version
Update our supported DRI2 protocol version as each driver does
DRI2ScreenInit, since depending on available kernel features, each DDX
may support different callbacks and therefore protocol.

Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-29 10:02:37 -07:00
Aaron Plattner f311f2d047 DRI2: Allow multiple driver names.
Each driver type (e.g. DRI2DriverDRI or DRI2DriverVDPAU) can have a name in the
driverNames array in DRI2InfoRec.  DRI2Connect returns the name for the driver
specified by driverType.  Also print names of supported drivers in
DRI2ScreenInit.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-27 13:57:00 -08:00
Jesse Barnes 84956ca43b GLX/DRI2: add INTEL_swap_event support
This allows clients to easily check for swap completion status in their
main loop.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@nwnk.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-11 16:17:15 -05:00
Jesse Barnes 04a54f69a8 DRI2: add support for new DRI2 protocol requests
Support the new DRI2 2.2 protocol requests: DRI2SwapBuffers, DRI2GetMSC,
DRI2WaitMSC, DRI2WaitSBC and DRI2SwapInterval.

These requests allow the server to support the SGI_video_sync,
SGI_swap_interval, and OML_sync_control GLX extensions if DDX support is
present.  The new DDX APIs are documented in dri2.h.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@nwnk.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-11 16:16:35 -05:00
Keith Packard 5aec727452 Remove old DRI2 buffer alloc/free interfaces
These old interfaces are no longer supported by the server, removing them
requires bumping the video driver ABI. Note that this is not guaranteed to
be the last change in ABI version 6.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2009-07-06 12:01:22 -07:00
Keith Packard 2e2c5b216c dri2: Preserve compatibility with 1.6 DRI2 API/ABI
The old DRI2 buffer allocation API wasn't great, but there's no reason to
make the server stop working with those drivers. This patch has the
X server adapting to the API provided by the driver, using the new API where
available and falling back to the old API as necessary. A warning will be
placed in the log file when the old API is in use.

Signed-off-by: Keith Packard <keithp@keithp.com>
2009-07-06 12:01:12 -07:00
Ian Romanick ff6c7764c2 DRI2: Implement protocol for DRI2GetBuffersWithFormat
This change implements the protocol for DRI2GetBuffersWithFormat, but
the bulk of the differences are the changes to the extension / driver
interface to make this function work.  The old CreateBuffers and
DeleteBuffers routines are replaced with CreateBuffer and DeleteBuffer
(both singular).

This allows drivers to allocate buffers for a drawable one at a time.
As a result, 3D drivers can now allocate the (fake) front-buffer for a
window only when it is needed.  Since 3D drivers only ask for the
front-buffer on demand, the real front-buffer is always created.  This
allows CopyRegion impelemenations of SwapBuffers to continue working.
As with previous version of this code, if the client asks for the
front-buffer for a window, we instead give it the fake front-buffer.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
2009-04-24 12:49:19 -07:00
Ian Romanick 28ddfc88d8 DRI2: Add interface for drivers to query DRI2 extension version
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2009-04-24 12:24:07 -07:00
Paulo Cesar Pereira de Andrade 49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Kristian Høgsberg ced6690284 dri2: Update to latest protocol draft.
Mainly rename SwapBuffers to CopyRegion, which adds the xfixes region
argument and the bitmask argument to let us extend it in the future.
2008-10-15 00:00:44 -04:00
Kristian Høgsberg 5af77d43fe DRI2: Drop sarea use, implement server side swap buffers. 2008-08-29 12:33:28 -04:00
Kristian Høgsberg c40e0b51f0 Implement DRI2 direct rendering and update AIGLX to DRI interface changes.
Get rid of glcontextmodes.[ch] from build, rename __GlcontextModes to
__GLXcontext.  Drop all #includes of glcontextmodes.h and glcore.h.
Drop the DRI context modes extension.

Add protocol code to DRI2 module and load DRI2 extension by default.
2008-03-31 16:50:58 -04:00
Kristian Høgsberg bc504ffbba DRI2: Add DRI2AuthConnection().
DRI2 uses the same authentication scheme as XF86DRI, so implement this
entry point so DRI2 protocol code can access it.
2008-03-11 00:56:16 -04:00
Kristian Høgsberg acedc03367 DRI2: Return event buffer head index in DRI2CreateDrawable.
And pass it to the DRI driver in AIGLX.
2008-03-09 21:39:19 -04:00
Kristian Høgsberg 13bfa5937d GLX: Adjust to changes in DRI driver interface. 2008-02-29 15:11:13 -05:00
Kristian Høgsberg 0ffb6a3ad0 GLX: Implement support for TTM BO based TFP when available. 2008-02-14 22:20:56 -05:00
Kristian Høgsberg b71dc54352 Add DRI2 module. 2008-02-14 19:53:49 -05:00