Commit Graph

96 Commits

Author SHA1 Message Date
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