Commit Graph

33 Commits

Author SHA1 Message Date
Maks Naumov
e1cc0d3df1 glx: Fix 'y ' value in swrastGetDrawableInfo()
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-11 17:51:12 -07:00
Eric Anholt
ab6e958a2e glx: Make sure that DRI2/swrast calls haven't changed the GL context.
These functions are called from the GL driver, in some series of GL
calls by GLX.  If some server component (like glamor CreatePixmap for
GetBuffers()) changes the GL context on us, we need to set it back or
the later GL calls will land in the glamor context instead of the GLX
context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:15 -07:00
Eric Anholt
295d41fa2a glx: unifdef swrast dri_interface.h values from Mesa 7.1.
We can't remove all the ifdefs (__DRI_TEX_BUFFER_VERSION) because
configure.ac is only checking for that version of Mesa in the absence
of dri2.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-30 23:10:34 -08:00
Adam Jackson
a668aa0e41 drisw: Wire up GetProcAddress
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-12-10 08:04:19 -08:00
Eric Anholt
ac772cb187 glx: Fix incorrect use of dri_interface.h version defines in driver probing.
If we extend __DRI_CORE or __DRI_SWRAST in dri_interface.h to allow a
new version, it shouldn't make old server code retroactively require
the new version from swrast drivers.

Notably, new Mesa defines __DRI_SWRAST version 4, but we still want to
be able to probe version 1 drivers, since we don't use any features
beyond version 1 of the struct.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05 10:51:01 -08:00
Eric Anholt
6e926b18ca glx: Fix incorrect use of dri_interface.h version defines in extensions.
Those defines are so you can compile-time check "do I have a
dri_interface.h that defines this new field of the struct?"  You don't
want the server to claim it implements the new struct just because you
installed a new copy of Mesa.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05 10:50:53 -08:00
Adam Jackson
be6680967a glx: convert to direct GL dispatch (v2)
We now expect to be linked against something that provides the GL API,
instead of manually grubbing about in the DRI driver's dispatch table.
Since the GLX we expose calls GL functions that are meant to be looked
up dynamically, also add a way to thunk through to GetProcAddress.

This includes a refresh of the generated sources, which requires a
correspondingly new Mesa.

The GetProcAddress stubs are at the moment merely enough to make this
link against Mesa 9.2, but should really be provided for everything not
in the OpenGL 1.2 ABI.

v2: Explicitly hide the GetProcAddress stubs so we can't conflict with
libGL symbols; fix leading tab/space issues [anholt]

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29 12:29:16 -04:00
Ian Romanick
96d74138b1 glx: Extend __GLXscreen::createContext to take attributes
The attributes will be used for glXCreateContextAttribsARB additions
in follow-on patches.

v2: Add missing 'int *error' parameters noticed by Christopher James
Halse Rogers.

v3: Remove redundant 'int err;' declaration noticed by Christopher
James Halse Rogers.  This was supposed to be in v2, but I missed it.

v4: Add comma missing from additions in v2.  Ugh.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:07:51 -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
Paulo Zanoni
0ae087e131 glx: don't leak driConfigs
For dri, dri2 and driswrast.

