xref: /aosp_15_r20/external/mesa3d/docs/submittingpatches.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerSubmitting Patches
2*61046927SAndroid Build Coastguard Worker==================
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard Worker.. _guidelines:
5*61046927SAndroid Build Coastguard Worker
6*61046927SAndroid Build Coastguard WorkerBasic guidelines
7*61046927SAndroid Build Coastguard Worker----------------
8*61046927SAndroid Build Coastguard Worker
9*61046927SAndroid Build Coastguard Worker-  Patches should not mix code changes with code formatting changes
10*61046927SAndroid Build Coastguard Worker   (except, perhaps, in very trivial cases.)
11*61046927SAndroid Build Coastguard Worker-  Code patches should follow Mesa :doc:`coding
12*61046927SAndroid Build Coastguard Worker   conventions <codingstyle>`.
13*61046927SAndroid Build Coastguard Worker-  Whenever possible, patches should only affect individual Mesa/Gallium
14*61046927SAndroid Build Coastguard Worker   components.
15*61046927SAndroid Build Coastguard Worker-  Patches should never introduce build breaks and should be bisectable
16*61046927SAndroid Build Coastguard Worker   (see ``Git bisect``.)
17*61046927SAndroid Build Coastguard Worker-  Patches should be properly :ref:`formatted <formatting>`.
18*61046927SAndroid Build Coastguard Worker-  Patches should be sufficiently :ref:`tested <testing>` before
19*61046927SAndroid Build Coastguard Worker   submitting.
20*61046927SAndroid Build Coastguard Worker-  Patches should be :ref:`submitted <submit>` via a merge request for
21*61046927SAndroid Build Coastguard Worker   :ref:`review <reviewing>`.
22*61046927SAndroid Build Coastguard Worker
23*61046927SAndroid Build Coastguard Worker.. _formatting:
24*61046927SAndroid Build Coastguard Worker
25*61046927SAndroid Build Coastguard WorkerPatch formatting
26*61046927SAndroid Build Coastguard Worker----------------
27*61046927SAndroid Build Coastguard Worker
28*61046927SAndroid Build Coastguard Worker-  Lines should be limited to 75 characters or less so that Git logs
29*61046927SAndroid Build Coastguard Worker   displayed in 80-column terminals avoid line wrapping. Note that
30*61046927SAndroid Build Coastguard Worker   ``git log`` uses 4 spaces of indentation (4 + 75 < 80).
31*61046927SAndroid Build Coastguard Worker-  The first line should be a short, concise summary of the change
32*61046927SAndroid Build Coastguard Worker   prefixed with a module name. Examples:
33*61046927SAndroid Build Coastguard Worker
34*61046927SAndroid Build Coastguard Worker   ::
35*61046927SAndroid Build Coastguard Worker
36*61046927SAndroid Build Coastguard Worker      mesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG
37*61046927SAndroid Build Coastguard Worker
38*61046927SAndroid Build Coastguard Worker      gallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY
39*61046927SAndroid Build Coastguard Worker
40*61046927SAndroid Build Coastguard Worker      i965: Fix missing type in local variable declaration.
41*61046927SAndroid Build Coastguard Worker
42*61046927SAndroid Build Coastguard Worker-  Subsequent patch comments should describe the change in more detail,
43*61046927SAndroid Build Coastguard Worker   if needed. For example:
44*61046927SAndroid Build Coastguard Worker
45*61046927SAndroid Build Coastguard Worker   ::
46*61046927SAndroid Build Coastguard Worker
47*61046927SAndroid Build Coastguard Worker      i965: Remove end-of-thread SEND alignment code.
48*61046927SAndroid Build Coastguard Worker
49*61046927SAndroid Build Coastguard Worker      This was present in Eric's initial implementation of the compaction code
50*61046927SAndroid Build Coastguard Worker      for Sandybridge (commit 077d01b6). There is no documentation saying this
51*61046927SAndroid Build Coastguard Worker      is necessary, and removing it causes no regressions in piglit on any
52*61046927SAndroid Build Coastguard Worker      platform.
53*61046927SAndroid Build Coastguard Worker
54*61046927SAndroid Build Coastguard Worker-  A "Signed-off-by:" line is not required, but not discouraged either.
55*61046927SAndroid Build Coastguard Worker-  If a patch addresses an issue in GitLab, use the Closes: tag For
56*61046927SAndroid Build Coastguard Worker   example:
57*61046927SAndroid Build Coastguard Worker
58*61046927SAndroid Build Coastguard Worker   ::
59*61046927SAndroid Build Coastguard Worker
60*61046927SAndroid Build Coastguard Worker      Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1
61*61046927SAndroid Build Coastguard Worker
62*61046927SAndroid Build Coastguard Worker   Prefer the full URL to just ``Closes: #1``, since the URL makes it
63*61046927SAndroid Build Coastguard Worker   easier to get to the bug page from ``git log``
64*61046927SAndroid Build Coastguard Worker
65*61046927SAndroid Build Coastguard Worker   **Do not use the ``Fixes:`` tag for this!** Mesa already uses
66*61046927SAndroid Build Coastguard Worker   ``Fixes:`` for something else.
67*61046927SAndroid Build Coastguard Worker   See :ref:`below <fixes>`.
68*61046927SAndroid Build Coastguard Worker
69*61046927SAndroid Build Coastguard Worker-  If there have been several revisions to a patch during the review
70*61046927SAndroid Build Coastguard Worker   process, they should be noted such as in this example:
71*61046927SAndroid Build Coastguard Worker
72*61046927SAndroid Build Coastguard Worker   ::
73*61046927SAndroid Build Coastguard Worker
74*61046927SAndroid Build Coastguard Worker      st/mesa: add ARB_texture_stencil8 support (v4)
75*61046927SAndroid Build Coastguard Worker
76*61046927SAndroid Build Coastguard Worker      if we support stencil texturing, enable texture_stencil8
77*61046927SAndroid Build Coastguard Worker      there is no requirement to support native S8 for this,
78*61046927SAndroid Build Coastguard Worker      the texture can be converted to x24s8 fine.
79*61046927SAndroid Build Coastguard Worker
80*61046927SAndroid Build Coastguard Worker      v2: fold fixes from Marek in:
81*61046927SAndroid Build Coastguard Worker         a) put S8 last in the list
82*61046927SAndroid Build Coastguard Worker         b) fix renderable to always test for d/s renderable
83*61046927SAndroid Build Coastguard Worker           fixup the texture case to use a stencil only format
84*61046927SAndroid Build Coastguard Worker           for picking the format for the texture view.
85*61046927SAndroid Build Coastguard Worker      v3: hit fallback for getteximage
86*61046927SAndroid Build Coastguard Worker      v4: put s8 back in front, it shouldn't get picked now (Ilia)
87*61046927SAndroid Build Coastguard Worker
88*61046927SAndroid Build Coastguard Worker-  If someone tested your patch, document it with a line like this:
89*61046927SAndroid Build Coastguard Worker
90*61046927SAndroid Build Coastguard Worker   ::
91*61046927SAndroid Build Coastguard Worker
92*61046927SAndroid Build Coastguard Worker      Tested-by: Joe Hacker <[email protected]>
93*61046927SAndroid Build Coastguard Worker
94*61046927SAndroid Build Coastguard Worker-  If the patch was reviewed (usually the case) or acked by someone,
95*61046927SAndroid Build Coastguard Worker   that should be documented with:
96*61046927SAndroid Build Coastguard Worker
97*61046927SAndroid Build Coastguard Worker   ::
98*61046927SAndroid Build Coastguard Worker
99*61046927SAndroid Build Coastguard Worker      Reviewed-by: Joe Hacker <[email protected]>
100*61046927SAndroid Build Coastguard Worker      Acked-by: Joe Hacker <[email protected]>
101*61046927SAndroid Build Coastguard Worker
102*61046927SAndroid Build Coastguard Worker-  When updating a merge request add all the tags (``Acked-by:``, ``Reviewed-by:``,
103*61046927SAndroid Build Coastguard Worker   ``Fixes:``, ``Backport-to:`` and/or other) to the commit messages.
104*61046927SAndroid Build Coastguard Worker   This provides reviewers with quick feedback if the patch has already
105*61046927SAndroid Build Coastguard Worker   been reviewed.
106*61046927SAndroid Build Coastguard Worker
107*61046927SAndroid Build Coastguard Worker.. _fixes:
108*61046927SAndroid Build Coastguard Worker
109*61046927SAndroid Build Coastguard WorkerThe ``Fixes:`` tag
110*61046927SAndroid Build Coastguard Worker------------------
111*61046927SAndroid Build Coastguard Worker
112*61046927SAndroid Build Coastguard WorkerIf a patch addresses a issue introduced with earlier commit, that
113*61046927SAndroid Build Coastguard Workershould be noted in the commit message. For example::
114*61046927SAndroid Build Coastguard Worker
115*61046927SAndroid Build Coastguard Worker    Fixes: d7b3707c612 ("util/disk_cache: use stat() to check if entry is a directory")
116*61046927SAndroid Build Coastguard Worker
117*61046927SAndroid Build Coastguard WorkerYou can produce those fixes lines by running this command once::
118*61046927SAndroid Build Coastguard Worker
119*61046927SAndroid Build Coastguard Worker    git config --global alias.fixes "show -s --pretty='format:Fixes: %h (\"%s\")'"
120*61046927SAndroid Build Coastguard Worker
121*61046927SAndroid Build Coastguard WorkerAfter that, using ``git fixes <sha1>`` will print the full line for you.
122*61046927SAndroid Build Coastguard Worker
123*61046927SAndroid Build Coastguard WorkerThe stable tag
124*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~
125*61046927SAndroid Build Coastguard Worker
126*61046927SAndroid Build Coastguard WorkerIf you want a commit to be applied to a stable branch, you should add an
127*61046927SAndroid Build Coastguard Workerappropriate note to the commit message.
128*61046927SAndroid Build Coastguard Worker
129*61046927SAndroid Build Coastguard WorkerUsing a ``Fixes:`` tag as described in :ref:`Patch formatting <formatting>`
130*61046927SAndroid Build Coastguard Workeris the preferred way to nominate a commit that should be backported.
131*61046927SAndroid Build Coastguard WorkerThere are scripts that will figure out which releases to apply the patch
132*61046927SAndroid Build Coastguard Workerto automatically, so you don't need to figure it out.
133*61046927SAndroid Build Coastguard Worker
134*61046927SAndroid Build Coastguard WorkerAlternatively, you may use the ``Backport-to:`` tag, as presented in the
135*61046927SAndroid Build Coastguard Workerfollowing example::
136*61046927SAndroid Build Coastguard Worker
137*61046927SAndroid Build Coastguard Worker    Backport-to: 21.0
138*61046927SAndroid Build Coastguard Worker
139*61046927SAndroid Build Coastguard WorkerMultiple ``Backport-to:`` lines are allowed.
140*61046927SAndroid Build Coastguard Worker
141*61046927SAndroid Build Coastguard WorkerThe last option is deprecated and mostly here for historical reasons
142*61046927SAndroid Build Coastguard Workerdating back to when patch submission was done via emails: using a ``Cc:``
143*61046927SAndroid Build Coastguard Workertag. Support for this tag will be removed at some point.
144*61046927SAndroid Build Coastguard WorkerHere are some examples of such a note::
145*61046927SAndroid Build Coastguard Worker
146*61046927SAndroid Build Coastguard Worker    Cc: mesa-stable
147*61046927SAndroid Build Coastguard Worker    Cc: 20.0 <mesa-stable>
148*61046927SAndroid Build Coastguard Worker    CC: 20.0 19.3 <mesa-stable>
149*61046927SAndroid Build Coastguard Worker
150*61046927SAndroid Build Coastguard WorkerUsing the CC tag **should** include the stable branches you want to
151*61046927SAndroid Build Coastguard Workernominate the patch to. If you do not provide any version it is nominated
152*61046927SAndroid Build Coastguard Workerto all active stable branches.
153*61046927SAndroid Build Coastguard Worker
154*61046927SAndroid Build Coastguard Worker.. _testing:
155*61046927SAndroid Build Coastguard Worker
156*61046927SAndroid Build Coastguard WorkerTesting Patches
157*61046927SAndroid Build Coastguard Worker---------------
158*61046927SAndroid Build Coastguard Worker
159*61046927SAndroid Build Coastguard WorkerIt should go without saying that patches must be tested. In general, do
160*61046927SAndroid Build Coastguard Workerwhatever testing is prudent.
161*61046927SAndroid Build Coastguard Worker
162*61046927SAndroid Build Coastguard WorkerYou should always run the Mesa test suite before submitting patches. The
163*61046927SAndroid Build Coastguard Workertest suite can be run using the 'meson test' command. All tests must
164*61046927SAndroid Build Coastguard Workerpass before patches will be accepted, this may mean you have to update
165*61046927SAndroid Build Coastguard Workerthe tests themselves.
166*61046927SAndroid Build Coastguard Worker
167*61046927SAndroid Build Coastguard WorkerWhenever possible and applicable, test the patch with
168*61046927SAndroid Build Coastguard Worker`Piglit <https://piglit.freedesktop.org>`__ and/or
169*61046927SAndroid Build Coastguard Worker`dEQP <https://android.googlesource.com/platform/external/deqp/>`__ to
170*61046927SAndroid Build Coastguard Workercheck for regressions.
171*61046927SAndroid Build Coastguard Worker
172*61046927SAndroid Build Coastguard WorkerAs mentioned at the beginning, patches should be bisectable. A good way
173*61046927SAndroid Build Coastguard Workerto test this is to make use of the \`git rebase\` command, to run your
174*61046927SAndroid Build Coastguard Workertests on each commit. Assuming your branch is based off
175*61046927SAndroid Build Coastguard Worker``origin/main``, you can run:
176*61046927SAndroid Build Coastguard Worker
177*61046927SAndroid Build Coastguard Worker.. code-block:: sh
178*61046927SAndroid Build Coastguard Worker
179*61046927SAndroid Build Coastguard Worker   $ git rebase --interactive --exec "meson test -C build/" origin/main
180*61046927SAndroid Build Coastguard Worker
181*61046927SAndroid Build Coastguard Workerreplacing ``"meson test"`` with whatever other test you want to run.
182*61046927SAndroid Build Coastguard Worker
183*61046927SAndroid Build Coastguard Worker.. _submit:
184*61046927SAndroid Build Coastguard Worker
185*61046927SAndroid Build Coastguard WorkerSubmitting Patches
186*61046927SAndroid Build Coastguard Worker------------------
187*61046927SAndroid Build Coastguard Worker
188*61046927SAndroid Build Coastguard WorkerPatches are submitted to the Mesa project via a
189*61046927SAndroid Build Coastguard Worker`GitLab <https://gitlab.freedesktop.org/mesa/mesa>`__ Merge Request.
190*61046927SAndroid Build Coastguard Worker
191*61046927SAndroid Build Coastguard WorkerAdd labels to your MR to help reviewers find it. For example:
192*61046927SAndroid Build Coastguard Worker
193*61046927SAndroid Build Coastguard Worker-  Mesa changes affecting all drivers: mesa
194*61046927SAndroid Build Coastguard Worker-  Hardware vendor specific code: AMD common, intel, ...
195*61046927SAndroid Build Coastguard Worker-  Driver specific code: ANV, freedreno, i965, iris, radeonsi, RADV,
196*61046927SAndroid Build Coastguard Worker   vc4, ...
197*61046927SAndroid Build Coastguard Worker-  Other tag examples: gallium, util
198*61046927SAndroid Build Coastguard Worker
199*61046927SAndroid Build Coastguard WorkerTick the following when creating the MR. It allows developers to rebase
200*61046927SAndroid Build Coastguard Workeryour work on top of main.
201*61046927SAndroid Build Coastguard Worker
202*61046927SAndroid Build Coastguard Worker::
203*61046927SAndroid Build Coastguard Worker
204*61046927SAndroid Build Coastguard Worker   Allow commits from members who can merge to the target branch
205*61046927SAndroid Build Coastguard Worker
206*61046927SAndroid Build Coastguard WorkerIf you revise your patches based on code review and push an update to
207*61046927SAndroid Build Coastguard Workeryour branch, you should maintain a **clean** history in your patches.
208*61046927SAndroid Build Coastguard WorkerThere should not be "fixup" patches in the history. The series should be
209*61046927SAndroid Build Coastguard Workerbuildable and functional after every commit whenever you push the
210*61046927SAndroid Build Coastguard Workerbranch.
211*61046927SAndroid Build Coastguard Worker
212*61046927SAndroid Build Coastguard WorkerIt is your responsibility to keep the MR alive and making progress, as
213*61046927SAndroid Build Coastguard Workerthere are no guarantees that a Mesa dev will independently take interest
214*61046927SAndroid Build Coastguard Workerin it.
215*61046927SAndroid Build Coastguard Worker
216*61046927SAndroid Build Coastguard WorkerSome other notes:
217*61046927SAndroid Build Coastguard Worker
218*61046927SAndroid Build Coastguard Worker-  Make changes and update your branch based on feedback
219*61046927SAndroid Build Coastguard Worker-  After an update, for the feedback you handled, close the feedback
220*61046927SAndroid Build Coastguard Worker   discussion with the "Resolve Discussion" button. This way the
221*61046927SAndroid Build Coastguard Worker   reviewers know which feedback got handled and which didn't.
222*61046927SAndroid Build Coastguard Worker-  Old, stale MR may be closed, but you can reopen it if you still want
223*61046927SAndroid Build Coastguard Worker   to pursue the changes
224*61046927SAndroid Build Coastguard Worker-  You should periodically check to see if your MR needs to be rebased
225*61046927SAndroid Build Coastguard Worker-  Make sure your MR is closed if your patches get pushed outside of
226*61046927SAndroid Build Coastguard Worker   GitLab
227*61046927SAndroid Build Coastguard Worker-  Please send MRs from a personal fork rather than from the main Mesa
228*61046927SAndroid Build Coastguard Worker   repository, as it clutters it unnecessarily.
229*61046927SAndroid Build Coastguard Worker
230*61046927SAndroid Build Coastguard Worker.. _reviewing:
231*61046927SAndroid Build Coastguard Worker
232*61046927SAndroid Build Coastguard WorkerReviewing Patches
233*61046927SAndroid Build Coastguard Worker-----------------
234*61046927SAndroid Build Coastguard Worker
235*61046927SAndroid Build Coastguard WorkerTo participate in code review, you can monitor the GitLab Mesa `Merge
236*61046927SAndroid Build Coastguard WorkerRequests <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests>`__
237*61046927SAndroid Build Coastguard Workerpage, and/or register for notifications in your GitLab settings.
238*61046927SAndroid Build Coastguard Worker
239*61046927SAndroid Build Coastguard WorkerWhen you've reviewed a patch, please be unambiguous about your review.
240*61046927SAndroid Build Coastguard WorkerThat is, state either
241*61046927SAndroid Build Coastguard Worker
242*61046927SAndroid Build Coastguard Worker::
243*61046927SAndroid Build Coastguard Worker
244*61046927SAndroid Build Coastguard Worker   Reviewed-by: Joe Hacker <[email protected]>
245*61046927SAndroid Build Coastguard Worker
246*61046927SAndroid Build Coastguard Workeror
247*61046927SAndroid Build Coastguard Worker
248*61046927SAndroid Build Coastguard Worker::
249*61046927SAndroid Build Coastguard Worker
250*61046927SAndroid Build Coastguard Worker   Acked-by: Joe Hacker <[email protected]>
251*61046927SAndroid Build Coastguard Worker
252*61046927SAndroid Build Coastguard WorkerRather than saying just "LGTM" or "Seems OK".
253*61046927SAndroid Build Coastguard Worker
254*61046927SAndroid Build Coastguard WorkerIf small changes are suggested, it's OK to say something like:
255*61046927SAndroid Build Coastguard Worker
256*61046927SAndroid Build Coastguard Worker::
257*61046927SAndroid Build Coastguard Worker
258*61046927SAndroid Build Coastguard Worker   With the above fixes, Reviewed-by: Joe Hacker <[email protected]>
259*61046927SAndroid Build Coastguard Worker
260*61046927SAndroid Build Coastguard Workerwhich tells the patch author that the patch can be committed, as long as
261*61046927SAndroid Build Coastguard Workerthe issues are resolved first.
262*61046927SAndroid Build Coastguard Worker
263*61046927SAndroid Build Coastguard WorkerThese Reviewed-by, Acked-by, and Tested-by tags should also be amended
264*61046927SAndroid Build Coastguard Workerinto commits in a MR before it is merged.
265*61046927SAndroid Build Coastguard Worker
266*61046927SAndroid Build Coastguard WorkerWhen providing a Reviewed-by, Acked-by, or Tested-by tag in a GitLab MR,
267*61046927SAndroid Build Coastguard Workerenclose the tag in backticks:
268*61046927SAndroid Build Coastguard Worker
269*61046927SAndroid Build Coastguard Worker::
270*61046927SAndroid Build Coastguard Worker
271*61046927SAndroid Build Coastguard Worker   `Reviewed-by: Joe Hacker <[email protected]>`
272*61046927SAndroid Build Coastguard Worker
273*61046927SAndroid Build Coastguard WorkerThis is the markdown format for literal, and will prevent GitLab from
274*61046927SAndroid Build Coastguard Workerhiding the < and > symbols.
275*61046927SAndroid Build Coastguard Worker
276*61046927SAndroid Build Coastguard WorkerReview by non-experts is encouraged. Understanding how someone else goes
277*61046927SAndroid Build Coastguard Workerabout solving a problem is a great way to learn your way around the
278*61046927SAndroid Build Coastguard Workerproject. The submitter is expected to evaluate whether they have an
279*61046927SAndroid Build Coastguard Workerappropriate amount of review feedback from people who also understand
280*61046927SAndroid Build Coastguard Workerthe code before merging their patches.
281*61046927SAndroid Build Coastguard Worker
282*61046927SAndroid Build Coastguard Worker.. _merging:
283*61046927SAndroid Build Coastguard Worker
284*61046927SAndroid Build Coastguard WorkerMerging merge requests
285*61046927SAndroid Build Coastguard Worker----------------------
286*61046927SAndroid Build Coastguard Worker
287*61046927SAndroid Build Coastguard WorkerOnce a merge request has been appropriately reviewed, its author can decide to
288*61046927SAndroid Build Coastguard Workermerge it.
289*61046927SAndroid Build Coastguard Worker
290*61046927SAndroid Build Coastguard Worker.. warning::
291*61046927SAndroid Build Coastguard Worker   Pushing (``git push``) directly to ``main`` is forbidden. This bypasses all
292*61046927SAndroid Build Coastguard Worker   the CI checks and is likely to cause issues for everyone else.
293*61046927SAndroid Build Coastguard Worker
294*61046927SAndroid Build Coastguard Worker.. warning::
295*61046927SAndroid Build Coastguard Worker   Do not use the "Merge"/"Merge when pipeline succeeds"/"Set to auto-merge"
296*61046927SAndroid Build Coastguard Worker   buttons.
297*61046927SAndroid Build Coastguard Worker
298*61046927SAndroid Build Coastguard WorkerWe use a `custom script <https://gitlab.com/marge-org/marge-bot>`__ to manage
299*61046927SAndroid Build Coastguard Workerthis, triggered by **assigning the MR** to the pseudo-user `@marge-bot
300*61046927SAndroid Build Coastguard Worker<https://gitlab.freedesktop.org/marge-bot>`__.
301*61046927SAndroid Build Coastguard Worker
302*61046927SAndroid Build Coastguard WorkerAuthors who do not have ``Developer`` access (or above) should ask on the
303*61046927SAndroid Build Coastguard Workermerge request for someone else to do it for them, or reach on
304*61046927SAndroid Build Coastguard Worker:doc:`other channels <lists>` if the MR reviewers don't have access themselves.
305*61046927SAndroid Build Coastguard Worker
306*61046927SAndroid Build Coastguard WorkerDo not merge someone else's MR unless you are sure they don't have a new
307*61046927SAndroid Build Coastguard Workerversion that they are testing locally for instance.
308*61046927SAndroid Build Coastguard Worker**When in doubt, ask**, for instance by leaving a comment on that MR.
309*61046927SAndroid Build Coastguard Worker
310*61046927SAndroid Build Coastguard WorkerNominating a commit for a stable branch
311*61046927SAndroid Build Coastguard Worker---------------------------------------
312*61046927SAndroid Build Coastguard Worker
313*61046927SAndroid Build Coastguard WorkerThere are several ways to nominate a patch for inclusion in the stable
314*61046927SAndroid Build Coastguard Workerbranch and release. In order or preference:
315*61046927SAndroid Build Coastguard Worker
316*61046927SAndroid Build Coastguard Worker- By adding the ``Fixes:`` tag in the commit message as described above, if you are fixing
317*61046927SAndroid Build Coastguard Worker  a specific commit.
318*61046927SAndroid Build Coastguard Worker- By adding the ``Cc: mesa-stable`` tag in the commit message as described above.
319*61046927SAndroid Build Coastguard Worker- By submitting a merge request against the ``staging/year.quarter``
320*61046927SAndroid Build Coastguard Worker  branch on GitLab. Refer to the :ref:`instructions below <backports>`.
321*61046927SAndroid Build Coastguard Worker
322*61046927SAndroid Build Coastguard WorkerPlease **DO NOT** send patches to [email protected], it
323*61046927SAndroid Build Coastguard Workeris not monitored actively and is a historical artifact.
324*61046927SAndroid Build Coastguard Worker
325*61046927SAndroid Build Coastguard WorkerIf you are not the author of the original patch, please Cc: them in your
326*61046927SAndroid Build Coastguard Workernomination request.
327*61046927SAndroid Build Coastguard Worker
328*61046927SAndroid Build Coastguard WorkerThe current patch status can be observed in the :ref:`staging
329*61046927SAndroid Build Coastguard Workerbranch <stagingbranch>`.
330*61046927SAndroid Build Coastguard Worker
331*61046927SAndroid Build Coastguard Worker.. _criteria:
332*61046927SAndroid Build Coastguard Worker
333*61046927SAndroid Build Coastguard WorkerCriteria for accepting patches to the stable branch
334*61046927SAndroid Build Coastguard Worker---------------------------------------------------
335*61046927SAndroid Build Coastguard Worker
336*61046927SAndroid Build Coastguard WorkerMesa has a designated release manager for each stable branch, and the
337*61046927SAndroid Build Coastguard Workerrelease manager is the only developer that should be pushing changes to
338*61046927SAndroid Build Coastguard Workerthese branches. Everyone else should nominate patches using the
339*61046927SAndroid Build Coastguard Workermechanism described above. The following rules define which patches are
340*61046927SAndroid Build Coastguard Workeraccepted and which are not. The stable-release manager is also given
341*61046927SAndroid Build Coastguard Workerbroad discretion in rejecting patches that have been nominated.
342*61046927SAndroid Build Coastguard Worker
343*61046927SAndroid Build Coastguard Worker-  Patch must conform with the :ref:`Basic guidelines <guidelines>`
344*61046927SAndroid Build Coastguard Worker-  Patch must have landed in main first. In case where the original
345*61046927SAndroid Build Coastguard Worker   patch is too large and/or otherwise contradicts with the rules set
346*61046927SAndroid Build Coastguard Worker   within, a backport is appropriate.
347*61046927SAndroid Build Coastguard Worker-  It must not introduce a regression - be that build or runtime wise.
348*61046927SAndroid Build Coastguard Worker
349*61046927SAndroid Build Coastguard Worker   .. note::
350*61046927SAndroid Build Coastguard Worker      If the regression is due to faulty Piglit/dEQP/CTS/other test
351*61046927SAndroid Build Coastguard Worker      the latter must be fixed first. A reference to the offending test(s)
352*61046927SAndroid Build Coastguard Worker      and respective fix(es) should be provided in the nominated patch.
353*61046927SAndroid Build Coastguard Worker
354*61046927SAndroid Build Coastguard Worker-  Patch cannot be larger than 100 lines.
355*61046927SAndroid Build Coastguard Worker-  Patches that move code around with no functional change should be
356*61046927SAndroid Build Coastguard Worker   rejected.
357*61046927SAndroid Build Coastguard Worker-  Patch must be a bug fix and not a new feature.
358*61046927SAndroid Build Coastguard Worker
359*61046927SAndroid Build Coastguard Worker   .. note::
360*61046927SAndroid Build Coastguard Worker      An exception to this rule, are hardware-enabling "features". For
361*61046927SAndroid Build Coastguard Worker      example, :ref:`backports <backports>` of new code to support a
362*61046927SAndroid Build Coastguard Worker      newly-developed hardware product can be accepted if they can be
363*61046927SAndroid Build Coastguard Worker      reasonably determined not to have effects on other hardware.
364*61046927SAndroid Build Coastguard Worker
365*61046927SAndroid Build Coastguard Worker-  Patch must be reviewed, For example, the commit message has
366*61046927SAndroid Build Coastguard Worker   Reviewed-by, Signed-off-by, or Tested-by tags from someone but the
367*61046927SAndroid Build Coastguard Worker   author.
368*61046927SAndroid Build Coastguard Worker-  Performance patches are considered only if they provide information
369*61046927SAndroid Build Coastguard Worker   about the hardware, program in question and observed improvement. Use
370*61046927SAndroid Build Coastguard Worker   numbers to represent your measurements.
371*61046927SAndroid Build Coastguard Worker
372*61046927SAndroid Build Coastguard WorkerIf the patch complies with the rules it will be
373*61046927SAndroid Build Coastguard Worker:ref:`cherry-picked <pickntest>`. Alternatively the release
374*61046927SAndroid Build Coastguard Workermanager will reply to the patch in question stating why the patch has
375*61046927SAndroid Build Coastguard Workerbeen rejected or would request a backport. The stable-release manager
376*61046927SAndroid Build Coastguard Workermay at times need to force-push changes to the stable branches, for
377*61046927SAndroid Build Coastguard Workerexample, to drop a previously-picked patch that was later identified as
378*61046927SAndroid Build Coastguard Workercausing a regression). These force-pushes may cause changes to be lost
379*61046927SAndroid Build Coastguard Workerfrom the stable branch if developers push things directly. Consider
380*61046927SAndroid Build Coastguard Workeryourself warned.
381*61046927SAndroid Build Coastguard Worker
382*61046927SAndroid Build Coastguard Worker.. _backports:
383*61046927SAndroid Build Coastguard Worker
384*61046927SAndroid Build Coastguard WorkerSending backports for the stable branch
385*61046927SAndroid Build Coastguard Worker---------------------------------------
386*61046927SAndroid Build Coastguard Worker
387*61046927SAndroid Build Coastguard WorkerBy default merge conflicts are resolved by the stable-release manager.
388*61046927SAndroid Build Coastguard WorkerThe release maintainer should resolve trivial conflicts, but for complex
389*61046927SAndroid Build Coastguard Workerconflicts they should ask the original author to provide a backport or
390*61046927SAndroid Build Coastguard Workerdenominate the patch.
391*61046927SAndroid Build Coastguard Worker
392*61046927SAndroid Build Coastguard WorkerFor patches that either need to be nominated after they've landed in
393*61046927SAndroid Build Coastguard Workermain, or that are known ahead of time to not not apply cleanly to a
394*61046927SAndroid Build Coastguard Workerstable branch (such as due to a rename), using a GitLab MR is most
395*61046927SAndroid Build Coastguard Workerappropriate. The MR should be based on and target the
396*61046927SAndroid Build Coastguard Worker``staging/year.quarter`` branch, not on the ``year.quarter`` branch,
397*61046927SAndroid Build Coastguard Workerper the stable branch policy. Assigning the MR to release maintainer for
398*61046927SAndroid Build Coastguard Workersaid branch or mentioning them is helpful, but not required.
399*61046927SAndroid Build Coastguard Worker
400*61046927SAndroid Build Coastguard WorkerMake sure to use ``git cherry-pick -x`` when cherry-picking the commits
401*61046927SAndroid Build Coastguard Workerfrom the main branch. This adds the "cherry picked from commit ..." line
402*61046927SAndroid Build Coastguard Workerto the commit message, to allow the release maintainters to mark those
403*61046927SAndroid Build Coastguard Workeras backported, which in turn allows the tools to correctly report any
404*61046927SAndroid Build Coastguard Workerfuture ``Fixes:`` affecting the commits you backported.
405*61046927SAndroid Build Coastguard Worker
406*61046927SAndroid Build Coastguard WorkerDocumentation patches
407*61046927SAndroid Build Coastguard Worker---------------------
408*61046927SAndroid Build Coastguard Worker
409*61046927SAndroid Build Coastguard WorkerOur documentation is written as `reStructuredText`_ files in the
410*61046927SAndroid Build Coastguard Worker:file:`docs` folder, and built using `Sphinx`_.
411*61046927SAndroid Build Coastguard Worker
412*61046927SAndroid Build Coastguard Worker.. code-block:: sh
413*61046927SAndroid Build Coastguard Worker
414*61046927SAndroid Build Coastguard Worker   # Install dependencies (adapt for your distro)
415*61046927SAndroid Build Coastguard Worker   apk add coreutils graphviz py3-clang clang-dev musl-dev linux-headers
416*61046927SAndroid Build Coastguard Worker   pip3 install sphinx===5.1.1 mako===1.2.3 hawkmoth===0.16.0
417*61046927SAndroid Build Coastguard Worker
418*61046927SAndroid Build Coastguard Worker   # Build docs
419*61046927SAndroid Build Coastguard Worker   sphinx-build -W -b html docs docs-html/
420*61046927SAndroid Build Coastguard Worker
421*61046927SAndroid Build Coastguard WorkerThe preferred language of the documentation is US English. This
422*61046927SAndroid Build Coastguard Workerdoesn't mean that everyone is expected to pay close attention to
423*61046927SAndroid Build Coastguard Workerthe different English variants, but it does mean someone might
424*61046927SAndroid Build Coastguard Workersuggest a spelling-change, either during review or as a follow-up
425*61046927SAndroid Build Coastguard Workermerge-request.
426*61046927SAndroid Build Coastguard Worker
427*61046927SAndroid Build Coastguard Worker.. _reStructuredText: https://docutils.sourceforge.io/rst.html
428*61046927SAndroid Build Coastguard Worker.. _Sphinx: https://www.sphinx-doc.org/
429*61046927SAndroid Build Coastguard Worker
430*61046927SAndroid Build Coastguard WorkerGit tips
431*61046927SAndroid Build Coastguard Worker--------
432*61046927SAndroid Build Coastguard Worker
433*61046927SAndroid Build Coastguard Worker-  ``git rebase -i ...`` is your friend. Don't be afraid to use it.
434*61046927SAndroid Build Coastguard Worker-  Apply a fixup to commit FOO.
435*61046927SAndroid Build Coastguard Worker
436*61046927SAndroid Build Coastguard Worker   .. code-block:: sh
437*61046927SAndroid Build Coastguard Worker
438*61046927SAndroid Build Coastguard Worker      git add ...
439*61046927SAndroid Build Coastguard Worker      git commit --fixup=FOO
440*61046927SAndroid Build Coastguard Worker      git rebase -i --autosquash ...
441*61046927SAndroid Build Coastguard Worker
442*61046927SAndroid Build Coastguard Worker-  Test for build breakage between patches e.g last 8 commits.
443*61046927SAndroid Build Coastguard Worker
444*61046927SAndroid Build Coastguard Worker   .. code-block:: sh
445*61046927SAndroid Build Coastguard Worker
446*61046927SAndroid Build Coastguard Worker      git rebase -i --exec="ninja -C build/" HEAD~8
447