summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add libvts (Virtual Terminal Session) apiwip/vtsRobert Bragg2013-07-176-0/+2049
| | | | | | | | | | | | | | | | | | | This adds a small library - libvts - to the cogl repo for safely handling the privileged operations involved in opening a tty, opening a pam session (optional), claiming drmMaster() mode for using KMS and opening evdev input devices for the session-seat. This was written to support the launching of Wayland based compositors but there is nothing Wayland specific about the code so it can be used to launch any kind of full screen application that wants to run on a Linux virtual console via KMS. The code has very minimal dependencies (no glib usage for example) and could be factored out into a standalone project. This would enable weston-launch to share the same code. In the meantime we will maintain this code in Cogl so that applications using the KMS backend can automatically take advantage of it.
* framebuffer: remove attribute drawing apisRobert Bragg2013-07-159-382/+68
| | | | | | | | Almost nothing draws attributes directly and for those things that do it's trivial to adapt them to instead draw via the cogl_primitive api. This simplifies the Cogl api a bit. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* framebuffer: remove _draw_primitive() apiRobert Bragg2013-07-152-32/+0
| | | | | | | Since there is a replacement cogl_primitive_draw() api this removes the cogl_framebuffer_draw_primitive() api. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add _primitive_draw to replace _framebuffer_draw_primitiveRobert Bragg2013-07-1531-101/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | When splitting out the CoglPath api we saw that we would be left with inconsistent drawing apis if the drawing apis in core Cogl were lumped into the cogl_framebuffer_ api considering other Cogl sub-libraries or that others will want to create higher level drawing apis outside of Cogl but can't use the same namespace. So that we can aim for a more consistent style this adds a cogl_primitive_draw() api, comparable to cogl_path_fill() or cogl_pango_show_layout() that's intended to replace cogl_framebuffer_draw_primitive() Note: the attribute and rectangle drawing apis are still in the cogl_framebuffer_ namespace and this might potentially change but in these cases there is no single object representing the thing being drawn so it seems a more reasonable they they live in the framebuffer namespace for now. Note: the cogl_framebuffer_draw_primitive() api isn't removed by this patch so it can more conveniently be cherry picked to the 1.16 branch so we can mark it deprecated for a short while. Even though it's marked as experimental api we know that there are people using the api so we'd like to give them a chance to switch to the new api. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Remove cogl-auto-texture apisRobert Bragg2013-07-116-592/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the automagic texture constructors including: cogl_texture_new_with_size cogl_texture_new_from_file cogl_texture_new_from_bitmap cogl_texture_new_from_data cogl_texture_gl_new_from_foreign The same convenience can instead be found by using the more specific apis such as cogl_texture_2d_new_with_size/from_file but the advantage should be that it's clearer what kind of texture you will end up with and what special considerations you must be mindful of with any particular texture that you allocate. This way applications will also be less likely to hammer the texture-atlas with very large images that may not be appropriate for the atlas and also avoid extra work migrating images out of the atlas when choosing to use mipmapping. Another nice side affect is that the #CoglTexture api is now just an interface for handling operations common to all of the different texture types in Cogl instead of a combination of constructor apis and interface apis. The CoglTextureFlags type is also removed by this patch a corresponding references to the type in the documentation since these flags were only used with the auto-texture apis. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* remove unused _cogl_texture_2d_sliced_new_from_foreignRobert Bragg2013-07-112-103/+0
| | | | | | | | We don't see any pressing need to be able to create sliced textures from foreign gl textures, and removing the api will make further re-working of the texture backends a bit easier. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* examples: avoid using the auto-texture apisRobert Bragg2013-07-113-15/+13
| | | | | | | | Instead of using cogl_texture_new_from_file/with_size in the example we now use the cogl_texture_2d_ equivalents. This is in preparation for removing the cogl-auto-texture apis. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* tests: stop using cogl-auto-texture apisRobert Bragg2013-07-1120-128/+417
| | | | | | | | | | | | | | | | | | The plan is to remove the cogl-auto-texture apis since they hide a bit too much from developers but currently the conformance tests depend on these apis in numerous places. For the conformance tests it makes some sense to continue using high level texture apis similar to the auto-texture apis since we may want to make broad variations to how textures are allocated as part of the testing running if that might help exercise more code paths. This patch copies much of the auto-texture functionality into some slightly more special purpose utilities in test-utils.c/h. Minor changes include being constrained to the public Cogl api and they also don't let you catch CoglErrors and just assume they should abort on error. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* bitmap: calc rowstride from width * bpp if 0Robert Bragg2013-07-111-0/+4
| | | | | | | | This updates cogl_bitmap_new_for_data() to calculate the rowstride from the width and bpp if the given rowstride is 0, to be consistent with how the texture apis work. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* gst: don't use cogl_texture_new_with_dataRobert Bragg2013-07-111-36/+95
| | | | | | | | This updates cogl-gst to use cogl_texture_2d_new_with_data instead of cogl_texture_new_with_data in preparation for removing the automagic apis in cogl-auto-texture.c Reviewed-by: Neil Roberts <neil@linux.intel.com>
* remove internal use of cogl_texture_new_with_sizeRobert Bragg2013-07-114-9/+99
| | | | | | | | | | | | | | | In preparation for removing the automagic cogl-auto-texture apis this adds a more minimal version of the cogl_texture_new_with_size code to cogl-atlas.c for creating textures used to migrate images out of an atlas and to cogl-texture-pixmap-x11.c. Note: It turned out that both of these minimal versions were the same so I did consider keeping a shared utility, but since the implementations are very small and potentially due to the differing requirements for atlas and pixmap-x11 textures we might even want them to differ later I chose to keep them separate. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* 2d-sliced: add _new_from_file/data/bitmap apisRobert Bragg2013-07-115-37/+289
| | | | | | | | | This adds cogl_texture_2d_sliced_new_from_bitmap/data/file apis in preparation for removing the cogl_texture_new_from_bitmap/file apis that are considered a bit too magic, but we don't want to loose the convenience they have. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture-2d: Add _new_from_file apiRobert Bragg2013-07-113-0/+53
| | | | | | | | This adds a cogl_texture_2d_new_from_file() api since we are planning to remove cogl_texture_new_from_file() but don't want to loose the convenience it had. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Expose CoglAtlasTexture apiRobert Bragg2013-07-118-71/+327
| | | | | | | | | | | | | | | | | | | This exposes the CoglAtlasTexture api, making the following public: cogl_atlas_texture_new_with_size cogl_atlas_texture_new_from_file cogl_atlas_texture_new_from_data cogl_atlas_texture_new_from_bitmap The plan is to remove auto-texture apis like cogl_texture_new_from_file since they are a bit too magic, but that means we need an explicit way for users to allocate texture that will go in the atlas. Although the _new_from_file() api is arguably redundant since you can use _bitmap_new_from_file() followed by _atlas_texture_new_from_bitmap() we don't want to loose any of the convenience that cogl_texture_new_from_file() had. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture: remove _cogl_texture_prepare_for_uploadRobert Bragg2013-07-1119-318/+345
| | | | | | | | | | | | | | | | | | | | | | This removes the gl centric _cogl_texture_prepare_for_upload api from cogl-texture.c and instead adds a _cogl_bitmap_convert_for_upload() api which everything now uses instead. GL specific code that needed the gl internal/format/type enums returned by _cogl_texture_prepare_for_upload now use ->pixel_format_to_gl directly. Since there was a special case optimization in cogl_texture_new_from_file that aimed to avoid copying the temporary bitmap that's created for the given file and allow conversions to happen in-place the new _cogl_bitmap_convert_for_upload() api supports converting in place depending on a 'can_convert_in_place' argument. This ability to convert bitmaps in-place has been integrated across the different components as appropriate. In updating cogl-texture-2d-sliced.c this was able to remove a number of other GL specific parts to how spans are setup. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Initialise dirty_real_blend_enable in _cogl_pipeline_copyNeil Roberts2013-07-111-0/+1
| | | | | | | | | When making a copy of a pipeline, the flag to mark whether the real blend enable is valid was not being initialised. Thanks to Damien Lespiau for pointing this out Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland: Send COGL_FRAME_EVENT_SYNC based on the frame callbackNeil Roberts2013-07-113-1/+85
| | | | | | | | | | | | | | | | | | | | | Instead of queuing the frame sync event immediately after a swap, the Wayland winsys now installs a frame callback and queues the event when Wayland reports that the frame is complete. It also reports the COGL_FRAME_EVENT_COMPLETE event at the same time because there is no more information we can give. This patch is a bit of a divergence from how the events are handled in the GLX winsys. Instead of installing its own idle function, the _cogl_onscreen_queue_event() function has now been made non-static so that it can be used by the Wayland winsys. The frame callback now just queues an event using that. The pending_frame_infos queue on the CoglOnscreen isn't used and instead the CoglFrameInfo is immediately popped off the queue so that it can be stored as part of the closure data when the frame callback is set up. That way it would use the right frame info even if somehow the Wayland callbacks were invoked in the wrong order and the code is a bit simpler. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland: Remove the Wayland socket FD if there are any errorsNeil Roberts2013-07-112-20/+69
| | | | | | | | | | | | | | | | | | | | Previously if the Wayland socket gets closed then Cogl would ignore the error when dispatching events which meant the socket would be constantly ready for reading, the main loop would never go idle and it would sit at 100% CPU. When Wayland encounters an error it will actually close the socket which means if something else opened another file then we might even end up polling on a completely unrelated FD. This patch makes it remove the FD from the main loop as soon as it hits an error so that it will at least avoid breaking the main loop. However I think most applications would probably want to abort in this case so we might also want to add a way to inform the application of this or even just abort directly. The cogl_poll_* functions have been changed so that they can cope if the pending and dispatch callbacks remove their own FD while they are invoked. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* README: misc updatesRobert Bragg2013-07-091-7/+13
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-gst: move initialization code so CoglGstVideoSink can be subclassedLionel Landwerlin2013-07-091-2/+2
| | | | Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Install conformance testsMatthias Clasen2013-07-093-0/+38
| | | | | | | | | Install the conformance tests, and metadata to run them with gnome-desktop-testing-runner. https://bugzilla.gnome.org/show_bug.cgi?id=702942 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland: Add API to prevent Cogl from dispatching the wayland displayNeil Roberts2013-07-095-7/+48
| | | | | | | | | | This adds cogl_wayland_renderer_set_event_dispatch_enabled() which can be used to prevent Cogl from adding the socket for the Wayland display to its list of file descriptors to poll. This can be used in applications that want to integrate Cogl with existing code that is reading from the Wayland socket itself. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Get rid of the foreign shell and compositor APIsNeil Roberts2013-07-094-164/+6
| | | | | | | | The Wayland 1.0 protocol supports multiple independent components querying the available interfaces by retreiving their own wl_registry object so the application doesn't need to pass them down anymore. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Implicitly allocate on cogl_wayland_onscreen_get_(shell_)?surfaceNeil Roberts2013-07-091-20/+16
| | | | | | | | | | | | The idea with the framebuffer allocation is that it will lazily allocate so that if you don't want to handle errors then you don't have to be aware that there is an allocation step. In order for this to work any accessors that get data that is only available after allocation should implicitly allocate the framebuffer. This patch makes that change for cogl_wayland_onscreen_get_surface and cogl_wayland_onscreen_get_shell_surface. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Allow cogl_wayland_onscreen_get_surface to be used non-foreignlyNeil Roberts2013-07-091-1/+1
| | | | | | | | | | | cogl_wayland_onscreen_get_surface previously only worked if the onscreen had a foreign surface on it. However there is no reason why this shouldn't also work fine for manipulating the surface that Cogl created as well. We may want to consider adding a separate getter for the foreign surface that can be used before the framebuffer is allocated. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-gst: protect public API using type checksLionel Landwerlin2013-07-091-5/+32
|
* gitignore: config.env has changed placeDamien Lespiau2013-07-091-1/+1
| | | | and is now in tests/ to be used by all the different kind of tests.
* cogl-path: fix compile outside of source treeAndreas Oberritter2013-07-041-6/+1
| | | | | | | | | | cogl-path.h doesn't get included from cogl.h anymore. It also can't include cogl-*.h headers directly and must include the whole cogl.h instead. Signed-off-by: Andreas Oberritter <obi@saftware.de> Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogland: Use wl_resource_get_user_data instead of resource->dataNeil Roberts2013-07-041-11/+13
| | | | | | | wl_resource may become an opaque type in future so we should probably be using the accessors instead of directly prodding into the struct. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix the GBM_MICRO macroNeil Roberts2013-07-041-1/+1
| | | | | | | | | The version of gbm can sometimes be suffixed with ‘-devel’. This was making the GBM_MICRO define come out as 0-devel which was generating a warning when it was used in a #if check. This patch makes it chop off anything after a ‘-’ using sed. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add -I$(top_builddir) to the cogl-gst doc include flagsNeil Roberts2013-07-041-1/+1
| | | | | | Otherwise make distcheck fails Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Remove cogl-swap-chain.xml from cogl2-docs.xmlNeil Roberts2013-07-041-1/+0
| | | | | | | This is no longer generated so it was breaking the build when the docs are enabled. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add test-unit.h to test-fixtures/Makefile.amNeil Roberts2013-07-041-0/+1
| | | | | | | | Otherwise make distcheck was breaking. Thanks to Rico Tzschichholz for pointing this out. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Don't include cogl/cogl.h from test-utils.hNeil Roberts2013-07-044-6/+7
| | | | | | | | | | | | | | | There was a circular depedency when building from a fresh git clone where test-fixtures needs to be built before the cogl directory, but test-fixtures also indirectly includes cogl-enum-types.h which is only generated when building the cogl directory. If we change the header to just include specific cogl headers instead of cogl/cogl.h then we can break the circular dependency. This needs a tweak to test-no-gl-header because that first undefines COGL_COMPILATION before including test-utils.h. However it doesn't really do any actual work so we can get away without including it. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add support for automake 1.14Yosef Or Boczko2013-07-031-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=703553
* cogl-path: export cogl_framebuffer_push_path_clipAndreas Oberritter2013-07-031-1/+1
| | | | | | | | Fixes linker error. Signed-off-by: Andreas Oberritter <obi@saftware.de> Reviewed-by: Neil Roberts <neil@linux.intel.com>
* build: Fix make distRico Tzschichholz2013-07-031-2/+1
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Set the minimum required wayland-server version to 1.1.90Neil Roberts2013-07-011-2/+4
| | | | | | | | | | Since the Wayland server support has been updated to use wl_shm_buffer we need the latest git version of Wayland to build. Previously the configure.ac file only had one define for the minimum version of both the client-side and server-side support but as they are now different this patch splits them out. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Use wl_client_add_object instead of wl_client_add_resourceNeil Roberts2013-07-011-56/+68
| | | | | | | | | | | wl_client_add_resource has been deprecated in the Wayland API in favour of wl_client_add_object which returns a pointer to a wl_resource which it allocates instead of the compositor having to embed it in a larger struct. As far as I understand the idea is to eventually make wl_resource completely opaque. This patch changes Cogland accordingly. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland-server: Update because wl_shm_buffer is no longer a wl_bufferNeil Roberts2013-07-013-146/+230
| | | | | | | | | | | | | | | | | | | | | | | The Wayland server API has changed so that wl_shm_buffer is no longer a type of wl_buffer and it instead must be retrieved directly from the resource. cogl_wayland_texture_2d_new_from_buffer now takes a resource pointer instead of directly taking a wl_buffer and it will do different things depending on whether it can get a wl_shm_buffer out of the resource instead of trying to query the buffer type. Cogland has also been updated so that it tracks a resource for buffers of surfaces instead of directly tracking a wl_buffer. This are pointed to by a new CoglandBuffer struct which can be referenced by a CoglandBufferReference. The WL_BUFFER_RELEASE event will be posted when the last reference to the buffer is removed instead of directly whenever a new buffer is attached. This is similar to how Weston works. https://bugzilla.gnome.org/show_bug.cgi?id=702999 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland: Always call wl_display_flush before going idleNeil Roberts2013-07-011-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously Cogl would only call wl_display_flush after doing a swap buffers on the onscreen because that is the only place where Cogl itself would end up queueing requests. However since commit 323fe188748 Cogl takes control of calling wl_display_dispatch as well which effectively makes it very difficult for the application to handle the Wayland event queue itself. Therefore it needs to rely on Cogl to do it which means that other parts of the application may also queue requests that need to be flushed. This patch tries to copy the display fd handling of window.c in the Weston example clients. wl_display_flush will always be called in prepare function for the fd which means it will always be called before going idle. If flushing the display causes the socket buffer to become full, it will additionally poll for write on the FD to try flushing again when it becomes empty. We also need to call wl_display_dispatch_pending in the prepare because apparently calling eglSwapBuffers can cause it to read data from the FD to receive events for a different queue. In that case there will be events that need to be handled but the FD will no longer be ready for reading so we won't wake up the main loop any other way. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* poll: Add _cogl_poll_renderer_modify_fdNeil Roberts2013-07-012-0/+24
| | | | | | | | | | _cogl_poll_rendererer_modify_fd can be used internally to modify the event mask on an FD to be polled. This will be used in the Wayland backend to start blocking on write whenever flushing the display fills the socket's buffer. Modifying the FD's events causes the poll age to increase. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* poll: Always run the prepare callbacks for all sourcesNeil Roberts2013-07-011-11/+3
| | | | | | | | | | | | Eventually the Wayland winsys will want to do useful work in its prepare callback before the main loop goes idle. Previously cogl_poll_renderer_get_info would stop calling any further prepare functions if it found one with a zero timeout. That would mean the Wayland prepare function might not get called before going idle in some cases. This patch changes it so that it continues to call all of the prepare functions regardless of the timeout. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland: Disconnect the display when the renderer disconnectsNeil Roberts2013-07-011-1/+11
| | | | | | | If we don't do this then it might leak connections to the display if multiple different renderers are tried. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Don't create a layer when enabling texture coordinate attributesNeil Roberts2013-07-011-12/+31
| | | | | | | | | | | | | | | When a primitive is drawn with an attribute that contains texture coordinates Cogl will fetch the corresponding layer in order to determine the unit number. However if the pipeline didn't actually have a layer it would end up redundantly creating it. It's probably not a good idea to be modifying the pipeline while flushing the attributes state so this patch makes it pass the no-create flag to the get_layer function and then skips out enabling the attribute if the layer didn't already exist. https://bugzilla.gnome.org/show_bug.cgi?id=702570 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix the alpha value in the default texture dataNeil Roberts2013-07-011-1/+1
| | | | | | | | | | | | When a layer is added to a pipeline without setting a texture it ends up sampling from a default 1x1 texture which is meant to be solid white. However for some reason we were creating the texture with 0 opacity which is effectively an invalid premultiplied colour. This would make the blending behave oddly if it was used. https://bugzilla.gnome.org/show_bug.cgi?id=702570 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* renderer: Don't allow the COGL_DRIVER env var to override applicationNeil Roberts2013-06-271-2/+16
| | | | | | | | | | | | Since e07d0fc7441 the COGL_DRIVER environment variable was able to override the application's driver selection. This doesn't seem like a good idea because if the application is specifying a driver explicitly then presumably it can not work with any other driver. This patch changes it so that if a driver is selected in the configuration and by the application then they must match, otherwise it will fail with a CoglError. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* renderer: Only check certain constraints when selecting a driverNeil Roberts2013-06-272-0/+10
| | | | | | | | | | | | Only COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 affects the driver selection and all of the the other constraints are only relevant to the winsys selection. However Cogl was trying to apply all of the constraints to the driver selection which meant that if any other constraint was specified then it would always fail. This patch makes the driver selection filter out all other constraints based on a mask defined in cogl-renderer-private.h. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Log a fatal error when an error is propagated to a NULL error argumentNeil Roberts2013-06-271-1/+4
| | | | | | | | | | Unlike in GError, the policy in Cogl for when NULL is passed as the CoglError argument is that the program should abort with a fatal error. Previously however any errors that were being propagated were being silently dropped if the application passed NULL. This patch fixes it to also log a fatal error in that case. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix the check for whether snippets require pipeline to need blendingNeil Roberts2013-06-211-2/+2
| | | | | | | | | | | When determining whether a pipeline needs blending, it was previously returning TRUE if the pipeline has no snippets, whereas it should be the other way around because we can't determine the final colour when there are snipets. https://bugzilla.gnome.org/show_bug.cgi?id=702570 Reviewed-by: Robert Bragg <robert@linux.intel.com>