<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">While trying to add support of GBM_FORMAT_NV12 format in mesa GBM, we are facing some issues to modify u_format.csv file.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Progress till now:<o:p></o:p></b></p>
<p class="MsoNormal">Initially we have faced gbm_dri_bo_create API failure because gbm_format_to_dri_format API was returning 0. Since gbm_dri_visual_table does not have mapping for GBM_FORMAT_NV12. So, this has been resolved by adding mapping for GBM_FORMAT_NV12
as: <o:p></o:p></p>
<p class="MsoNormal"><i><span style="color:#0070C0">diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">index 560b97f2b70..67e23d5b368 100644<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">--- a/src/gbm/backends/dri/gbm_dri.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+++ b/src/gbm/backends/dri/gbm_dri.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">@@ -605,6 +605,9 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> { 16, 16, 16, 16 },<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> true,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> },<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ {<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ GBM_FORMAT_NV12, __DRI_IMAGE_FORMAT_NV12,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ },<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">};<o:p></o:p></span></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">After that it required additional changes, as loader_dri_create_image was not successful which eventually is calling dri2_create_image_common. Based on format, we are getting dri_format_mapping and mapping for __DRI_IMAGE_FORMAT_NV12 was
missing. So, resolved this by adding below changes:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><i><span style="color:#0070C0">diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">index 215fb4e4e3a..6ae1fc85d12 100644<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">--- a/src/gallium/frontends/dri/dri_helpers.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+++ b/src/gallium/frontends/dri/dri_helpers.c<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">@@ -484,6 +484,11 @@ static const struct dri2_format_mapping dri2_format_table[] = {<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> __DRI_IMAGE_COMPONENTS_RG, PIPE_FORMAT_RG1616_UNORM, 1,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> { { 0, 0, 0, __DRI_IMAGE_FORMAT_GR1616 } } },<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"><o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ { DRM_FORMAT_NV12, __DRI_IMAGE_FORMAT_NV12,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ __DRI_IMAGE_COMPONENTS_Y_UV, PIPE_FORMAT_NV12, 2,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8 },<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88 } } },<o:p></o:p></span></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then in kms_sw_displaytarget_create API, DRM_IOCTL_MODE_CREATE_DUMB was getting failed with return value as -1. As util_format_get_blocksizebits was returning bpp value as zero which is incorrect for NV12 format. When we manually pass bpp
value as 8, then we can see gbm_bo_create API is successful.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#0070C0"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#0070C0">diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#0070C0">index c91f7e2ca9a..6a649e9c173 100644<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#0070C0">--- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#0070C0">+++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c<o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="color:#0070C0">@@ -181,25 +181,33 @@ kms_sw_displaytarget_create(struct sw_winsys *ws,<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> kms_sw_dt->ro_mapped = MAP_FAILED;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"><o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> kms_sw_dt->format = format;<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> memset(&create_req, 0, sizeof(create_req));<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0"> create_req.bpp = util_format_get_blocksizebits(format);<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ if(format == 213)<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="color:#0070C0">+ create_req.bpp = 8;<o:p></o:p></span></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Next Challenge:<o:p></o:p></b></p>
<p class="MsoNormal">Next challenge for us is to get correct bpp value which is 8. As format description is coming from u_format.csv file. We have tried to modify u_format.csv file for PIPE_FORMAT_NV12 row by adding number of bits in a cell, but that does
not seem to be working. We need help for the same how to modify u_format.csv as it is getting generated at compile time.
<o:p></o:p></p>
<p class="MsoNormal">Please provide your valuable feedback how we can add bpp value in u_format.csv.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Gurpreet<o:p></o:p></p>
</div>
</body>
</html>