Commit Graph

155 Commits

Author SHA1 Message Date
Axel Davy e8f9195e5f gallium, intel: Implements new __DRI_IMAGE_USE_LINEAR and PIPE_BIND_LINEAR flags to enforce no tiling.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2013-09-06 15:02:34 -07:00
Topi Pohjolainen 674dedc87a dri: propagate extra dma_buf import attributes to the drivers
v2: do not break ABI, but instead introduce new entry point for
    dma buffers and bump up the dri-interface version to eight

v3 (Chad): allow the hook to specify an error originating from the
           driver. For now only unsupported format is considered.
           I thought about rejecting the hints also as they are
           addressing only YUV sampling which is not supported at
           the moment but then thought against it as the spec is
           not saying one way or the other.

v4 (Eric, Chad): restrict to rgb formatted only

v5: rebased on top of i915/i965 split

v6 (Chad): document using full extension name

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-02 08:56:03 +03:00
Tomasz Lis c37c367d38 dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPE
Mark __DRI_ATTRIB_FLOAT_MODE as deprecated, and introduce new flags to
__DRI_ATTRIB_RENDER_TYPE for float modes.  Both signed float
(fbconfig_float) and unsigned (packed_float) are introduced. The old
attribute should be set for both float modes.

v2 (idr): Require that the render mode from the DRI attributes matches the
render mode of the config exactly.  This is the behavior of the old code.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-07-18 16:03:42 -07:00
Kristian Høgsberg 2356e28452 Add dri image entry point for creating image from fd
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2013-03-18 21:03:54 -04:00
Abdiel Janulgue 7b7af48e01 dri2: Create image from texture
Add create image from texture extension and bump version.

v8: - Add appropriate image errors codes in DRI interface so we don't
      have to use internal EGL functions in driver. Suggested by Chad Versace.

Reviewed-by: Eric Anholt <eric@anholt.net> (v6)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v8)
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2013-02-01 11:58:12 -08:00
Chad Versace e90c08e667 dri: Define enum __DRI_API_GLES3
This enum corresponds to EGL_OPENGL_ES3_BIT_KHR.
Neither the GLX nor EGL layer use the enum yet.

I don't like the GLES bits. I'd prefer that all GLES APIs be exposed
through a single API bit, as is done in GLX_EXT_create_context_es_profile.
But, we need this GLES3 enum in order to do the plumbing necessary to
correctly support EGL_OPENGL_ES3_BIT_KHR as required by the
EGL_KHR_create_context spec.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:45:53 -08:00
Chad Versace e5f1f8d52e dri: Fix i965 build
The following commit broke the i965 build:

    commit 4a486f8bf2
    Author: Marek Olšák <maraeo@gmail.com>
    Date:   Fri Nov 23 18:31:42 2012 +0100

    glx/dri2: add and use new driver hook flush_with_flags

That commit added a forward declaration of enum __DRI2throttleReason to
dri_interface.h. C++ 98 does not allow forward declarations of enums.

The fix: Move the enum's definition to earlier in the file.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2012-12-01 17:08:41 -08:00
Marek Olšák 4a486f8bf2 glx/dri2: add and use new driver hook flush_with_flags 2012-12-02 00:19:00 +01:00
Jakob Bornecrantz 6a7dea93fa dri: Rework planar image interface
As discussed with Kristian on #wayland. Pushes the decision of components into
the dri driver giving it greater freedom to allow t to implement YUV samplers
in hardware, and which mode to use.

This interface will also allow drivers like SVGA to implement YUV surfaces
without the need to sub-allocate and instead send 3 seperate buffers for each
channel, currently not implemented.

I have tested these changes on Gallium Svga. Scott tested them on both intel
and Gallium Radeon. Kristan and Pekka tested them on intel.

v2: Fix typo in dri2_from_planar.
v3: Merge in intel changes.