12,968 (584 direct, 12,384 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 570
   at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7821E3B: driConcatConfigs (utils.c:560)
   by 0x7827CF2: dri_fill_in_modes (dri_screen.c:224)
   by 0x782831E: dri_init_screen_helper (dri_screen.c:405)
   by 0x7826C03: drisw_init_screen (drisw.c:266)
   by 0x782225F: driCreateNewScreen (drisw_util.c:69)
   by 0x4826E2: __glXDRIscreenProbe (glxdriswrast.c:451)
   by 0x4812FA: GlxExtensionInit (glxext.c:327)
   by 0x41FB14: InitExtensions (miinitext.c:471)
   by 0x568622: main (main.c:208)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24 17:40:01 -02:00
Adam Jackson
c327d07cc6 glx: Remove ->forceCurrent from the context vtable
All the implementations of makeCurrent and forceCurrent are identical,
so just use makeCurrent everywhere.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Christopher James Halse Rogers
021393d1b8 glx: Factor out glxProbeDriver function.
DRI, DRI2 and swrast all had near-identical driver probing logic.
Pull it into glxdricommon.

[ajax: warning fix]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2011-03-14 13:42:32 -04:00
Adam Jackson
1ad9f01c31 glx: Add texbuffer2 support to swrast
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-14 13:13:58 -04:00
Adam Jackson
a80780a763 glx: Remove swap barrier and hyperpipe support
Never implemented in any open source driver.  The implementation
assumed explicit DDX driver knowledge of how the client-side driver
worked, since at the time the server's GL renderer was not a DRI driver.
But now, it is, so any implementation of these should be done with
additional DRI driver API, like the swap control extension.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-11-30 12:54:47 -05:00
Jamey Sharp
0f48e362c5 glxdriswrast: Use CreateGC, not CreateScratchGC.
Since this code was using CreateScratchGC and not GetScratchGC,
FreeScratchGC would always call FreeGC, so just call it directly.

As long as the drawable provided to CreateGC has the same screen and
depth as were passed to CreateScratchGC, these functions are basically
identical. There are two differences:

- CreateGC gives you a non-null stipple. You probably don't care.

- CreateGC passes the gcid and client to XACE. There are several
  internal GCs allocated in the server, and they all pass 0 and
  serverClient. I expect XACE will never reject that combination.

The callers of createDrawable all verify that pDraw has the same screen
that driScreen does. In short, this should have no behavioral change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-09-13 15:58:08 -07:00
Jamey Sharp
353e32d371 glxdriswrast bugfix: configure swapgc, not gc.
I got this wrong in e2929db7b7.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:50:47 -07:00
Jamey Sharp
6a84cd9434 Replace dixChangeGC with calls directly to the right variant.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:14:07 -07:00
Jamey Sharp
e2929db7b7 dixChangeGC callers: Use ChangeGCVal instead of XID almost everywhere.
The exceptions are ProcChangeGC and CreateGC.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:13:48 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +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
Kristian Høgsberg
1760d2bef9 glx: Set the pbuffer bit for dri2 fbconfigs
They've been implemented for a while, but we never advertised them.  All we
need to do is set the GLX_PBUFFER_BIT in the drawable type fbconfig
field when we're using DRI2.

https://bugs.freedesktop.org/show_bug.cgi?id=26581

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-12 21:42:14 -07: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
Adam Jackson
77221c9155 glx: swrast can do GLX 1.4 too
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-14 14:34:15 -08:00
Werner LEMBERG
335c63fcd6 Add newline to some LogMessage strings.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-20 12:38:08 +10:00
Kristian Høgsberg
7b6400a1b8 glx: Fix drawable private leak on destroy
When a drawable goes away, we don't destroy the GLX drawable in full,
since it may be current for a context.  This means that when the drawable
is destroyed in full later, the backend doesn't get a chance to
destroy resources associated with the drawable (the DRI2Drawable).

With this patch, we destroy the GLX drawable in full when it goes away
and then track down all contexts that reference it and NULL their
pointers.
2009-04-13 13:17:53 -04:00
Yaakov Selkowitz
7f781e780e Cygwin/X: Cygwin doesn't have RTLD_LOCAL
RTLD_LOCAL is not defined on Cygwin

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-01-19 14:46:06 +00:00
Eric Anholt
85d84c7cf2 Fix GLX after 180bad8477.
Sigh.
2008-12-02 17:36:49 -08:00
Adam Jackson
8a5b89e8e1 xalloc+memset(0) -> xcalloc 2008-10-06 15:36:51 -04:00
Daniel Drake
eff25430b4 Don't abort if swrast library is not present
GLX is enabled by default, but the current swrast behaviour causes X
to abort with fatal error if the swrast dri library dlopen fails.

Handle the case where the swrast library is not present, and do not
register the GLX extension unless at least one screen has a usable
GL provider.
2008-07-24 21:06:34 -05:00
Kristian Høgsberg
dff1a609bb Drop the glx resize hook and stop chaining PositionWindow. 2008-07-24 13:34:24 -04:00
George Sapountzis
3108980f5e glx: drop unused cleargc 2008-06-13 16:00:15 +03:00
George Sapountzis
877e6c35ff glx: missing swrast is fatal 2008-05-23 22:40:26 +03:00
Kristian Høgsberg
c3eb5b80d8 Move GL/glx on level up now that it's the only thing left under GL. 2008-05-21 13:33:36 -04:00