Age | Commit message (Collapse) | Author |
|
The current code to convert between two buffer formats is quite tied to the
cairo surface infrastructure. Since we'll want to reuse it, make that
function more generic by introducing a common structure that passes all the
arguments and a common function that will call the right functions we
needed.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
|
Since it can be inferred from the framebuffer that is already given as an
argument, it is redundant and can be removed.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
|
In the case where an igt_fb user wants to get a cairo surface out of that
framebuffer, if the format of that framebuffer cannot be imported as-is in
Cairo, the current code will do an anonymous mapping to create a shadow
buffer where an RGB24 copy of that buffer will be created.
However, making that shadow buffer into an igt_fb itself will help us do
further improvements on the conversion code.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
|
|
The RGB888 format is the one used as the shadow buffer used when a cairo
surface is requested for a format that Cairo cannot handle.
Since we're going to move that buffer representation to a struct igt_fb,
let's add the RGB888 format to the list of formats that igt_fb knows about.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
|
|
The gem_set_domain call uses an i915 specific ioctl that will fail on
anything else. Let's move that call under a check for whether or not we're
running on an intel platform.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
|
|
The current code to manipulate the buffer has the assumption that we can
create an underlying cairo instance.
However, when it comes to supporting various formats, cairo is very limited
so we would need to decouple the buffer access from cairo surfaces.
Let's create a function that allows to map the underlying GEM buffer from
an igt_fb structure, which will then allow use to manipulate as we wish.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
|
Deduplicate the blitter code.
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Instead of passing around a boatload of integers everywhere let's
just pass around the igt_fb struct. That obviously means we have to
populate it first sufficiently, to which end we'll add a small helper.
Later on the stride/size calculations will consult the already
pre-populated igt_fb and fill in the rest as needed.
This makes the whole thing a lot less error prone as it's impossible
to accidentally pass the arguments in the wrong order when there's
just the one of them, and it's a pointer.
v2: Rebase due to uint64_t size
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
We don't want anyone to modify the format description structures. Make
them const.
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Eliminate the planar vs. packed size calculation differences and just
use one function for the entire thing.
v2: Rebase due to uint64_t size
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Extract the stride calculation from calc_fb_size_packed() to its own
thing so that we can use it to calculate just the stride.
v2: Rebase due to overflow fixes and roundup_power_of_two()
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Just use __kms_addfb() always instead of hand rolling another
drmModeAddFB2() usage. __kms_addfb() demands support for modifiers
but we've had that for a long time now so it's not a problem.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Currently __kms_addfb() assumes that only the first plane can be
at offset 0. I don't particularly like such assumptions so let's
just pass in the number of planes explicitly.
We'll also require offsets[] to be passed in always. Nothing really
to gain by making it optional.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Make __kms_addfb() usable with planar formats by passing in the
stride for each plane.
v2: Handle strides[1] for planar formats in kms_available_modes_crc
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Add a helper to return the number of color planes. We'll need this
for ccs support later.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Add another helper to get the bpp for a specific color plane. We'll
need this for ccs support later.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Rename the planar_foo() functions to fb_plane_foo(). Makes it clear
they're perfectly usable with non-planar formats too.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
With fb_blit_upload now being the base class of fb_convert_blit_upload
we can pass the entire structure down to free_linear_mapping().
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
fb_blit_upload already has everything we need, so let's use it as the
base class for fb_convert_blit_upload.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Add DIV_ROUND_UP() and replace some hand rolled versions with it.
v2: Drop the duplicate from gem_render_copy() (Paulo)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
We prented to allow the caller to specify the stride explicitly for the
fb. But we don't actually use that user specified stride when we
calculate the require bo size. Fix that oversight.
v2: Rebased due to uint64_t size
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
|
|
Add a helper to round a value to the next power of two size.
And since we need fls() to implement that, reuse that elsewhere
as well.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
Switch all fb size handling to 64bits to accomodate >4GiB
framebuffers.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
We're missing some set_domain calls around the ggtt mmap paths. This
means we never tell the kernel that we've dirtied the object. And
then at some point down the line the kernel throws the pages into
/dev/null instead of hanging on to them/swapping them out because
they were never marked as dirty.
Throw in the missing set_domains(GTT,GTT) calls and rip out the old
bogus set_domain(CPU,CPU).
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
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>
|
|
Reuse the __convert() cairo stuff to support packed YCbCr framebuffers.
v2: Allow odd fb width since some tests want it
v3: Use igt_memcpy_from_wc()
v4: Rebase due to color_encoding/range enums
v5: Follow the fixed nv12 code
v6: Use igt_format_is_yuv()
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
Probably horribly inefficient (not that the original code tried to be
particularly efficient), but at least this is now pretty generic so
it'll be super easy to add other color encodings and whatnot.
v2: Rebase
v3: Deal with the new color_encoding/range enums
v4: Fix the code to actually work, and do things in 2x2 blocks
Keep the chroma siting comment and pimp it up a bit
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
Always populate the plane_bpp[] stuff, and use named initializers so
that we can actually see what's being set to what.
v2: Fix depth for xrgb8888
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
We don't do the "black != zero" clearing for dumb buffers, so let's not
use them for YCbCr framebuffers.
v2: Use igt_format_is_yuv()
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
As we do for NV12, let's also clear packed YUV formats to black instead
of zero. Avoids unexpected green screens.
v2: Nuke the debug messages
v3: Use wmemset(Maarten)
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
|
|
I think round to nearest is maybe more correct here. Also do the
clamp with integers as it actually makes the resulting code
measurably faster.
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
|
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
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
|
|
It doesn't look like there should be a dependency there.
v2: s/intel_batchbuffer/intel_reg/
v3: One more s/intel_batchbuffer/intel_reg/ in benchmarks
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
|
|
Reading from WC is awfully slow as each access is uncached and so
performed synchronously, stalling for the memory load. x86 did introduce
some new instructions in SSE 4.1 to provide a small internal buffer to
accelerate reading back a cacheline at a time from uncached memory, for
this purpose.
v2: Don't be lazy and handle misalignment.
v3: Switch out of sse41 before emitting the generic memcpy routine
v4: Replace opencoded memcpy_from_wc
v5: Always flush the internal buffer before use (Eric)
v6: Assume bulk moves, so check for dst alignment.
v7: Use _mm_fence for _buitlin_ia32_mfence for consistency, remove
superfluous defines (Ville)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
|
|
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>
|
|
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>
|
|
This will make it easier for tests to unconditionally call
igt_remove_fb, without first checking whether the FB is allocated.
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>
|
|
For NV12 a format conversion is needed. Because YUV formats are not
fully defined with just a fourcc, I've chosen BT.601 limited range.
This puts the pixel center of the CbCr components between the top
left Y and bottom left Y:
Y Y Y Y
UV UV
Y Y Y Y
Some work is put into optimising the conversion routines in order to
make it fast enough. Before converting nv12 to rgb24, it is copied to
a temporary buffer to take advantage of memory caching. This is
approximately 20x faster than directly reading the BO.
When testing on my KBL with a 1080p buffer, it takes approximately
.1s to convert either way, this is fast enough not to bother optimising
even further for me.
Changes since v1:
- Use BT.601 instead of BT.709 coefficients.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
|
|
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) * ..)]
|
|
Adding a delta offset will allow us to copy planar framebuffers with this
function.
Changes since v1:
- Set src and destination addresses to the delta, in case BO is mapped at offset 0.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com> #v1
|
|
By adding support for planar formats to igt_calc_fb_size and create_bo_for_fb,
we can calculate dimensions and create backing storage for planar framebuffers.
This is required for adding support to create planar framebuffers in the next patch.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
[mlankhorst: Use plane < ARRAY_SIZE(format->plane_bpp) instead of < 4.]
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
|
|
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>
|
|
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>
|
|
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96620
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
|
|
When drawing with cairo to Y/Yf tiled FBs we use a temporary linear
buffer which is mapped to the CPU, but the fast blit needed for this
only expects 32 bpp FBs. Add support for other bpps too.
This is needed for upcoming patches testing non-32bit bpp formats with
Y/Yf tiling.
Thanks to Ville for explaining why we need the temporary buffer. (Looks
like for Y tiling we could do without, but that's a separate topic.)
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Imre Deak <imre.deak@intel.com>
|
|
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>
|
|
We are, the build system takes care of that.
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Acked-by: Petri Latvala <petri.latvala@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
|
|
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>
|
|
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>
|