Tested-by: Scott Moreau <oreaus@gmail.com>
Tested-by: Pekka Paalanen <ppaalanen@gmail.com>
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-08-31 19:51:02 +02:00
Jakob Bornecrantz 93ebec87ed dri: Make query image WIDTH and HEIGHT be version 4
Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-08-26 15:39:50 +02:00
Jakob Bornecrantz 6bb71b8cbe dri: Remove image write function
Since its not used by anything anymore and no release has gone out
where it was being used.

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-08-26 15:39:41 +02:00
Ian Romanick a2ce2eba26 dri2: Note that __DRI_API_GLES2 is also used for OpenGL ES 3.0
Unlike 1.x to 2.0, OpenGL ES 3.0 is backwards compatible with 2.0.  Use the
same API flag for both.  Applications that specifically want 3.0 will specify
this using the major / minor version attributes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-14 15:41:03 -07:00
Kristian Høgsberg 44f066b9ff gbm: Add new gbm_bo_import entry point
This generalizes and replaces gbm_bo_create_for_egl_image.  gbm_bo_import
will create a gbm_bo from either an EGLImage or a struct wl_buffer.
2012-07-16 16:29:15 -04:00
Kristian Høgsberg c029834808 __DRIimage: version 5, add new formats and createSubImage
The additions in version 5 enables creating EGLImages for different planes
of a YUV buffer.  createImageFromName is still used to create the containing
__DRIimage, and createSubImage can then be used no that __DRIimage to create
__DRIimages that correspond to the y, u, and v planes (__DRI_IMAGE_FORMAT_R8)
or the uv planes (__DRI_IMAGE_FORMAT_RG88) for formats such as NV12 where
the u and v components are interleaved.  Packed formats such as YUYV etc
doesn't require any special treatment, we just sample those as a regular
ARGB texture.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-07-11 15:28:34 -04:00
Ian Romanick a8724d85f8 glx/dri2: Add support for GLX_ARB_create_context_robustness
Add the infrastructure required for this extension.  There is no
xserver support and no driver support yet.  Drivers can enable this be
advertising DRI2 version 4 and accepting the
__DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
__DRI_CTX_ATTRIB_RESET_STRATEGY attribute in create context.

Some additional Mesa infrastructure is needed before drivers can do
this.  The GL_ARB_robustness spec, which all Mesa drivers already
advertise, requires:

    "If the behavior is LOSE_CONTEXT_ON_RESET_ARB, a graphics reset
    will result in the loss of all context state, requiring the
    recreation of all associated objects."

It is necessary to land this infrastructure now so that the related
infrastructure can land in the xserver.  The xserver has very long
release schedules, and the remaining Mesa parts should land long, long
before the next xserver merge window opens.

v2: Expose robustness as a DRI2 extension rather than bumping
__DRI_DRI2_VERSION.

v3: Add a comment explaining why dri2->base.version >= 3 is also
required for GLX_ARB_create_context_robustness.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2012-07-11 08:54:50 -07:00
Kristian Høgsberg 4fddb2ba21 gbm: Add gbm_bo_write entry point
This new gbm entry point allows writing data into a gbm bo.  The bo has
to be created with the GBM_BO_USE_WRITE flag, and it's only required to
work for GBM_BO_USE_CURSOR_64X64 bos.

The gbm API is designed to be the glue layer between EGL and KMS, but there
was never a mechanism initialize a buffer suitable for use with KMS
hw cursors.  The hw cursor bo is typically not compatible with anything EGL
can render to, and thus there's no way to get data into such a bo.

gbm_bo_write() fills that gap while staying out of the efficient
cpu->gpu pixel transfer business.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2012-05-03 10:57:32 -04:00
Sean V Kelley 81f95ce13d egl/android: Add support for RGBX_8888 used in Android native buffers
Add new format __DRI_IMAGE_FORMAT_XBGR8888 to __DRI_IMAGE.
HAL_PIXEL_FORMAT_RGBX_8888 now maps to __DRI_IMAGE_FORMAT_XBGR8888.

Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2012-04-30 11:22:46 -07:00
Jesse Barnes 8de5c355fa gbm: track buffer format through DRI drivers
GBM needs the buffer format in order to communicate with DRM and clients
for things like scanout.

So track the DRI format requested in the various back ends and use it to
return the DRI format back to GBM when requested.  GBM will then map
this into the GBM surface type (which is in turn based on the DRM fb
format list).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2012-02-22 09:41:40 -08:00
Kristian Høgsberg 221c678329 gbm: Validate usage flags in gbm_bo_create_from_egl_image()
The entry point is supposed to validate that the EGLImage is suitable for
the passed in usage flags, but that was never implemented.
2012-01-18 15:32:51 -05:00
Ian Romanick b5b2081d75 dri2: Add createContextAttribs entry point for DRISW version 3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:49:53 -08:00
Ian Romanick 1ab545494a dri2: Add createContextAttribs entry point for DRI2 version 3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-23 08:49:53 -08:00
Thomas Hellstrom 511dc295f8 dri2: Implement a throttle dri extension.
The X server has limited throttle support on the server side,
but doing this in the client has some benefits:

1) X server throttling is per client. Client side throttling can be done
per drawable.

2) It's easier to control the throttling based on what client is run,
for example using "driconf".

3) X server throttling requires drm swap complete events.

So implement a dri2 throttling extension intended to be used by direct
rendering clients.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2011-10-14 09:52:53 +02:00
Chia-I Wu e3cf7b69f2 dri2: add __DRI_IMAGE_FORMAT_ABGR8888 to __DRI_IMAGE
Add a new format token, __DRI_IMAGE_FORMAT_ABGR8888, to __DRI_IMAGE.  It
maps to MESA_FORMAT_RGBA8888_REV in core mesa or
PIPE_FORMAT_R8G8B8A8_UNORM in gallium.  The format is used by
translucent surfaces on Android.
2011-09-09 12:06:16 +08:00
Benjamin Franzke 8c40940321 dri2: Add __DRI_BUFFER_COUNT token
Remove definition from egl_dri2.
Defining this is egl_dri2.h breaks as soon as
a new dri2 buffer token is added like with commit
4501a5d6e8.
2011-08-16 09:06:41 +02:00
Benjamin Franzke 5fbbd4c19f dri: Add dupImage to DRIimageExtension 2011-06-23 21:07:17 +02:00
Chad Versace 4501a5d6e8 dri2: Add token for DRI2BufferHiz
CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-06-08 10:06:40 -07:00
Kristian Høgsberg e5169e9615 egl: Add a cursor use bit to MESA_drm_image 2011-05-06 10:33:50 -04:00
Benjamin Franzke 1b8ef9416b Add dri2::{Allocate,Release}Buffer extension 2011-02-07 13:52:28 +01:00
Haitao Feng b43a147128 swrast: add an interface createNewContextForAPI
This new interface could set up context for OpenGL,
OpenGL ES1 and OpenGL ES2. It will be used by egl_dri2
driver.

Signed-off-by: Haitao Feng <haitao.feng@intel.com>
2011-02-03 11:59:30 -05:00
Dave Airlie 476db2bd3d dri: add a placeholder for the framebuffer sRGB capable bit.
This is needed to build the X server GLX_EXT_framebuffer_sRGB bits.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-01-28 11:45:44 +10:00
Juan Zhao e59fa4c46c dri2: release texture image.
Add release function for texture_from_pixmap extension.
Some platform need to release texture image for texture_from_pixmap
extension, add this interface for those platforms.
2011-01-09 14:55:16 -05:00
Kristian Høgsberg 17eace581d dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
We will typically have a current context when we need to lookup the image,
but the lookup implementation don't need it so drop it.
2010-09-22 22:02:05 -04:00
Kristian Høgsberg 9ec0b2a45e dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext
We can't expect to have a context when this is called, and we don't need one
so just require a __DRIscreen instead.

Reported by Yu Dai <yu.dai@intel.com>
2010-09-22 15:08:22 -04:00
Kristian Høgsberg 5aaa53e66c egl_dri2: Add support for MESA_image_drm 2010-08-25 09:17:48 -04:00
Kristian Høgsberg cb2a66fd0c glx: Drop support for GLX_MESA_allocate_memory
Only r200 implemented it.
2010-07-19 22:45:50 -04:00
Kristian Høgsberg 97a6cbc6dd dri_interface.h: Add new __DRI_USE_INVALIDATE extension
The presence of this extension indicates to the DRI driver that the
loader will call invalidate in the __DRI2_FLUSH extension, whenever
the needs to query for new buffers.  This means that the DRI driver
can drop the polling in glViewport().
2010-05-11 10:23:53 -04:00
Kristian Høgsberg 0870e4a202 Merge branch 'gles2-2'
Conflicts:
	src/mesa/drivers/dri/common/dri_util.h
2010-05-02 10:17:07 -04:00
Kristian Høgsberg a7a9a91d7b dri: Add DRI entrypoints to create a context for a given API 2010-04-28 14:05:21 -04:00
Jesse Barnes 234286c0f8 DRI2: add config query extension
Add a new DRI2 configuration query extension.  Allows for DRI2 client
code to query for common DRI2 configuration options.
2010-04-22 12:49:45 -07:00
George Sapountzis f4e561ce12 drisw: make stride issue profound 2010-03-27 20:56:36 +02:00
George Sapountzis 0b932284f2 dri_inteface: add define for checking presence of drm.h
__NOT_HAVE_DRM_H is a like a feature, defined by default on specific platforms
and allows to be defined externally as well.

