Before delving into Wayland‘s shaders, we need to define what a shader is and the difference between vertex shader and fragment shaders.
A shader is a computer program that runs on the GPU and is used to produce appropriate levels of light and colour within an image. Shaders are written in a specific shading language and they can be used to achieve customised effects.
There are different types of shaders, applied in different stages of the graphic pipeline and having different purposes. Here, we are mainly concerned with two types: the Vertex Shader and the Fragment Shader.
A vertex shader is run once for each vertex given to the graphics processor in the early stages of the graphical pipeline. It can manipulate properties such as position, colour, and texture coordinate. It’s in the vertex shader stage that each vertex’s 3D position is transformed to the 2D coordinate on the screen.
The fragment shader, on the other hand, manipulates pixels instead of vertices. It takes part in the rasterisation step, when colour and other attributes are computed for each fragment (pixel). With limited information about the whole scene — the fragment shader can only operate in a single pixel and sample nearby pixels — fragment shaders cannot produce very complex effects apart from blur, edge detection/enhancement, post-processing and filtering.
The interesting thing about the colour conversion is that all the conversion data is stored per output. So if you have two different monitors with different colour profiles, the appropriate conversion is done to each of one, separately.
The complete set of changes can be seen in the branch ‘colour’ of my clone of the Weston repo.
As part of my Google Summer of Code project, I attended GUADEC 2013 in Brno from 1st to 8th of August. All the talks happened in the first four days. The subjects ranged from the current situation of Gnome, its libraries and applications, to the future planned features.
I would say the subjects discussed can be categorised into three main topics: Web related (Webkit, Evolution, Tracker, Grilo, Maps and security) Graphical Interfaces (High resolution display support, Cogl, Wayland, GTK, Glade) and Community (reporting bugs, working with the Gnome community, women and open source, etc).
One of the highlights of the conference was the talk given by Bruno Cardoso about using Clang, LLVM in Gnome. Besides giving an overview of the LLVM project, he actually ran the Clang tool in a couple of projects and was able to find four security bugs (although some of them might be false-positives).
In the 4th day I gave a brief presentation of my GSoC project. It was really brief: in 3 minutes I explained what a color profile is and the reason why we want to make the color management in Wayland/Weston using a shader.
Brno is an amazing city and I had the chance to meet some old friends there and meet a lot of new people. I also met my GSoC mentor, Richard Hughes, and we took the opportunity to discuss the future of my project.
Finally, I would like to thank Fabiano Fidencio for the hospitality and for being our tour guide through the city! And the Gnome Foundation for the sponsorship.
This week I did an efenniht theme for the Ephoto applicative.
It is an alternative theme to the E17 Window Manager and Elementary Widget Library developed by the ProFUSION’s designer Marina Proni. It is basically a black theme using mostly black and orange colors. More info about it and screenshots can be found here.
It is a picture viewer focused on simplicity with functions for displaying pictures contained inside a directory and simple tools to view them elegantly. It is being currently developed using the default Elementary’s theme as you can see here.
Before doing the aforementioned theme we realized that some of the parts defined inside the Ephoto’s own theme could be merged into the default theme and reused later even for others applications. Done that, creating the new theme was just a matter of adding the appropriate parts to the Efenniht theme. These parts were basically Gengrid item’s themes: one for the up arrow, other for the folders with previews and the last one to the thumbnail itself. All the remaining used widgets already had their themes implemented inside Efenniht.
As you can see there are still some work to be done like providing images for some icons and maybe improve the entry’s theme since it is hard to know where its boundaries are. At least Marina herself seems to already like of the new Ephoto’s look. Yay!
If you are a programmer you have probably used or heard of the Valgrind tool. It is described as a framework for memory management and threading bugs detection. I usually use it to find out memory leaks or invalid memory access in my programs.
Valgrind is a great tool but think in the case of mempools. Usually you get a big memory area and manage it yourself during the life of the mempool and that area is only freed when the mempool is destroyed. If a user has requested a memory chunk but hadn’t returned it Valgrind can’t track that since it only knows about that big memory area previously allocated. Hmmm so what? Can’t we tell Valgrind what is going on?
Actually we can! Valgrind has a set of macros to allow you to track down what is happening in your mempool. Let’s learn how to use it. To do that I will use as example an EFL library I use a lot at ProFUSION called Eina.
Eina has two most used mempools: Chained and One big. The first one allocates a big memory area with malloc and manage chunks of it using a stack. The other is used when you know in advance how many objects of the same type you will have so it just calls malloc once. I will concentrate here in the Chained pool.
Before we start using the Valgrind’s macros we must understand the concepts of pool and superblock. These concepts are used in a very high level manner by Valgrind because of the many types of custom allocators existent. In Eina’s case the pool is the struct defining the mempool type and the superblock is the memory area from which chunks are given to the users, i.e, the stack pointer.
where the second argument of the macro indicates the superblock size in bytes.
to indicate the the chunk pointed by ptr was returned.
And that is all. Just run a program using the mempool inside valgrind and you will find out whether the pool is being correctly used. For more details you can take a look into the valgrind’s docs and in the Eina’s source code since I’ve commited that changes in revision 53405. Also in the commit message you will find a little program using it.
Just a reminder: if you want to use valgrind with eina you must ./configure it with the option –enable-valgrind.
You may be wondering why the blog’s name is 15experience. Everything started with ProFUSION – the company I work at – and a couch. Yeah a couch! I have said I had 5 years of experience transporting couches because of a previous job of mine when a couch had arrived to the company and my boss Gustavo Barbieri changed it to 15 years and for anything I do or will ever do.
Experience is a good thing after all and it describes exactly what is this blog about: my experience as a Computer Scientist!