summaryrefslogtreecommitdiff
path: root/lib/igt_fb.h
AgeCommit message (Collapse)Author
2018-06-08lib/fb: Add color_encoding/color_range to igt_fbVille Syrjälä
Make igt_fb be aware of the color encoding/range. For now we still hardcore everything to BT.709 limited range though. v2: Default to BT.709 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2018-05-23tests/kms_plane_scaling: Allow clip test to fail with YUVVille Syrjälä
YUV formats require the clipped src coordinates to be suitably aligned. We'd need to very carefully compute the unclipped dst coordinates to guarantee that. That's too much hassle so let's just accept failure in case YUV formats are used. v2: Actually remove the original igt_display_commit2() (Maarten) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> #irc
2018-02-12lib/igt_fb: Remove igt_get_all_cairo_formats()Maarten Lankhorst
All users have been converted to igt_fb_supported_format(), I don't think there's a valid use left for this. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-12lib/igt_fb: Add igt_fb_supported_format()Maarten Lankhorst
This makes it possible to iterate whether a format is supported or not, without each driver having to open code it. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2018-02-01lib/fb: Add support for creating planar framebuffers, v3.Maarten Lankhorst
Add support to create planar framebuffers, but don't add formats that support them yet. This first requires conversion to the RGB24 format. Changes since v1: - Don't crash in igt_create_bo_with_dimensions(). Changes since v2: - Zero offsets for dumb fb too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> [mlankhorst: Change memset(4 * ..) to memset(ARRAY_SIZE(format->plane_bpp) * ..)]
2018-02-01lib/igt_fb: Pass format to igt_calc_fb_sizeMaarten Lankhorst
bpp is only sufficient to calculate dimensions for packed formats, in case of planar formats we need to pass the drm format fourcc, which will give us better information. This is required for supporting planar framebuffers. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2018-02-01lib/igt_fb: Add igt_put_cairo_ctx as counter to igt_get_cairo_ctxMaarten Lankhorst
This will allow support for NV12 in the future, where igt_get_cairo_ctx will return a RGB image to draw with, which will be converted in igt_put_cairo_ctx so tests don't have to add special support for NV12. This is the same as cairo_destroy + checking for errors, but not all tests use this correctly so it's better to have a single handler for it. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2017-11-29igt: Remove Android supportArkadiusz Hiler
This patch gets rid of the Android support, deleting all the hacks and moving code around to the places it belongs. Android build is not really maintained properly and rots rather fast. With recent push for Meson here and Android going for Soong it will only accelerate. It's a good time to drop the illusion of providing any support. Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Kalyan Kondapally <kalyan.kondapally@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2017-09-22lib/igt_fb: Add igt_cairo_image_surface_create_from_png()Ville Syrjälä
Raw usage of cairo_image_surface_create_from_png() doesn't work since it doesn't know about IGT_DATADIR and IGT_SRCDIR. Let's extract the helper from igt_paint_image() that uses igt_fopen_data() + cairo_image_surface_create_from_png_stream() and call it igt_cairo_image_surface_create_from_png(). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-07-25lib/igt_fb: Add helper function for tile_to_modPraveen Paneri
igt_get_fb_tile_size function takes modifer as an argument This helper function will let users to convert tiling to modifier and use igt_get_fb_tile_size() v2: Improved code comment (Paulo) v3 (from Paulo): Simple rebase. Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2017-07-25lib/igt_fb: Let others use igt_get_fb_tile_sizePraveen Paneri
This function can be used by igt_draw to get accurate tile dimensions for all tile formats. v2: Added comments to function igt_get_fb_tile_size (Daniel) v3: Fixed errors in comments and coding style (Paulo) Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
2017-07-19lib/igt_fb: Export the cairo surface instead of writing to a pngPaul Kocialkowski
This removes the igt_write_fb_to_png function (that was unused thus far) and exports the igt_get_cairo_surface function to grab the matching cairo surface. Writing to a png is now handled by the common frame handling code in lib/igt_frame. This also fixes how the surface is retreived in chamelium code, which avoids destroying it too early. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2016-11-10lib: Pass tiling constant where that's expectedTomeu Vizoso
We were passing in two places a framebuffer modifier constant instead of a tiling constant. Also adds igt_fb_mod_to_tiling so tests can do that by themselves. Cc: Tvrtko Ursulin <tursulin@ursulin.net> Fixes: 8a1a38661f56 ("lib: Add igt_create_bo_with_dimensions") Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2016-07-27lib: Update docs for igt_fbDaniel Vetter
- Again match names of paramaters - structs need a typedef to work in gtk-doc - gtk-doc doesn't know about unsigned, expects unsigned int instead Cc: Paulo Zanoni <paulo.r.zanoni@intel.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: Add igt_create_bo_with_dimensionsTomeu Vizoso
igt_create_bo_with_dimensions() is intended to abstract differences between drivers in buffer object creation. The driver-specific ioctls will be called if the driver that is being tested can satisfy the needs of the calling subtest, or it will be skipped otherwise. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: Map dumb buffersTomeu Vizoso
If a buffer object is dumb, call DRM_IOCTL_MODE_MAP_DUMB when mapping it. Also, don't call DRM_IOCTL_I915_GEM_SET_DOMAIN on dumb buffers. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: Add igt_dirty_fbTomeu Vizoso
Just wraps drmModeDirtyFB and for now invalidates the whole FB. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-05lib: kms: move framebuffer scanout offset/size to planeLionel Landwerlin
This fixes potential crashes when the framebuffer is unset from a given plane. v2: s/with/within/ typo in header Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Marius Vlad <marius.c.vlad@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-03-21lib: fb: add igt_paint_color_gradient_rangeLionel Landwerlin
This is a helper to draw a gradient between 2 colors. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
2016-03-02lib/igt_fb: Fix domain tracking for GTT cairo surfacesChris Wilson
If we create a cairo surface using a GTT mmaping, then we need to use the GTT access domain. cairo surfaces created with a blit temporary (for unfenced surfaces) still use the CPU domain. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-29tests/igt_fb: rename igt_get_all_formats to igt_get_all_cairo_formatsPaulo Zanoni
I recently had this discussion with Daniel where I didn't want to use igt_drm_format_to_bpp() because it uses the format_desc array, and igt_fb currently assumes that all the format_desc formats have a matching valid Cairo format, so I wouldn't be able to easily add formats such as ARGB2101010. The function that has the assumption mentioned above is igt_get_all_formats: its current users call igt_get_all_formats, and then call cairo-dependent functions, such as igt_get_cairo_ctx on the returned formats. In order to document the current behavior and prevent any problems in case we start adding new formats without matching Cairo versions to format_desc, rename igt_get_all_formats to igt_get_all_cairo_formats and make it explicitly check for CAIRO_FORMAT_INVALID. Requested-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29lib/igt_fb: make the automatic buffer sizes/strides smallerPaulo Zanoni
The big motivation behind this patch is that the current power-of-two granularity from igt_fb is way too big. There was more than one occasion where I had to work around this problem on kms_frontbuffer_tracking, and during my last workaround I was requested to just make igt_fb use more minimal buffers. I also need to export the size computation function so I won't need to reimplement it inside kms_frontbuffer_tracking. v2: - Fix the Yf sizes (Ville). - Don't change the Gen 2/3 behavior for both tiled and non-tiled. v3: - Edit the commit message, clarify that v1 was wrongly treating gen 2/3 non-tiled as tiled (Chris). Requested-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-08lib: Extract some common fb create+fill methods into helpersVille Syrjälä
Several tests do one or more of the following: * igt_create_fb() + igt_paint_test_pattern() * igt_create_color_fb() + igt_paint_test_pattern() * igt_create_fb() + igt_paint_image() Extract them into new helpers: igt_create_pattern_fb(), igt_create_color_pattern_fb(), igt_create_image_fb(). v2: Fix typos, and improve API docs (Thomas) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-11-27lib/igt_fb: also pass the stride to igt_create_fb_with_bo_size()Paulo Zanoni
If the caller is going to specify a custom size, it's likely that he will also specify a custom stride. The automatic stride picked by create_bo_for_fb() is too huge for tiled buffers, so if the caller wants smaller buffers, then he'll need a smaller stride too, otherwise the Kernel will reject the addfb IOCTL due to stride * height being bigger than the size. I want to make tests/kms_frontbuffer_tracking use igt_create_fb_with_bo_size() so I can provide smaller buffers that will fit into the CFB. I'm also planning to make all frontbuffers with the same width/height/format have the same stride and size regardless of tiling method so I can exercise specific code paths. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-04-14i-g-t: Adding plane scaling test casechandra konduru
This patch is adding i-g-t plane scaling test case to test couple basic display plane scaling usages. Additional test scenarios can be added later. v2: -Added iterative scaling to visually observe scaling (me) v3: -Added a flag to control primary plane scaling (me) v4: -Use new tiled types when calling igt_create_fb (me) Signed-off-by: chandra konduru <chandra.konduru@intel.com> [Thomas: convert test to use igt_simple_main] Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-12tiling: Convert framebuffer helpers to use fb modifiersTvrtko Ursulin
This converts the IGT API only, underneath legacy set_tiling is still used. v2: One got away in kms_flip. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-09-05lib/igt_fb: ensure igt_create_fb parameters are consistentThomas Wood
Make sure the parameters in the prototype and implementation of igt_create_fb match and are complete so that the documentation is correct. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-05lib: move create_stereo_fb from testdisplay to igt_fbThomas Wood
Move create_stereo_fb from testdisplay to igt_create_stereo_fb in igt_fb so that it can be used in other tests. v2: update for new igt_create_fb API add parameters for format and tiling remove some old debug code Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-08-21lib: Change the fb creation functions to take fully qualified tiling formatsDamien Lespiau
In the future, we'll need more than X tiling here. So give a full enum instead of bool meaning X-tiled. It's fine to do this change without updating the users just yet as 'true' happens to be I915_TILING_X. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-29lib: Remove unused field from struct igt_fbDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-06-16lib: add missing includes to headersThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-16lib/igt_fb: igt_create_fb_with_bo_sizeOscar Mateo
Useful for testing bigger/smaller fb-wrapped buffer objects. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Oscar Mateo <oscar.mateo@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-12intel-gpu-tools: Build tests needing cairo if ANDROID_HAS_CAIRO=1Tim Gore
Until now the tests that depended on libcairo were simply skipped in the android build. Now that I have a cairo port working, build these cairo dependent tests if ANDROID_HAS_CAIRO is set to 1 in the environment. For information on building cairo for IGT on Android see the wiki at: https://securewiki.ith.intel.com/display/GFXCore/IGT+Test+Suite+on+Android Signed-off-by: Tim Gore <tim.gore@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-31intel-gpu-tools: avoid include of cairo.h on Android buildstgore
A recent commit means igt_debugfs.c now needs to include igt_kms.h, which in turn includes igt_fb.h and hence cairo.h. We need to avoid this inclusion of cairo.h when building for Android, (until we have a cairo port) so I have added a #ifndef around it. Signed-off-by: Tim Gore <tim.gore@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26lib/igt_fb: api documentationDaniel Vetter
Also realign function parameters and replace abort() with igt_fail() while at it. v2: Forgotten to add a nice intro. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26lib/igt_fb: switch to igt_ prefix from kmstest_Daniel Vetter
Shorter and more in line with our general igt_ prefix for everything which isn't somehow intel or i915-gem or otherwise hw specific - these helpers here are all fully generic framebuffer handling functions based on kms + cairo. Well, the actual buffer alloc is done with i915 gem, but meh ;-) Two special cases: - bpp_depth_to_drm_format and drm_format_to_bpp completely lacked prefixes, so just add igt_. - write_fb was a bit misleading given that we have gem_write for uploading to buffers. Rename that to write_fb_to_png to make it crystal clear what this thing does even without looking at docs. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26lib: extract igt_fb libraryDaniel Vetter
Stuff all the framebuffer creation, cairo and drm fourcc format handling in there. This gives us a very clear cut in the headers where igt_fb.c only needs to include igt_fb.h, and igt_kms.c includes both (well igt_kms.h pulls in igt_fb.h since we always need this). The aim here is to add api docs for igt_fb since that part of the kms library seems fairly stable already, while all the mode setting and iteration is still a bit in flux. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>