__NOT_HAVE_DRM_H should only be used by xserver and mesa swrast_dri drivers
2010-03-21 13:21:45 +02:00
Kristian Høgsberg 79cbcb663d dri_interface.h: Add DRI image and eglImageLookup extensions
These are used for implementing the various EGLImage extensions.
2010-02-24 14:28:41 -05:00
Francisco Jerez 61d26bc82e dri2: Event driven buffer validation.
When a buffer invalidation event is received from the X server, the
"invalidate" hook of the DRI2 flush extension is executed: A generic
implementation (dri2InvalidateDrawable) is provided that just bumps
the "pStamp" sequence number in __DRIdrawableRec.

For old servers not supporting buffer invalidation events, the
invalidate hook will be called before flushing the fake front/back
buffer (that's typically once per frame -- not a lot worse than the
situation we were in before).

No effort has been made on preserving backwards compatibility with
version 2 of the flush extension, but I think it's acceptable because
AFAIK no released stack is making use of it.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-02-16 10:38:50 -05:00
Kristian Høgsberg debf00e5fc dri_interface: Introduce DRI tokens for the texBuffer texture formats
This used to take GLX tokens, but the DRI interface can't depend on GLX
defines.  We fix this by introducing DRI tokens that have the same value
as the GLX texture format tokens.
2010-02-09 15:55:25 -05:00
Jesse Barnes a35f6bb207 DRI2: add SwapBuffers support
Support the new DRI2 protocol request, DRI2SwapBuffers, in both direct
and indirect rendering context.  This request allows the display server
to optimize back->front swaps (e.g. through page flipping) and allows us
to more easily support other GLX features like swap interval and the OML
sync extension in DRI2.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-08 12:29:50 -05:00
Samuel Thibault d18dd6ad11 GNU/Hurd fixes
Here is a couple of fixes for GNU/Hurd:
- dri_interface.h: no libdrm support either.
- configure.ac:
 - GNU/Hurd is a GNU OS with _GNU_SOURCE and PTHREADS.
 - GNU needs a couple of flags like other OSes

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2009-04-24 19:10:01 -07:00
Ian Romanick dbf87f2312 DRI2: Implement interface for drivers to access DRI2GetBuffersWithFormat
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
2009-04-24 12:48:20 -07:00
Ian Romanick 82634ee8df DRI2: Provide an interface for drivers to flush front-buffer rendering
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
2009-04-09 14:18:14 -07:00
Eric Anholt 66175aac76 Fix DRI2 accelerated EXT_texture_from_pixmap with GL_RGB format.
This requires upgrading the interface so that the argument to
glXBindTexImageEXT isn't just dropped on the floor.  Note that this only
fixes the accelerated path on Intel, as Mesa's texture format support is
missing x8r8g8b8 support (right now, GL_RGB textures get uploaded as a8r8gb8,
but in this case we're not doing the upload so we can't really work around it
that way).

Fixes bugs with compositors trying to use shaders that use alpha channels, on
windows without a valid alpha channel.  Bug #19910 and likely others as well.

Reviewed-by:	Ian Romanick <ian.d.romanick@intel.com>
2009-03-20 10:41:28 -07:00
Alan Hourihane 65562453fb glx: add support for a reallyFlush() function before swap occurs. 2009-02-23 20:28:11 +00:00
Alan Hourihane 396711b840 dri: add fake front definitions 2009-01-19 15:41:19 +00:00
Jon Turney 8e7599892f dri: fix for Cygwin compilation, bug 19144 2008-12-17 18:01:16 -07:00
Kristian Høgsberg f56b569e9a DRI2: Drop sarea, implement swap buffers in the X server. 2008-08-29 12:13:14 -04:00
Jeremy Huddleston 01ac4540f0 Apple: Some changes to fix compilation problems on OSX 2008-08-08 02:19:52 -07:00
George Sapountzis 280bf89bd4 Add DRI driver that uses the mesa swrast module. 2008-05-20 16:03:44 -04:00
Kristian Høgsberg e82dd8c6e1 DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code.  Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.

Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration.  Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide.  glcore.h is no
longer part of the DRI driver interface.  The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.

The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for.  The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts.  The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.

Change DRI2 client code to not use drm drawables or contexts.  We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock.  We now just allocate a
unique lock ID out of the DRILock sarea block.  Once we get rid of the
lock entirely, we can drop this hack.

Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point.  This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-31 16:51:26 -04:00
Kristian Høgsberg dcbe215c01 DRI2: Make setTexBuffer take a __DRIdrawable instead of a BO handle.
This fixes a problem where texturing from the same Pixmap more than
once per batchbuffer would hang the DRI driver.  We just use the region
associated with the front left renderbuffer of the __DRIdrawable for
texturing, which avoids creating different regions for the same BO.

This change also make GLX_EXT_texture_from_pixmap work for direct
rendering, since tracking the __DRIdrawable -> BO handle now uses
the standard DRI2 event buffer.  Of course, DRI2 direct rendering
doesn't exist yet.

Finally, this commit bumps the DRI interface version again, accounting
for the change in the DRI_TEX_BUFFER extension and the change in
commit 0bba0e5be7 to pass in the
event buffer head index on drawable creation.
2008-03-09 21:28:04 -04:00
Kristian Høgsberg 0bba0e5be7 DRI2: Add event buffer head as an argument to driCreateNewDrawable().
The DRI driver needs to know where in the buffer to start reading.
2008-03-09 21:16:30 -04:00
Kristian Høgsberg 3d608c7a2d [dri2] Add tail pointer to reemitDrawableInfo callback.
When the DRI doesn't parse the event buffer for a while, the X server
may overwrite data that the driver didn't get a chance to look at.  The
reemitDrawableInfo callback requests that the X server reemit all info
for the specified drawable.  To make use of this, the drive needs to know
the new tail pointer so it know where to start reading from.
2008-03-03 19:16:20 -05:00
Kristian Høgsberg 6cb3f5c4d8 Use __DRIextension mechanism providing loader functionality to the driver.
Instead of passing in a fixed struct, the loader now passes in a list
of __DRIextension structs, to advertise the functionality it can provide
to the driver.  Each extension is individually versioned and can be
extended or phased out as the interface develops.
2008-02-29 15:05:39 -05:00
Kristian Høgsberg 16242a8007 Reduce the versioning madness required to create a DRI2 screen.
Right now the DRI2 screen constructor takes 3 different versions:
DRI, DDX and DRM.  This is mostly useless, though:

  DRI: The DRI driver doesn't actually care about the DRI protocol,
  it only talks to the loader, which in turn speaks DRI protocol.  Thus,
  the DRI protocol version is of not interest to the DRI driver, but it
  needs to know what functionality the loader provides.  At this point
  that's reflected in the __DRIinterfaceMethods struct and the
  internal_version integer.

  DDX: The DDX version number is essentially used to track extensions
  to the SAREA.  With DRI2 the SAREA consists of a number of versioned,
  self-describing blocks, so the DDX version is no longer interesting.

  DRM: We have the fd, lets just ask the kernel ourselves.
2008-02-29 15:05:39 -05:00
Kristian Høgsberg 6e8d21d72f Remove GetMSC DriverAPI function.
The DriverAPI is internal to the DRI drivers and GetDrawableMSC
obsoletes GetMSC.  Also, since the DRI driver interface has not yet
been released, just drop the getMSC function from the DRI interface
instead using the ABI preserving version mechanism.

Finally, using void pointer privates in the DRI interface is not allowed,
always pass the actual types around (__DRIdrawable in this case) to
enhance type safety and readability of the code.
2008-02-25 19:02:06 -05:00
Kristian Høgsberg 6d48779c7e Add TTM buffer object based texture from pixmap implementation.
Currently only implemented for intel hw.
2008-02-14 22:12:51 -05:00
Kristian Høgsberg 7da5705b09 Add new DRI2 infrastructure. 2008-02-14 17:56:42 -05:00
Jesse Barnes 38fdb47d26 Refactor and fix core vblank support
Consolidate support for synchronizing to and retrieving vblank counters.  Also
fix the core vblank code to return monotonic MSC counters, which are required
by some GLX extensions.  Adding support for multiple pipes to a low level
driver is fairly easy, the Intel 965 driver provides simple example code (see
intel_buffers.c:intelWindowMoved()).

The new code bumps the media stream counter extension version to 2 and adds a
new getDrawableMSC callback.  This callback takes a drawablePrivate pointer,
which is used to calculate the MSC value seen by clients based on the actual
vblank counter(s) returned from the kernel.  The new drawable private fields
are as follows:
  - vblSeq - used for tracking vblank counts for buffer swapping
  - vblFlags - flags (e.g. current pipe), updated by low level driver
  - msc_base - MSC counter from the last time the current pipe changed
  - vblank_base - kernel DRM vblank counter from the last time the pipe changed

Using the above variables, the core vblank code (in vblank.c) can calculate a
monotonic MSC value.  The low level DRI drivers are responsible for updating
the current pipe (by setting VBLANK_FLAG_SECONDARY for example in vblFlags)
along with msc_base and vblank_base whenever the pipe associated with a given
drawable changes (again, see intelWindowMoved for an example of this).

Drivers should fill in the GetDrawableMSC DriverAPIRec field to point to
driDrawableGetMSC32 and add code for pipe switching as outlined above to fully
support the new scheme.
2007-10-29 12:06:00 -07:00
Kristian Høgsberg ccff0cb263 Add a version field to __DRIextension. 2007-10-11 11:30:39 -04:00
Kristian Høgsberg f29f0ae838 Move new texOffset extension to the new extension mechanism. 2007-10-11 11:28:38 -04:00
Kristian Høgsberg ecdb45cb29 Convert a left-over private void * to __DRIcontext *. 2007-10-11 11:27:51 -04:00
Kristian Høgsberg 594006d8b2 Remove now unused getProcAddress from DRIinterfaceMethods. 2007-10-11 11:25:37 -04:00
Kristian Høgsberg f968f67e62 Add a DRI_ReadDrawable marker extension to signal read drawable capability. 2007-10-11 11:22:55 -04:00
Kristian Høgsberg 106a6f29bb Move media stream counter entry points to new extension. 2007-10-11 11:21:29 -04:00
Kristian Høgsberg a7a0a2beb5 Move GLX_MESA_swap_frame_usage DRI entry points to the new mechanism. 2007-10-11 11:11:12 -04:00
Kristian Høgsberg 78a6aa57a0 Move GLX_MESA_allocate_memory related functions to new extension mechanism. 2007-10-11 11:09:57 -04:00
Kristian Høgsberg efaf90b03e Move swap_interval to new extension mechanism. 2007-10-10 19:14:10 -04:00
Kristian Høgsberg ac3e838fa7 Move the copySubBuffer extension over to the new mechanism. 2007-10-10 18:57:57 -04:00
Kristian Høgsberg f616a263a2 Implement new screen extension API.
This new API lets the loader examine DRI level extensions provided by the
driver in a forward compatible manner.

Much of the churn in the DRI interface is adding support for new
extensions or removing old, unused extensions.  This new extension
mechanism lets the loader query the extensions provided by the driver
and implement the extensions it knows about.  Deprecating extensions
is done by not exporting that extension in the list, which doesn't
require keeping old function pointers around to preserve ABI.
2007-10-10 18:47:22 -04:00
Kristian Høgsberg 295dc2d225 Stop passing in unused fbconfigs to createNewScreen. 2007-10-10 18:46:51 -04:00
Kristian Høgsberg 5987a03f99 Convert all DRI entrypoints to take pointers to __DRI* types.
The entrypoints take a mix of __DRIscreen * and void * (screen private)
arguments (similarly for contexts and drawables).  This patch does away
with passing the private void pointer and always only passes the fully
typed __DRIscreen pointer and always as the first argument.

This makes the interface more consistent and increases type safety, and
catches a bug where we would pass a screen private to DRIdrawable::getSBC.
2007-10-10 18:00:18 -04:00
Kristian Høgsberg aac367f48a Remove screenConfigs from __DRIscreen.
The screenConfigs field of __DRIscreen points back to the containing
__GLXscreenConfigs struct.  This is a serious abstraction violation; it
assumes that the loader is libGL and that there *is* a __GLXscreenConfigs
type in the loader.

Using the containerOf macro, we can get from the __DRIscreen pointer to
the containing __GLXscreenConfigs struct, at a place in the stack
where the above is a valid assumption.  Besides, the __DRI* structs shouldn't
hold state other than the private pointer.
2007-10-10 18:00:13 -04:00
Kristian Høgsberg fa72013ada Drop mostly unused __DRIid typedef. 2007-10-10 17:09:48 -04:00
Kristian Høgsberg 8ed5c7ca05 Drop createContext and destroyContext from DRIinterfaceMethods.
As for createDrawable and destroyDrawable, these functions immediately
upon entry to driCreateNewContext and immediately before exit from
driDestroyContext.  Instead of passing function pointers back and forth
just obtain the drm_context_t prior to calling DRIscreen::createNewContext
and pass it as a parameter.

This change also lets us keep the DRI context XID in the libGL loader only.
2007-10-10 17:09:16 -04:00
Kristian Høgsberg 4ff95e78e1 Drop createDrawable and destroyDrawable fron DRIinterfaceMethods.
All the DRI driver did was call the createDrawable callback immediately
upon entry to DRIscreen::createNewDrawable to get the drm_drawable_t.
We can just call that before calling into the DRI driver and pass the
returned drm_drawable_t as an argument to the DRI entry point.

Likewise for destroyDrawable.

Also, DRIdrawablePrivate::draw isn't used anywhere, and since the
driver no longer needs the XID of the drawable we can now drop that.
2007-10-10 17:07:26 -04:00
Kristian Høgsberg aceccda56b Drop __DRInativeDisplay and pass in __DRIscreen pointers instead.
Many DRI entry points took a __DRInativeDisplay pointer and a screen
index as arguments.  The only use for the native display pointer was to
pass it back to the loader when looking up the __DRIscreen for the given
screen index.

Instead, let's just pass in the __DRIscreen pointer directly, which
let's drop the __DRInativeDisplay type and the getScreen function.

The assumption is now that the loader will be able to retrieve context
from the __DRIscreen pointer when necessary.
2007-10-10 15:32:15 -04:00
Kristian Høgsberg b42152061c Add macros to generate CreateNewScreen entrypoint. 2007-10-05 00:12:30 -04:00
Kristian Høgsberg 4a22ae8d44 Remove XIDs from DRI interface (see #5714). 2007-10-05 00:09:32 -04:00
Michel Dänzer 043d219b6d Add interfaces for overriding texture images with driver specific 'offsets'.
To be used by AIGLX for GLX_EXT_texture_from_pixmap without several
additional data copies.
2007-05-22 14:08:10 +02:00
Eric Anholt c2b185cff8 Add reporting of damage by DRI drivers when the extension support is available.
With this, tools like ximagesrc in gstreamer correctly see updates from GL
rendering.  Support requires that the Xdamage library be current (but will be
disabled if not present) plus a new X Server with support for the new
XDamagePost request.  libGL now has a new interface version, and also links
against libXdamage and libXfixes to support it, but backwards compatibility
is retained.

Currently, all drivers report damage at SwapBuffers time through common code --
front buffer rendering doesn't result in damage being reported.  Also, the
damage is against the root window, as our drivers don't yet render to backing
store when they should (composited environments).
2007-01-05 18:23:57 -08:00
Brian Paul f2ad1b60c0 Dave Reveman's patch for GLX_MESA_copy_sub_buffer support 2006-03-31 15:48:04 +00:00
Brian Paul 96f216565e assorted fixes for server-side direct rendering (bug 5199) 2005-11-29 23:01:43 +00:00
Ian Romanick 68679d2b9e Remove '#if 0' block that was accidentally left in. 2005-07-28 20:55:26 +00:00
Ian Romanick 1585c234e0 Major rip-up of internal function insertion interface. The old
_glapi_add_entrypoint has been replaced by a new routine called
_glapi_add_dispatch.  This new routine dynamically assignes dispatch offsets
to functions added.  This allows IHVs to add support for extension functions
that do not have assigned dispatch offsets.

It also means that a driver has no idea what offset will be assigned to a
function.  The vast majority of the changes in this commit account for that.
An additional table, driDispatchRemapTable, is added.  Functions not in the
Linux OpenGL ABI (i.e., anything not in GL 1.2 + ARB_multitexture) has a
fixed offset in this new table.  The entry in this table specifies the
offset in of the function in the real dispatch table.

The internal interface was also bumped from version 20050725 to 20050727.

This has been tested with various programs in progs/demos on:

radeon (Radeon Mobility M6)
r128 (Rage 128 Pro)
mga (G400)
2005-07-28 00:29:51 +00:00
Ian Romanick 5c6fd3dd4c No, really, get rid of all the remaining references to DRI_USE_NEW_INTERFACE.
A couple other remnants of the old interfaces hit the dust too.  Thanks
Jon. :)
2005-07-26 05:57:24 +00:00
Ian Romanick 5f1ba3e21b Fixes the glXGetProcAddress portion of the interface. Most of the functions
that are currently obtained via glXGetProcAddress and all of the XF86DRI
functions are replaced with a funciton table.  This table will be passed to
__driCreateNewScreen.

One of the functions in the table is getProcAddress.  This allows some
loaders to expose functionality not in all loaders.  This will be immediatly
used for glxEnableExtension (formerly known to drivers as
__glXScrEnableExtension).  libGL (and in the future libglx) expose this
function so that drivers can enable GLX extensions.  libEGL should exposed
eglEnableExtension to enable EGL extensions.  The same function cannot be
used for both because the extensions have different names and (possibly)
different semantics.  Drivers can optionally use one, both, or neither.

The key parts are in the __DRIinterfaceMethodsRec structure in
dri_interface.h.  A pointer to one of these structures is passed into
__driCreateNewScreen.  Because of this, the version of the API is bumped to
20050725.  Since the previous version(s) were never in a release, their
existance is erased.

I was actually a little surprised by how much code this cuts from the
drivers.  A lot of glXGetProcAddress calls disappear, and a lot of
version checks go with them.  Nice.

The one thing I'm not sure of is removing __glXInitialize.  For some
reason that function was in the glXGetProcAddress table, but *nothing*
in the Mesa tree used it.  Did something with DRI conf. use this
function?  It seems odd...
2005-07-26 02:44:01 +00:00
Ian Romanick e9dbe58b8b Gut a few more dead bits. Replace uses of the CreateNewScreenFunc typedef
(from glxclient.h) with PFNCREATENEWSCREEN (from dri_interface.h).

Remove the prototype for __driCreateScreen and fix the prototype for
__driCreateNewScreen (append the API version) in dri_interface.h.
2005-07-24 07:38:23 +00:00
Ian Romanick c39bf5e273 All elements of pre-DRI_NEW_INTERFACE_ONLY are removed. This allows
1,402 lines of code to be removed from Mesa (drivers and libGL).  The
big winner is dri_util.c.

Primary changes are:

1. Remove all "deprecated" entry-points from the various structures in
dri_interface.h.

2. Rename the remaining fields to removed "version numbers."  So,
bindContext3 becomes bindContext.  Functions with "New" in the name
(e.g., CreateNewContext) were *not* changed, but that is an option.
Having "New" in the name is less annoying to me than having "3" in the name.

3. Remove all compatibility code that handles cases where the driver or
the loader is too old to support the latest interfaces.

4. Append the API version to the __driCreateNewScreen function name.
This is currently done by hand.  In the future (i.e., the next time we
make an incompatible change to the interface) we'll want to come up with
a better way to do this.  This prevents old loaders from being able to load
new (incompatible) drivers.

5. Bump the API version to 20050722.  All drivers (by way of dri_util.c)
require this version.

6. All drivers are *required* to expose GLX_SGIX_fbconfig and
GLX_OML_swap_method (or the moral equivalents).  Support for these
functions in implicit in the use of the "new" interface.

7. Some cases still exist that need to be compiled differently in a loader
or core Mesa versus in a driver.  These are identified by the define
IN_DRI_DRIVER.
2005-07-24 06:29:14 +00:00
Alan Hourihane 8635615501 Check for some header defines before redefining functions. Silences warnings. 2004-12-08 12:59:15 +00:00
Jon Smirl c2bffec91a Mesa-solo builds with these changes. There are still more fixups needed to
get individual drivers working again. This converts miniglx to the new
dri interface. Thanks to Erdi Chen for the new interface code.
2004-06-26 17:16:42 +00:00
Jon Smirl ba3d643c49 kill __driRegisterExtensions(), none of the functions did anything 2004-06-03 01:56:07 +00:00
Ian Romanick 749e842953 Replace Bool with GLboolean. 2004-06-02 20:46:03 +00:00
Ian Romanick 318aa84099 XF86DRIDestroyContext, XF86DRICreateDrawable, and
XF86DRIDestroyDrawable are all called directly from DRI drivers using
the new interface.  Therefore, prototypes, using available datatypes,
must be available in dri_interface.h.  Since the prototypes are
available there, xf86dri.h is no longer needed for
DRI_NEW_INTERFACE_ONLY builds.
2004-06-02 17:37:09 +00:00